llvm-project/clang/test/AST/ast-print-openacc-update-construct.cpp
erichkeane d47401e376 [OpenACC] Start enforcing 'device_type' clause values
Researching in prep of doing the implementation for lowering, I found
that the source of the valid identifiers list from flang is in the
frontend.  This patch adds the same list to the frontend, but does it as
a sema diagnostic, so we still parse it as an identifier/identifier-like
thing, but then diagnose it as invalid later.
2025-04-09 14:55:50 -07:00

48 lines
1.8 KiB
C++

// RUN: %clang_cc1 -fopenacc -ast-print %s -o - | FileCheck %s
void uses(bool cond) {
int I;
int *iPtr;
int array[5];
// CHECK: #pragma acc update self(I)
#pragma acc update self(I)
// CHECK: #pragma acc update self(I) if_present
#pragma acc update self(I) if_present
// CHECK: #pragma acc update self(I) if(cond)
#pragma acc update self(I) if(cond)
// CHECK: #pragma acc update self(I) async
#pragma acc update self(I) async
// CHECK: #pragma acc update self(I) async(*iPtr)
#pragma acc update self(I) async(*iPtr)
// CHECK: #pragma acc update self(I) async(I)
#pragma acc update self(I) async(I)
// CHECK: #pragma acc update self(I) wait(*iPtr, I) async
#pragma acc update self(I) wait(*iPtr, I) async
// CHECK: #pragma acc update self(I) wait(queues: *iPtr, I) async(*iPtr)
#pragma acc update self(I) wait(queues:*iPtr, I) async(*iPtr)
// CHECK: #pragma acc update self(I) wait(devnum: I : *iPtr, I) async(I)
#pragma acc update self(I) wait(devnum:I:*iPtr, I) async(I)
// CHECK: #pragma acc update self(I) wait(devnum: I : queues: *iPtr, I) if(I == array[I]) async(I)
#pragma acc update self(I) wait(devnum:I:queues:*iPtr, I) if(I == array[I]) async(I)
// CHECK: #pragma acc update self(I) device_type(nvidia) dtype(host)
#pragma acc update self(I) device_type(nvidia) dtype(host)
// CHECK: #pragma acc update self(I) device_type(radeon) dtype(multicore)
#pragma acc update self(I) device_type(radeon) dtype(multicore)
// CHECK: #pragma acc update self(I, iPtr, array, array[1], array[1:2])
#pragma acc update self(I, iPtr, array, array[1], array[1:2])
// CHECK: #pragma acc update host(I, iPtr, array, array[1], array[1:2])
#pragma acc update host (I, iPtr, array, array[1], array[1:2])
// CHECK: #pragma acc update device(I, iPtr, array, array[1], array[1:2])
#pragma acc update device(I, iPtr, array, array[1], array[1:2])
}