| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| // RUN: %clang_cc1 -verify=ped -std=c23 -Wall -pedantic %s | ||
| // RUN: %clang_cc1 -verify=yay -std=c2y -Wall -pedantic %s | ||
| // RUN: %clang_cc1 -verify=pre -std=c2y -Wpre-c2y-compat -Wall -pedantic %s | ||
| // RUN: %clang_cc1 -verify=gnu -Wall -Wgnu -x c++ %s | ||
| // RUN: %clang_cc1 -verify=yay -Wall -Wgnu -Wno-gnu-imaginary-constant -x c++ %s | ||
|
|
||
|
|
||
| /* WG14 N3298: Yes | ||
| * Introduce complex literals v. 2 | ||
| * | ||
| * This introduces two suffixes for making complex literals: i and j (and I and | ||
| * J), which can be combined in any order with the other floating literal | ||
| * suffixes. | ||
| * | ||
| * We support these suffixes in older language modes as a conforming extension. | ||
| * It used to be a GNU extension, but now it's a C2y extension. | ||
| */ | ||
|
|
||
| // yay-no-diagnostics | ||
|
|
||
| static_assert(_Generic(12.0i, _Complex double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0fi, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0li, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0if, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0il, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
|
|
||
| static_assert(_Generic(12.0I, _Complex double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0fI, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0lI, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0If, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0Il, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
|
|
||
| static_assert(_Generic(12.0j, _Complex double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0fj, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0lj, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0jf, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0jl, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
|
|
||
| static_assert(_Generic(12.0J, _Complex double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0fJ, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0lJ, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0Jf, _Complex float : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
| static_assert(_Generic(12.0Jl, _Complex long double : 1, default : 0)); /* gnu-warning {{imaginary constants are a GNU extension}} | ||
| ped-warning {{imaginary constants are a C2y extension}} | ||
| pre-warning {{imaginary constants are incompatible with C standards before C2y}} | ||
| */ | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // RUN: not %clang_cc1 -triple x86_64 %s -fsyntax-only -verify 2>&1 | FileCheck %s --check-prefix=CHECK-ERR | ||
|
|
||
| float fminimum_numf (float, float); | ||
| double fminimum_num (double, double); | ||
| long double fminimum_numl (long double, long double); | ||
| float fmaximum_numf (float, float); | ||
| double fmaximum_num (double, double); | ||
| long double fmaximum_numl (long double, long double); | ||
|
|
||
| // CHECK-ERR: passing 'char *' to parameter of incompatible type 'float' | ||
| float fmin1(char *a, char *b) { | ||
| return fminimum_numf(a, b); | ||
| } | ||
| // CHECK-ERR: passing 'char *' to parameter of incompatible type 'double' | ||
| float fmin2(char *a, char *b) { | ||
| return fminimum_num(a, b); | ||
| } | ||
| // CHECK-ERR: passing 'char *' to parameter of incompatible type 'long double' | ||
| float fmin3(char *a, char *b) { | ||
| return fminimum_numl(a, b); | ||
| } | ||
| // CHECK-ERR: passing 'char *' to parameter of incompatible type 'float' | ||
| float fmax1(char *a, char *b) { | ||
| return fmaximum_numf(a, b); | ||
| } | ||
| // CHECK-ERR: passing 'char *' to parameter of incompatible type 'double' | ||
| float fmax2(char *a, char *b) { | ||
| return fmaximum_num(a, b); | ||
| } | ||
| // CHECK-ERR: passing 'char *' to parameter of incompatible type 'long double' | ||
| float fmax3(char *a, char *b) { | ||
| return fmaximum_numl(a, b); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // RUN: %clang_cc1 -E -dM -triple=i686-pc-linux-gnu /dev/null | FileCheck -match-full-lines -check-prefix TIME32 %s | ||
| // RUN: %clang_cc1 -E -dM -triple=i686-pc-linux-gnut64 /dev/null | FileCheck -match-full-lines -check-prefix TIME64 %s | ||
| // RUN: %clang_cc1 -E -dM -triple=armv5tel-softfloat-linux-gnueabi /dev/null | FileCheck -match-full-lines -check-prefix TIME32 %s | ||
| // RUN: %clang_cc1 -E -dM -triple=armv5tel-softfloat-linux-gnueabit64 /dev/null | FileCheck -match-full-lines -check-prefix TIME64 %s | ||
| // RUN: %clang_cc1 -E -dM -triple=armv7a-unknown-linux-gnueabihf /dev/null | FileCheck -match-full-lines -check-prefix TIME32 %s | ||
| // RUN: %clang_cc1 -E -dM -triple=armv7a-unknown-linux-gnueabihft64 /dev/null | FileCheck -match-full-lines -check-prefix TIME64 %s | ||
| // | ||
| // TIME32-NOT:#define _FILE_OFFSET_BITS 64 | ||
| // TIME32-NOT:#define _TIME_BITS 64 | ||
| // | ||
| // TIME64:#define _FILE_OFFSET_BITS 64 | ||
| // TIME64:#define _TIME_BITS 64 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s | ||
| // FIXME: %clang_cc1 -std=c++17 -fsyntax-only -verify -fexperimental-new-constant-interpreter %s | ||
| // expected-no-diagnostics | ||
|
|
||
| constexpr double NaN = __builtin_nan(""); | ||
| constexpr double SNaN = __builtin_nans(""); | ||
| constexpr double Inf = __builtin_inf(); | ||
| constexpr double NegInf = -__builtin_inf(); | ||
|
|
||
| #define FMAXIMUMNUM_TEST_SIMPLE(T, FUNC) \ | ||
| static_assert(T(6.7890) == FUNC(T(1.2345), T(6.7890))); \ | ||
| static_assert(T(6.7890) == FUNC(T(6.7890), T(1.2345))); | ||
|
|
||
| #define FMAXIMUMNUM_TEST_SNAN(T, FUNC) \ | ||
| static_assert(Inf == FUNC(SNaN, Inf)); \ | ||
| static_assert(NegInf == FUNC(NegInf, SNaN)); \ | ||
| static_assert(0.0 == FUNC(SNaN, 0.0)); \ | ||
| static_assert(-0.0 == FUNC(-0.0, SNaN)); \ | ||
| static_assert(T(-1.2345) == FUNC(SNaN, T(-1.2345))); \ | ||
| static_assert(T(1.2345) == FUNC(T(1.2345), SNaN)); \ | ||
| static_assert(__builtin_isnan(FUNC(SNaN, SNaN))); \ | ||
| static_assert(__builtin_isnan(FUNC(NaN, SNaN))); \ | ||
| static_assert(!__builtin_issignaling(FUNC(SNaN, SNaN))); \ | ||
| static_assert(!__builtin_issignaling(FUNC(NaN, SNaN))); | ||
|
|
||
| #define FMAXIMUMNUM_TEST_NAN(T, FUNC) \ | ||
| static_assert(Inf == FUNC(NaN, Inf)); \ | ||
| static_assert(NegInf == FUNC(NegInf, NaN)); \ | ||
| static_assert(0.0 == FUNC(NaN, 0.0)); \ | ||
| static_assert(-0.0 == FUNC(-0.0, NaN)); \ | ||
| static_assert(T(-1.2345) == FUNC(NaN, T(-1.2345))); \ | ||
| static_assert(T(1.2345) == FUNC(T(1.2345), NaN)); \ | ||
| static_assert(__builtin_isnan(FUNC(NaN, NaN))); | ||
|
|
||
| #define FMAXIMUMNUM_TEST_INF(T, FUNC) \ | ||
| static_assert(Inf == FUNC(NegInf, Inf)); \ | ||
| static_assert(Inf == FUNC(Inf, 0.0)); \ | ||
| static_assert(Inf == FUNC(-0.0, Inf)); \ | ||
| static_assert(Inf == FUNC(Inf, T(1.2345))); \ | ||
| static_assert(Inf == FUNC(T(-1.2345), Inf)); | ||
|
|
||
| #define FMAXIMUMNUM_TEST_NEG_INF(T, FUNC) \ | ||
| static_assert(Inf == FUNC(Inf, NegInf)); \ | ||
| static_assert(0.0 == FUNC(NegInf, 0.0)); \ | ||
| static_assert(-0.0 == FUNC(-0.0, NegInf)); \ | ||
| static_assert(T(-1.2345) == FUNC(NegInf, T(-1.2345))); \ | ||
| static_assert(T(1.2345) == FUNC(T(1.2345), NegInf)); | ||
|
|
||
| #define FMAXIMUMNUM_TEST_BOTH_ZERO(T, FUNC) \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(0.0, 0.0)) == 1.0); \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(-0.0, 0.0)) == 1.0); \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(0.0, -0.0)) == 1.0); \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(-0.0, -0.0)) == -1.0); | ||
|
|
||
| #define LIST_FMAXIMUMNUM_TESTS(T, FUNC) \ | ||
| FMAXIMUMNUM_TEST_SIMPLE(T, FUNC) \ | ||
| FMAXIMUMNUM_TEST_NAN(T, FUNC) \ | ||
| FMAXIMUMNUM_TEST_SNAN(T, FUNC) \ | ||
| FMAXIMUMNUM_TEST_INF(T, FUNC) \ | ||
| FMAXIMUMNUM_TEST_NEG_INF(T, FUNC) \ | ||
| FMAXIMUMNUM_TEST_BOTH_ZERO(T, FUNC) | ||
|
|
||
| LIST_FMAXIMUMNUM_TESTS(double, __builtin_fmaximum_num) | ||
| LIST_FMAXIMUMNUM_TESTS(float, __builtin_fmaximum_numf) | ||
| LIST_FMAXIMUMNUM_TESTS((long double), __builtin_fmaximum_numl) | ||
| LIST_FMAXIMUMNUM_TESTS(__fp16, __builtin_fmaximum_numf16) | ||
| #ifdef __FLOAT128__ | ||
| LIST_FMAXIMUMNUM_TESTS(__float128, __builtin_fmaximum_numf128) | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s | ||
| // FIXME: %clang_cc1 -std=c++17 -fsyntax-only -verify -fexperimental-new-constant-interpreter %s | ||
| // expected-no-diagnostics | ||
|
|
||
| constexpr double NaN = __builtin_nan(""); | ||
| constexpr double SNaN = __builtin_nans(""); | ||
| constexpr double Inf = __builtin_inf(); | ||
| constexpr double NegInf = -__builtin_inf(); | ||
|
|
||
| #define FMINIMUMNUM_TEST_SIMPLE(T, FUNC) \ | ||
| static_assert(T(1.2345) == FUNC(T(1.2345), T(6.7890))); \ | ||
| static_assert(T(1.2345) == FUNC(T(6.7890), T(1.2345))); | ||
|
|
||
| #define FMINIMUMNUM_TEST_NAN(T, FUNC) \ | ||
| static_assert(Inf == FUNC(NaN, Inf)); \ | ||
| static_assert(NegInf == FUNC(NegInf, NaN)); \ | ||
| static_assert(0.0 == FUNC(NaN, 0.0)); \ | ||
| static_assert(-0.0 == FUNC(-0.0, NaN)); \ | ||
| static_assert(T(-1.2345) == FUNC(NaN, T(-1.2345))); \ | ||
| static_assert(T(1.2345) == FUNC(T(1.2345), NaN)); \ | ||
| static_assert(__builtin_isnan(FUNC(NaN, NaN))); | ||
|
|
||
| #define FMINIMUMNUM_TEST_SNAN(T, FUNC) \ | ||
| static_assert(Inf == FUNC(SNaN, Inf)); \ | ||
| static_assert(NegInf == FUNC(NegInf, SNaN)); \ | ||
| static_assert(0.0 == FUNC(SNaN, 0.0)); \ | ||
| static_assert(-0.0 == FUNC(-0.0, SNaN)); \ | ||
| static_assert(T(-1.2345) == FUNC(SNaN, T(-1.2345))); \ | ||
| static_assert(T(1.2345) == FUNC(T(1.2345), SNaN)); \ | ||
| static_assert(__builtin_isnan(FUNC(SNaN, SNaN))); \ | ||
| static_assert(__builtin_isnan(FUNC(NaN, SNaN))); \ | ||
| static_assert(!__builtin_issignaling(FUNC(SNaN, SNaN))); \ | ||
| static_assert(!__builtin_issignaling(FUNC(NaN, SNaN))); | ||
|
|
||
| #define FMINIMUMNUM_TEST_INF(T, FUNC) \ | ||
| static_assert(NegInf == FUNC(NegInf, Inf)); \ | ||
| static_assert(0.0 == FUNC(Inf, 0.0)); \ | ||
| static_assert(-0.0 == FUNC(-0.0, Inf)); \ | ||
| static_assert(T(1.2345) == FUNC(Inf, T(1.2345))); \ | ||
| static_assert(T(-1.2345) == FUNC(T(-1.2345), Inf)); | ||
|
|
||
| #define FMINIMUMNUM_TEST_NEG_INF(T, FUNC) \ | ||
| static_assert(NegInf == FUNC(Inf, NegInf)); \ | ||
| static_assert(NegInf == FUNC(NegInf, 0.0)); \ | ||
| static_assert(NegInf == FUNC(-0.0, NegInf)); \ | ||
| static_assert(NegInf == FUNC(NegInf, T(-1.2345))); \ | ||
| static_assert(NegInf == FUNC(T(1.2345), NegInf)); | ||
|
|
||
| #define FMINIMUMNUM_TEST_BOTH_ZERO(T, FUNC) \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(0.0, 0.0)) == 1.0); \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(-0.0, 0.0)) == -1.0); \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(0.0, -0.0)) == -1.0); \ | ||
| static_assert(__builtin_copysign(1.0, FUNC(-0.0, -0.0)) == -1.0); | ||
|
|
||
| #define LIST_FMINIMUMNUM_TESTS(T, FUNC) \ | ||
| FMINIMUMNUM_TEST_SIMPLE(T, FUNC) \ | ||
| FMINIMUMNUM_TEST_NAN(T, FUNC) \ | ||
| FMINIMUMNUM_TEST_SNAN(T, FUNC) \ | ||
| FMINIMUMNUM_TEST_INF(T, FUNC) \ | ||
| FMINIMUMNUM_TEST_NEG_INF(T, FUNC) \ | ||
| FMINIMUMNUM_TEST_BOTH_ZERO(T, FUNC) | ||
|
|
||
| LIST_FMINIMUMNUM_TESTS(double, __builtin_fminimum_num) | ||
| LIST_FMINIMUMNUM_TESTS(float, __builtin_fminimum_numf) | ||
| LIST_FMINIMUMNUM_TESTS((long double), __builtin_fminimum_numl) | ||
| LIST_FMINIMUMNUM_TESTS(__fp16, __builtin_fminimum_numf16) | ||
| #ifdef __FLOAT128__ | ||
| LIST_FMINIMUMNUM_TESTS(__float128, __builtin_fminimum_numf128) | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,270 @@ | ||
| // RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s | ||
|
|
||
| // Test this with PCH. | ||
| // RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s | ||
| // RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s | ||
| #ifndef PCH_HELPER | ||
| #define PCH_HELPER | ||
|
|
||
| template<unsigned I, typename ConvertsToInt, typename Int> | ||
| void TemplUses(ConvertsToInt CTI, Int IsI) { | ||
| // CHECK: FunctionTemplateDecl{{.*}}TemplUses | ||
| // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'unsigned int' depth 0 index 0 I | ||
| // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 1 ConvertsToInt | ||
| // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 2 Int | ||
| // CHECK-NEXT: FunctionDecl{{.*}}TemplUses 'void (ConvertsToInt, Int)' | ||
| // CHECK-NEXT: ParmVarDecl{{.*}}CTI 'ConvertsToInt' | ||
| // CHECK-NEXT: ParmVarDecl{{.*}}IsI 'Int' | ||
| // CHECK-NEXT: CompoundStmt | ||
|
|
||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan> | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc parallel | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} serial | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc serial | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: DeclRefExpr{{.*}} 'ConvertsToInt' lvalue ParmVar | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc kernels | ||
| #pragma acc loop worker(CTI) | ||
| for(;;); | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: DeclRefExpr{{.*}} 'Int' lvalue ParmVar | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc kernels | ||
| #pragma acc loop worker(num:IsI) | ||
| for(;;); | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: DeclRefExpr{{.*}} 'unsigned int' NonTypeTemplateParm{{.*}}'I' 'unsigned int' | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc kernels | ||
| #pragma acc loop worker(num:I) | ||
| for(;;); | ||
|
|
||
| // Instantiations: | ||
| // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (Converts, int)' implicit_instantiation | ||
| // CHECK-NEXT: TemplateArgument integral '3U' | ||
| // CHECK-NEXT: TemplateArgument type 'Converts' | ||
| // CHECK-NEXT: RecordType{{.*}}'Converts' | ||
| // CHECK-NEXT: CXXRecord{{.*}}'Converts | ||
| // CHECK-NEXT: TemplateArgument type 'int' | ||
| // CHECK-NEXT: BuiltinType{{.*}}'int' | ||
| // CHECK-NEXT: ParmVarDecl{{.*}} CTI 'Converts' | ||
| // CHECK-NEXT: ParmVarDecl{{.*}} IsI 'int' | ||
| // CHECK-NEXT: CompoundStmt | ||
| // | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan> | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| // | ||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| // | ||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} serial | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| // | ||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <UserDefinedConversion> | ||
| // CHECK-NEXT: CXXMemberCallExpr{{.*}} 'int' | ||
| // CHECK-NEXT: MemberExpr{{.*}} .operator int | ||
| // CHECK-NEXT: DeclRefExpr{{.*}} 'Converts' lvalue ParmVar | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| // | ||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue> | ||
| // CHECK-NEXT: DeclRefExpr{{.*}} 'int' lvalue ParmVar{{.*}} 'IsI' 'int' | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| // | ||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'unsigned int' | ||
| // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}}'unsigned int' depth 0 index 0 I | ||
| // CHECK-NEXT: IntegerLiteral{{.*}} 'unsigned int' 3 | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| } | ||
|
|
||
| struct Converts{ | ||
| operator int(); | ||
| }; | ||
|
|
||
| void uses() { | ||
| // CHECK: FunctionDecl{{.*}} uses | ||
| // CHECK-NEXT: CompoundStmt | ||
| // | ||
| // CHECK-NEXT: CallExpr | ||
| TemplUses<3>(Converts{}, 5); | ||
|
|
||
| // CHECK: OpenACCLoopConstruct{{.*}}<orphan> | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc parallel | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} serial | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc serial | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| Converts CTI; | ||
| // CHECK-NEXT: DeclStmt | ||
| // CHECK-NEXT: VarDecl | ||
| // CHECK-NEXT: CXXConstructExpr | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <UserDefinedConversion> | ||
| // CHECK-NEXT: CXXMemberCallExpr{{.*}} 'int' | ||
| // CHECK-NEXT: MemberExpr{{.*}} .operator int | ||
| // CHECK-NEXT: DeclRefExpr{{.*}}'Converts' lvalue Var | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc kernels | ||
| #pragma acc loop worker(CTI) | ||
| for(;;); | ||
|
|
||
| int IsI; | ||
| // CHECK-NEXT: DeclStmt | ||
| // CHECK-NEXT: VarDecl | ||
|
|
||
| // CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels | ||
| // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]] | ||
| // CHECK-NEXT: worker clause{{.*}} | ||
| // CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <LValueToRValue> | ||
| // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var | ||
| // CHECK-NEXT: ForStmt | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: <<<NULL>>> | ||
| // CHECK-NEXT: NullStmt | ||
| #pragma acc kernels | ||
| #pragma acc loop worker(num:IsI) | ||
| for(;;); | ||
| } | ||
|
|
||
| #endif // PCH_HELPER |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,202 @@ | ||
| // RUN: %clang_cc1 %s -fopenacc -verify | ||
|
|
||
| template<unsigned I, typename NotInt, typename ConvertsToInt, typename Int> | ||
| void TemplUses(NotInt NI, ConvertsToInt CTI, Int IsI) { | ||
| int i; | ||
|
|
||
| // expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}} | ||
| #pragma acc loop worker(i) | ||
| for(;;); | ||
|
|
||
| // expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}} | ||
| #pragma acc loop worker(num:IsI) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(i) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(CTI) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(IsI) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(I) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| // expected-error@+1{{OpenACC clause 'worker' requires expression of integer type ('NoConvert' invalid)}} | ||
| #pragma acc loop worker(NI) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(num:i) | ||
| for(;;); | ||
|
|
||
| // expected-error@+3{{'num' argument to 'worker' clause not allowed on a 'loop' construct associated with a 'kernels' construct that has a 'num_workers' clause}} | ||
| // expected-note@+1{{previous clause is here}} | ||
| #pragma acc kernels num_workers(IsI) | ||
| #pragma acc loop worker(num:CTI) | ||
| for(;;); | ||
| for(;;); | ||
| } | ||
|
|
||
| struct NoConvert{}; | ||
| struct Converts{ | ||
| operator int(); | ||
| }; | ||
|
|
||
| void uses() { | ||
| TemplUses<3>(NoConvert{}, Converts{}, 5); // expected-note{{in instantiation of function template specialization}} | ||
|
|
||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| #pragma acc parallel | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| int i; | ||
|
|
||
| // expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}} | ||
| #pragma acc loop worker(i) | ||
| for(;;); | ||
|
|
||
| // expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'parallel' compute construct}} | ||
| #pragma acc parallel | ||
| #pragma acc loop worker(i) | ||
| for(;;); | ||
|
|
||
| // expected-error@+1{{'num' argument on 'worker' clause is not permitted on an orphaned 'loop' construct}} | ||
| #pragma acc loop worker(num:i) | ||
| for(;;); | ||
|
|
||
| // expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'parallel' compute construct}} | ||
| #pragma acc parallel | ||
| #pragma acc loop worker(num:i) | ||
| for(;;); | ||
|
|
||
| #pragma acc serial | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| // expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'serial' compute construct}} | ||
| #pragma acc serial | ||
| #pragma acc loop worker(i) | ||
| for(;;); | ||
|
|
||
| // expected-error@+2{{'num' argument on 'worker' clause is not permitted on a 'loop' construct associated with a 'serial' compute construct}} | ||
| #pragma acc serial | ||
| #pragma acc loop worker(num:i) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(i) | ||
| for(;;); | ||
|
|
||
| Converts Cvts; | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(Cvts) | ||
| for(;;); | ||
|
|
||
| NoConvert NoCvts; | ||
|
|
||
| #pragma acc kernels | ||
| // expected-error@+1{{OpenACC clause 'worker' requires expression of integer type ('NoConvert' invalid)}} | ||
| #pragma acc loop worker(NoCvts) | ||
| for(;;); | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker(num:i) | ||
| for(;;); | ||
|
|
||
| // expected-error@+3{{'num' argument to 'worker' clause not allowed on a 'loop' construct associated with a 'kernels' construct that has a 'num_workers' clause}} | ||
| // expected-note@+1{{previous clause is here}} | ||
| #pragma acc kernels num_workers(i) | ||
| #pragma acc loop worker(num:i) | ||
| for(;;); | ||
|
|
||
| #pragma acc loop worker | ||
| for(;;) { | ||
| // expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-note@-4 2{{previous clause is here}} | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
|
|
||
| #pragma acc loop worker | ||
| for(;;) { | ||
| #pragma acc parallel | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
|
|
||
|
|
||
| #pragma acc parallel | ||
| #pragma acc loop worker | ||
| for(;;) { | ||
| // expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-note@-4 2{{previous clause is here}} | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
|
|
||
| #pragma acc parallel | ||
| #pragma acc loop worker | ||
| for(;;) { | ||
| #pragma acc parallel | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
|
|
||
| #pragma acc serial | ||
| #pragma acc loop worker | ||
| for(;;) { | ||
| // expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-note@-4 2{{previous clause is here}} | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
|
|
||
| #pragma acc serial | ||
| #pragma acc loop worker | ||
| for(;;) { | ||
| #pragma acc parallel | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker | ||
| for(;;) { | ||
| // expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'worker' clause}} | ||
| // expected-note@-4 2{{previous clause is here}} | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
|
|
||
| #pragma acc kernels | ||
| #pragma acc loop worker | ||
| for(;;) { | ||
| #pragma acc parallel | ||
| #pragma acc loop worker, gang | ||
| for(;;) {} | ||
| } | ||
| } |