diff options
Diffstat (limited to 'clang/test')
172 files changed, 6034 insertions, 2395 deletions
diff --git a/clang/test/AST/ByteCode/builtin-constant-p.cpp b/clang/test/AST/ByteCode/builtin-constant-p.cpp index 0d222d1c9627..62899b60064c 100644 --- a/clang/test/AST/ByteCode/builtin-constant-p.cpp +++ b/clang/test/AST/ByteCode/builtin-constant-p.cpp @@ -12,3 +12,9 @@ static_assert(__builtin_constant_p(I + 10.0), ""); static_assert(__builtin_constant_p(nullptr), ""); static_assert(__builtin_constant_p(&I), ""); // both-error {{failed due to requirement}} static_assert(__builtin_constant_p((void)I), ""); // both-error {{failed due to requirement}} + +extern int z; +constexpr int foo(int &a) { + return __builtin_constant_p(a); +} +static_assert(!foo(z)); diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index c1fd1bc13815..723764010d9a 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -1244,6 +1244,34 @@ namespace BuiltinMemcpy { } static_assert(cpyptr()); +#ifndef __AVR__ + constexpr int test_memmove(int a, int b, int n) { + int arr[4] = {1, 2, 3, 4}; + __builtin_memmove(arr + a, arr + b, n); // both-note {{destination is not a contiguous array of at least 3 elements of type 'int'}} + return result(arr); + } + static_assert(test_memmove(2, 0, 12) == 4234); // both-error {{constant}} \ + // both-note {{in call}} +#endif + + struct Trivial { char k; short s; constexpr bool ok() { return k == 3 && s == 4; } }; + constexpr bool test_trivial() { + Trivial arr[3] = {{1, 2}, {3, 4}, {5, 6}}; + __builtin_memcpy(arr, arr+1, sizeof(Trivial)); + __builtin_memmove(arr+1, arr, 2 * sizeof(Trivial)); + + return arr[0].ok() && arr[1].ok() && arr[2].ok(); + } + static_assert(test_trivial()); + + // Check that an incomplete array is rejected. + constexpr int test_incomplete_array_type() { // both-error {{never produces a constant}} + extern int arr[]; + __builtin_memmove(arr, arr, 4 * sizeof(arr[0])); + // both-note@-1 2{{'memmove' not supported: source is not a contiguous array of at least 4 elements of type 'int'}} + return arr[0] * 1000 + arr[1] * 100 + arr[2] * 10 + arr[3]; + } + static_assert(test_incomplete_array_type() == 1234); // both-error {{constant}} both-note {{in call}} } namespace Memcmp { diff --git a/clang/test/AST/ByteCode/cxx2a.cpp b/clang/test/AST/ByteCode/cxx2a.cpp index eaae978e0118..f6006881cee4 100644 --- a/clang/test/AST/ByteCode/cxx2a.cpp +++ b/clang/test/AST/ByteCode/cxx2a.cpp @@ -110,3 +110,63 @@ namespace DtorOrder { } static_assert(check_abnormal_termination()); } + +namespace std { + struct type_info; +} + +namespace TypeId { + struct A { + const std::type_info &ti = typeid(*this); + }; + struct A2 : A {}; + static_assert(&A().ti == &typeid(A)); + static_assert(&typeid((A2())) == &typeid(A2)); + extern A2 extern_a2; + static_assert(&typeid(extern_a2) == &typeid(A2)); + + constexpr A2 a2; + constexpr const A &a1 = a2; + static_assert(&typeid(a1) == &typeid(A)); + + struct B { + virtual void f(); + const std::type_info &ti1 = typeid(*this); + }; + struct B2 : B { + const std::type_info &ti2 = typeid(*this); + }; + static_assert(&B2().ti1 == &typeid(B)); + static_assert(&B2().ti2 == &typeid(B2)); + extern B2 extern_b2; + static_assert(&typeid(extern_b2) == &typeid(B2)); // both-error {{constant expression}} \ + // both-note{{typeid applied to object 'extern_b2' whose dynamic type is not constant}} + + + constexpr B2 b2; + constexpr const B &b1 = b2; + static_assert(&typeid(b1) == &typeid(B2)); + + constexpr bool side_effects() { + // Not polymorphic nor a glvalue. + bool OK = true; + (void)typeid(OK = false, A2()); // both-warning {{has no effect}} + if (!OK) return false; + + // Not polymorphic. + A2 a2; + (void)typeid(OK = false, a2); // both-warning {{has no effect}} + if (!OK) return false; + + // Not a glvalue. + (void)typeid(OK = false, B2()); // both-warning {{has no effect}} + if (!OK) return false; + + // Polymorphic glvalue: operand evaluated. + OK = false; + B2 b2; + (void)typeid(OK = true, b2); // both-warning {{will be evaluated}} + return OK; + } + static_assert(side_effects()); +} diff --git a/clang/test/AST/ast-print-openacc-set-construct.cpp b/clang/test/AST/ast-print-openacc-set-construct.cpp new file mode 100644 index 000000000000..a801ae16739e --- /dev/null +++ b/clang/test/AST/ast-print-openacc-set-construct.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fopenacc -ast-print %s -o - | FileCheck %s + +unsigned Int; + +void uses() { +// CHECK: #pragma acc set default_async(Int) if(Int == 5) device_type(I) device_num(Int) +#pragma acc set default_async(Int) if (Int == 5) device_type(I) device_num(Int) +// CHECK: #pragma acc set default_async(Int) device_type(I) device_num(Int) +#pragma acc set default_async(Int) device_type(I) device_num(Int) +// CHECK: #pragma acc set default_async(Int) if(Int == 5) device_num(Int) +#pragma acc set default_async(Int) if (Int == 5) device_num(Int) +// CHECK: #pragma acc set default_async(Int) if(Int == 5) device_type(I) +#pragma acc set default_async(Int) if (Int == 5) device_type(I) +// CHECK: #pragma acc set if(Int == 5) device_type(I) device_num(Int) +#pragma acc set if (Int == 5) device_type(I) device_num(Int) +// CHECK: #pragma acc set default_async(Int) +#pragma acc set default_async(Int) +// CHECK: #pragma acc set if(Int == 5) +#pragma acc set if (Int == 5) +// CHECK: #pragma acc set device_type(I) +#pragma acc set device_type(I) +// CHECK: #pragma acc set device_num(Int) +#pragma acc set device_num(Int) +} diff --git a/clang/test/AST/ast-print-openacc-update-construct.cpp b/clang/test/AST/ast-print-openacc-update-construct.cpp new file mode 100644 index 000000000000..a7f5b2a42285 --- /dev/null +++ b/clang/test/AST/ast-print-openacc-update-construct.cpp @@ -0,0 +1,41 @@ +// 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 +#pragma acc update + +// CHECK: #pragma acc update if_present +#pragma acc update if_present +// CHECK: #pragma acc update if(cond) +#pragma acc update if(cond) + +// CHECK: #pragma acc update async +#pragma acc update async +// CHECK: #pragma acc update async(*iPtr) +#pragma acc update async(*iPtr) +// CHECK: #pragma acc update async(I) +#pragma acc update async(I) + +// CHECK: #pragma acc update wait(*iPtr, I) async +#pragma acc update wait(*iPtr, I) async + +// CHECK: #pragma acc update wait(queues: *iPtr, I) async(*iPtr) +#pragma acc update wait(queues:*iPtr, I) async(*iPtr) + +// CHECK: #pragma acc update wait(devnum: I : *iPtr, I) async(I) +#pragma acc update wait(devnum:I:*iPtr, I) async(I) + +// CHECK: #pragma acc update wait(devnum: I : queues: *iPtr, I) if(I == array[I]) async(I) +#pragma acc update wait(devnum:I:queues:*iPtr, I) if(I == array[I]) async(I) + +// CHECK: #pragma acc update device_type(I) dtype(H) +#pragma acc update device_type(I) dtype(H) + +// CHECK: #pragma acc update device_type(J) dtype(K) +#pragma acc update device_type(J) dtype(K) + +// 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]) +} diff --git a/clang/test/Analysis/PR121201.cpp b/clang/test/Analysis/PR121201.cpp new file mode 100644 index 000000000000..acd2492d011f --- /dev/null +++ b/clang/test/Analysis/PR121201.cpp @@ -0,0 +1,67 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s \ +// RUN: -analyzer-config unroll-loops=true + +// expected-no-diagnostics + +template <bool, typename T, typename> using conditional_t = T; +class basic_format_arg; +template <typename> struct formatter; + +template <typename Context> struct value { + template <typename T> value(T) { + using value_type = T; + (void)format_custom_arg<value_type, + typename Context::template formatter_type<value_type>>; + } + + template <typename, typename Formatter> static void format_custom_arg() { + Context ctx; + auto f = Formatter(); + f.format(0, ctx); + } +}; + +struct context { + template <typename T> using formatter_type = formatter<T>; +}; + +enum { max_packed_args }; + +template <typename Context, long> +using arg_t = conditional_t<max_packed_args, value<Context>, basic_format_arg>; + +template <int NUM_ARGS> struct format_arg_store { + arg_t<context, NUM_ARGS> args; +}; + +template <typename... T, long NUM_ARGS = sizeof...(T)> +auto make_format_args(T... args) -> format_arg_store<NUM_ARGS> { + return {args...}; +} + +template <typename F> void write_padded(F write) { write(0); } + +template <typename... T> void format(T... args) { make_format_args(args...); } + +template <int> struct bitset { + bitset(long); +}; + +template <long N> struct formatter<bitset<N>> { + struct writer { + bitset<N> bs; + + template <typename OutputIt> void operator()(OutputIt) { + for (auto pos = N; pos > 0; --pos) // no-crash + ; + } + }; + + template <typename FormatContext> void format(bitset<N> bs, FormatContext) { + write_padded(writer{bs}); + } +}; + +bitset<6> TestBody_bs(2); + +void TestBody() { format(TestBody_bs); } diff --git a/clang/test/Analysis/analyzer-config.c b/clang/test/Analysis/analyzer-config.c index 8ce6184144d4..d5eb790b82f2 100644 --- a/clang/test/Analysis/analyzer-config.c +++ b/clang/test/Analysis/analyzer-config.c @@ -41,6 +41,7 @@ // CHECK-NEXT: cplusplus.SmartPtrModeling:ModelSmartPtrDereference = false // CHECK-NEXT: crosscheck-with-z3 = false // CHECK-NEXT: crosscheck-with-z3-eqclass-timeout-threshold = 0 +// CHECK-NEXT: crosscheck-with-z3-max-attempts-per-query = 3 // CHECK-NEXT: crosscheck-with-z3-rlimit-threshold = 0 // CHECK-NEXT: crosscheck-with-z3-timeout-threshold = 15000 // CHECK-NEXT: ctu-dir = "" diff --git a/clang/test/Analysis/dump_egraph.cpp b/clang/test/Analysis/dump_egraph.cpp index d1229b263467..13459699a06f 100644 --- a/clang/test/Analysis/dump_egraph.cpp +++ b/clang/test/Analysis/dump_egraph.cpp @@ -21,7 +21,7 @@ void foo() { // CHECK: \"location_context\": \"#0 Call\", \"calling\": \"T::T\", \"location\": \{ \"line\": 15, \"column\": 5, \"file\": \"{{.*}}dump_egraph.cpp\" \}, \"items\": [\l \{ \"init_id\": {{[0-9]+}}, \"kind\": \"construct into member variable\", \"argument_index\": null, \"pretty\": \"s\", \"value\": \"&t.s\" -// CHECK: \"cluster\": \"t\", \"pointer\": \"{{0x[0-9a-f]+}}\", \"items\": [\l \{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\" +// CHECK: \"cluster\": \"t\", \"pointer\": \"{{0x[0-9a-f]+}}\", \"items\": [\l \{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$3\{int, LC5, no stmt, #1\}\" // CHECK: \"dynamic_types\": [\l \{ \"region\": \"HeapSymRegion\{conj_$1\{S *, LC1, S{{[0-9]+}}, #1\}\}\", \"dyn_type\": \"S\", \"sub_classable\": false \}\l diff --git a/clang/test/Analysis/embed.c b/clang/test/Analysis/embed.c index 32f6c1303257..db8c270fb35d 100644 --- a/clang/test/Analysis/embed.c +++ b/clang/test/Analysis/embed.c @@ -8,5 +8,5 @@ int main() { #embed "embed.c" }; clang_analyzer_dump_ptr(SelfBytes); // expected-warning {{&Element{SelfBytes,0 S64b,unsigned char}}} - clang_analyzer_dump(SelfBytes[0]); // expected-warning {{Unknown}} FIXME: This should be the `/` character. + clang_analyzer_dump(SelfBytes[0]); // expected-warning {{47 U8b}} } diff --git a/clang/test/Analysis/expr-inspection-printState-diseq-info.c b/clang/test/Analysis/expr-inspection-printState-diseq-info.c index c5c31785a600..515fcbbd4307 100644 --- a/clang/test/Analysis/expr-inspection-printState-diseq-info.c +++ b/clang/test/Analysis/expr-inspection-printState-diseq-info.c @@ -18,17 +18,17 @@ void test_disequality_info(int e0, int b0, int b1, int c0) { // CHECK-NEXT: { // CHECK-NEXT: "class": [ "(reg_$0<int e0>) - 2" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "reg_$2<int b1>" ]] + // CHECK-NEXT: [ "reg_$7<int b1>" ]] // CHECK-NEXT: }, // CHECK-NEXT: { - // CHECK-NEXT: "class": [ "reg_$2<int b1>" ], + // CHECK-NEXT: "class": [ "reg_$15<int c0>" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "(reg_$0<int e0>) - 2" ], - // CHECK-NEXT: [ "reg_$3<int c0>" ]] + // CHECK-NEXT: [ "reg_$7<int b1>" ]] // CHECK-NEXT: }, // CHECK-NEXT: { - // CHECK-NEXT: "class": [ "reg_$3<int c0>" ], + // CHECK-NEXT: "class": [ "reg_$7<int b1>" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "reg_$2<int b1>" ]] + // CHECK-NEXT: [ "(reg_$0<int e0>) - 2" ], + // CHECK-NEXT: [ "reg_$15<int c0>" ]] // CHECK-NEXT: } // CHECK-NEXT: ], diff --git a/clang/test/Analysis/expr-inspection-printState-eq-classes.c b/clang/test/Analysis/expr-inspection-printState-eq-classes.c index 38e23d6e8382..19cc13735ab5 100644 --- a/clang/test/Analysis/expr-inspection-printState-eq-classes.c +++ b/clang/test/Analysis/expr-inspection-printState-eq-classes.c @@ -16,6 +16,6 @@ void test_equivalence_classes(int a, int b, int c, int d) { } // CHECK: "equivalence_classes": [ -// CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$2<int c>)" ], -// CHECK-NEXT: [ "reg_$0<int a>", "reg_$2<int c>", "reg_$3<int d>" ] +// CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$5<int c>)" ], +// CHECK-NEXT: [ "reg_$0<int a>", "reg_$20<int d>", "reg_$5<int c>" ] // CHECK-NEXT: ], diff --git a/clang/test/Analysis/loop-assumptions.c b/clang/test/Analysis/loop-assumptions.c new file mode 100644 index 000000000000..eb0ffdce722e --- /dev/null +++ b/clang/test/Analysis/loop-assumptions.c @@ -0,0 +1,219 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection \ +// RUN: -verify=expected,eagerlyassume %s +// RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection \ +// RUN: -analyzer-config eagerly-assume=false \ +// RUN: -verify=expected,noeagerlyassume %s + +// These tests validate the logic within `ExprEngine::processBranch` which +// ensures that in loops with opaque conditions we don't assume execution paths +// if the code does not imply that they are possible. + +void clang_analyzer_numTimesReached(void); +void clang_analyzer_warnIfReached(void); +void clang_analyzer_dump(int); + +void clearCondition(void) { + // If the analyzer can definitely determine the value of the loop condition, + // then this corrective logic doesn't activate and the engine executes + // `-analyzer-max-loop` iterations (by default, 4). + for (int i = 0; i < 10; i++) + clang_analyzer_numTimesReached(); // expected-warning {{4}} + + clang_analyzer_warnIfReached(); // unreachable +} + +void opaqueCondition(int arg) { + // If the loop condition is opaque, don't assume more than two iterations, + // because the presence of a loop does not imply that the programmer thought + // that more than two iterations are possible. (It _does_ imply that two + // iterations may be possible at least in some cases, because otherwise an + // `if` would've been enough.) + for (int i = 0; i < arg; i++) + clang_analyzer_numTimesReached(); // expected-warning {{2}} + + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +int check(void); + +void opaqueConditionCall(int arg) { + // Same situation as `opaqueCondition()` but with a `while ()` loop. This + // is also an example for a situation where the programmer cannot easily + // insert an assertion to guide the analyzer and rule out more than two + // iterations (so the analyzer needs to proactively avoid those unjustified + // branches). + while (check()) + clang_analyzer_numTimesReached(); // expected-warning {{2}} + + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +void opaqueConditionDoWhile(int arg) { + // Same situation as `opaqueCondition()` but with a `do {} while ()` loop. + // This is tested separately because this loop type is a special case in the + // iteration count calculation. + int i = 0; + do { + clang_analyzer_numTimesReached(); // expected-warning {{2}} + } while (i++ < arg); + + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +void dontRememberOldBifurcation(int arg) { + // In this (slightly contrived) test case the analyzer performs an assumption + // at the first iteration of the loop, but does not make any new assumptions + // in the subsequent iterations, so the analyzer should continue evaluating + // the loop. + // Previously this was mishandled in `eagerly-assume` mode (which is enabled + // by default), because the code remembered that there was a bifurcation on + // the first iteration of the loop and didn't realize that this is obsolete. + + // NOTE: The variable `i` is introduced to ensure that the iterations of the + // loop change the state -- otherwise the analyzer stops iterating because it + // returns to the same `ExplodedNode`. + int i = 0; + while (arg > 3) { + clang_analyzer_numTimesReached(); // expected-warning {{4}} + i++; + } + + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +void dontAssumeFourthIterartion(int arg) { + if (arg == 2) + return; + + // In this function the analyzer cannot leave the loop after exactly two + // iterations (because it knows that `arg != 2` at that point), so it + // performs a third iteration, but it does not assume that a fourth iteration + // is also possible. + for (int i = 0; i < arg; i++) + clang_analyzer_numTimesReached(); // expected-warning {{3}} + + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +#define TRUE 1 +void shortCircuitInLoopCondition(int arg) { + // When the loop condition expression contains short-circuiting operators, it + // performs "inner" bifurcations for those operators and only considers the + // last (rightmost) operand as the branch condition that is associated with + // the loop itself (as its loop condition). + // This means that assumptions taken in the left-hand side of a short-circuiting + // operator are not recognized as "opaque" loop condition, so the loop in + // this test case is allowed to finish four iterations. + // FIXME: This corner case is responsible for at least one out-of-bounds + // false positive on the ffmpeg codebase. Eventually we should properly + // recognize the full syntactical loop condition expression as "the loop + // condition", but this will be complicated to implement. + for (int i = 0; i < arg && TRUE; i++) { + clang_analyzer_numTimesReached(); // expected-warning {{4}} + } + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +void shortCircuitInLoopConditionRHS(int arg) { + // Unlike `shortCircuitInLoopCondition()`, this case is handled properly + // because the analyzer thinks that the right hand side of the `&&` is the + // loop condition. + for (int i = 0; TRUE && i < arg; i++) { + clang_analyzer_numTimesReached(); // expected-warning {{2}} + } + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +void eagerlyAssumeInSubexpression(int arg) { + // The `EagerlyAssume` logic is another complication that can "split the + // state" within the loop condition, but before the `processBranch()` call + // which is (in theory) responsible for evaluating the loop condition. + // The current implementation partially compensates this by noticing the + // cases where the loop condition is targeted by `EagerlyAssume`, but does + // not handle the (fortunately rare) case when `EagerlyAssume` hits a + // sub-expression of the loop condition (as in this contrived test case). + // FIXME: I don't know a real-world example for this inconsistency, but it + // would be good to eliminate it eventually. + for (int i = 0; (i >= arg) - 1; i++) { + clang_analyzer_numTimesReached(); // eagerlyassume-warning {{4}} noeagerlyassume-warning {{2}} + } + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} + +void calledTwice(int arg, int isFirstCall) { + // This function is called twice (with two different unknown 'arg' values) to + // check the iteration count handling in this situation. + for (int i = 0; i < arg; i++) { + if (isFirstCall) { + clang_analyzer_numTimesReached(); // expected-warning {{2}} + } else { + clang_analyzer_numTimesReached(); // expected-warning {{2}} + } + } +} + +void caller(int arg, int arg2) { + // Entry point for `calledTwice()`. + calledTwice(arg, 1); + calledTwice(arg2, 0); +} + +void innerLoopClearCondition(void) { + // A "control group" test case for the behavior of an inner loop. Notice that + // although the (default) value of `-analyzer-max-loop` is 4, we only see 3 iterations + // of the inner loop, because `-analyzer-max-loop` limits the number of + // evaluations of _the loop condition of the inner loop_ and in addition to + // the 3 evaluations before the 3 iterations, there is also a step where it + // evaluates to false (in the first iteration of the outer loop). + for (int outer = 0; outer < 2; outer++) { + int limit = 0; + if (outer) + limit = 10; + clang_analyzer_dump(limit); // expected-warning {{0}} expected-warning {{10}} + for (int i = 0; i < limit; i++) { + clang_analyzer_numTimesReached(); // expected-warning {{3}} + } + } +} + +void innerLoopOpaqueCondition(int arg) { + // In this test case the engine doesn't assume a second iteration within the + // inner loop (in the second iteration of the outer loop, when the limit is + // opaque) because `CoreEngine::getCompletedIterationCount()` is based on the + // `BlockCount` values queried from the `BlockCounter` which count _all_ + // evaluations of a given `CFGBlock` (in our case, the loop condition) and + // not just the evaluations within the current iteration of the outer loop. + // FIXME: This inaccurate iteration count could in theory cause some false + // negatives, although I think this would be unusual in practice, as the + // small default value of `-analyzer-max-loop` means that this is only + // relevant if the analyzer can deduce that the inner loop performs 0 or 1 + // iterations within the first iteration of the outer loop (and then the + // condition of the inner loop is opaque within the second iteration of the + // outer loop). + for (int outer = 0; outer < 2; outer++) { + int limit = 0; + if (outer) + limit = arg; + clang_analyzer_dump(limit); // expected-warning {{0}} expected-warning {{reg_$}} + for (int i = 0; i < limit; i++) { + clang_analyzer_numTimesReached(); // expected-warning {{1}} + } + } +} + +void onlyLoopConditions(int arg) { + // This "don't assume third iteration" logic only examines the conditions of + // loop statements and does not affect the analysis of code that implements + // similar behavior with different language features like if + break, goto, + // recursive functions, ... + int i = 0; + while (1) { + clang_analyzer_numTimesReached(); // expected-warning {{4}} + + // This is not a loop condition. + if (i++ > arg) + break; + } + + clang_analyzer_warnIfReached(); // expected-warning {{REACHABLE}} +} diff --git a/clang/test/Analysis/loop-unrolling.cpp b/clang/test/Analysis/loop-unrolling.cpp index 66a828abfb51..bf05a7739ce4 100644 --- a/clang/test/Analysis/loop-unrolling.cpp +++ b/clang/test/Analysis/loop-unrolling.cpp @@ -63,7 +63,7 @@ int simple_no_unroll1() { int a[9]; int k = 42; for (int i = 0; i < 9; i++) { - clang_analyzer_numTimesReached(); // expected-warning {{4}} + clang_analyzer_numTimesReached(); // expected-warning {{2}} a[i] = 42; foo(i); } @@ -76,7 +76,7 @@ int simple_no_unroll2() { int k = 42; int i; for (i = 0; i < 9; i++) { - clang_analyzer_numTimesReached(); // expected-warning {{4}} + clang_analyzer_numTimesReached(); // expected-warning {{2}} a[i] = 42; i += getNum(); } @@ -309,9 +309,9 @@ int nested_inner_unrolled() { int k = 42; int j = 0; for (int i = 0; i < getNum(); i++) { - clang_analyzer_numTimesReached(); // expected-warning {{4}} + clang_analyzer_numTimesReached(); // expected-warning {{2}} for (j = 0; j < 8; ++j) { - clang_analyzer_numTimesReached(); // expected-warning {{32}} + clang_analyzer_numTimesReached(); // expected-warning {{16}} a[j] = 22; } a[i] = 42; @@ -346,11 +346,7 @@ int simple_known_bound_loop() { int simple_unknown_bound_loop() { for (int i = 2; i < getNum(); i++) { -#ifdef DFS - clang_analyzer_numTimesReached(); // expected-warning {{16}} -#else clang_analyzer_numTimesReached(); // expected-warning {{8}} -#endif } return 0; } @@ -368,11 +364,7 @@ int nested_inlined_unroll1() { int nested_inlined_no_unroll1() { int k; for (int i = 0; i < 9; i++) { -#ifdef DFS - clang_analyzer_numTimesReached(); // expected-warning {{18}} -#else - clang_analyzer_numTimesReached(); // expected-warning {{14}} -#endif + clang_analyzer_numTimesReached(); // expected-warning {{10}} k = simple_unknown_bound_loop(); // reevaluation without inlining, splits the state as well } int a = 22 / k; // no-warning @@ -475,9 +467,13 @@ int num_steps_over_limit2() { int num_steps_on_limit3() { for (int i = 0; i < getNum(); i++) { - clang_analyzer_numTimesReached(); // expected-warning {{4}} + clang_analyzer_numTimesReached(); // expected-warning {{2}} for (int j = 0; j < 32; j++) { - clang_analyzer_numTimesReached(); // expected-warning {{128}} + // Here the loop unrollig logic calculates with four potential iterations + // in the outer loop where it cannot determine the iteration count in + // advance; but after two loops the analyzer conservatively assumes that + // the (still opaque) loop condition is false. + clang_analyzer_numTimesReached(); // expected-warning {{64}} } } return 0; @@ -493,6 +489,15 @@ int num_steps_over_limit3() { return 0; } +int num_steps_on_limit4() { + for (int i = 0; i < 4; i++) { + clang_analyzer_numTimesReached(); // expected-warning {{4}} + for (int j = 0; j < 32; j++) { + clang_analyzer_numTimesReached(); // expected-warning {{128}} + } + } + return 0; +} void pr34943() { for (int i = 0; i < 6L; ++i) { diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m index 668b5ffd7001..a882e7eb0dc9 100644 --- a/clang/test/Analysis/misc-ps-region-store.m +++ b/clang/test/Analysis/misc-ps-region-store.m @@ -910,13 +910,13 @@ void pr6302(id x, Class y) { //===----------------------------------------------------------------------===// // Specially handle global variables that are declared constant. In the -// example below, this forces the loop to take exactly 2 iterations. +// example below, this forces the loop to take exactly 1 iteration. //===----------------------------------------------------------------------===// -const int pr6288_L_N = 2; +const int pr6288_L_N = 1; void pr6288_(void) { - int x[2]; - int *px[2]; + int x[1]; + int *px[1]; int i; for (i = 0; i < pr6288_L_N; i++) px[i] = &x[i]; @@ -924,8 +924,8 @@ void pr6288_(void) { } void pr6288_pos(int z) { - int x[2]; - int *px[2]; + int x[1]; + int *px[1]; int i; for (i = 0; i < z; i++) px[i] = &x[i]; // expected-warning{{Access out-of-bound array element (buffer overflow)}} @@ -933,15 +933,28 @@ void pr6288_pos(int z) { } void pr6288_b(void) { - const int L_N = 2; - int x[2]; - int *px[2]; + const int L_N = 1; + int x[1]; + int *px[1]; int i; for (i = 0; i < L_N; i++) px[i] = &x[i]; *(px[0]) = 0; // no-warning } +void pr6288_no_third_iter(int z) { + int x[2]; + int *px[2]; + int i; + // If the loop condition is opaque, we assume that there may be two + // iterations (becasuse otherwise the loop could be replaced by an if); but + // we do not assume that there may be a third iteration. Therefore, + // unlike 'pr6288_pos', this testcase does not produce an out-of-bounds error. + for (i = 0; i < z; i++) + px[i] = &x[i]; + *(px[0]) = 0; // expected-warning{{Dereference of undefined pointer value}} +} + // A bug in RemoveDeadBindings was causing instance variable bindings to get // prematurely pruned from the state. @interface Rdar7817800 { diff --git a/clang/test/Analysis/ptr-arith.cpp b/clang/test/Analysis/ptr-arith.cpp index a1264a1f0483..ec1c75c0c406 100644 --- a/clang/test/Analysis/ptr-arith.cpp +++ b/clang/test/Analysis/ptr-arith.cpp @@ -139,10 +139,10 @@ struct parse_t { int parse(parse_t *p) { unsigned copy = p->bits2; clang_analyzer_dump(copy); - // expected-warning@-1 {{reg_$1<unsigned int Element{SymRegion{reg_$0<parse_t * p>},0 S64b,struct Bug_55934::parse_t}.bits2>}} + // expected-warning@-1 {{reg_$2<unsigned int Element{SymRegion{reg_$0<parse_t * p>},0 S64b,struct Bug_55934::parse_t}.bits2>}} header *bits = (header *)© clang_analyzer_dump(bits->b); - // expected-warning@-1 {{derived_$2{reg_$1<unsigned int Element{SymRegion{reg_$0<parse_t * p>},0 S64b,struct Bug_55934::parse_t}.bits2>,Element{copy,0 S64b,struct Bug_55934::header}.b}}} + // expected-warning@-1 {{derived_$4{reg_$2<unsigned int Element{SymRegion{reg_$0<parse_t * p>},0 S64b,struct Bug_55934::parse_t}.bits2>,Element{copy,0 S64b,struct Bug_55934::header}.b}}} return bits->b; // no-warning } } // namespace Bug_55934 diff --git a/clang/test/Analysis/symbol-simplification-disequality-info.cpp b/clang/test/Analysis/symbol-simplification-disequality-info.cpp index 69238b583eb8..33b8f150f5d0 100644 --- a/clang/test/Analysis/symbol-simplification-disequality-info.cpp +++ b/clang/test/Analysis/symbol-simplification-disequality-info.cpp @@ -14,14 +14,14 @@ void test(int a, int b, int c, int d) { clang_analyzer_printState(); // CHECK: "disequality_info": [ // CHECK-NEXT: { - // CHECK-NEXT: "class": [ "((reg_$0<int a>) + (reg_$1<int b>)) + (reg_$2<int c>)" ], + // CHECK-NEXT: "class": [ "((reg_$0<int a>) + (reg_$2<int b>)) + (reg_$5<int c>)" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "reg_$3<int d>" ]] + // CHECK-NEXT: [ "reg_$8<int d>" ]] // CHECK-NEXT: }, // CHECK-NEXT: { - // CHECK-NEXT: "class": [ "reg_$3<int d>" ], + // CHECK-NEXT: "class": [ "reg_$8<int d>" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "((reg_$0<int a>) + (reg_$1<int b>)) + (reg_$2<int c>)" ]] + // CHECK-NEXT: [ "((reg_$0<int a>) + (reg_$2<int b>)) + (reg_$5<int c>)" ]] // CHECK-NEXT: } // CHECK-NEXT: ], @@ -32,14 +32,14 @@ void test(int a, int b, int c, int d) { clang_analyzer_printState(); // CHECK: "disequality_info": [ // CHECK-NEXT: { - // CHECK-NEXT: "class": [ "(reg_$0<int a>) + (reg_$2<int c>)" ], + // CHECK-NEXT: "class": [ "(reg_$0<int a>) + (reg_$5<int c>)" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "reg_$3<int d>" ]] + // CHECK-NEXT: [ "reg_$8<int d>" ]] // CHECK-NEXT: }, // CHECK-NEXT: { - // CHECK-NEXT: "class": [ "reg_$3<int d>" ], + // CHECK-NEXT: "class": [ "reg_$8<int d>" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "(reg_$0<int a>) + (reg_$2<int c>)" ]] + // CHECK-NEXT: [ "(reg_$0<int a>) + (reg_$5<int c>)" ]] // CHECK-NEXT: } // CHECK-NEXT: ], @@ -50,10 +50,10 @@ void test(int a, int b, int c, int d) { // CHECK-NEXT: { // CHECK-NEXT: "class": [ "reg_$0<int a>" ], // CHECK-NEXT: "disequal_to": [ - // CHECK-NEXT: [ "reg_$3<int d>" ]] + // CHECK-NEXT: [ "reg_$8<int d>" ]] // CHECK-NEXT: }, // CHECK-NEXT: { - // CHECK-NEXT: "class": [ "reg_$3<int d>" ], + // CHECK-NEXT: "class": [ "reg_$8<int d>" ], // CHECK-NEXT: "disequal_to": [ // CHECK-NEXT: [ "reg_$0<int a>" ]] // CHECK-NEXT: } diff --git a/clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp b/clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp index 73922d420a8c..42e984762538 100644 --- a/clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp +++ b/clang/test/Analysis/symbol-simplification-fixpoint-one-iteration.cpp @@ -13,10 +13,10 @@ void test(int a, int b, int c) { return; clang_analyzer_printState(); // CHECK: "constraints": [ - // CHECK-NEXT: { "symbol": "((reg_$0<int a>) + (reg_$1<int b>)) != (reg_$2<int c>)", "range": "{ [0, 0] }" } + // CHECK-NEXT: { "symbol": "((reg_$0<int a>) + (reg_$2<int b>)) != (reg_$5<int c>)", "range": "{ [0, 0] }" } // CHECK-NEXT: ], // CHECK-NEXT: "equivalence_classes": [ - // CHECK-NEXT: [ "(reg_$0<int a>) + (reg_$1<int b>)", "reg_$2<int c>" ] + // CHECK-NEXT: [ "(reg_$0<int a>) + (reg_$2<int b>)", "reg_$5<int c>" ] // CHECK-NEXT: ], // CHECK-NEXT: "disequality_info": null, @@ -25,12 +25,12 @@ void test(int a, int b, int c) { return; clang_analyzer_printState(); // CHECK: "constraints": [ - // CHECK-NEXT: { "symbol": "(reg_$0<int a>) != (reg_$2<int c>)", "range": "{ [0, 0] }" }, - // CHECK-NEXT: { "symbol": "reg_$1<int b>", "range": "{ [0, 0] }" } + // CHECK-NEXT: { "symbol": "(reg_$0<int a>) != (reg_$5<int c>)", "range": "{ [0, 0] }" }, + // CHECK-NEXT: { "symbol": "reg_$2<int b>", "range": "{ [0, 0] }" } // CHECK-NEXT: ], // CHECK-NEXT: "equivalence_classes": [ - // CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$2<int c>)" ], - // CHECK-NEXT: [ "reg_$0<int a>", "reg_$2<int c>" ] + // CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$5<int c>)" ], + // CHECK-NEXT: [ "reg_$0<int a>", "reg_$5<int c>" ] // CHECK-NEXT: ], // CHECK-NEXT: "disequality_info": null, diff --git a/clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp b/clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp index 679ed3fda7a7..cffb5a70869e 100644 --- a/clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp +++ b/clang/test/Analysis/symbol-simplification-fixpoint-two-iterations.cpp @@ -15,11 +15,11 @@ void test(int a, int b, int c, int d) { return; clang_analyzer_printState(); // CHECK: "constraints": [ - // CHECK-NEXT: { "symbol": "(((reg_$0<int a>) + (reg_$1<int b>)) + (reg_$2<int c>)) != (reg_$3<int d>)", "range": "{ [0, 0] }" }, - // CHECK-NEXT: { "symbol": "(reg_$2<int c>) + (reg_$1<int b>)", "range": "{ [0, 0] }" } + // CHECK-NEXT: { "symbol": "(((reg_$0<int a>) + (reg_$2<int b>)) + (reg_$5<int c>)) != (reg_$8<int d>)", "range": "{ [0, 0] }" }, + // CHECK-NEXT: { "symbol": "(reg_$5<int c>) + (reg_$2<int b>)", "range": "{ [0, 0] }" } // CHECK-NEXT: ], // CHECK-NEXT: "equivalence_classes": [ - // CHECK-NEXT: [ "((reg_$0<int a>) + (reg_$1<int b>)) + (reg_$2<int c>)", "reg_$3<int d>" ] + // CHECK-NEXT: [ "((reg_$0<int a>) + (reg_$2<int b>)) + (reg_$5<int c>)", "reg_$8<int d>" ] // CHECK-NEXT: ], // CHECK-NEXT: "disequality_info": null, @@ -28,14 +28,14 @@ void test(int a, int b, int c, int d) { return; clang_analyzer_printState(); // CHECK: "constraints": [ - // CHECK-NEXT: { "symbol": "(reg_$0<int a>) != (reg_$3<int d>)", "range": "{ [0, 0] }" }, - // CHECK-NEXT: { "symbol": "reg_$1<int b>", "range": "{ [0, 0] }" }, - // CHECK-NEXT: { "symbol": "reg_$2<int c>", "range": "{ [0, 0] }" } + // CHECK-NEXT: { "symbol": "(reg_$0<int a>) != (reg_$8<int d>)", "range": "{ [0, 0] }" }, + // CHECK-NEXT: { "symbol": "reg_$2<int b>", "range": "{ [0, 0] }" }, + // CHECK-NEXT: { "symbol": "reg_$5<int c>", "range": "{ [0, 0] }" } // CHECK-NEXT: ], // CHECK-NEXT: "equivalence_classes": [ - // CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$3<int d>)" ], - // CHECK-NEXT: [ "reg_$0<int a>", "reg_$3<int d>" ], - // CHECK-NEXT: [ "reg_$2<int c>" ] + // CHECK-NEXT: [ "(reg_$0<int a>) != (reg_$8<int d>)" ], + // CHECK-NEXT: [ "reg_$0<int a>", "reg_$8<int d>" ], + // CHECK-NEXT: [ "reg_$5<int c>" ] // CHECK-NEXT: ], // CHECK-NEXT: "disequality_info": null, diff --git a/clang/test/Analysis/unary-sym-expr.c b/clang/test/Analysis/unary-sym-expr.c index 92e11b295bee..64a01a956c44 100644 --- a/clang/test/Analysis/unary-sym-expr.c +++ b/clang/test/Analysis/unary-sym-expr.c @@ -11,9 +11,9 @@ int test(int x, int y) { clang_analyzer_dump(-x); // expected-warning{{-reg_$0<int x>}} clang_analyzer_dump(~x); // expected-warning{{~reg_$0<int x>}} int z = x + y; - clang_analyzer_dump(-z); // expected-warning{{-((reg_$0<int x>) + (reg_$1<int y>))}} - clang_analyzer_dump(-(x + y)); // expected-warning{{-((reg_$0<int x>) + (reg_$1<int y>))}} - clang_analyzer_dump(-x + y); // expected-warning{{(-reg_$0<int x>) + (reg_$1<int y>)}} + clang_analyzer_dump(-z); // expected-warning{{-((reg_$0<int x>) + (reg_$3<int y>))}} + clang_analyzer_dump(-(x + y)); // expected-warning{{-((reg_$0<int x>) + (reg_$3<int y>))}} + clang_analyzer_dump(-x + y); // expected-warning{{(-reg_$0<int x>) + (reg_$3<int y>)}} if (-x == 0) { clang_analyzer_eval(-x == 0); // expected-warning{{TRUE}} diff --git a/clang/test/Analysis/z3-crosscheck-max-attempts.cpp b/clang/test/Analysis/z3-crosscheck-max-attempts.cpp new file mode 100644 index 000000000000..7951d2654647 --- /dev/null +++ b/clang/test/Analysis/z3-crosscheck-max-attempts.cpp @@ -0,0 +1,42 @@ +// Check the default config. +// RUN: %clang_analyze_cc1 -analyzer-checker=debug.ConfigDumper 2>&1 \ +// RUN: | FileCheck %s --match-full-lines +// CHECK: crosscheck-with-z3-max-attempts-per-query = 3 + +// RUN: rm -rf %t && mkdir %t +// RUN: %host_cxx -shared -fPIC \ +// RUN: %S/z3/Inputs/MockZ3_solver_check.cpp \ +// RUN: -o %t/MockZ3_solver_check.so + +// DEFINE: %{mocked_clang} = \ +// DEFINE: LD_PRELOAD="%t/MockZ3_solver_check.so" \ +// DEFINE: %clang_cc1 %s -analyze -setup-static-analyzer \ +// DEFINE: -analyzer-config crosscheck-with-z3=true \ +// DEFINE: -analyzer-checker=core + +// DEFINE: %{attempts} = -analyzer-config crosscheck-with-z3-max-attempts-per-query + +// RUN: not %clang_analyze_cc1 %{attempts}=0 2>&1 | FileCheck %s --check-prefix=VERIFY-INVALID +// VERIFY-INVALID: invalid input for analyzer-config option 'crosscheck-with-z3-max-attempts-per-query', that expects a positive value + +// RUN: Z3_SOLVER_RESULTS="UNDEF" %{mocked_clang} %{attempts}=1 -verify=refuted +// RUN: Z3_SOLVER_RESULTS="UNSAT" %{mocked_clang} %{attempts}=1 -verify=refuted +// RUN: Z3_SOLVER_RESULTS="SAT" %{mocked_clang} %{attempts}=1 -verify=accepted + +// RUN: Z3_SOLVER_RESULTS="UNDEF,UNDEF" %{mocked_clang} %{attempts}=2 -verify=refuted +// RUN: Z3_SOLVER_RESULTS="UNDEF,UNSAT" %{mocked_clang} %{attempts}=2 -verify=refuted +// RUN: Z3_SOLVER_RESULTS="UNDEF,SAT" %{mocked_clang} %{attempts}=2 -verify=accepted + +// RUN: Z3_SOLVER_RESULTS="UNDEF,UNDEF,UNDEF" %{mocked_clang} %{attempts}=3 -verify=refuted +// RUN: Z3_SOLVER_RESULTS="UNDEF,UNDEF,UNSAT" %{mocked_clang} %{attempts}=3 -verify=refuted +// RUN: Z3_SOLVER_RESULTS="UNDEF,UNDEF,SAT" %{mocked_clang} %{attempts}=3 -verify=accepted + + +// REQUIRES: z3, asserts, shell, system-linux + +// refuted-no-diagnostics + +int div_by_zero_test(int b) { + if (b) {} + return 100 / b; // accepted-warning {{Division by zero}} +} diff --git a/clang/test/Analysis/z3/D83660.c b/clang/test/Analysis/z3/D83660.c index fd463333a51e..b42d934bcc9e 100644 --- a/clang/test/Analysis/z3/D83660.c +++ b/clang/test/Analysis/z3/D83660.c @@ -1,21 +1,18 @@ // RUN: rm -rf %t && mkdir %t -// RUN: %host_cxx -shared -fPIC %S/Inputs/MockZ3_solver_check.c -o %t/MockZ3_solver_check.so +// RUN: %host_cxx -shared -fPIC \ +// RUN: %S/Inputs/MockZ3_solver_check.cpp \ +// RUN: -o %t/MockZ3_solver_check.so // -// RUN: LD_PRELOAD="%t/MockZ3_solver_check.so" \ -// RUN: %clang_cc1 -analyze -analyzer-constraints=z3 -setup-static-analyzer \ -// RUN: -analyzer-checker=core,debug.ExprInspection %s -verify 2>&1 | FileCheck %s +// RUN: Z3_SOLVER_RESULTS="SAT,SAT,SAT,SAT,UNDEF" \ +// RUN: LD_PRELOAD="%t/MockZ3_solver_check.so" \ +// RUN: %clang_cc1 -analyze -analyzer-constraints=z3 -setup-static-analyzer \ +// RUN: -analyzer-checker=core %s -verify // // REQUIRES: z3, asserts, shell, system-linux // // Works only with the z3 constraint manager. // expected-no-diagnostics -// CHECK: Z3_solver_check returns the real value: TRUE -// CHECK-NEXT: Z3_solver_check returns the real value: TRUE -// CHECK-NEXT: Z3_solver_check returns the real value: TRUE -// CHECK-NEXT: Z3_solver_check returns the real value: TRUE -// CHECK-NEXT: Z3_solver_check returns a mocked value: UNDEF - void D83660(int b) { if (b) { } diff --git a/clang/test/Analysis/z3/Inputs/MockZ3_solver_check.c b/clang/test/Analysis/z3/Inputs/MockZ3_solver_check.c deleted file mode 100644 index 9c63a64ada22..000000000000 --- a/clang/test/Analysis/z3/Inputs/MockZ3_solver_check.c +++ /dev/null @@ -1,28 +0,0 @@ -#include <dlfcn.h> -#include <stdio.h> - -#include <z3.h> - -// Mock implementation: return UNDEF for the 5th invocation, otherwise it just -// returns the result of the real invocation. -Z3_lbool Z3_API Z3_solver_check(Z3_context c, Z3_solver s) { - static Z3_lbool (*OriginalFN)(Z3_context, Z3_solver); - if (!OriginalFN) { - OriginalFN = (Z3_lbool(*)(Z3_context, Z3_solver))dlsym(RTLD_NEXT, - "Z3_solver_check"); - } - - // Invoke the actual solver. - Z3_lbool Result = OriginalFN(c, s); - - // Mock the 5th invocation to return UNDEF. - static unsigned int Counter = 0; - if (++Counter == 5) { - fprintf(stderr, "Z3_solver_check returns a mocked value: UNDEF\n"); - return Z3_L_UNDEF; - } - fprintf(stderr, "Z3_solver_check returns the real value: %s\n", - (Result == Z3_L_UNDEF ? "UNDEF" - : ((Result == Z3_L_TRUE ? "TRUE" : "FALSE")))); - return Result; -} diff --git a/clang/test/Analysis/z3/Inputs/MockZ3_solver_check.cpp b/clang/test/Analysis/z3/Inputs/MockZ3_solver_check.cpp new file mode 100644 index 000000000000..54cd86d0ac32 --- /dev/null +++ b/clang/test/Analysis/z3/Inputs/MockZ3_solver_check.cpp @@ -0,0 +1,62 @@ +#include <cassert> +#include <dlfcn.h> +#include <cstdio> +#include <cstdlib> +#include <cstring> + +#include <z3.h> + +static char *Z3ResultsBegin; +static char *Z3ResultsCursor; + +static __attribute__((constructor)) void init() { + const char *Env = getenv("Z3_SOLVER_RESULTS"); + if (!Env) { + fprintf(stderr, "Z3_SOLVER_RESULTS envvar must be defined; abort\n"); + abort(); + } + Z3ResultsBegin = strdup(Env); + Z3ResultsCursor = Z3ResultsBegin; + if (!Z3ResultsBegin) { + fprintf(stderr, "strdup failed; abort\n"); + abort(); + } +} + +static __attribute__((destructor)) void finit() { + if (strlen(Z3ResultsCursor) > 0) { + fprintf(stderr, "Z3_SOLVER_RESULTS should have been completely consumed " + "by the end of the test; abort\n"); + abort(); + } + free(Z3ResultsBegin); +} + +static bool consume_token(char **pointer_to_cursor, const char *token) { + assert(pointer_to_cursor); + int len = strlen(token); + if (*pointer_to_cursor && strncmp(*pointer_to_cursor, token, len) == 0) { + *pointer_to_cursor += len; + return true; + } + return false; +} + +Z3_lbool Z3_API Z3_solver_check(Z3_context c, Z3_solver s) { + consume_token(&Z3ResultsCursor, ","); + + if (consume_token(&Z3ResultsCursor, "UNDEF")) { + printf("Z3_solver_check returns UNDEF\n"); + return Z3_L_UNDEF; + } + if (consume_token(&Z3ResultsCursor, "SAT")) { + printf("Z3_solver_check returns SAT\n"); + return Z3_L_TRUE; + } + if (consume_token(&Z3ResultsCursor, "UNSAT")) { + printf("Z3_solver_check returns UNSAT\n"); + return Z3_L_FALSE; + } + fprintf(stderr, "Z3_SOLVER_RESULTS was exhausted; abort\n"); + abort(); +} diff --git a/clang/test/CIR/global-var-simple.cpp b/clang/test/CIR/global-var-simple.cpp index bbd452655a01..ffcc3ef71a6c 100644 --- a/clang/test/CIR/global-var-simple.cpp +++ b/clang/test/CIR/global-var-simple.cpp @@ -13,11 +13,11 @@ unsigned char uc; short ss; // CHECK: cir.global @ss : !cir.int<s, 16> -unsigned short us; -// CHECK: cir.global @us : !cir.int<u, 16> +unsigned short us = 100; +// CHECK: cir.global @us = #cir.int<100> : !cir.int<u, 16> -int si; -// CHECK: cir.global @si : !cir.int<s, 32> +int si = 42; +// CHECK: cir.global @si = #cir.int<42> : !cir.int<s, 32> unsigned ui; // CHECK: cir.global @ui : !cir.int<u, 32> @@ -31,8 +31,8 @@ unsigned long ul; long long sll; // CHECK: cir.global @sll : !cir.int<s, 64> -unsigned long long ull; -// CHECK: cir.global @ull : !cir.int<u, 64> +unsigned long long ull = 123456; +// CHECK: cir.global @ull = #cir.int<123456> : !cir.int<u, 64> __int128 s128; // CHECK: cir.global @s128 : !cir.int<s, 128> @@ -67,8 +67,8 @@ __bf16 bf16; float f; // CHECK: cir.global @f : !cir.float -double d; -// CHECK: cir.global @d : !cir.double +double d = 1.25; +// CHECK: cir.global @d = #cir.fp<1.250000e+00> : !cir.double long double ld; // CHECK: cir.global @ld : !cir.long_double<!cir.f80> @@ -79,8 +79,8 @@ __float128 f128; void *vp; // CHECK: cir.global @vp : !cir.ptr<!cir.void> -int *ip; -// CHECK: cir.global @ip : !cir.ptr<!cir.int<s, 32>> +int *ip = 0; +// CHECK: cir.global @ip = #cir.ptr<null> : !cir.ptr<!cir.int<s, 32>> double *dp; // CHECK: cir.global @dp : !cir.ptr<!cir.double> @@ -91,8 +91,8 @@ char **cpp; void (*fp)(); // CHECK: cir.global @fp : !cir.ptr<!cir.func<!cir.void ()>> -int (*fpii)(int); -// CHECK: cir.global @fpii : !cir.ptr<!cir.func<!cir.int<s, 32> (!cir.int<s, 32>)>> +int (*fpii)(int) = 0; +// CHECK: cir.global @fpii = #cir.ptr<null> : !cir.ptr<!cir.func<!cir.int<s, 32> (!cir.int<s, 32>)>> void (*fpvar)(int, ...); // CHECK: cir.global @fpvar : !cir.ptr<!cir.func<!cir.void (!cir.int<s, 32>, ...)>> diff --git a/clang/test/CXX/drs/cwg0xx.cpp b/clang/test/CXX/drs/cwg0xx.cpp index 993b6f292385..15f469440c66 100644 --- a/clang/test/CXX/drs/cwg0xx.cpp +++ b/clang/test/CXX/drs/cwg0xx.cpp @@ -1,9 +1,10 @@ -// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98,cxx98-14 -fexceptions -fcxx-exceptions -pedantic-errors -Wno-bind-to-temporary-copy +// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98,cxx98-14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++11 %s -verify=expected,since-cxx11,cxx98-14,cxx11-14 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple // RUN: %clang_cc1 -std=c++14 %s -verify=expected,since-cxx11,cxx98-14,cxx11-14 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple // RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -53,16 +54,16 @@ namespace cwg1 { // cwg1: no // FIXME: This should be rejected, due to the ambiguous default argument. i(); } -} +} // namespace cwg1 -namespace cwg3 { // cwg3: yes +namespace cwg3 { // cwg3: 2.7 template<typename T> struct A {}; template<typename T> void f(T) { A<T> a; } // #cwg3-f-T template void f(int); template<> struct A<int> {}; // expected-error@-1 {{explicit specialization of 'cwg3::A<int>' after instantiation}} // expected-note@#cwg3-f-T {{implicit instantiation first required here}} -} +} // namespace cwg3 namespace cwg4 { // cwg4: 2.8 extern "C" { @@ -73,7 +74,7 @@ namespace cwg4 { // cwg4: 2.8 // expected-error@-1 {{conflicting types for 'cwg4_g'}} // expected-note@#cwg4-g-int {{previous definition is here}} } -} +} // namespace cwg4 namespace cwg5 { // cwg5: 3.1 struct A {} a; @@ -87,7 +88,7 @@ namespace cwg5 { // cwg5: 3.1 struct D : C {}; struct E { operator D&(); } e; const C c = e; -} +} // namespace cwg5 namespace cwg7 { // cwg7: 3.4 class A { public: ~A(); }; @@ -117,7 +118,7 @@ namespace cwg7 { // cwg7: 3.4 }; S5::S5() {} } -} +} // namespace cwg7 namespace cwg8 { // cwg8: dup 45 class A { @@ -129,7 +130,7 @@ namespace cwg8 { // cwg8: dup 45 T<U, k, &A::f> *g(); }; A::T<A::U, A::k, &A::f> *A::g() { return 0; } -} +} // namespace cwg8 namespace cwg9 { // cwg9: 2.8 struct B { @@ -145,7 +146,7 @@ namespace cwg9 { // cwg9: 2.8 // expected-note@#cwg9-N {{constrained by protected inheritance here}} // expected-note@#cwg9-m {{member is declared here}} int R2() { return n.m; } -} +} // namespace cwg9 namespace cwg10 { // cwg10: dup 45 class A { @@ -153,9 +154,9 @@ namespace cwg10 { // cwg10: dup 45 A::B *p; }; }; -} +} // namespace cwg10 -namespace cwg11 { // cwg11: yes +namespace cwg11 { // cwg11: 2.7 template<typename T> struct A : T { using typename T::U; U u; @@ -167,7 +168,7 @@ namespace cwg11 { // cwg11: yes }; struct X { typedef int U; }; A<X> ax; -} +} // namespace cwg11 namespace cwg12 { // cwg12: sup 239 enum E { e }; @@ -179,7 +180,7 @@ namespace cwg12 { // cwg12: sup 239 int &b = f(e); int &c = f(1); } -} +} // namespace cwg12 namespace cwg13 { // cwg13: no extern "C" void f(int); @@ -194,7 +195,7 @@ namespace cwg13 { // cwg13: no A<char> a2(g); int a3 = h(f); // FIXME: We should reject this. int a4 = h(g); -} +} // namespace cwg13 namespace cwg14 { // cwg14: 3.4 namespace X { extern "C" int cwg14_f(); } @@ -218,14 +219,14 @@ namespace cwg14 { // cwg14: 3.4 // expected-error@-1 {{reference to 'U' is ambiguous}} // expected-note@#cwg14-X-U {{candidate found by name lookup is 'cwg14::X::U'}} // expected-note@#cwg14-Y-U {{candidate found by name lookup is 'cwg14::Y::U'}} -} +} // namespace cwg14 -namespace cwg15 { // cwg15: yes +namespace cwg15 { // cwg15: 2.7 template<typename T> void f(int); // #cwg15-f-decl-first template<typename T> void f(int = 0); // expected-error@-1 {{default arguments cannot be added to a function template that has already been declared}} // expected-note@#cwg15-f-decl-first {{previous template declaration is here}} -} +} // namespace cwg15 namespace cwg16 { // cwg16: 2.8 class A { // #cwg16-A @@ -247,9 +248,9 @@ namespace cwg16 { // cwg16: 2.8 // expected-note@#cwg16-B {{implicitly declared private here}} } }; -} +} // namespace cwg16 -namespace cwg17 { // cwg17: yes +namespace cwg17 { // cwg17: 2.7 class A { int n; int f(); @@ -260,7 +261,7 @@ namespace cwg17 { // cwg17: yes struct A::C : A { int g() { return n; } }; -} +} // namespace cwg17 // cwg18: sup 577 @@ -278,7 +279,7 @@ namespace cwg19 { // cwg19: 3.1 // expected-note@#cwg19-n {{member is declared here}} int get2() { return ((A&)c).n; } // ok, A is an accessible base of B from here }; -} +} // namespace cwg19 namespace cwg20 { // cwg20: 2.8 class X { @@ -291,7 +292,7 @@ namespace cwg20 { // cwg20: 2.8 X x = f(); // expected-error@-1 {{calling a private constructor of class 'cwg20::X'}} // expected-note@#cwg20-X-ctor {{declared private here}} -} +} // namespace cwg20 namespace cwg21 { // cwg21: 3.4 template<typename T> struct A; @@ -301,27 +302,27 @@ namespace cwg21 { // cwg21: 3.4 template<typename T = int> friend struct B; // expected-error@-1 {{default template argument not permitted on a friend template}} }; -} +} // namespace cwg21 namespace cwg22 { // cwg22: sup 481 template<typename cwg22_T = cwg22_T> struct X; // expected-error@-1 {{unknown type name 'cwg22_T'}} typedef int T; template<typename T = T> struct Y; -} +} // namespace cwg22 -namespace cwg23 { // cwg23: yes +namespace cwg23 { // cwg23: 2.7 template<typename T> void f(T, T); // #cwg23-f-T-T template<typename T> void f(T, int); // #cwg23-f-T-int void g() { f(0, 0); } // expected-error@-1 {{call to 'f' is ambiguous}} // expected-note@#cwg23-f-T-T {{candidate function [with T = int]}} // expected-note@#cwg23-f-T-int {{candidate function [with T = int]}} -} +} // namespace cwg23 // cwg24: na -namespace cwg25 { // cwg25: yes +namespace cwg25 { // cwg25: 4 struct A { void f() throw(int); // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}} @@ -354,9 +355,9 @@ namespace cwg25 { // cwg25: yes // since-cxx17-error@-2 {{different exception specifications}} j = &A::f; } -} +} // namespace cwg25 -namespace cwg26 { // cwg26: yes +namespace cwg26 { // cwg26: 2.7 struct A { A(A, const A & = A()); }; // expected-error@-1 {{copy constructor must pass its first argument by reference}} struct B { @@ -374,12 +375,12 @@ namespace cwg26 { // cwg26: yes // expected-error@-1 {{recursive evaluation of default argument}} // expected-note@-2 {{default argument used here}} }; -} +} // namespace cwg26 -namespace cwg27 { // cwg27: yes +namespace cwg27 { // cwg27: 2.7 enum E { e } n; E &m = true ? n : n; -} +} // namespace cwg27 // cwg28: na lib @@ -440,7 +441,7 @@ namespace cwg29 { // cwg29: 3.4 // expected-error@-1 {{declaration of 'cwg29_f8' has a different language linkage}} // expected-note@#cwg29-f8 {{previous declaration is here}} } -} +} // namespace cwg29 namespace cwg30 { // cwg30: sup 468 c++11 struct A { @@ -453,7 +454,7 @@ namespace cwg30 { // cwg30: sup 468 c++11 // cxx98-error@-1 {{'template' keyword outside of a template}} int z = p->template f<0>(); // cxx98-error@-1 {{'template' keyword outside of a template}} -} +} // namespace cwg30 namespace cwg31 { // cwg31: 2.8 class X { @@ -465,7 +466,7 @@ namespace cwg31 { // cwg31: 2.8 X *p = new X; // expected-error@-1 {{'operator delete' is a private member of 'cwg31::X'}} // expected-note@#cwg31-delete {{declared private here}} -} +} // namespace cwg31 // cwg32: na @@ -510,7 +511,7 @@ namespace cwg33 { // cwg33: 9 int m = Q() + X().f<int>; // ok int n = Q() + (&(X().f<int>)); // ok } -} +} // namespace cwg33 // cwg34: na // cwg35: dup 178 @@ -618,15 +619,15 @@ namespace example4 { // expected-note@#cwg36-E-k-first {{previous using declaration}} }; } -} +} // namespace cwg36 // cwg37: sup 475 -namespace cwg38 { // cwg38: yes +namespace cwg38 { // cwg38: 2.7 template<typename T> struct X {}; template<typename T> X<T> operator+(X<T> a, X<T> b) { return a; } template X<int> operator+<int>(X<int>, X<int>); -} +} // namespace cwg38 namespace cwg39 { // cwg39: no namespace example1 { @@ -708,25 +709,25 @@ namespace cwg39 { // cwg39: no // expected-error@#cwg39-sizeof {{unknown type name}} #if __cplusplus >= 201103L decltype(D::n) n; - /* expected-error@-1 + /* since-cxx11-error@-1 {{non-static member 'n' found in multiple base-class subobjects of type 'A': struct cwg39::PR5916::D -> B -> A struct cwg39::PR5916::D -> C -> A}} */ - // expected-note@#cwg39-A-n {{member found by ambiguous name lookup}} + // since-cxx11-note@#cwg39-A-n {{member found by ambiguous name lookup}} #endif } -} +} // namespace cwg39 // cwg40: na -namespace cwg41 { // cwg41: yes +namespace cwg41 { // cwg41: 2.7 struct S f(S); -} +} // namespace cwg41 -namespace cwg42 { // cwg42: yes +namespace cwg42 { // cwg42: 2.7 struct A { static const int k = 0; }; struct B : A { static const int k = A::k; }; -} +} // namespace cwg42 // cwg43: na @@ -735,21 +736,21 @@ namespace cwg44 { // cwg44: sup 727 template<int> void f(); template<> void f<0>(); }; -} +} // namespace cwg44 -namespace cwg45 { // cwg45: yes +namespace cwg45 { // cwg45: 2.7 class A { class B {}; class C : B {}; C c; }; -} +} // namespace cwg45 -namespace cwg46 { // cwg46: yes +namespace cwg46 { // cwg46: 2.7 template<typename> struct A { template<typename> struct B {}; }; template template struct A<int>::B<int>; // expected-error@-1 {{expected unqualified-id}} -} +} // namespace cwg46 namespace cwg47 { // cwg47: sup 329 template<typename T> struct A { @@ -763,9 +764,9 @@ namespace cwg47 { // cwg47: sup 329 void f(); void g() { f(); } -} +} // namespace cwg47 -namespace cwg48 { // cwg48: yes +namespace cwg48 { // cwg48: 2.7 namespace { struct S { static const int m = 0; @@ -779,7 +780,7 @@ namespace cwg48 { // cwg48: yes const int &b = S::n; const int S::o; const int &c = S::o; -} +} // namespace cwg48 namespace cwg49 { // cwg49: 2.8 template<int*> struct A {}; // #cwg49-A @@ -805,9 +806,9 @@ namespace cwg49 { // cwg49: 2.8 // since-cxx17-error@#cwg49-c {{non-type template argument is not a constant expression}} // since-cxx17-note@#cwg49-c {{read of non-constexpr variable 'q' is not allowed in a constant expression}} // since-cxx17-note@#cwg49-q {{declared here}} -} +} // namespace cwg49 -namespace cwg50 { // cwg50: yes +namespace cwg50 { // cwg50: 2.7 struct X; // #cwg50-X extern X *p; X *q = (X*)p; @@ -817,7 +818,7 @@ namespace cwg50 { // cwg50: yes X *u = dynamic_cast<X*>(p); // expected-error@-1 {{'cwg50::X' is an incomplete type}} // expected-note@#cwg50-X {{forward declaration of 'cwg50::X'}} -} +} // namespace cwg50 namespace cwg51 { // cwg51: 2.8 struct A {}; @@ -827,7 +828,7 @@ namespace cwg51 { // cwg51: 2.8 operator B&(); } s; A &a = s; -} +} // namespace cwg51 namespace cwg52 { // cwg52: 2.8 struct A { int n; }; // #cwg52-A @@ -839,12 +840,12 @@ namespace cwg52 { // cwg52: 2.8 // expected-note@#cwg52-A {{member is declared here}} // expected-error@#cwg52-k {{cannot cast 'struct B' to its private base class 'cwg52::A'}} // expected-note@#cwg52-B {{declared private here}} -} +} // namespace cwg52 -namespace cwg53 { // cwg53: yes +namespace cwg53 { // cwg53: 2.7 int n = 0; enum E { e } x = static_cast<E>(n); -} +} // namespace cwg53 namespace cwg54 { // cwg54: 2.8 struct A { int a; } a; @@ -898,14 +899,14 @@ namespace cwg54 { // cwg54: 2.8 // expected-error@-1 {{cannot cast 'cwg54::V *' to 'B *' via virtual base 'cwg54::V'}} int B::*cmbv = (int B::*)(&V::v); // expected-error@-1 {{conversion from pointer to member of class 'cwg54::V' to pointer to member of class 'B' via virtual base 'cwg54::V' is not allowed}} -} +} // namespace cwg54 -namespace cwg55 { // cwg55: yes +namespace cwg55 { // cwg55: 2.7 enum E { e = 5 }; static_assert(e + 1 == 6, ""); -} +} // namespace cwg55 -namespace cwg56 { // cwg56: yes +namespace cwg56 { // cwg56: 2.7 struct A { typedef int T; // #cwg56-typedef-int-T-first typedef int T; @@ -919,7 +920,7 @@ namespace cwg56 { // cwg56: yes // expected-error@-1 {{redefinition of 'X'}} // expected-note@#cwg56-typedef-X-X-first {{previous definition is here}} }; -} +} // namespace cwg56 namespace cwg58 { // cwg58: 3.1 // FIXME: Ideally, we should have a CodeGen test for this. @@ -930,9 +931,9 @@ namespace cwg58 { // cwg58: 3.1 static_assert(X{E1_1, E2_m1}.e1 == 1, ""); static_assert(X{E1_1, E2_m1}.e2 == -1, ""); #endif -} +} // namespace cwg58 -namespace cwg59 { // cwg59: yes +namespace cwg59 { // cwg59: 2.7 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-volatile" template<typename T> struct convert_to { operator T() const; }; @@ -987,14 +988,14 @@ namespace cwg59 { // cwg59: yes int n4 = convert_to<const volatile int>(); int n5 = convert_to<const volatile int&>(); #pragma clang diagnostic pop -} +} // namespace cwg59 -namespace cwg60 { // cwg60: yes +namespace cwg60 { // cwg60: 2.7 void f(int &); int &f(...); const int k = 0; int &n = f(k); -} +} // namespace cwg60 namespace cwg61 { // cwg61: 3.4 struct X { @@ -1011,7 +1012,7 @@ namespace cwg61 { // cwg61: 3.4 // expected-error@-1 {{cannot create a non-constant pointer to member function}} void (*r)() = y.f; // expected-error@-1 {{cannot create a non-constant pointer to member function}} -} +} // namespace cwg61 namespace cwg62 { // cwg62: 2.9 struct A { @@ -1064,21 +1065,21 @@ namespace cwg62 { // cwg62: 2.9 X<int NoLinkage::*> d; // cxx98-error@-1 {{template argument uses local type }} } -} +} // namespace cwg62 -namespace cwg63 { // cwg63: yes +namespace cwg63 { // cwg63: 2.7 template<typename T> struct S { typename T::error e; }; extern S<int> *p; void *q = p; -} +} // namespace cwg63 -namespace cwg64 { // cwg64: yes +namespace cwg64 { // cwg64: 2.7 template<class T> void f(T); template<class T> void f(T*); template<> void f(int*); template<> void f<int>(int*); template<> void f(int); -} +} // namespace cwg64 // cwg65: na @@ -1099,7 +1100,7 @@ namespace cwg66 { // cwg66: no int c = f(1, 2); // expected-error@-1 {{no matching function for call to 'f'}} // expected-note@#cwg66-f-first {{candidate function not viable: requires single argument 'n', but 2 arguments were provided}} -} +} // namespace cwg66 // cwg67: na @@ -1120,7 +1121,7 @@ namespace cwg68 { // cwg68: 2.8 friend typename ::cwg68::X<double>; // cxx98-error@-1 {{unelaborated friend declaration is a C++11 extension; specify 'struct' to befriend 'typename ::cwg68::X<double>'}} }; -} +} // namespace cwg68 namespace cwg69 { // cwg69: 9 template<typename T> static void f() {} // #cwg69-f @@ -1133,59 +1134,59 @@ namespace cwg69 { // cwg69: 9 Q<&f<int> > q; // cxx98-error@-1 {{non-type template argument referring to function 'f<int>' with internal linkage is a C++11 extension}} // cxx98-note@#cwg69-f {{non-type template argument refers to function here}} -} +} // namespace cwg69 -namespace cwg70 { // cwg70: yes +namespace cwg70 { // cwg70: 2.7 template<int> struct A {}; template<int I, int J> int f(int (&)[I + J], A<I>, A<J>); int arr[7]; int k = f(arr, A<3>(), A<4>()); -} +} // namespace cwg70 // cwg71: na // cwg72: dup 69 -#if __cplusplus >= 201103L namespace cwg73 { // cwg73: sup 1652 +#if __cplusplus >= 201103L int a, b; static_assert(&a + 1 != &b, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{comparison against pointer '&a + 1' that points past the end of a complete object has unspecified value}} -} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{comparison against pointer '&a + 1' that points past the end of a complete object has unspecified value}} #endif +} // namespace cwg73 -namespace cwg74 { // cwg74: yes +namespace cwg74 { // cwg74: 2.7 enum E { k = 5 }; int (*p)[k] = new int[k][k]; -} +} // namespace cwg74 -namespace cwg75 { // cwg75: yes +namespace cwg75 { // cwg75: 2.7 struct S { static int n = 0; // expected-error@-1 {{non-const static data member must be initialized out of line}} }; -} +} // namespace cwg75 -namespace cwg76 { // cwg76: yes +namespace cwg76 { // cwg76: 2.7 const volatile int n = 1; static_assert(n, ""); // expected-error@-1 {{static assertion expression is not an integral constant expression}} // expected-note@-2 {{read of volatile-qualified type 'const volatile int' is not allowed in a constant expression}} -} +} // namespace cwg76 -namespace cwg77 { // cwg77: yes +namespace cwg77 { // cwg77: 2.7 struct A { struct B {}; friend struct B; }; -} +} // namespace cwg77 namespace cwg78 { // cwg78: sup ???? // Under CWG78, this is valid, because 'k' has static storage duration, so is // zero-initialized. const int k; // expected-error@-1 {{default initialization of an object of const type 'const int'}} -} +} // namespace cwg78 // cwg79: na @@ -1207,18 +1208,18 @@ namespace cwg80 { // cwg80: 2.9 int D; // expected-error@-1 {{member 'D' has the same name as its class}} }; -} +} // namespace cwg80 // cwg81: na // cwg82: dup 48 -namespace cwg83 { // cwg83: yes +namespace cwg83 { // cwg83: 2.7 int &f(const char*); char &f(char *); int &k = f("foo"); -} +} // namespace cwg83 -namespace cwg84 { // cwg84: yes +namespace cwg84 { // cwg84: 2.7 struct B; struct A { operator B() const; }; struct C {}; @@ -1234,7 +1235,7 @@ namespace cwg84 { // cwg84: yes // cxx98-14-error@-1 {{no viable constructor copying variable of type 'B'}} // cxx98-14-note@#cwg84-copy-ctor {{candidate constructor not viable: expects an lvalue for 1st argument}} // cxx98-14-note@#cwg84-ctor-from-C {{candidate constructor not viable: no known conversion from 'B' to 'C' for 1st argument}} -} +} // namespace cwg84 namespace cwg85 { // cwg85: 3.4 struct A { @@ -1254,14 +1255,14 @@ namespace cwg85 { // cwg85: 3.4 enum E1 : int; enum E1 : int { e1 }; // #cwg85-E1-def enum E1 : int; - // expected-error@-1 {{class member cannot be redeclared}} - // expected-note@#cwg85-E1-def {{previous declaration is here}} + // since-cxx11-error@-1 {{class member cannot be redeclared}} + // since-cxx11-note@#cwg85-E1-def {{previous declaration is here}} enum class E2; enum class E2 { e2 }; // #cwg85-E2-def enum class E2; - // expected-error@-1 {{class member cannot be redeclared}} - // expected-note@#cwg85-E2-def {{previous declaration is here}} + // since-cxx11-error@-1 {{class member cannot be redeclared}} + // since-cxx11-note@#cwg85-E2-def {{previous declaration is here}} #endif }; @@ -1272,7 +1273,7 @@ namespace cwg85 { // cwg85: 3.4 // expected-error@-1 {{class member cannot be redeclared}} // expected-note@#cwg85-C-B-def {{previous declaration is here}} }; -} +} // namespace cwg85 // cwg86: dup 446 @@ -1283,7 +1284,7 @@ namespace cwg87 { // cwg87: no X<void() throw()> x; // This is valid under cwg87 but not under cwg1975. X<void(void() throw())> y; -} +} // namespace cwg87 namespace cwg88 { // cwg88: 2.8 template<typename T> struct S { @@ -1294,11 +1295,11 @@ namespace cwg88 { // cwg88: 2.8 // expected-error@-1 {{static data member 'a' already has an initializer}} // expected-note@#cwg88-a {{previous initialization is here}} template<> const int S<int>::b = 4; -} +} // namespace cwg88 // cwg89: na -namespace cwg90 { // cwg90: yes +namespace cwg90 { // cwg90: 2.7 struct A { template<typename T> friend void cwg90_f(T); }; @@ -1330,12 +1331,12 @@ namespace cwg90 { // cwg90: yes cwg90_g(F()); // expected-error@-1 {{use of undeclared identifier 'cwg90_g'}} } -} +} // namespace cwg90 -namespace cwg91 { // cwg91: yes +namespace cwg91 { // cwg91: 2.7 union U { friend int f(U); }; int k = f(U()); -} +} // namespace cwg91 namespace cwg92 { // cwg92: 4 c++17 void f() throw(int, float); @@ -1378,14 +1379,14 @@ namespace cwg92 { // cwg92: 4 c++17 // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}} // since-cxx17-note@-2 {{use 'noexcept(false)' instead}} Y<&h> yp; // ok -} +} // namespace cwg92 // cwg93: na -namespace cwg94 { // cwg94: yes +namespace cwg94 { // cwg94: 2.7 struct A { static const int n = 5; }; int arr[A::n]; -} +} // namespace cwg94 namespace cwg95 { // cwg95: 3.3 struct A; @@ -1402,7 +1403,7 @@ namespace cwg95 { // cwg95: 3.3 struct B { void f() { N::C::f(); } }; // expected-error@-1 {{'f' is a private member of 'cwg95::N::C'}} // expected-note@#cwg95-C-f {{implicitly declared private here}} -} +} // namespace cwg95 namespace cwg96 { // cwg96: sup P1787 struct A { @@ -1423,16 +1424,16 @@ namespace cwg96 { // cwg96: sup P1787 A::template S<int> s; B<A::template S> b; } -} +} // namespace cwg96 -namespace cwg97 { // cwg97: yes +namespace cwg97 { // cwg97: 2.7 struct A { static const int a = false; static const int b = !a; }; -} +} // namespace cwg97 -namespace cwg98 { // cwg98: yes +namespace cwg98 { // cwg98: 2.7 void test(int n) { switch (n) { try { // #cwg98-try @@ -1458,11 +1459,11 @@ namespace cwg98 { // cwg98: yes // expected-note@#cwg98-catch {{jump bypasses initialization of catch block}} } } -} +} // namespace cwg98 namespace cwg99 { // cwg99: sup 214 template<typename T> void f(T&); template<typename T> int &f(const T&); const int n = 0; int &r = f(n); -} +} // namespace cwg99 diff --git a/clang/test/CXX/drs/cwg10xx.cpp b/clang/test/CXX/drs/cwg10xx.cpp index 58d552942c77..c5b96c4ab8ff 100644 --- a/clang/test/CXX/drs/cwg10xx.cpp +++ b/clang/test/CXX/drs/cwg10xx.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors namespace std { __extension__ typedef __SIZE_TYPE__ size_t; @@ -12,7 +13,7 @@ namespace std { const T *p; size_t n; initializer_list(const T *p, size_t n); }; -} +} // namespace std namespace cwg1004 { // cwg1004: 5 template<typename> struct A {}; @@ -43,7 +44,7 @@ namespace cwg1004 { // cwg1004: 5 // expected-error@-1 {{is a constructor name}} // expected-note@#cwg1004-t {{in instantiation of default argument}} Third<A<int> > t; // #cwg1004-t -} +} // namespace cwg1004 namespace cwg1042 { // cwg1042: 3.5 #if __cplusplus >= 201402L @@ -58,7 +59,7 @@ namespace cwg1042 { // cwg1042: 3.5 // list in this mode. using foo [[]] = int; #endif -} +} // namespace cwg1042 namespace cwg1048 { // cwg1048: 3.6 struct A {}; @@ -76,7 +77,7 @@ namespace cwg1048 { // cwg1048: 3.6 } } (0); #endif -} +} // namespace cwg1048 namespace cwg1054 { // cwg1054: no // FIXME: Test is incomplete. @@ -89,7 +90,7 @@ namespace cwg1054 { // cwg1054: no a; // expected-warning@-1 {{expression result unused; assign into a variable to force a volatile load}} } -} +} // namespace cwg1054 namespace cwg1070 { // cwg1070: 3.5 #if __cplusplus >= 201103L @@ -108,4 +109,4 @@ namespace cwg1070 { // cwg1070: 3.5 }; C c = {}; #endif -} +} // namespace cwg1070 diff --git a/clang/test/CXX/drs/cwg118.cpp b/clang/test/CXX/drs/cwg118.cpp index 04e19ce05078..c7685fdb4f5b 100644 --- a/clang/test/CXX/drs/cwg118.cpp +++ b/clang/test/CXX/drs/cwg118.cpp @@ -1,7 +1,11 @@ // RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " // RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " // RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " -// RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " +// RUN: %clang_cc1 -triple x86_64-linux -std=c++17 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " +// RUN: %clang_cc1 -triple x86_64-linux -std=c++20 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " +// RUN: %clang_cc1 -triple x86_64-linux -std=c++23 %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " +// RUN: %clang_cc1 -triple x86_64-linux -std=c++2c %s -pedantic-errors -emit-llvm -o - | FileCheck %s --implicit-check-not " call " + // cwg118: yes diff --git a/clang/test/CXX/drs/cwg11xx.cpp b/clang/test/CXX/drs/cwg11xx.cpp index 8d187041400a..03612b6d8764 100644 --- a/clang/test/CXX/drs/cwg11xx.cpp +++ b/clang/test/CXX/drs/cwg11xx.cpp @@ -2,7 +2,9 @@ // RUN: %clang_cc1 -std=c++11 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++17 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2a %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors namespace cwg1110 { // cwg1110: 3.1 #if __cplusplus >= 201103L @@ -19,7 +21,7 @@ decltype(return_T<B<int>>())* b; #endif } // namespace cwg1110 -namespace cwg1111 { // cwg1111: 3.2 +namespace cwg1111 { // cwg1111: partial namespace example1 { template <typename> struct set; // #cwg1111-struct-set @@ -57,6 +59,48 @@ void baz() { a.operator A(); } } // namespace example2 + +namespace example3 { +struct A { + operator int(); +} a; +void foo() { + typedef int T; + a.operator T(); // T is found using unqualified lookup + // after qualified lookup in A fails. +} +} // namespace example3 + +namespace example4 { +struct A { + typedef int T; // #cwg1111-A-T + operator T(); +}; +struct B : A { + operator T(); +} b; +void foo() { + b.A::operator T(); // FIXME: qualified lookup should find T in A. + // expected-error@-1 {{unknown type name 'T'}} + // expected-note@#cwg1111-A-T {{'A::T' declared here}} +} +} // namespace example4 + +namespace example5 { +template <class T1> struct A { + operator T1(); +}; +template <class T2> struct B : A<T2> { + operator T2(); + void foo() { + // In both cases, during instantiation, qualified lookup for T2 wouldn't be able + // to find anything, so T2 has to be found by unqualified lookup. + // After that, 'operator T2()' is found in A<T2> by qualfied lookup. + T2 a = A<T2>::operator T2(); + T2 b = ((A<T2> *)this)->operator T2(); + } +}; +} // namespace example5 } // namespace cwg1111 namespace cwg1113 { // cwg1113: partial @@ -84,6 +128,6 @@ namespace cwg1113 { // cwg1113: partial extern "C" void f(); } void g() { f(); } -} +} // namespace cwg1113 // cwg1150: na diff --git a/clang/test/CXX/drs/cwg12xx.cpp b/clang/test/CXX/drs/cwg12xx.cpp index cdfbc6d67265..344adb6d7202 100644 --- a/clang/test/CXX/drs/cwg12xx.cpp +++ b/clang/test/CXX/drs/cwg12xx.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx17,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx17,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx17,since-cxx14,since-cxx11,since-cxx23 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx17,since-cxx14,since-cxx11,since-cxx23 -fexceptions -fcxx-exceptions -pedantic-errors // cwg1200: na @@ -29,10 +30,10 @@ namespace cwg1213 { // cwg1213: 7 using U = decltype(V4Int()[0]); using U = decltype(EV4Int()[0]); #endif -} +} // namespace cwg1213 +namespace cwg1223 { // cwg1223: 17 #if __cplusplus >= 201103L -namespace cwg1223 { // cwg1223: 17 drafting 2023-05-12 struct M; template <typename T> struct V; @@ -82,12 +83,11 @@ void g() { sizeof(auto () -> C[1]); // since-cxx11-error@-1 {{function cannot return array type 'C[1]' (aka 'cwg1223::BB[1]')}} } - -} #endif +} // namespace cwg1223 -#if __cplusplus >= 201103L namespace cwg1227 { // cwg1227: 3.0 +#if __cplusplus >= 201103L template <class T> struct A { using X = typename T::X; }; // since-cxx11-error@-1 {{type 'int' cannot be used prior to '::' because it has no members}} // since-cxx11-note@#cwg1227-g {{in instantiation of template class 'cwg1227::A<int>' requested here}} @@ -101,8 +101,8 @@ void h() { f<int>(0); // OK, substituting return type causes deduction to fail g<int>(0); // #cwg1227-g-int } -} #endif +} // namespace cwg1227 namespace cwg1250 { // cwg1250: 3.9 struct Incomplete; @@ -114,7 +114,7 @@ struct Base { struct Derived : Base { virtual Incomplete *meow(); }; -} +} // namespace cwg1250 namespace cwg1265 { // cwg1265: 5 #if __cplusplus >= 201103L @@ -134,7 +134,7 @@ namespace cwg1265 { // cwg1265: 5 auto k(), l(); // since-cxx14-error@-1 {{function with deduced return type must be the only declaration in its group}} #endif -} +} // namespace cwg1265 // cwg1291: na @@ -161,5 +161,4 @@ namespace cwg1295 { // cwg1295: 4 using T = decltype(true ? other : x.bitfield); using T = unsigned; #endif -} - +} // namespace cwg1295 diff --git a/clang/test/CXX/drs/cwg13xx.cpp b/clang/test/CXX/drs/cwg13xx.cpp index 980fcb4eb18a..9c72fefb5b65 100644 --- a/clang/test/CXX/drs/cwg13xx.cpp +++ b/clang/test/CXX/drs/cwg13xx.cpp @@ -14,10 +14,10 @@ namespace std { size_t n; initializer_list(const T*, size_t); }; -} +} // namespace std -#if __cplusplus >= 201103L namespace cwg1305 { // cwg1305: 3.0 +#if __cplusplus >= 201103L struct Incomplete; // #cwg1305-Incomplete struct Complete {}; @@ -25,8 +25,8 @@ int incomplete = alignof(Incomplete(&)[]); // since-cxx11-error@-1 {{invalid application of 'alignof' to an incomplete type 'Incomplete'}} // since-cxx11-note@#cwg1305-Incomplete {{forward declaration of 'cwg1305::Incomplete'}} int complete = alignof(Complete(&)[]); -} #endif +} // namespace cwg1305 namespace cwg1307 { // cwg1307: 14 #if __cplusplus >= 201103L @@ -150,7 +150,7 @@ namespace cwg1310 { // cwg1310: 5 } template void wt_test<W<int> >(); // #cwg1310-W-int template void wt_test_good<W<int> >(); -} +} // namespace cwg1310 namespace cwg1315 { // cwg1315: partial template <int I, int J> struct A {}; @@ -182,7 +182,7 @@ namespace cwg1315 { // cwg1315: partial template <typename T, int I> struct C; template <typename T> struct C<T, T::value>; // expected-error@-1 {{type of specialized non-type template argument depends on a template parameter of the partial specialization}} -} +} // namespace cwg1315 namespace cwg1330 { // cwg1330: 4 c++11 // exception-specifications are parsed in a context where the class is complete. @@ -302,7 +302,7 @@ namespace cwg1330 { // cwg1330: 4 c++11 struct E : C<int> {}; // #cwg1330-C-int E e; // #cwg1330-e -} +} // namespace cwg1330 // cwg1334: sup 1719 @@ -333,7 +333,7 @@ struct S { int z : 1 || new int { 0 }; }; #endif -} +} // namespace cwg1341 namespace cwg1346 { // cwg1346: 3.5 auto a(1); @@ -376,7 +376,7 @@ namespace cwg1346 { // cwg1346: 3.5 // since-cxx11-error@-2 {{cannot deduce type for lambda capture 'e' from parenthesized initializer list}} } #endif -} +} // namespace cwg1346 namespace cwg1347 { // cwg1347: 3.1 auto x = 5, *y = &x; @@ -390,7 +390,7 @@ namespace cwg1347 { // cwg1347: 3.1 auto (*fp)(int) -> int, i = 0; // since-cxx11-error@-1 {{declaration with trailing return type must be the only declaration in its group}} #endif -} +} // namespace cwg1347 namespace cwg1350 { // cwg1350: 3.5 #if __cplusplus >= 201103L @@ -520,7 +520,7 @@ namespace cwg1358 { // cwg1358: 3.1 // cxx11-20-note@#cwg1358-NonLit {{'NonLit' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors}} }; #endif -} +} // namespace cwg1358 namespace cwg1359 { // cwg1359: 3.5 #if __cplusplus >= 201103L @@ -549,7 +549,7 @@ namespace cwg1359 { // cwg1359: 3.5 // cxx11-17-note@#cwg1359-Y {{candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided}} // cxx11-17-note@#cwg1359-Y {{candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided}} #endif -} +} // namespace cwg1359 namespace cwg1388 { // cwg1388: 4 template<typename A, typename ...T> void f(T..., A); // #cwg1388-f @@ -622,7 +622,7 @@ namespace cwg1388 { // cwg1388: 4 // expected-error@-1 {{no matching function for call to 'f_pair_4'}} // expected-note@#cwg1388-f-4 {{candidate template ignored: deduced packs of different lengths for parameter 'T' (<int, long> vs. <int, long, const char *>)}} } -} +} // namespace cwg1388 namespace cwg1391 { // cwg1391: partial struct A {}; struct B : A {}; @@ -713,14 +713,14 @@ namespace cwg1391 { // cwg1391: partial int test_c1 = c(0); // ok int test_c2 = c<int>(0); // FIXME: apparently ambiguous } -} +} // namespace cwg1391 namespace cwg1394 { // cwg1394: 15 #if __cplusplus >= 201103L struct Incomplete; Incomplete f(Incomplete) = delete; // well-formed #endif -} +} // namespace cwg1394 namespace cwg1395 { // cwg1395: 16 #if __cplusplus >= 201103L @@ -731,7 +731,7 @@ namespace cwg1395 { // cwg1395: 16 f(&i); } #endif -} +} // namespace cwg1395 namespace cwg1397 { // cwg1397: 3.2 #if __cplusplus >= 201103L @@ -757,4 +757,4 @@ namespace cwg1399 { // cwg1399: dup 1388 // expected-error@-1 {{no matching function for call to 'f'}} // expected-note@#cwg1399-f {{candidate template ignored: deduced packs of different lengths for parameter 'T' (<> vs. <int, int>)}} } -} +} // namespace cwg1399 diff --git a/clang/test/CXX/drs/cwg14xx.cpp b/clang/test/CXX/drs/cwg14xx.cpp index cb2f34bf5e42..51bc9614299a 100644 --- a/clang/test/CXX/drs/cwg14xx.cpp +++ b/clang/test/CXX/drs/cwg14xx.cpp @@ -40,7 +40,7 @@ namespace cwg1413 { // cwg1413: 12 // expected-note@#cwg1413-var2 {{'var2' declared here}} } }; -} +} // namespace cwg1413 namespace cwg1423 { // cwg1423: 11 #if __cplusplus >= 201103L @@ -53,7 +53,7 @@ namespace cwg1423 { // cwg1423: 11 bool b4{nullptr}; // since-cxx11-warning@-1 {{implicit conversion of nullptr constant to 'bool'}} #endif -} +} // namespace 1423 // cwg1425: na abi @@ -76,15 +76,15 @@ namespace cwg1432 { // cwg1432: 16 template struct common_type<int, double>; #endif -} +} // namespace cwg1432 -namespace cwg1443 { // cwg1443: yes +namespace cwg1443 { // cwg1443: 2.7 struct A { int i; A() { void foo(int=i); } // expected-error@-1 {{default argument references 'this'}} }; -} +} // namespace cwg1443 namespace cwg1458 { // cwg1458: 3.1 #if __cplusplus >= 201103L @@ -93,7 +93,7 @@ struct A; void f() { constexpr A* a = nullptr; constexpr int p = &*a; - // expected-error@-1 {{cannot initialize a variable of type 'const int' with an rvalue of type 'A *'}} + // since-cxx11-error@-1 {{cannot initialize a variable of type 'const int' with an rvalue of type 'A *'}} constexpr A *p2 = &*a; } @@ -108,27 +108,27 @@ namespace cwg1460 { // cwg1460: 3.5 namespace DRExample { union A { union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} constexpr A() {} }; constexpr A a = A(); union B { union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} constexpr B() = default; }; constexpr B b = B(); union C { union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} union {}; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} }; constexpr C c = C(); #if __cplusplus >= 201403L @@ -141,7 +141,7 @@ namespace cwg1460 { // cwg1460: 3.5 union B { int n; }; // #cwg1460-B union C { int n = 0; }; struct D { union {}; }; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} struct E { union { int n; }; }; // #cwg1460-E struct F { union { int n = 0; }; }; @@ -173,7 +173,7 @@ namespace cwg1460 { // cwg1460: 3.5 // cxx11-17-error@-1 {{defaulted definition of default constructor cannot be marked constexpr}} union C { int n = 0; constexpr C() = default; }; struct D { union {}; constexpr D() = default; }; - // expected-error@-1 {{declaration does not declare anything}} + // since-cxx11-error@-1 {{declaration does not declare anything}} struct E { union { int n; }; constexpr E() = default; }; // cxx11-17-error@-1 {{defaulted definition of default constructor cannot be marked constexpr}} struct F { union { int n = 0; }; constexpr F() = default; }; @@ -222,8 +222,8 @@ namespace cwg1460 { // cwg1460: 3.5 union G { int a = 0; // #cwg1460-G-a int b = 0; - // expected-error@-1 {{initializing multiple members of union}} - // expected-note@#cwg1460-G-a {{previous initialization is here}} + // since-cxx11-error@-1 {{initializing multiple members of union}} + // since-cxx11-note@#cwg1460-G-a {{previous initialization is here}} }; union H { union { @@ -231,16 +231,16 @@ namespace cwg1460 { // cwg1460: 3.5 }; union { int b = 0; - // expected-error@-1 {{initializing multiple members of union}} - // expected-note@#cwg1460-H-a {{previous initialization is here}} + // since-cxx11-error@-1 {{initializing multiple members of union}} + // since-cxx11-note@#cwg1460-H-a {{previous initialization is here}} }; }; struct I { union { int a = 0; // #cwg1460-I-a int b = 0; - // expected-error@-1 {{initializing multiple members of union}} - // expected-note@#cwg1460-I-a {{previous initialization is here}} + // since-cxx11-error@-1 {{initializing multiple members of union}} + // since-cxx11-note@#cwg1460-I-a {{previous initialization is here}} }; }; struct J { @@ -264,23 +264,23 @@ namespace cwg1460 { // cwg1460: 3.5 }; static_assert(B().a == 1, ""); static_assert(B().b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} static_assert(B('x').a == 0, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} static_assert(B('x').b == 4, ""); static_assert(B(123).b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} static_assert(B(123).c == 3, ""); static_assert(B("").a == 1, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} static_assert(B("").b == 2, ""); static_assert(B("").c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} struct C { union { int a, b = 2, c; }; @@ -294,54 +294,54 @@ namespace cwg1460 { // cwg1460: 3.5 static_assert(C().a == 1, ""); static_assert(C().b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'a' is not allowed in a constant expression}} static_assert(C().d == 4, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} static_assert(C().e == 5, ""); static_assert(C('x').b == 2, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'b' of union with active member 'c' is not allowed in a constant expression}} static_assert(C('x').c == 3, ""); static_assert(C('x').d == 4, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} static_assert(C('x').e == 5, ""); static_assert(C(1).b == 2, ""); static_assert(C(1).c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} static_assert(C(1).d == 4, ""); static_assert(C(1).e == 5, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'e' of union with active member 'd' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'e' of union with active member 'd' is not allowed in a constant expression}} static_assert(C(1.f).b == 2, ""); static_assert(C(1.f).c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} static_assert(C(1.f).e == 5, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'e' of union with active member 'f' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'e' of union with active member 'f' is not allowed in a constant expression}} static_assert(C(1.f).f == 6, ""); static_assert(C("").a == 1, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'a' of union with active member 'b' is not allowed in a constant expression}} static_assert(C("").b == 2, ""); static_assert(C("").c == 3, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'c' of union with active member 'b' is not allowed in a constant expression}} static_assert(C("").d == 4, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'd' of union with active member 'e' is not allowed in a constant expression}} static_assert(C("").e == 5, ""); static_assert(C("").f == 6, ""); - // expected-error@-1 {{static assertion expression is not an integral constant expression}} - // expected-note@-2 {{read of member 'f' of union with active member 'e' is not allowed in a constant expression}} + // since-cxx11-error@-1 {{static assertion expression is not an integral constant expression}} + // since-cxx11-note@-2 {{read of member 'f' of union with active member 'e' is not allowed in a constant expression}} struct D; extern const D d; @@ -357,7 +357,7 @@ namespace cwg1460 { // cwg1460: 3.5 static_assert(d.a == 0, ""); } #endif -} +} // namespace cwg1460 #if __cplusplus >= 201103L namespace std { @@ -388,7 +388,7 @@ namespace std { const _E* begin() const {return __begin_;} const _E* end() const {return __begin_ + __size_;} }; -} // std +} // namespace std #endif namespace cwg1467 { // cwg1467: 3.7 c++11 @@ -601,7 +601,7 @@ namespace cwg1467 { // cwg1467: 3.7 c++11 } } // namespace StringLiterals #endif -} // cwg1467 +} // namespace cwg1467 namespace cwg1477 { // cwg1477: 2.7 namespace N { @@ -630,7 +630,7 @@ namespace cwg1479 { // cwg1479: 3.1 int operator""_a(const char*, std::size_t = 0); // since-cxx11-error@-1 {{literal operator cannot have a default argument}} #endif -} +} // namespace cwg1479 namespace cwg1482 { // cwg1482: 3.0 // NB: sup 2516, test reused there @@ -675,7 +675,7 @@ namespace cwg1490 { // cwg1490: 3.7 c++11 std::initializer_list<char>{"abc"}; // since-cxx11-error@-1 {{expected unqualified-id}}} #endif -} // cwg1490 +} // namespace cwg1490 namespace cwg1495 { // cwg1495: 4 #if __cplusplus >= 201103L @@ -717,7 +717,7 @@ namespace cwg1495 { // cwg1495: 4 // since-cxx14-note@#cwg1495-c {{template is declared here}} #endif #endif -} +} // namespace cwg1495 namespace cwg1496 { // cwg1496: no #if __cplusplus >= 201103L @@ -728,4 +728,4 @@ struct A { // default constructor which is not deleted. static_assert(__is_trivial(A), ""); #endif -} +} // namespace cwg1496 diff --git a/clang/test/CXX/drs/cwg158.cpp b/clang/test/CXX/drs/cwg158.cpp index 2a7443826477..1f5c319e6bd2 100644 --- a/clang/test/CXX/drs/cwg158.cpp +++ b/clang/test/CXX/drs/cwg158.cpp @@ -1,7 +1,10 @@ // RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s // RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s // RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s -// RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++17 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++20 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++23 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s +// RUN: %clang_cc1 -triple x86_64-linux -std=c++2c %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK %s // RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -pointer-tbaa -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK,POINTER-TBAA %s // cwg158: yes diff --git a/clang/test/CXX/drs/cwg15xx.cpp b/clang/test/CXX/drs/cwg15xx.cpp index 961c25000111..30ec63999ca2 100644 --- a/clang/test/CXX/drs/cwg15xx.cpp +++ b/clang/test/CXX/drs/cwg15xx.cpp @@ -170,7 +170,7 @@ namespace cwg1512 { // cwg1512: 4 // since-cxx11-note@#cwg1512-Wrap {{second operand was implicitly converted to type 'int *'}} } #endif -} +} // namespace cwg1512 namespace cwg1514 { // cwg1514: 11 #if __cplusplus >= 201103L @@ -184,7 +184,7 @@ namespace cwg1514 { // cwg1514: 11 // The behavior in other contexts is superseded by CWG1966. #endif -} +} // namespace cwg1514 namespace cwg1518 { // cwg1518: 4 #if __cplusplus >= 201103L @@ -321,13 +321,13 @@ namespace std_example { } } #endif // __cplusplus >= 201103L -} +} // namespace cwg1518 namespace cwg1550 { // cwg1550: 3.4 int f(bool b, int n) { return (b ? (throw 0) : n) + (b ? n : (throw 0)); } -} +} // namespace cwg1550 namespace cwg1558 { // cwg1558: 12 #if __cplusplus >= 201103L @@ -344,7 +344,7 @@ namespace cwg1558 { // cwg1558: 12 // since-cxx11-note@#cwg1558-f {{candidate template ignored: substitution failure [with T = int]: type 'int' cannot be used prior to '::' because it has no members}} } #endif -} +} // namespace cwg1558 namespace cwg1560 { // cwg1560: 3.5 void f(bool b, int n) { @@ -353,9 +353,9 @@ namespace cwg1560 { // cwg1560: 3.5 class X { X(const X&); }; const X &get(); const X &x = true ? get() : throw 0; -} +} // namespace cwg1560 -namespace cwg1563 { // cwg1563: yes +namespace cwg1563 { // cwg1563: 3.1 #if __cplusplus >= 201103L double bar(double) { return 0.0; } float bar(float) { return 0.0f; } @@ -363,7 +363,7 @@ namespace cwg1563 { // cwg1563: yes using fun = double(double); fun &foo{bar}; // ok #endif -} +} // namespace cwg1563 namespace cwg1567 { // cwg1567: 3.3 #if __cplusplus >= 201103L @@ -402,7 +402,7 @@ B b5{A{0}}; // since-cxx11-note@#cwg1567-B {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'A' to 'B' for 1st argument}} // since-cxx11-note@#cwg1567-B-double {{candidate constructor not viable: no known conversion from 'A' to 'double' for 1st argument}} #endif -} +} // namespace cwg1567 namespace cwg1573 { // cwg1573: 3.9 #if __cplusplus >= 201103L @@ -445,7 +445,7 @@ namespace cwg1573 { // cwg1573: 3.9 // since-cxx11-error@-1 {{call to deleted constructor of 'J'}} // since-cxx11-note@#cwg1573-I {{'I' has been explicitly marked deleted here}} #endif -} +} // namespace cwg1573 #if __cplusplus >= 201103L namespace std { @@ -485,7 +485,7 @@ namespace std { }; typedef basic_string<char> string; -} // std +} // namespace std #endif namespace cwg1579 { // cwg1579: 3.9 @@ -558,7 +558,7 @@ auto CWG1579_lambda_invalid = []() -> GenericMoveOnly<char> { // since-cxx11-note@#cwg1579-deleted-U {{'GenericMoveOnly<float>' has been explicitly marked deleted here}} }; #endif -} // end namespace cwg1579 +} // namespace cwg1579 namespace cwg1584 { // cwg1584: 7 drafting 2015-05 // Deducing function types from cv-qualified types @@ -633,7 +633,7 @@ namespace cwg1589 { // cwg1589: 3.7 c++11 // since-cxx11-note@#cwg1589-f2-ilist-int {{candidate function}} } #endif -} // cwg1589 +} // namespace cwg1589 namespace cwg1591 { //cwg1591. Deducing array bound and element type from initializer list #if __cplusplus >= 201103L @@ -718,4 +718,4 @@ namespace cwg1591 { //cwg1591. Deducing array bound and element type from initi short *ps = i(Arr<int>{1, 2}); // OK #5 } #endif -} // cwg1591 +} // namespace cwg1591 diff --git a/clang/test/CXX/drs/cwg16xx.cpp b/clang/test/CXX/drs/cwg16xx.cpp index 95e241f0d03e..bd2c484344dd 100644 --- a/clang/test/CXX/drs/cwg16xx.cpp +++ b/clang/test/CXX/drs/cwg16xx.cpp @@ -51,7 +51,7 @@ namespace cwg1611 { // cwg1611: dup 1658 struct B : virtual A { virtual void f() = 0; }; struct C : B { C() : A(0) {} void f(); }; C c; -} +} // namespace cwg1611 namespace cwg1631 { // cwg1631: 3.7 #if __cplusplus >= 201103L @@ -81,7 +81,7 @@ namespace cwg1631 { // cwg1631: 3.7 } } #endif -} +} // namespace cwg1631 namespace cwg1638 { // cwg1638: 3.1 #if __cplusplus >= 201103L @@ -122,7 +122,7 @@ namespace cwg1638 { // cwg1638: 3.1 // since-cxx11-note@-3 {{remove 'enum class' to befriend an enum}} }; #endif -} +} // namespace cwg1638 namespace cwg1645 { // cwg1645: 3.9 #if __cplusplus >= 201103L @@ -149,14 +149,14 @@ namespace cwg1645 { // cwg1645: 3.9 // since-cxx11-note@#cwg1645-int-int-int {{candidate inherited constructor has been explicitly deleted}} // since-cxx11-note@#cwg1645-using {{constructor from base class 'A' inherited here}} #endif -} +} // namespace cwg1645 namespace cwg1652 { // cwg1652: 3.6 int a, b; static_assert(&a + 1 == &b, ""); // expected-error@-1 {{static assertion expression is not an integral constant expression}} // expected-note@-2 {{comparison against pointer '&a + 1' that points past the end of a complete object has unspecified value}} -} +} // namespace cwg1652 namespace cwg1653 { // cwg1653: 4 c++17 void f(bool b) { @@ -173,7 +173,7 @@ namespace cwg1653 { // cwg1653: 4 c++17 b += 1; // ok b -= 1; // ok } -} +} // namespace cwg1653 namespace cwg1658 { // cwg1658: 5 namespace DefCtor { @@ -324,7 +324,7 @@ namespace cwg1658 { // cwg1658: 5 } // assignment case is superseded by cwg2180 -} +} // namespace cwg1658 namespace cwg1672 { // cwg1672: 7 struct Empty {}; @@ -349,7 +349,7 @@ namespace cwg1672 { // cwg1672: 7 static_assert(!__is_standard_layout(Y<G>), ""); static_assert(!__is_standard_layout(Y<H>), ""); static_assert(!__is_standard_layout(Y<X>), ""); -} +} // namespace cwg1672 namespace cwg1684 { // cwg1684: 3.6 #if __cplusplus >= 201103L @@ -363,7 +363,7 @@ namespace cwg1684 { // cwg1684: 3.6 // cxx11-20-error@-1 {{constexpr function's 1st parameter type 'NonLiteral' is not a literal type}} // cxx11-20-note@#cwg1684-struct {{'NonLiteral' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors}} #endif -} +} // namespace cwg1684 namespace cwg1687 { // cwg1687: 7 template<typename T> struct To { @@ -386,7 +386,7 @@ namespace cwg1687 { // cwg1687: 7 // since-cxx20-error@-1 {{invalid operands to binary expression ('To<E1>' and 'To<E2>')}} // since-cxx20-note@#cwg1687-op-T {{operand was implicitly converted to type 'cwg1687::E}} #endif -} +} // namespace cwg1687 namespace cwg1690 { // cwg1690: 9 // See also the various tests in "CXX/basic/basic.lookup/basic.lookup.argdep". @@ -401,7 +401,7 @@ namespace cwg1690 { // cwg1690: 9 f(s); // ok } #endif -} +} // namespace cwg1690 namespace cwg1691 { // cwg1691: 9 #if __cplusplus >= 201103L @@ -421,7 +421,7 @@ namespace cwg1691 { // cwg1691: 9 // since-cxx11-note@#cwg1691-g {{'N::g' declared here}} } #endif -} +} // namespace cwg1691 namespace cwg1692 { // cwg1692: 9 namespace N { @@ -436,7 +436,7 @@ namespace cwg1692 { // cwg1692: 9 N::A::B::C c; f(c); // ok } -} +} // namespace cwg1692 namespace cwg1696 { // cwg1696: 7 namespace std_examples { @@ -554,4 +554,4 @@ namespace cwg1696 { // cwg1696: 7 // since-cxx11-note@#cwg1696-il-5 {{nitializing field 'il' with default member initializer}} }; #endif -} +} // namespace cwg1696 diff --git a/clang/test/CXX/drs/cwg1748.cpp b/clang/test/CXX/drs/cwg1748.cpp index f216963d69f2..a0fe73753939 100644 --- a/clang/test/CXX/drs/cwg1748.cpp +++ b/clang/test/CXX/drs/cwg1748.cpp @@ -1,7 +1,10 @@ // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s // RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s // RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s -// RUN: %clang_cc1 -std=c++1z %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s +// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s +// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s +// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s +// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s // cwg1748: 3.7 diff --git a/clang/test/CXX/drs/cwg177x.cpp b/clang/test/CXX/drs/cwg177x.cpp index cc62bdac4cf0..a17fd221b51f 100644 --- a/clang/test/CXX/drs/cwg177x.cpp +++ b/clang/test/CXX/drs/cwg177x.cpp @@ -1,7 +1,10 @@ // RUN: %clang_cc1 -std=c++98 %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s // RUN: %clang_cc1 -std=c++11 %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11 // RUN: %clang_cc1 -std=c++14 %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11,CXX14 -// RUN: %clang_cc1 -std=c++1z %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11,CXX14 +// RUN: %clang_cc1 -std=c++17 %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11,CXX14 +// RUN: %clang_cc1 -std=c++20 %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11,CXX14 +// RUN: %clang_cc1 -std=c++23 %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11,CXX14 +// RUN: %clang_cc1 -std=c++2c %s -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11,CXX14 // RUN: %clang_cc1 -std=c++1z %s -fexceptions -fcxx-exceptions -pedantic-errors -triple i386-windows-pc -ast-dump | FileCheck %s --check-prefixes=CHECK,CXX11,CXX14 namespace cwg1772 { // cwg1772: 14 @@ -28,7 +31,7 @@ namespace cwg1772 { // cwg1772: 14 // CXX11-NEXT: StringLiteral{{.+}} 'const char[11]' lvalue "operator()" } #endif // __cplusplus >= 201103L -} +} // namespace cwg1772 namespace cwg1779 { // cwg1779: 14 // __func__ in a function template, member function template, or generic @@ -76,4 +79,4 @@ namespace cwg1779 { // cwg1779: 14 }; } #endif // __cplusplus >= 201402L -} +} // namespace cwg1779 diff --git a/clang/test/CXX/drs/cwg17xx.cpp b/clang/test/CXX/drs/cwg17xx.cpp index fb53a56923b1..8c4f916a606a 100644 --- a/clang/test/CXX/drs/cwg17xx.cpp +++ b/clang/test/CXX/drs/cwg17xx.cpp @@ -44,7 +44,7 @@ namespace cwg1715 { // cwg1715: 3.9 // since-cxx11-note@#cwg1715-E {{candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided}} // since-cxx11-note@#cwg1715-E {{candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided}} #endif -} +} // namespace cwg1715 namespace cwg1719 { // cwg1719: 19 #if __cplusplus >= 201103L @@ -96,7 +96,7 @@ struct A { // operator, or move assignment operator. static_assert(__is_trivially_copyable(A), ""); #endif -} +} // namespace cwg1734 namespace cwg1736 { // cwg1736: 3.9 #if __cplusplus >= 201103L @@ -115,7 +115,7 @@ struct S { struct Q { typedef int type; } q; S s(q); // #cwg1736-s #endif -} +} // namespace cwg1736 namespace cwg1738 { // cwg1738: sup P0136R1 #if __cplusplus >= 201103L @@ -132,7 +132,7 @@ struct B : A { template B::B(int, double); // since-cxx11-error@-1 {{explicit instantiation of 'B' does not refer to a function template, variable template, member function, member class, or static data member}} #endif -} +} // namespace cwg1738 // cwg1748 is in cwg1748.cpp @@ -165,7 +165,7 @@ namespace cwg1753 { // cwg1753: 11 n.~decltype(n)(); // OK #endif } -} +} // namespace cwg1753 namespace cwg1756 { // cwg1756: 3.7 #if __cplusplus >= 201103L @@ -176,7 +176,7 @@ namespace cwg1756 { // cwg1756: 3.7 struct X { operator int(); } x; int b{x}; #endif -} +} // namespace cwg1756 namespace cwg1758 { // cwg1758: 3.7 #if __cplusplus >= 201103L @@ -195,7 +195,7 @@ namespace cwg1758 { // cwg1758: 3.7 } b; A a{b}; #endif -} +} // namespace cwg1758 namespace cwg1762 { // cwg1762: 14 #if __cplusplus >= 201103L @@ -204,7 +204,7 @@ namespace cwg1762 { // cwg1762: 14 // since-cxx11-error@-1 {{invalid suffix on literal; C++11 requires a space between literal and identifier}} // since-cxx11-warning@-2 {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}} #endif -} +} // namespace cwg1762 // cwg1772 is in cwg177x.cpp @@ -221,12 +221,12 @@ namespace cwg1778 { // cwg1778: 9 static_assert(!noexcept(C()), ""); static_assert(noexcept(D()), ""); #endif -} +} // namespace cwg1778 // cwg1779 is in cwg177x.cpp -namespace cwg1794 { // cwg1794: yes - // NB: dup 1710 +namespace cwg1794 { // cwg1794: 2.7 + // NB: dup 1710 #if __cplusplus >= 201103L template <template <typename> class Template> struct Internal { template <typename Arg> using Bind = Template<Arg>; diff --git a/clang/test/CXX/drs/cwg1807.cpp b/clang/test/CXX/drs/cwg1807.cpp index 59edacc49658..a2c4968ef773 100644 --- a/clang/test/CXX/drs/cwg1807.cpp +++ b/clang/test/CXX/drs/cwg1807.cpp @@ -15,7 +15,7 @@ struct S { void f() { S s[3]; } -} +} // namespace cwg1807 // CHECK-LABEL: define dso_local void @cwg1807::f() // CHECK: invoke void @cwg1807::S::S(){{.+}} diff --git a/clang/test/CXX/drs/cwg18xx.cpp b/clang/test/CXX/drs/cwg18xx.cpp index 0fd2cd6b2d87..626473f11d3e 100644 --- a/clang/test/CXX/drs/cwg18xx.cpp +++ b/clang/test/CXX/drs/cwg18xx.cpp @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx11-17,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,cxx98-14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,cxx11-17,since-cxx11,since-cxx14,cxx17 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx23,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx23,since-cxx11,since-cxx14 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,cxx98-14,cxx11-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx14,cxx98-14,cxx11-17,since-cxx11,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx14,since-cxx17,cxx11-17,since-cxx11,since-cxx14,cxx17 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,cxx11-20,since-cxx14,since-cxx17,since-cxx20,since-cxx11,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx23,since-cxx11,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx14,since-cxx17,since-cxx20,since-cxx23,since-cxx11,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -26,7 +26,7 @@ S<i> V; // #cwg1801-S-i // cxx98-14-error@-1 {{non-type template argument does not refer to any declaration}} // cxx98-14-note@#cwg1801-S {{template parameter is declared here}} // cxx17-error@#cwg1801-S-i {{non-type template argument refers to subobject '.i'}} -} +} // namespace cwg1801 namespace cwg1802 { // cwg1802: 3.1 #if __cplusplus >= 201103L @@ -198,13 +198,13 @@ namespace cwg1813 { // cwg1813: 7 static_assert(!__is_standard_layout(U), ""); } -namespace cwg1814 { // cwg1814: yes +namespace cwg1814 { // cwg1814: 3.1 #if __cplusplus >= 201103L void test() { auto lam = [](int x = 42) { return x; }; } #endif -} +} // namespace cwg1814 namespace cwg1815 { // cwg1815: 20 #if __cplusplus >= 201402L @@ -229,7 +229,7 @@ namespace cwg1815 { // cwg1815: 20 static_assert(f() == 0); #endif #endif -} +} // namespace cwg1815 // cwg1818 is in cwg1818.cpp @@ -274,8 +274,8 @@ void d2() { #if __cplusplus >= 201103L auto e = [] { typedef int cwg1820::A; - // expected-error@-1 {{definition or redeclaration of 'A' not allowed inside a function}} - // expected-error@-2 {{typedef declarator cannot be qualified}} + // since-cxx11-error@-1 {{definition or redeclaration of 'A' not allowed inside a function}} + // since-cxx11-error@-2 {{typedef declarator cannot be qualified}} }; #endif } // namespace cwg1820 @@ -296,14 +296,14 @@ struct A { }; } // namespace cwg1821 -namespace cwg1822 { // cwg1822: yes +namespace cwg1822 { // cwg1822: 3.1 #if __cplusplus >= 201103L double a; auto x = [] (int a) { static_assert(__is_same(decltype(a), int), "should be resolved to lambda parameter"); }; #endif -} +} // namespace cwg1822 namespace cwg1824 { // cwg1824: 2.7 template<typename T> @@ -325,9 +325,9 @@ enum E { // #cwg1832-E #if __cplusplus >= 201103L enum E2: decltype(static_cast<E2>(0), 0) {}; -// expected-error@-1 {{unknown type name 'E2'}} +// since-cxx11-error@-1 {{unknown type name 'E2'}} enum class E3: decltype(static_cast<E3>(0), 0) {}; -// expected-error@-1 {{unknown type name 'E3'}} +// since-cxx11-error@-1 {{unknown type name 'E3'}} #endif } // namespace cwg1832 @@ -373,7 +373,7 @@ namespace cwg1837 { // cwg1837: 3.3 }; }; #endif -} +} // namespace cwg1837 namespace cwg1862 { // cwg1862: no template<class T> @@ -488,17 +488,14 @@ namespace cwg1872 { // cwg1872: 9 // cxx11-17-error@-1 {{constexpr variable 'y2' must be initialized by a constant expression}} // cxx11-17-note@-2 {{cannot evaluate call to virtual function in a constant expression in C++ standards before C++20}} #if __cplusplus >= 202002L - static_assert(y == 0); + static_assert(y2 == 0); #endif constexpr int z = A<Z>().f(); - // since-cxx11-error@-1 {{constexpr variable 'z' must be initialized by a constant expression}}a -#if __cplusplus < 202302L - // since-cxx11-note@-3 {{non-literal type 'A<Z>' cannot be used in a constant expression}} -#else - // since-cxx23-note@-5 {{cannot construct object of type 'A<cwg1872::Z>' with virtual base class in a constant expression}} -#endif + // since-cxx11-error@-1 {{constexpr variable 'z' must be initialized by a constant expression}} + // cxx11-20-note@-2 {{non-literal type 'A<Z>' cannot be used in a constant expression}} + // since-cxx23-note@-3 {{cannot construct object of type 'A<cwg1872::Z>' with virtual base class in a constant expression}} #endif -} +} // namespace cwg1872 namespace cwg1878 { // cwg1878: 18 #if __cplusplus >= 201402L @@ -533,7 +530,7 @@ struct S { #endif }; #endif -} +} // namespace cwg1878 namespace cwg1881 { // cwg1881: 7 struct A { int a : 4; }; @@ -545,7 +542,7 @@ namespace cwg1881 { // cwg1881: 7 struct D : C { int : 0; }; static_assert(__is_standard_layout(C), ""); static_assert(!__is_standard_layout(D), ""); -} +} // namespace cwg1881 // cwg1884 is in cwg1884.cpp @@ -585,9 +582,9 @@ void cwg1891() { // cwg1891: 4 typedef decltype(a) A; typedef decltype(b) B; - static_assert(!__has_trivial_constructor(A), ""); + static_assert(!__is_trivially_constructible(A), ""); // since-cxx20-error@-1 {{failed}} - static_assert(!__has_trivial_constructor(B), ""); + static_assert(!__is_trivially_constructible(B), ""); // C++20 allows default construction for non-capturing lambdas (P0624R2). A x; @@ -613,7 +610,7 @@ void cwg1891() { // cwg1891: 4 // since-cxx11-error-re@-1 {{{{object of type '\(lambda at .+\)' cannot be assigned because its copy assignment operator is implicitly deleted}}}} // since-cxx11-note@#cwg1891-b {{lambda expression begins here}} #endif -} +} // void cwg1891() namespace cwg1894 { // cwg1894: 3.8 // NB: reusing part of cwg407 test @@ -641,7 +638,7 @@ namespace H { using namespace A; struct S s; } -} +} // namespace cwg1894 namespace cwg1898 { // cwg1898: 2.7 void e(int) {} // #cwg1898-e diff --git a/clang/test/CXX/drs/cwg19xx.cpp b/clang/test/CXX/drs/cwg19xx.cpp index 2fe46909eaac..55a7c7cbba66 100644 --- a/clang/test/CXX/drs/cwg19xx.cpp +++ b/clang/test/CXX/drs/cwg19xx.cpp @@ -6,7 +6,9 @@ // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -namespace std { struct type_info; } +namespace std { +struct type_info; +} // namespace std namespace cwg1900 { // cwg1900: 2.7 // See the test for CWG1477 for detailed analysis @@ -44,7 +46,7 @@ namespace cwg1902 { // cwg1902: 3.7 // since-cxx11-note@#cwg1902-B-A {{candidate constructor}} // since-cxx11-note@#cwg1902-B-copy-ctor {{candidate constructor has been explicitly deleted}} #endif -} +} // namespace cwg1902 namespace cwg1903 { // cwg1903: 2.7 namespace A { @@ -69,7 +71,7 @@ namespace cwg1903 { // cwg1903: 2.7 using A::d; struct a *p; } -} +} // namespace cwg1903 namespace cwg1909 { // cwg1909: 3.7 struct A { @@ -90,7 +92,7 @@ namespace cwg1909 { // cwg1909: 3.7 // cxx98-error@-1 {{alias declarations are a C++11 extension}} // expected-error@-2 {{member 'D' has the same name as its class}} }; -} +} // namespace cwg1909 namespace cwg1918 { // cwg1918: no template<typename T> struct A { @@ -125,7 +127,7 @@ static union { int not_empty; }; #endif -} +} // namespace cwg1918 namespace cwg1941 { // cwg1941: 3.9 #if __cplusplus >= 201402L @@ -155,7 +157,7 @@ struct iter { derived d1(it, end); derived d2(42, 9); #endif -} +} // namespace cwg1941 namespace cwg1945 { // cwg1945: no template<typename T> struct A { @@ -180,7 +182,7 @@ unsigned b = 0b'01; unsigned x = 0x'01; // since-cxx14-error@-1 {{invalid suffix 'x'01' on integer constant}} #endif -} +} // namespace cwg1947 #if __cplusplus >= 201103L // cwg1948: 3.5 @@ -230,7 +232,7 @@ namespace cwg1959 { // cwg1959: 3.9 // where the base class is reference-related to the argument type. c q(static_cast<c&&>(q)); #endif -} +} // namespace cwg1959 namespace cwg1960 { // cwg1960: no struct A { @@ -251,7 +253,7 @@ struct C : B { using A::f; using A::g; }; -} +} // namespace cwg1960 namespace cwg1966 { // cwg1966: 11 #if __cplusplus >= 201103L @@ -280,7 +282,7 @@ namespace cwg1966 { // cwg1966: 11 // since-cxx11-error@-3 {{anonymous bit-field cannot have a default member initializer}} }; #endif -} +} // namespace cwg1966 namespace cwg1968 { // cwg1968: no #if __cplusplus >= 201103L @@ -291,7 +293,7 @@ namespace cwg1968 { // cwg1968: no constexpr const std::type_info *f() { return &typeid(int); } static_assert(f() == f(), ""); #endif -} +} // namespace cwg1968 namespace cwg1991 { // cwg1991: 3.9 #if __cplusplus >= 201103L @@ -309,6 +311,6 @@ namespace cwg1991 { // cwg1991: 3.9 // of ambiguity. B b(0, 0); // ok, calls B constructor #endif -} +} // namespace cwg1991 // cwg1994: dup 529 diff --git a/clang/test/CXX/drs/cwg1xx.cpp b/clang/test/CXX/drs/cwg1xx.cpp index 6aec8b65c91f..98eb86c92900 100644 --- a/clang/test/CXX/drs/cwg1xx.cpp +++ b/clang/test/CXX/drs/cwg1xx.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11,since-cxx17,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -16,7 +17,7 @@ #define __enable_constant_folding #endif -namespace cwg100 { // cwg100: yes +namespace cwg100 { // cwg100: 2.7 template<const char (*)[4]> struct A {}; // #cwg100-A template<const char (&)[4]> struct B {}; // #cwg100-B template<const char *> struct C {}; // #cwg100-C @@ -37,7 +38,7 @@ namespace cwg100 { // cwg100: yes // cxx98-14-error@#cwg100-d {{non-type template argument does not refer to any declaration}} // cxx98-14-note@#cwg100-D {{template parameter is declared here}} // since-cxx17-error@#cwg100-d {{reference to subobject of string literal is not allowed in a template argument}} -} +} // namespace cwg100 namespace cwg101 { // cwg101: 3.5 extern "C" void cwg101_f(); @@ -50,9 +51,9 @@ namespace cwg101 { // cwg101: 3.5 using X::size_t; extern "C" void cwg101_f(); typedef unsigned size_t; -} +} // namespace cwg101 -namespace cwg102 { // cwg102: yes +namespace cwg102 { // cwg102: 2.7 namespace A { template<typename T> T f(T a, T b) { return a + b; } // expected-error@-1 {{call to function 'operator+' that is neither visible in the template definition nor found by argument-dependent lookup}} @@ -64,7 +65,7 @@ namespace cwg102 { // cwg102: yes } B::S operator+(B::S, B::S); // #cwg102-operator-plus template B::S A::f(B::S, B::S); // #cwg102-instantiation -} +} // namespace cwg102 // cwg103: na // cwg104: na lib @@ -84,12 +85,12 @@ namespace cwg106 { // cwg106: sup 540 // expected-warning@-1 {{'const' qualifier on reference type 'r2' (aka 'const int &') has no effect}} typedef const r2 &r2; // expected-warning@-1 {{'const' qualifier on reference type 'r2' (aka 'const int &') has no effect}} -} +} // namespace cwg106 -namespace cwg107 { // cwg107: yes +namespace cwg107 { // cwg107: 2.7 struct S {}; extern "C" S operator+(S, S) { return S(); } -} +} // namespace cwg107 namespace cwg108 { // cwg108: 2.9 template<typename T> struct A { @@ -100,9 +101,9 @@ namespace cwg108 { // cwg108: 2.9 // expected-error@-1 {{unknown type name 'X'}} }; template<> struct A<int>::B { int X; }; -} +} // namespace cwg108 -namespace cwg109 { // cwg109: yes +namespace cwg109 { // cwg109: 2.8 struct A { template<typename T> void f(T); }; template<typename T> struct B : T { using T::template f; @@ -117,7 +118,7 @@ namespace cwg109 { // cwg109: yes void g() { this->f<int>(123); } // expected-error@-1 {{use 'template' keyword to treat 'f' as a dependent template name}} }; -} +} // namespace cwg109 namespace cwg110 { // cwg110: 2.8 template <typename T> @@ -141,9 +142,9 @@ namespace cwg111 { // cwg111: dup 535 // expected-error@-1 {{no matching constructor for initialization of 'B'}} // expected-note@#cwg111-B {{candidate constructor (the implicit copy constructor) not viable: 1st argument ('const B') would lose const qualifier}} // expected-note@#cwg111-B {{candidate constructor not viable: requires 0 arguments, but 1 was provided}} -} +} // namespace cwg111 -namespace cwg112 { // cwg112: yes +namespace cwg112 { // cwg112: 3.1 struct T { int n; }; typedef T Arr[1]; @@ -161,9 +162,9 @@ namespace cwg112 { // cwg112: yes // cxx98-error@-1 {{non-type template argument referring to object 'a3' with internal linkage is a C++11 extension}} // cxx98-note@#cwg112-a3 {{non-type template argument refers to object here}} X<a4> x4; -} +} // namespace cwg112 -namespace cwg113 { // cwg113: yes +namespace cwg113 { // cwg113: 2.7 extern void (*p)(); void f() { no_such_function(); @@ -172,9 +173,9 @@ namespace cwg113 { // cwg113: yes } void g(); void (*p)() = &g; -} +} // namespace cwg113 -namespace cwg114 { // cwg114: yes +namespace cwg114 { // cwg114: 2.7 struct A { virtual void f(int) = 0; // #cwg114-A-f }; @@ -184,7 +185,7 @@ namespace cwg114 { // cwg114: yes } b; // expected-error@-1 {{variable type 'struct B' is an abstract class}} // expected-note@#cwg114-A-f {{unimplemented pure virtual method 'f' in 'B'}} -} +} // namespace cwg114 namespace cwg115 { // cwg115: 3.0 template<typename T> int f(T); // #cwg115-f @@ -278,24 +279,24 @@ namespace cwg115 { // cwg115: 3.0 // Special case kicks in only if a template argument list is specified. template<typename T=int> void with_default(); // #cwg115-with-default int k10 = f(&with_default); - // expected-error@-1 {{no matching function for call to 'f'}} - // expected-note@#cwg115-f {{candidate template ignored: couldn't infer template argument 'T'}} + // since-cxx11-error@-1 {{no matching function for call to 'f'}} + // since-cxx11-note@#cwg115-f {{candidate template ignored: couldn't infer template argument 'T'}} int k11 = f(&with_default<>); void k() { (void)&with_default; - // expected-error@-1 {{address of overloaded function 'with_default' cannot be cast to type 'void'}} - // expected-note@#cwg115-with-default {{candidate function template}} + // since-cxx11-error@-1 {{address of overloaded function 'with_default' cannot be cast to type 'void'}} + // since-cxx11-note@#cwg115-with-default {{candidate function template}} (void)&with_default<>; &with_default; - // expected-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}} - // expected-note@#cwg115-with-default {{possible target for call}} + // since-cxx11-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}} + // since-cxx11-note@#cwg115-with-default {{possible target for call}} &with_default<>; - // expected-warning@-1 {{expression result unused}} + // since-cxx11-warning@-1 {{expression result unused}} } #endif -} +} // namespace cwg115 -namespace cwg116 { // cwg116: yes +namespace cwg116 { // cwg116: 2.7 template<int> struct A {}; template<int N> void f(A<N>) {} // #cwg116-f-N template<int M> void f(A<M>) {} @@ -305,14 +306,14 @@ namespace cwg116 { // cwg116: yes template<typename U> void f(A<sizeof(U)>) {} // expected-error@-1 {{redefinition of 'f'}} // expected-note@#cwg116-f-T {{previous definition is here}} -} +} // namespace cwg116 // cwg117: na // cwg118 is in cwg118.cpp // cwg119: na // cwg120: na -namespace cwg121 { // cwg121: yes +namespace cwg121 { // cwg121: 2.7 struct X { template<typename T> struct Y {}; }; @@ -323,17 +324,17 @@ namespace cwg121 { // cwg121: yes // cxx98-17-error@-2 {{missing 'typename' prior to dependent type name T::Y; implicit 'typename' is a C++20 extension}} }; Z<X> z; -} +} // namespace cwg121 -namespace cwg122 { // cwg122: yes +namespace cwg122 { // cwg122: 2.7 template<typename T> void f(); void g() { f<int>(); } -} +} // namespace cwg122 // cwg123: na // cwg124 is in cwg124.cpp -// cwg125: yes +// cwg125: 2.7 struct cwg125_A { struct cwg125_B {}; }; // #cwg125_B cwg125_A::cwg125_B cwg125_C(); namespace cwg125_B { cwg125_A cwg125_C(); } @@ -348,7 +349,7 @@ namespace cwg125 { // since-cxx11-error@#cwg125_C {{'cwg125_B' is missing exception specification 'noexcept'}} // since-cxx11-note@#cwg125_B {{previous declaration is here}} }; -} +} // namespace cwg125 namespace cwg126 { // cwg126: partial // FIXME: We do not yet generate correct code for this change: @@ -459,7 +460,7 @@ namespace cwg126 { // cwg126: partial void f() throw(int); // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}} // since-cxx17-note@-2 {{use 'noexcept(false)' instead}} -} +} // namespace cwg126 namespace cwg127 { // cwg127: 2.9 __extension__ typedef __decltype(sizeof(0)) size_t; @@ -475,12 +476,12 @@ namespace cwg127 { // cwg127: 2.9 }; A<void> *p = new A<void>; // #cwg127-p A<int> *q = new ("") A<int>; // #cwg127-q -} +} // namespace cwg127 -namespace cwg128 { // cwg128: yes +namespace cwg128 { // cwg128: 2.7 enum E1 { e1 } x = e1; enum E2 { e2 } y = static_cast<E2>(x), z = static_cast<E2>(e1); -} +} // namespace cwg128 // cwg129: dup 616 // cwg130: na @@ -489,7 +490,7 @@ namespace cwg131 { // cwg131: sup P1949 const char *a_with_\u0e8c = "\u0e8c"; const char *b_with_\u0e8d = "\u0e8d"; const char *c_with_\u0e8e = "\u0e8e"; -} +} // namespace cwg131 namespace cwg132 { // cwg132: no void f() { @@ -497,18 +498,18 @@ namespace cwg132 { // cwg132: no extern struct S {} y; // FIXME: This is invalid. } static enum { E } e; -} +} // namespace cwg132 // cwg133: dup 87 // cwg134: na -namespace cwg135 { // cwg135: yes +namespace cwg135 { // cwg135: 2.7 struct A { A f(A a) { return a; } friend A g(A a) { return a; } static A h(A a) { return a; } }; -} +} // namespace cwg135 namespace cwg136 { // cwg136: 3.4 void f(int, int, int = 0); // #cwg136-f @@ -556,9 +557,9 @@ namespace cwg136 { // cwg136: 3.4 // expected-error@-1 {{friend declaration specifying a default argument must be the only declaration}} // expected-note@#cwg136-B-f {{previous declaration is here}} }; -} +} // namespace cwg136 -namespace cwg137 { // cwg137: yes +namespace cwg137 { // cwg137: 2.7 extern void *p; extern const void *cp; extern volatile void *vp; @@ -580,7 +581,7 @@ namespace cwg137 { // cwg137: yes const volatile int *cvqc = static_cast<const volatile int*>(cp); const volatile int *cvqv = static_cast<const volatile int*>(vp); const volatile int *cvqcv = static_cast<const volatile int*>(cvp); -} +} // namespace cwg137 namespace cwg138 { // cwg138: partial namespace example1 { @@ -656,7 +657,7 @@ struct Data { } // namespace example3 } // namespace cwg138 -namespace cwg139 { // cwg139: yes +namespace cwg139 { // cwg139: 2.7 namespace example1 { typedef int f; // #cwg139-typedef-f struct A { @@ -676,16 +677,16 @@ namespace cwg139 { // cwg139: yes }; } } -} +} // namespace cwg139 -namespace cwg140 { // cwg140: yes +namespace cwg140 { // cwg140: 2.7 void f(int *const) {} // #cwg140-f-first void f(int[3]) {} // expected-error@-1 {{redefinition of 'f'}} // expected-note@#cwg140-f-first {{previous definition is here}} void g(const int); void g(int n) { n = 2; } -} +} // namespace cwg140 namespace cwg141 { // cwg141: 3.1 template<typename T> void f(); @@ -727,7 +728,7 @@ namespace cwg141 { // cwg141: 3.1 template<typename T> void S(); }; void i() { C<X>().i(); } // ok!! -} +} // namespace cwg141 namespace cwg142 { // cwg142: 2.8 class B { // #cwg142-B @@ -780,9 +781,9 @@ namespace cwg142 { // cwg142: 2.8 cwg142::B *bp2 = (cwg142::B*)this; bp2->mi = 3; } -} +} // namespace cwg142 -namespace cwg143 { // cwg143: yes +namespace cwg143 { // cwg143: 2.7 namespace A { struct X; } namespace B { void f(A::X); } namespace A { @@ -792,9 +793,9 @@ namespace cwg143 { // cwg143: yes f(x); // expected-error@-1 {{use of undeclared identifier 'f'}} } -} +} // namespace cwg143 -namespace cwg145 { // cwg145: yes +namespace cwg145 { // cwg145: 2.7 void f(bool b) { ++b; // cxx98-14-warning@-1 {{incrementing expression of type bool is deprecated and incompatible with C++17}} @@ -803,9 +804,9 @@ namespace cwg145 { // cwg145: yes // cxx98-14-warning@-1 {{incrementing expression of type bool is deprecated and incompatible with C++17}} // since-cxx17-error@-2 {{ISO C++17 does not allow incrementing expression of type bool}} } -} +} // namespace cwg145 -namespace cwg147 { // cwg147: yes +namespace cwg147 { // cwg147: 2.7 namespace example1 { template<typename> struct A { template<typename T> A(T); @@ -831,13 +832,13 @@ namespace cwg147 { // cwg147: yes template<> A<int>::A<int>(A<int>::a); // expected-error@-1 {{qualified reference to 'A' is a constructor name rather than a template name in this context}} } -} +} // namespace cwg147 -namespace cwg148 { // cwg148: yes +namespace cwg148 { // cwg148: 2.7 struct A { int A::*p; }; static_assert(__is_pod(int(A::*)), ""); static_assert(__is_pod(A), ""); -} +} // namespace cwg148 // cwg149: na @@ -879,15 +880,15 @@ namespace cwg150 { // cwg150: 19 b + p; } } // namespace n1 -} +} // namespace cwg150 namespace cwg151 { // cwg151: 3.1 struct X {}; typedef int X::*p; static_assert(__enable_constant_folding(p() == 0), ""); -} +} // namespace cwg151 -namespace cwg152 { // cwg152: yes +namespace cwg152 { // cwg152: 2.7 struct A { A(); // #cwg152-A-ctor explicit A(const A&); // #cwg152-A-explicit-ctor @@ -904,24 +905,25 @@ namespace cwg152 { // cwg152: yes // expected-note@#cwg152-A-explicit-ctor {{explicit constructor is not a candidate}} // expected-note@#cwg152-A-ctor {{candidate constructor not viable: requires 0 arguments, but 1 was provided}} A a4(f()); -} +} // namespace cwg152 // cwg153: na -namespace cwg154 { // cwg154: yes +namespace cwg154 { // cwg154: 2.7 union { int a; }; // expected-error@-1 {{nonymous unions at namespace or global scope must be declared 'static'}} namespace { union { int b; }; } static union { int c; }; -} +} // namespace cwg154 namespace cwg155 { // cwg155: dup 632 struct S { int n; } s = { { 1 } }; // expected-warning@-1 {{braces around scalar initializer}} -} +} // namespace cwg155 +// cwg156: sup 1111 // cwg158 is in cwg158.cpp namespace cwg159 { // cwg159: 3.5 @@ -930,7 +932,7 @@ namespace cwg159 { // cwg159: 3.5 void cwg159::f() {} // expected-warning@-1 {{extra qualification on member 'f'}} void cwg159::X::f() {} -} +} // namespace cwg159 // cwg160: na @@ -969,7 +971,7 @@ namespace cwg161 { // cwg161: 3.1 D::sf(); } }; -} +} // namespace cwg161 namespace cwg162 { // cwg162: 19 struct A { @@ -986,11 +988,11 @@ namespace cwg162 { // cwg162: 19 int &c = (&A::f)(0); char &d = (&A::f)('0'); // expected-error@-1 {{non-const lvalue reference to type 'char' cannot bind to a value of unrelated type 'int'}} -} +} // namespace cwg162 // cwg163: na -namespace cwg164 { // cwg164: yes +namespace cwg164 { // cwg164: 2.7 void f(int); template <class T> int g(T t) { return f(t); } @@ -998,7 +1000,7 @@ namespace cwg164 { // cwg164: yes int f(E); int k = g(e); -} +} // namespace cwg164 namespace cwg165 { // cwg165: no namespace N { @@ -1009,7 +1011,7 @@ namespace cwg165 { // cwg165: no struct N::B {}; // FIXME: cwg165 says this is ill-formed, but the argument in cwg1477 says it's ok void N::g() {} -} +} // namespace cwg165 namespace cwg166 { // cwg166: 2.9 namespace A { class X; } @@ -1041,7 +1043,7 @@ namespace cwg166 { // cwg166: 2.9 int i(A::X x) { return x.n; } // expected-error@-1 {{'n' is a private member of 'cwg166::A::X'}} // expected-note@#cwg166-X-n {{implicitly declared private here}} -} +} // namespace cwg166 // cwg167: sup 1012 @@ -1053,9 +1055,9 @@ namespace cwg168 { // cwg168: no }; p a = &S::f; // FIXME: this should fail. q b = &S::f; -} +} // namespace cwg168 -namespace cwg169 { // cwg169: yes +namespace cwg169 { // cwg169: 3.4 template<typename> struct A { int n; }; struct B { template<typename> struct C; @@ -1072,7 +1074,7 @@ namespace cwg169 { // cwg169: yes using B::n<int>; // expected-error@-1 {{using declaration cannot refer to a template specialization}} }; -} +} // namespace cwg169 namespace { // cwg171: 3.4 int cwg171a; @@ -1083,9 +1085,9 @@ namespace cwg171 { extern "C" void cwg171b(); // expected-error@-1 {{declaration of 'cwg171b' with C language linkage conflicts with declaration in global scope}} // expected-note@#cwg171b-int {{declared in global scope here}} -} +} // namespace cwg171 -namespace cwg172 { // cwg172: yes +namespace cwg172 { // cwg172: 2.7 enum { zero }; static_assert(-1 < zero, ""); @@ -1117,13 +1119,13 @@ namespace cwg172 { // cwg172: yes // cxx98-error@-1 {{'long long' is a C++11 extension}} static_assert(sizeof(f) == sizeof(unsigned long), ""); static_assert(-f > 0, ""); -} +} // namespace cwg172 -namespace cwg173 { // cwg173: yes +namespace cwg173 { // cwg173: 2.7 static_assert('0' + 1 == '1' && '0' + 2 == '2' && '0' + 3 == '3' && '0' + 4 == '4' && '0' + 5 == '5' && '0' + 6 == '6' && '0' + 7 == '7' && '0' + 8 == '8' && '0' + 9 == '9', ""); -} +} // namespace cwg173 // cwg174: sup 1012 @@ -1137,7 +1139,7 @@ namespace cwg175 { // cwg175: 2.8 // expected-note@#cwg175-A {{member is declared here}} cwg175::A b; }; -} +} // namespace cwg175 namespace cwg176 { // cwg176: 3.1 template<typename T> class Y; @@ -1177,9 +1179,9 @@ namespace cwg176 { // cwg176: 3.1 // since-cxx17-error@#cwg176-p4 {{use of class template 'cwg176::X' requires template arguments; argument deduction not allowed in non-static class member}} // since-cxx17-note@#cwg176-X {{template is declared here}} }; -} +} // namespace cwg176 -namespace cwg177 { // cwg177: yes +namespace cwg177 { // cwg177: 2.7 struct B {}; struct A { A(A &); // #cwg177-A-copy-ctor @@ -1198,9 +1200,9 @@ namespace cwg177 { // cwg177: yes C c = e; // expected-error@-1 {{no viable constructor copying variable of type 'D'}} // expected-note@#cwg177-C-copy-ctor {{candidate constructor not viable: expects an lvalue for 1st argument}} -} +} // namespace cwg177 -namespace cwg178 { // cwg178: yes +namespace cwg178 { // cwg178: 3.1 static_assert(int() == 0, ""); #if __cplusplus >= 201103L static_assert(int{} == 0, ""); @@ -1211,13 +1213,13 @@ namespace cwg178 { // cwg178: yes struct U : S { constexpr U() : S() {} }; static_assert(U().b == 0, ""); #endif -} +} // namespace cwg178 -namespace cwg179 { // cwg179: yes +namespace cwg179 { // cwg179: 2.7 void f(); int n = &f - &f; // expected-error@-1 {{arithmetic on pointers to the function type 'void ()'}} -} +} // namespace cwg179 namespace cwg180 { // cwg180: 2.8 template<typename T> struct X : T, T::some_base { @@ -1227,9 +1229,9 @@ namespace cwg180 { // cwg180: 2.8 enum T::some_enum e; } }; -} +} // namespace cwg180 -namespace cwg181 { // cwg181: yes +namespace cwg181 { // cwg181: 2.7 namespace X { template <template X<class T> > struct A { }; // expected-error@-1 +{{}} @@ -1241,7 +1243,7 @@ namespace cwg181 { // cwg181: yes template <template <class T> class X> struct A { }; template <template <class T> class X> void f(A<X>) { } } -} +} // namespace cwg181 namespace cwg182 { // cwg182: 14 template <class T> struct C { @@ -1264,7 +1266,7 @@ namespace cwg182 { // cwg182: 14 C<B> cb; cb.f(); } -} +} // namespace cwg182 namespace cwg183 { // cwg183: sup 382 template<typename T> struct A {}; @@ -1275,9 +1277,9 @@ namespace cwg183 { // cwg183: sup 382 typename B<int>::X x; // cxx98-error@-1 {{'typename' occurs outside of a template}} }; -} +} // namespace cwg183 -namespace cwg184 { // cwg184: yes +namespace cwg184 { // cwg184: 2.7 template<typename T = float> struct B {}; template<template<typename TT = float> class T> struct A { @@ -1298,7 +1300,7 @@ namespace cwg184 { // cwg184: yes } void h() { A<B>().g(); } -} +} // namespace cwg184 // cwg185 is in cwg185.cpp @@ -1307,18 +1309,35 @@ namespace cwg187 { // cwg187: sup 481 template<int X = Z, int Z = X> struct A; typedef A<> T; typedef A<1, 1> T; -} +} // namespace cwg187 -namespace cwg188 { // cwg188: yes +namespace cwg188 { // cwg188: 2.7 char c[10]; static_assert(sizeof(0, c) == 10, ""); -} +} // namespace cwg188 + +namespace cwg190 { // cwg190: 19 +struct A { + int a; + static double x; + int b; + void y(); + int c; +}; -// cwg190 FIXME: add codegen test for tbaa -// or implement C++20 std::is_layout_compatible and test it this way +struct B { + int a; + void y(); + int b; + static double x; + int c; +}; + +static_assert(__is_layout_compatible(A, B), ""); +} // namespace cwg190 int cwg191_j; -namespace cwg191 { // cwg191: yes +namespace cwg191 { // cwg191: 2.7 namespace example1 { struct outer { static int i; @@ -1345,11 +1364,19 @@ namespace cwg191 { // cwg191: yes } }; } -} +} // namespace cwg191 + +namespace cwg192 { // cwg192: 2.7 +struct S { + void f(I i) { } + // expected-error@-1 {{unknown type name 'I'}} + typedef int I; +}; +} // namespace cwg192 // cwg193 is in cwg193.cpp -namespace cwg194 { // cwg194: yes +namespace cwg194 { // cwg194: 2.7 struct A { A(); void A(); @@ -1363,17 +1390,17 @@ namespace cwg194 { // cwg194: yes struct C { inline explicit C(int) {} }; -} +} // namespace cwg194 -namespace cwg195 { // cwg195: yes +namespace cwg195 { // cwg195: 2.7 void f(); int *p = (int*)&f; // cxx98-error@-1 {{cast between pointer-to-function and pointer-to-object is an extension}} void (*q)() = (void(*)())&p; // cxx98-error@-1 {{cast between pointer-to-function and pointer-to-object is an extension}} -} +} // namespace cwg195 -namespace cwg197 { // cwg197: yes +namespace cwg197 { // cwg197: 2.7 char &f(char); template <class T> void g(T t) { @@ -1395,9 +1422,9 @@ namespace cwg197 { // cwg197: yes g(2); g(e); // #cwg197-g-e-call } -} +} // namespace cwg197 -namespace cwg198 { // cwg198: yes +namespace cwg198 { // cwg198: 2.9 struct A { int n; struct B { @@ -1420,6 +1447,6 @@ namespace cwg198 { // cwg198: yes // cxx98-error@-1 {{invalid use of non-static data member 'n'}} int f() { return n; } }; -} +} // namespace cwg198 // cwg199 is in cwg199.cpp diff --git a/clang/test/CXX/drs/cwg20xx.cpp b/clang/test/CXX/drs/cwg20xx.cpp index b2dc5a9865e3..141a1012aef9 100644 --- a/clang/test/CXX/drs/cwg20xx.cpp +++ b/clang/test/CXX/drs/cwg20xx.cpp @@ -22,7 +22,7 @@ int a = b2[0]; int b = __builtin_addressof(b2)->foo; // cxx98-error@-1 {{no member named 'foo' in 'cwg2007::B<cwg2007::A<void> >'}} // since-cxx11-error@-2 {{no member named 'foo' in 'cwg2007::B<cwg2007::A<void>>'}} -} +} // namespace cwg2007 // cwg2009: na @@ -88,7 +88,7 @@ namespace cwg2026 { // cwg2026: 11 // since-cxx20-note@-3 {{read of object outside its lifetime is not allowed in a constant expression}} #endif } -} +} // namespace cwg2026 namespace cwg2049 { // cwg2049: 18 #if __cplusplus >= 202302L @@ -97,9 +97,9 @@ X<> a; X<nullptr> b; static_assert(__is_same(decltype(a), decltype(b))); #endif -} +} // namespace cwg2049 -namespace cwg2061 { // cwg2061: yes +namespace cwg2061 { // cwg2061: 2.7 #if __cplusplus >= 201103L namespace A { inline namespace b { @@ -125,7 +125,7 @@ namespace cwg2061 { // cwg2061: yes A::C::S<int> s; } #endif // C++11 -} +} // namespace cwg2061 namespace cwg2076 { // cwg2076: 13 #if __cplusplus >= 201103L @@ -172,14 +172,14 @@ namespace cwg2076 { // cwg2076: 13 // since-cxx11-note@#cwg2076-bar {{cannot convert initializer list}} } #endif -} +} // namespace cwg2076 namespace cwg2082 { // cwg2082: 11 void test1(int x, int = sizeof(x)); // ok #if __cplusplus >= 201103L void test2(int x, int = decltype(x){}); // ok #endif -} +} // namespace cwg2082 namespace cwg2083 { // cwg2083: partial #if __cplusplus >= 201103L @@ -399,7 +399,7 @@ namespace cwg2083 { // cwg2083: partial } } #endif -} +} // namespace cwg2083 namespace cwg2091 { // cwg2091: 10 template<int &> struct X; @@ -448,6 +448,6 @@ namespace cwg2094 { // cwg2094: 5 static_assert(__is_trivially_assignable(A, const A&), ""); static_assert(__is_trivially_assignable(B, const B&), ""); -} +} // namespace cwg2094 // cwg2096: dup 2598 diff --git a/clang/test/CXX/drs/cwg21xx.cpp b/clang/test/CXX/drs/cwg21xx.cpp index 2800228748e6..42a7c4d7bbde 100644 --- a/clang/test/CXX/drs/cwg21xx.cpp +++ b/clang/test/CXX/drs/cwg21xx.cpp @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx98 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -Wno-deprecated-builtins -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected,cxx98-14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -64,9 +64,9 @@ namespace cwg2100 { // cwg2100: 12 template<int N> struct Y<N> { static const int declared_later = 0; }; -} +} // namespace cwg2100 -namespace cwg2103 { // cwg2103: yes +namespace cwg2103 { // cwg2103: 2.7 void f() { int a; int &r = a; // #cwg2103-r @@ -79,7 +79,7 @@ namespace cwg2103 { // cwg2103: yes } }; } -} +} // namespace cwg2103 namespace cwg2120 { // cwg2120: 7 struct A {}; @@ -90,7 +90,7 @@ namespace cwg2120 { // cwg2120: 7 static_assert(__is_standard_layout(B), ""); static_assert(__is_standard_layout(D), ""); static_assert(!__is_standard_layout(E), ""); -} +} // namespace cwg2120 namespace cwg2126 { // cwg2126: 12 #if __cplusplus >= 201103L @@ -142,7 +142,7 @@ namespace cwg2126 { // cwg2126: 12 // since-cxx11-note@#cwg21260-j {{temporary created here}} static_assert(k.a.n == 1, ""); #endif -} +} // namespace cwg2126 namespace cwg2137 { // cwg2137: 20 #if __cplusplus >= 201103L @@ -177,7 +177,7 @@ namespace cwg2137 { // cwg2137: 20 int z = g({ d }); #endif -} +} // namespace cwg2137 namespace cwg2140 { // cwg2140: 9 #if __cplusplus >= 201103L @@ -187,7 +187,7 @@ namespace cwg2140 { // cwg2140: 9 } static_assert(!test({123}), "u.b should be valid even when b is inactive"); #endif -} +} // namespace cwg2140 namespace cwg2141 { // cwg2141: 17 struct A{}; @@ -220,7 +220,7 @@ void foo() { // expected-error@-1 {{'E' cannot be defined in a type specifier}} } -} +} // namespace cwg2141 // cwg2149 is in cwg2149.cpp @@ -232,7 +232,7 @@ namespace cwg2157 { // cwg2157: 11 // since-cxx11-error@-1 {{ISO C++ only allows ':' in member enumeration declaration to introduce a fixed underlying type, not an anonymous bit-field}} }; #endif -} +} // namespace cwg2157 // cwg2165: na @@ -249,7 +249,7 @@ namespace cwg2170 { // cwg2170: 9 }; } #endif -} +} // namespace cwg2170 namespace cwg2171 { // cwg2171: 15 #if __cplusplus >= 201103L @@ -259,13 +259,13 @@ struct NonConstCopy { NonConstCopy &operator=(NonConstCopy &) = default; }; -static_assert(__has_trivial_copy(NonConstCopy), ""); +static_assert(__is_trivially_copyable(NonConstCopy), ""); static_assert(__is_trivially_constructible(NonConstCopy, NonConstCopy &), ""); static_assert(!__is_trivially_constructible(NonConstCopy, NonConstCopy), ""); static_assert(!__is_trivially_constructible(NonConstCopy, const NonConstCopy &), ""); static_assert(!__is_trivially_constructible(NonConstCopy, NonConstCopy &&), ""); -static_assert(__has_trivial_assign(NonConstCopy), ""); +static_assert(__is_trivially_assignable(NonConstCopy, NonConstCopy &), ""); static_assert(__is_trivially_assignable(NonConstCopy &, NonConstCopy &), ""); static_assert(!__is_trivially_assignable(NonConstCopy &, const NonConstCopy &), ""); static_assert(!__is_trivially_assignable(NonConstCopy &, NonConstCopy), ""); @@ -287,7 +287,7 @@ static_assert(!noexcept(typeid(*static_cast<D*>(nullptr))), ""); #endif } // namespace cwg2191 -namespace cwg2180 { // cwg2180: yes +namespace cwg2180 { // cwg2180: 3.0 class A { A &operator=(const A &); // #cwg2180-A-copy A &operator=(A &&); // #cwg2180-A-move @@ -315,7 +315,7 @@ namespace cwg2180 { // cwg2180: yes // cxx98-note@#cwg2180-A-move {{implicitly declared private here}} // since-cxx11-error@#cwg2180-B-move {{defaulting this move assignment operator would delete it after its first declaration}} // since-cxx11-note@#cwg2180-B {{move assignment operator of 'B' is implicitly deleted because base class 'A' has an inaccessible move assignment operator}} -} +} // namespace cwg2180 namespace cwg2199 { // cwg2199: 3.8 // NB: reusing part of cwg407 test @@ -343,4 +343,4 @@ namespace H { using namespace A; struct S s; } -} +} // namespace cwg2199 diff --git a/clang/test/CXX/drs/cwg22xx.cpp b/clang/test/CXX/drs/cwg22xx.cpp index 0614d4f34ad5..d93070ef3804 100644 --- a/clang/test/CXX/drs/cwg22xx.cpp +++ b/clang/test/CXX/drs/cwg22xx.cpp @@ -7,8 +7,8 @@ // RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -#if __cplusplus >= 201103L namespace cwg2211 { // cwg2211: 8 +#if __cplusplus >= 201103L void f() { int a; auto f = [a](int a) { (void)a; }; @@ -16,10 +16,10 @@ void f() { // since-cxx11-note@-2 {{variable 'a' is explicitly captured here}} auto g = [=](int a) { (void)a; }; } -} #endif +} // namespace cwg2211 -namespace cwg2213 { // cwg2213: yes +namespace cwg2213 { // cwg2213: 2.7 template <typename T, typename U> struct A; @@ -41,7 +41,7 @@ struct AnonBitfieldQualifiers { volatile unsigned i2 : 1; const volatile unsigned i3 : 1; }; -} +} // namespace cwg2229 namespace cwg2233 { // cwg2233: 11 #if __cplusplus >= 201103L @@ -153,7 +153,7 @@ D d1(c); const D &d2{c}; // FIXME ill-formed const D &d3(c); // FIXME ill-formed #endif -} +} // namespace cwg2267 namespace cwg2273 { // cwg2273: 3.3 #if __cplusplus >= 201103L @@ -170,7 +170,7 @@ B b; // since-cxx11-note@#cwg2273-B {{default constructor of 'B' is implicitly deleted because base class 'A' has a deleted default constructor}} // since-cxx11-note@#cwg2273-A {{'A' has been explicitly marked deleted here}} #endif -} +} // namespace cwg2273 namespace cwg2277 { // cwg2277: partial #if __cplusplus >= 201103L @@ -194,7 +194,7 @@ void g() { // since-cxx11-note@#cwg2277-B-f {{candidate function}} } #endif -} +} // namespace cwg2277 namespace cwg2292 { // cwg2292: 9 #if __cplusplus >= 201103L @@ -203,4 +203,4 @@ namespace cwg2292 { // cwg2292: 9 p->template id<int>::~id<int>(); } #endif -} +} // namespace cwg2292 diff --git a/clang/test/CXX/drs/cwg2335.cpp b/clang/test/CXX/drs/cwg2335.cpp index 8b00a9d2d98a..805c272f2f61 100644 --- a/clang/test/CXX/drs/cwg2335.cpp +++ b/clang/test/CXX/drs/cwg2335.cpp @@ -1,14 +1,12 @@ -// RUN: %clang_cc1 -std=c++98 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98-11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx98-11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors -#if __cplusplus <= 201103L -// expected-no-diagnostics -#endif +// cxx98-11-no-diagnostics namespace cwg2335 { // cwg2335: no drafting 2018-06 // FIXME: current consensus is that the examples are well-formed. diff --git a/clang/test/CXX/drs/cwg2353.cpp b/clang/test/CXX/drs/cwg2353.cpp new file mode 100644 index 000000000000..31dd5bdc9dd7 --- /dev/null +++ b/clang/test/CXX/drs/cwg2353.cpp @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s + +// expected-no-diagnostics + +namespace cwg2353 { // cwg2353: 9 + struct X { + static const int n = 0; + }; + + // CHECK: FunctionDecl {{.*}} use + int use(X x) { + // CHECK: MemberExpr {{.*}} .n + // CHECK-NOT: non_odr_use + // CHECK: DeclRefExpr {{.*}} 'x' + // CHECK-NOT: non_odr_use + return *&x.n; + } +#pragma clang __debug dump use + + // CHECK: FunctionDecl {{.*}} not_use + int not_use(X x) { + // CHECK: MemberExpr {{.*}} .n {{.*}} non_odr_use_constant + // CHECK: DeclRefExpr {{.*}} 'x' + return x.n; + } +#pragma clang __debug dump not_use + + // CHECK: FunctionDecl {{.*}} not_use_2 + int not_use_2(X *x) { + // CHECK: MemberExpr {{.*}} ->n {{.*}} non_odr_use_constant + // CHECK: DeclRefExpr {{.*}} 'x' + return x->n; + } +#pragma clang __debug dump not_use_2 +} // namespace cwg2353 diff --git a/clang/test/CXX/drs/cwg23xx.cpp b/clang/test/CXX/drs/cwg23xx.cpp index 7f57d237526b..d144cf9e4e86 100644 --- a/clang/test/CXX/drs/cwg23xx.cpp +++ b/clang/test/CXX/drs/cwg23xx.cpp @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s -// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx11-14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s -// RUN: %clang_cc1 -std=c++14 %s -verify=expected,cxx11-14,since-cxx11,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s -// RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s -// RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s -// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s -// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx11-14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 %s -verify=expected,cxx11-14,since-cxx11,since-cxx14 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors namespace std { __extension__ typedef __SIZE_TYPE__ size_t; @@ -16,8 +16,8 @@ namespace std { }; } -#if __cplusplus >= 201103L namespace cwg2303 { // cwg2303: 12 +#if __cplusplus >= 201103L template <typename... T> struct A; template <> @@ -54,8 +54,8 @@ void g() { struct cwg2303::F -> B -> A<int, int> struct cwg2303::F -> E -> A<int, int>}} */ } -} // namespace cwg2303 #endif +} // namespace cwg2303 namespace cwg2304 { // cwg2304: 2.8 template<typename T> void foo(T, int); @@ -191,10 +191,10 @@ auto j = std::initializer_list<InitListCtor>{ i }; // since-cxx17-error@-1 {{conversion function from 'std::initializer_list<InitListCtor>' to 'const cwg2311::InitListCtor' invokes a deleted function}} // since-cxx17-note@#cwg2311-InitListCtor {{'InitListCtor' has been explicitly marked deleted here}} #endif -} +} // namespace cwg2311 -#if __cplusplus >= 201103L namespace cwg2338 { // cwg2338: 12 +#if __cplusplus >= 201103L namespace B { enum E : bool { Zero, One }; static_assert((int)(E)2 == 1, ""); @@ -203,15 +203,15 @@ namespace D { enum class E : bool { Zero, One }; static_assert((int)(E)2 == 1, ""); } // namespace D -} // namespace cwg2338 #endif +} // namespace cwg2338 namespace cwg2346 { // cwg2346: 11 void test() { const int i2 = 0; extern void h2b(int x = i2 + 0); // ok, not odr-use } -} +} // namespace cwg2346 namespace cwg2351 { // cwg2351: 20 #if __cplusplus >= 201103L @@ -248,7 +248,7 @@ namespace cwg2351 { // cwg2351: 20 // cxx98-note@-2 {{to match this '('}} // cxx98-error@-3 {{expected expression}} #endif -} +} // namespace cwg2351 namespace cwg2352 { // cwg2352: 10 int **p; @@ -284,39 +284,7 @@ namespace cwg2352 { // cwg2352: 10 #if __cplusplus >= 201103L static_assert(&p == &check_f, ""); #endif -} - -namespace cwg2353 { // cwg2353: 9 - struct X { - static const int n = 0; - }; - - // CHECK: FunctionDecl {{.*}} use - int use(X x) { - // CHECK: MemberExpr {{.*}} .n - // CHECK-NOT: non_odr_use - // CHECK: DeclRefExpr {{.*}} 'x' - // CHECK-NOT: non_odr_use - return *&x.n; - } -#pragma clang __debug dump use - - // CHECK: FunctionDecl {{.*}} not_use - int not_use(X x) { - // CHECK: MemberExpr {{.*}} .n {{.*}} non_odr_use_constant - // CHECK: DeclRefExpr {{.*}} 'x' - return x.n; - } -#pragma clang __debug dump not_use - - // CHECK: FunctionDecl {{.*}} not_use_2 - int not_use_2(X *x) { - // CHECK: MemberExpr {{.*}} ->n {{.*}} non_odr_use_constant - // CHECK: DeclRefExpr {{.*}} 'x' - return x->n; - } -#pragma clang __debug dump not_use_2 -} +} // namespace cwg2352 namespace cwg2354 { // cwg2354: 15 #if __cplusplus >= 201103L @@ -350,22 +318,22 @@ B b2 = static_cast<B&&>(b1); // calls #3: #1, #2, and #4 are not viable struct C { operator B&&(); }; B b3 = C(); // calls #3 #endif -} +} // namespace cwg2356 -#if __cplusplus >= 201402L namespace cwg2358 { // cwg2358: 16 +#if __cplusplus >= 201402L void f2() { int i = 1; void g1(int = [xxx=1] { return xxx; }()); // OK void g2(int = [xxx=i] { return xxx; }()); // since-cxx14-error@-1 {{default argument references local variable 'i' of enclosing function}} } -} #endif +} // namespace cwg2358 // CWG2363 was closed as NAD, but its resolution does affirm that // a friend declaration cannot have an opaque-enumm-specifier. -namespace cwg2363 { // cwg2363: yes +namespace cwg2363 { // cwg2363: 19 #if __cplusplus >= 201103L enum class E0; enum E1 : int; @@ -373,26 +341,26 @@ enum E1 : int; struct A { friend enum class E0; // since-cxx11-error@-1 {{reference to enumeration must use 'enum' not 'enum class'}} - // expected-error@-2 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-3 {{remove 'enum class' to befriend an enum}} + // since-cxx11-error@-2 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-3 {{remove 'enum class' to befriend an enum}} friend enum E0; - // expected-error@-1 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-2 {{remove 'enum' to befriend an enum}} + // since-cxx11-error@-1 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-2 {{remove 'enum' to befriend an enum}} friend enum class E1; // since-cxx11-error@-1 {{reference to enumeration must use 'enum' not 'enum class'}} - // expected-error@-2 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-3 {{remove 'enum class' to befriend an enum}} + // since-cxx11-error@-2 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-3 {{remove 'enum class' to befriend an enum}} friend enum E1; - // expected-error@-1 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-2 {{remove 'enum' to befriend an enum}} + // since-cxx11-error@-1 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-2 {{remove 'enum' to befriend an enum}} friend enum class E2; // since-cxx11-error@-1 {{reference to enumeration must use 'enum' not 'enum class'}} - // expected-error@-2 {{elaborated enum specifier cannot be declared as a friend}} - // expected-note@-3 {{remove 'enum class' to befriend an enum}} + // since-cxx11-error@-2 {{elaborated enum specifier cannot be declared as a friend}} + // since-cxx11-note@-3 {{remove 'enum class' to befriend an enum}} }; #endif } // namespace cwg2363 @@ -411,11 +379,11 @@ class C { }; } // namespace cwg2370 -#if __cplusplus >= 201702L +namespace cwg2386 { // cwg2386: 9 // Otherwise, if the qualified-id std::tuple_size<E> names a complete class // type **with a member value**, the expression std::tuple_size<E>::value shall // be a well-formed integral constant expression -namespace cwg2386 { // cwg2386: 9 +#if __cplusplus >= 201702L struct Bad1 { int a, b; }; struct Bad2 { int a, b; }; } // namespace cwg2386 @@ -430,8 +398,8 @@ namespace cwg2386 { void no_value() { auto [x, y] = Bad1(); } void wrong_value() { auto [x, y] = Bad2(); } // since-cxx17-error@-1 {{type 'Bad2' decomposes into 42 elements, but only 2 names were provided}} -} // namespace cwg2386 #endif +} // namespace cwg2386 // cwg2385: na @@ -451,7 +419,7 @@ namespace cwg2387 { // cwg2387: 9 extern template int d<int>; extern template const int d<const int>; #endif -} +} // namespace cwg2387 namespace cwg2390 { // cwg2390: 14 // Test that macro expansion of the builtin argument works. @@ -499,7 +467,7 @@ const A a; struct B { const A a; }; B b; -} +} // namespace cwg2394 namespace cwg2396 { // cwg2396: no struct A { @@ -515,16 +483,15 @@ namespace cwg2396 { // cwg2396: no // void f(A a) { a.operator B B::*(); } // void g(A a) { a.operator decltype(B()) B::*(); } // void g2(A a) { a.operator B decltype(B())::*(); } -} +} // namespace cwg2396 -#if __cplusplus >= 201103L namespace cwg2397 { // cwg2397: 17 +#if __cplusplus >= 201103L void foo() { int a[5]; auto (&b)[5] = a; auto (*c)[5] = &a; } -} // namespace cwg2397 - #endif +} // namespace cwg2397 diff --git a/clang/test/CXX/drs/cwg24xx.cpp b/clang/test/CXX/drs/cwg24xx.cpp index 79e9d031ef41..9c9a3f14b9e8 100644 --- a/clang/test/CXX/drs/cwg24xx.cpp +++ b/clang/test/CXX/drs/cwg24xx.cpp @@ -2,9 +2,9 @@ // RUN: %clang_cc1 -std=c++11 -pedantic-errors %s -verify=expected,cxx98-14 // RUN: %clang_cc1 -std=c++14 -pedantic-errors %s -verify=expected,cxx98-14 // RUN: %clang_cc1 -std=c++17 -pedantic-errors %s -verify=expected,since-cxx17 -// RUN: %clang_cc1 -std=c++20 -pedantic-errors %s -verify=expected,since-cxx17 -// RUN: %clang_cc1 -std=c++23 -pedantic-errors %s -verify=expected,since-cxx17 -// RUN: %clang_cc1 -std=c++2c -pedantic-errors %s -verify=expected,since-cxx17 +// RUN: %clang_cc1 -std=c++20 -pedantic-errors %s -verify=expected,since-cxx20,since-cxx17 +// RUN: %clang_cc1 -std=c++23 -pedantic-errors %s -verify=expected,since-cxx20,since-cxx17 +// RUN: %clang_cc1 -std=c++2c -pedantic-errors %s -verify=expected,since-cxx20,since-cxx17 namespace cwg2406 { // cwg2406: 5 #if __cplusplus >= 201703L @@ -39,7 +39,7 @@ void fallthrough(int n) { } } #endif -} +} // namespace cwg2406 namespace cwg2428 { // cwg2428: 19 #if __cplusplus >= 202002L @@ -48,45 +48,45 @@ concept C [[deprecated]] = true; // #cwg2428-C template <typename> [[deprecated]] concept C2 = true; -// expected-error@-1 {{expected unqualified-id}} +// since-cxx20-error@-1 {{expected unqualified-id}} template <typename T> concept C3 = C<T>; -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} template <typename T, C U> -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} requires C<T> -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} void f() { bool b = C<int>; - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} }; void g(C auto a) {}; -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} template <typename T> auto h() -> C auto { -// expected-warning@-1 {{'C' is deprecated}} -// expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} +// since-cxx20-warning@-1 {{'C' is deprecated}} +// since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto foo = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto *bar = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto &baz = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} C auto &&quux = T(); - // expected-warning@-1 {{'C' is deprecated}} - // expected-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} + // since-cxx20-warning@-1 {{'C' is deprecated}} + // since-cxx20-note@#cwg2428-C {{'C' has been explicitly marked deprecated here}} return foo; } #endif @@ -110,7 +110,7 @@ f<{.a= 0}>(); } #endif -} +} // namespace cwg2450 namespace cwg2459 { // cwg2459: 18 #if __cplusplus >= 202302L @@ -120,7 +120,7 @@ struct A { template<A> struct X {}; X<1> x; #endif -} +} // namespace cwg2459 namespace cwg2445 { // cwg2445: 19 #if __cplusplus >= 202002L @@ -181,7 +181,7 @@ namespace cwg2445 { // cwg2445: 19 return d + 1; } #endif -} +} // namespace cwg2445 namespace cwg2486 { // cwg2486: 4 c++17 struct C { diff --git a/clang/test/CXX/drs/cwg2504.cpp b/clang/test/CXX/drs/cwg2504.cpp index fa775df327cb..535ef9b8a7c4 100644 --- a/clang/test/CXX/drs/cwg2504.cpp +++ b/clang/test/CXX/drs/cwg2504.cpp @@ -21,7 +21,7 @@ struct B : A { struct C : B {}; void foo() { C c; } // bar is not invoked, because the V subobject is not initialized as part of B #endif -} +} // namespace cwg2504 // FIXME: As specified in the comment above (which comes from an example in the Standard), // we are not supposed to unconditionally call `bar()` and call a constructor diff --git a/clang/test/CXX/drs/cwg25xx.cpp b/clang/test/CXX/drs/cwg25xx.cpp index 87a728088ee6..d9a7d2bbb267 100644 --- a/clang/test/CXX/drs/cwg25xx.cpp +++ b/clang/test/CXX/drs/cwg25xx.cpp @@ -71,7 +71,7 @@ int test_specialization() { } #endif -} +} // namespace cwg2518 namespace cwg2521 { // cwg2521: 17 #if __cplusplus >= 201103L @@ -86,8 +86,8 @@ operator"" _div(); // since-cxx11-warning@-1 {{identifier '_div' preceded by whitespace in a literal operator declaration is deprecated}} using ::cwg2521::operator"" _\u03C0___; +// since-cxx11-warning@-1 {{identifier '_π___' preceded by whitespace in a literal operator declaration is deprecated}} using ::cwg2521::operator""_div; -// since-cxx11-warning@-2 {{identifier '_π___' preceded by whitespace in a literal operator declaration is deprecated}} long double operator"" _RESERVED(long double); // since-cxx11-warning@-1 {{identifier '_RESERVED' preceded by whitespace in a literal operator declaration is deprecated}} @@ -120,8 +120,8 @@ struct S2 { #endif } // namespace cwg2547 -#if __cplusplus >= 202302L namespace cwg2553 { // cwg2553: 18 review 2023-07-14 +#if __cplusplus >= 202302L struct B { virtual void f(this B&); // since-cxx23-error@-1 {{an explicit object parameter cannot appear in a virtual function}} @@ -134,12 +134,11 @@ struct D : B { // since-cxx23-error@-1 {{an explicit object parameter cannot appear in a virtual function}} // since-cxx23-note@#cwg2553-g {{overridden virtual function is here}} }; - -} #endif +} // namespace cwg2553 -#if __cplusplus >= 202302L namespace cwg2554 { // cwg2554: 18 review 2021-12-10 +#if __cplusplus >= 202302L struct B { virtual void f(); // #cwg2554-g }; @@ -161,12 +160,11 @@ struct D3 : B { // since-cxx23-error@-1 {{an explicit object parameter cannot appear in a virtual function}} // since-cxx23-note@#cwg2554-g {{overridden virtual function is here}} }; - -} #endif +} // namespace cwg2554 -#if __cplusplus >= 202302L namespace cwg2561 { // cwg2561: no +#if __cplusplus >= 202302L struct C { constexpr C(auto) { } }; @@ -178,10 +176,8 @@ void foo() { static_assert(fp(1) == 1); static_assert((&decltype(b)::operator())(1) == 1); } - -} #endif - +} // namespace cwg2561 namespace cwg2565 { // cwg2565: 16 open 2023-06-07 #if __cplusplus >= 202002L @@ -210,7 +206,7 @@ namespace cwg2565 { // cwg2565: 16 open 2023-06-07 struct TwoParamsStruct{}; using TPSU = TwoParamsStruct<void, void>; - // since-cxx20-error@-1 {{constraints not satisfied for class template 'TwoParamsStruct'}} + // since-cxx20-error@-1 {{constraints not satisfied for class template 'TwoParamsStruct' [with T = void, U = void]}} // since-cxx20-note@#cwg2565-TPSREQ {{because 'TwoParams<void, void>' evaluated to false}} // since-cxx20-note@#cwg2565-TPC {{because 'b' would be invalid: argument may not have 'void' type}} @@ -222,15 +218,15 @@ namespace cwg2565 { // cwg2565: 16 open 2023-06-07 struct VariadicStruct{}; using VSU = VariadicStruct<void, int, char, double>; - // since-cxx20-error@-1 {{constraints not satisfied for class template 'VariadicStruct'}} + // since-cxx20-error@-1 {{constraints not satisfied for class template 'VariadicStruct' [with T = void, U = <int, char, double>]}} // since-cxx20-note@#cwg2565-VSREQ {{because 'Variadic<void, int, char, double>' evaluated to false}} // since-cxx20-note@#cwg2565-VC {{because 'b' would be invalid: argument may not have 'void' type}} template<typename T> concept ErrorRequires = requires (ErrorRequires auto x) { - // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} \ - // since-cxx20-error@-1 {{'auto' not allowed in requires expression parameter}} \ - // since-cxx20-note@-1 {{declared here}} + // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} + // since-cxx20-note@-2 {{declared here}} + // since-cxx20-error@-3 {{'auto' not allowed in requires expression parameter}} x; }; static_assert(ErrorRequires<int>); @@ -238,20 +234,20 @@ namespace cwg2565 { // cwg2565: 16 open 2023-06-07 // since-cxx20-note@-2 {{because substituted constraint expression is ill-formed: constraint depends on a previously diagnosed expression}} template<typename T> - concept NestedErrorInRequires = requires (T x) { // - // since-cxx20-note@-1 {{declared here}} + concept NestedErrorInRequires = requires (T x) { // #cwg2565-NEIR requires requires (NestedErrorInRequires auto y) { - // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} \ - // since-cxx20-error@-1 {{'auto' not allowed in requires expression parameter}} + // since-cxx20-error@-1 {{a concept definition cannot refer to itself}} + // since-cxx20-note@#cwg2565-NEIR {{declared here}} + // since-cxx20-error@-3 {{'auto' not allowed in requires expression parameter}} y; }; }; static_assert(NestedErrorInRequires<int>); - // expected-error@-1 {{static assertion failed}} - // expected-note@-2 {{because substituted constraint expression is ill-formed: constraint depends on a previously diagnosed expression}} + // since-cxx20-error@-1 {{static assertion failed}} + // since-cxx20-note@-2 {{because substituted constraint expression is ill-formed: constraint depends on a previously diagnosed expression}} #endif -} +} // namespace cwg2565 namespace cwg2583 { // cwg2583: 19 #if __cplusplus >= 201103L @@ -290,10 +286,10 @@ struct X { // e.g., "if an explicit object parameter is used it must be of type reference to 'X'" X& operator=(this int, const X&) = default; // since-cxx23-warning@-1 {{explicitly defaulted copy assignment operator is implicitly deleted}} - // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} + // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} X& operator=(this X, const X&) = default; // since-cxx23-warning@-1 {{explicitly defaulted copy assignment operator is implicitly deleted}} - // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} + // since-cxx23-note@-2 {{function is implicitly deleted because its declared type does not match the type of an implicit copy assignment operator}} }; struct Y { void operator=(this int, const Y&); // This is copy constructor, suppresses implicit declaration @@ -372,8 +368,5 @@ union U { }; static_assert(!__is_literal(U), ""); #endif - - - #endif -} +} // namespace cwg2598 diff --git a/clang/test/CXX/drs/cwg26xx.cpp b/clang/test/CXX/drs/cwg26xx.cpp index 63a954c803b7..efc49b0b502a 100644 --- a/clang/test/CXX/drs/cwg26xx.cpp +++ b/clang/test/CXX/drs/cwg26xx.cpp @@ -33,7 +33,7 @@ namespace std { static_assert(sizeof(int16_t) == 2 && sizeof(int32_t) == 4 && sizeof(int64_t) == 8, "Some tests rely on these sizes"); template<typename T> T declval(); -} +} // namespace std namespace cwg2621 { // cwg2621: sup 2877 #if __cplusplus >= 202002L @@ -49,7 +49,7 @@ int E; // ignored by type-only lookup using enum E; } #endif -} +} // namespace cwg2621 namespace cwg2627 { // cwg2627: 20 #if __cplusplus >= 202002L @@ -155,7 +155,7 @@ void f() { // FIXME-since-cxx20-note@#cwg2628-ctor {{marked deleted here}} } #endif -} +} // namespace cwg2628 // cwg2630 is in cwg2630.cpp @@ -175,7 +175,7 @@ namespace cwg2631 { // cwg2631: 16 return k(); } #endif -} +} // namespace cwg2631 namespace cwg2635 { // cwg2635: 16 #if __cplusplus >= 202002L @@ -205,7 +205,7 @@ void TemplUse() { // since-cxx20-error@-1 {{decomposition declaration cannot be declared with constrained 'auto'}} } #endif -} +} // namespace cwg2635 // cwg2636: na @@ -230,7 +230,7 @@ int y = cwg2640_a\N{LOTUS}); // expected-error@-1 {{character <U+1FAB7> not allowed in an identifier}} // expected-error@-2 {{use of undeclared identifier 'cwg2640_a🪷'}} // expected-error@-3 {{extraneous ')' before ';'}} -} +} // namespace cwg2640 // cwg2642: na @@ -243,10 +243,10 @@ auto z = [a = 42](int a) { return 1; }; #endif -} +} // namespace cwg2644 -#if __cplusplus >= 202302L namespace cwg2650 { // cwg2650: 17 +#if __cplusplus >= 202302L template <class T, T> struct S {}; template <class T> int f(S<T, T{}>*); // #cwg2650-f class X { @@ -255,17 +255,17 @@ class X { int i0 = f<X>(0); // since-cxx23-error@-1 {{no matching function for call to 'f'}} // since-cxx23-note@#cwg2650-f {{type 'X' of non-type template parameter is not a structural type}} -} #endif +} // namespace cwg2650 -#if __cplusplus >= 202302L namespace cwg2653 { // cwg2653: 18 +#if __cplusplus >= 202302L struct Test { void f(this const auto& = Test{}); }; // since-cxx23-error@-1 {{the explicit object parameter cannot have a default argument}} auto L = [](this const auto& = Test{}){}; // since-cxx23-error@-1 {{the explicit object parameter cannot have a default argument}} -} #endif +} // namespace cwg2653 namespace cwg2654 { // cwg2654: 16 void f() { @@ -275,7 +275,7 @@ void f() { brachiosaur -= neck; // OK brachiosaur |= neck; // OK } -} +} // namespace cwg2654 namespace cwg2681 { // cwg2681: 17 #if __cplusplus >= 202002L @@ -308,7 +308,7 @@ J j = { "ghi" }; // since-cxx20-note@#cwg2681-J {{candidate function template not viable: requires 0 arguments, but 1 was provided}} // since-cxx20-note@#cwg2681-J {{implicit deduction guide declared as 'template <size_t N> J() -> J<N>'}} #endif -} +} // namespace cwg2681 namespace cwg2672 { // cwg2672: 18 #if __cplusplus >= 202002L @@ -333,10 +333,10 @@ void m() { bar(0); } #endif -} +} // namespace cwg2672 -#if __cplusplus >= 202302L namespace cwg2687 { // cwg2687: 18 +#if __cplusplus >= 202302L struct S{ void f(int); static void g(int); @@ -349,9 +349,8 @@ void test() { (&S::g)(1); (&S::h)(S(), 1); } -} #endif - +} // namespace cwg2687 namespace cwg2692 { // cwg2692: 19 #if __cplusplus >= 202302L @@ -365,16 +364,13 @@ namespace cwg2692 { // cwg2692: 19 void A::g() { (&A::f)(A()); - // expected-error@-1 {{call to 'f' is ambiguous}} - // expected-note@#cwg2692-1 {{candidate}} - // expected-note@#cwg2692-2 {{candidate}} - - - + // since-cxx23-error@-1 {{call to 'f' is ambiguous}} + // since-cxx23-note@#cwg2692-1 {{candidate function}} + // since-cxx23-note@#cwg2692-2 {{candidate function}} (&A::f)(); - // expected-error@-1 {{no matching function for call to 'f'}} - // expected-note@#cwg2692-1 {{candidate function not viable: requires 1 argument, but 0 were provided}} - // expected-note@#cwg2692-2 {{candidate function not viable: requires 1 argument, but 0 were provided}} + // since-cxx23-error@-1 {{no matching function for call to 'f'}} + // since-cxx23-note@#cwg2692-1 {{candidate function not viable: requires 1 argument, but 0 were provided}} + // since-cxx23-note@#cwg2692-2 {{candidate function not viable: requires 1 argument, but 0 were provided}} } #endif -} +} // namespace cwg2692 diff --git a/clang/test/CXX/drs/cwg273.cpp b/clang/test/CXX/drs/cwg273.cpp new file mode 100644 index 000000000000..532f1a1abb73 --- /dev/null +++ b/clang/test/CXX/drs/cwg273.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -std=c++98 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors + +// expected-no-diagnostics + +#include <stdarg.h> +#include <stddef.h> +namespace cwg273 { // cwg273: 2.7 + struct A { + int n; + }; + void operator&(A); + void f(A a, ...) { + offsetof(A, n); + va_list val; + va_start(val, a); + va_end(val); + } +} // namespace cwg273 diff --git a/clang/test/CXX/drs/cwg2771.cpp b/clang/test/CXX/drs/cwg2771.cpp index 474660aa2844..2dd446ac0614 100644 --- a/clang/test/CXX/drs/cwg2771.cpp +++ b/clang/test/CXX/drs/cwg2771.cpp @@ -1,4 +1,10 @@ -// RUN: %clang_cc1 -std=c++23 %s -ast-dump | FileCheck --check-prefixes=CXX23 %s +// RUN: %clang_cc1 -std=c++98 %s -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++11 %s -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++14 %s -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++17 %s -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++20 %s -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++23 %s -ast-dump | FileCheck %s +// RUN: %clang_cc1 -std=c++2c %s -ast-dump | FileCheck %s namespace cwg2771 { // cwg2771: 18 @@ -8,12 +14,12 @@ struct A{ int* r = &a; } }; -// CXX23: CXXMethodDecl{{.+}}cwg2771 -// CXX23-NEXT: CompoundStmt -// CXX23-NEXT: DeclStmt -// CXX23-NEXT: VarDecl -// CXX23-NEXT: UnaryOperator -// CXX23-NEXT: MemberExpr -// CXX23-NEXT: CXXThisExpr{{.+}}'cwg2771::A *' +// CHECK: CXXMethodDecl{{.+}}cwg2771 +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: UnaryOperator +// CHECK-NEXT: MemberExpr +// CHECK-NEXT: CXXThisExpr{{.+}}'cwg2771::A *' } // namespace cwg2771 diff --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp index fb5c8b1d1fbf..a87d26dfc9ac 100644 --- a/clang/test/CXX/drs/cwg27xx.cpp +++ b/clang/test/CXX/drs/cwg27xx.cpp @@ -204,7 +204,7 @@ void test() { // since-cxx23-note@#cwg2789-g2 {{candidate function}} } #endif -} +} // namespace cwg2789 namespace cwg2798 { // cwg2798: 17 #if __cplusplus > 202302L diff --git a/clang/test/CXX/drs/cwg28xx.cpp b/clang/test/CXX/drs/cwg28xx.cpp index ff625a4a985b..caa9b0f1f505 100644 --- a/clang/test/CXX/drs/cwg28xx.cpp +++ b/clang/test/CXX/drs/cwg28xx.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -std=c++98 -pedantic-errors -verify=expected,cxx98 %s -// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected,since-cxx20 %s -// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected,since-cxx20,since-cxx23 %s -// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s +// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected,since-cxx11,cxx11-23 %s +// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected,since-cxx11,cxx11-23 %s +// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected,since-cxx11,cxx11-23 %s +// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected,since-cxx11,cxx11-23,since-cxx20 %s +// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected,since-cxx11,cxx11-23,since-cxx20,since-cxx23 %s +// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected,since-cxx11,since-cxx20,since-cxx23,since-cxx26 %s int main() {} // required for cwg2811 @@ -14,14 +14,14 @@ namespace cwg2811 { // cwg2811: 3.5 void f() { (void)[&] { using T = decltype(main); - // expected-error@-1 {{referring to 'main' within an expression is a Clang extension}} + // since-cxx11-error@-1 {{referring to 'main' within an expression is a Clang extension}} }; using T2 = decltype(main); - // expected-error@-1 {{referring to 'main' within an expression is a Clang extension}} + // since-cxx11-error@-1 {{referring to 'main' within an expression is a Clang extension}} } using T = decltype(main); -// expected-error@-1 {{referring to 'main' within an expression is a Clang extension}} +// since-cxx11-error@-1 {{referring to 'main' within an expression is a Clang extension}} int main(); @@ -47,14 +47,19 @@ void f() { #endif } // namespace cwg2813 -namespace cwg2819 { // cwg2819: 19 tentatively ready 2023-12-01 - -#if __cpp_constexpr >= 202306L +namespace cwg2819 { // cwg2819: 19 c++26 +#if __cplusplus >= 201103L + // CWG 2024-04-19: This issue is not a DR. constexpr void* p = nullptr; - constexpr int* q = static_cast<int*>(p); - static_assert(q == nullptr); + constexpr int* q = static_cast<int*>(p); // #cwg2819-q + // cxx11-23-error@-1 {{constexpr variable 'q' must be initialized by a constant expression}} + // cxx11-23-note@-2 {{cast from 'void *' is not allowed in a constant expression}} + static_assert(q == nullptr, ""); + // cxx11-23-error@-1 {{static assertion expression is not an integral constant expression}} + // cxx11-23-note@-2 {{initializer of 'q' is not a constant expression}} + // cxx11-23-note@#cwg2819-q {{declared here}} #endif -} +} // namespace cwg2819 namespace cwg2847 { // cwg2847: 19 review 2024-03-01 @@ -145,7 +150,7 @@ struct A { // FIXME: The index of the pack-index-specifier is printed as a memory address in the diagnostic. template<typename U> friend struct Ts...[0]::C; - // expected-warning-re@-1 {{dependent nested name specifier 'Ts...[{{.*}}]::' for friend template declaration is not supported; ignoring this friend declaration}} + // since-cxx26-warning@-1 {{dependent nested name specifier 'Ts...[0]::' for friend template declaration is not supported; ignoring this friend declaration}} }; #endif @@ -169,9 +174,7 @@ void g() { } // namespace cwg2877 namespace cwg2881 { // cwg2881: 19 - #if __cplusplus >= 202302L - template <typename T> struct A : T {}; template <typename T> struct B : T {}; template <typename T> struct C : virtual T { C(T t) : T(t) {} }; @@ -183,12 +186,12 @@ struct O1 : A<Ts>, B<Ts> { using B<Ts>::operator(); }; -template <typename Ts> struct O2 : protected Ts { // expected-note {{declared protected here}} +template <typename Ts> struct O2 : protected Ts { // #cwg2881-O2 using Ts::operator(); O2(Ts ts) : Ts(ts) {} }; -template <typename Ts> struct O3 : private Ts { // expected-note {{declared private here}} +template <typename Ts> struct O3 : private Ts { // #cwg2881-O3 using Ts::operator(); O3(Ts ts) : Ts(ts) {} }; @@ -212,7 +215,7 @@ struct O5 : private C<Ts>, D<Ts> { // This is only invalid if we call T's call operator. template <typename T, typename U> -struct O6 : private T, U { // expected-note {{declared private here}} +struct O6 : private T, U { // #cwg2881-O6 using T::operator(); using U::operator(); O6(T t, U u) : T(t), U(u) {} @@ -222,14 +225,26 @@ void f() { int x; auto L1 = [=](this auto&& self) { (void) &x; }; auto L2 = [&](this auto&& self) { (void) &x; }; - O1<decltype(L1)>{L1, L1}(); // expected-error {{inaccessible due to ambiguity}} - O1<decltype(L2)>{L2, L2}(); // expected-error {{inaccessible due to ambiguity}} - O2{L1}(); // expected-error {{must derive publicly from the lambda}} - O3{L1}(); // expected-error {{must derive publicly from the lambda}} + O1<decltype(L1)>{L1, L1}(); + /* since-cxx23-error-re@-1 {{inaccessible due to ambiguity: + struct cwg2881::O1<class (lambda at {{.+}})> -> A<(lambda at {{.+}})> -> class (lambda at {{.+}}) + struct cwg2881::O1<class (lambda at {{.+}})> -> B<(lambda at {{.+}})> -> class (lambda at {{.+}})}}*/ + O1<decltype(L2)>{L2, L2}(); + /* since-cxx23-error-re@-1 {{inaccessible due to ambiguity: + struct cwg2881::O1<class (lambda at {{.+}})> -> A<(lambda at {{.+}})> -> class (lambda at {{.+}}) + struct cwg2881::O1<class (lambda at {{.+}})> -> B<(lambda at {{.+}})> -> class (lambda at {{.+}})}}*/ + O2{L1}(); + // since-cxx23-error-re@-1 {{invalid explicit object parameter type 'cwg2881::O2<(lambda at {{.+}})>' in lambda with capture; the type must derive publicly from the lambda}} + // since-cxx23-note@#cwg2881-O2 {{declared protected here}} + O3{L1}(); + // since-cxx23-error-re@-1 {{invalid explicit object parameter type 'cwg2881::O3<(lambda at {{.+}})>' in lambda with capture; the type must derive publicly from the lambda}} + // since-cxx23-note@#cwg2881-O3 {{declared private here}} O4{L1}(); O5{L1}(); O6 o{L1, L2}; - o.decltype(L1)::operator()(); // expected-error {{must derive publicly from the lambda}} + o.decltype(L1)::operator()(); + // since-cxx23-error-re@-1 {{invalid explicit object parameter type 'cwg2881::O6<(lambda at {{.+}}), (lambda at {{.+}})>' in lambda with capture; the type must derive publicly from the lambda}} + // since-cxx23-note@#cwg2881-O6 {{declared private here}} o.decltype(L1)::operator()(); // No error here because we've already diagnosed this method. o.decltype(L2)::operator()(); } @@ -238,12 +253,14 @@ void f2() { int x = 0; auto lambda = [x] (this auto self) { return x; }; using Lambda = decltype(lambda); - struct D : private Lambda { // expected-note {{declared private here}} + struct D : private Lambda { // #cwg2881-D D(Lambda l) : Lambda(l) {} using Lambda::operator(); friend Lambda; } d(lambda); - d(); // expected-error {{must derive publicly from the lambda}} + d(); + // since-cxx23-error@-1 {{invalid explicit object parameter type 'D' in lambda with capture; the type must derive publicly from the lambda}} + // since-cxx23-note@#cwg2881-D {{declared private here}} } template <typename L> @@ -258,18 +275,20 @@ struct Indirect : T { }; template<typename T> -struct Ambiguous : Indirect<T>, T { // expected-warning {{is inaccessible due to ambiguity}} +struct Ambiguous : Indirect<T>, T { +/* since-cxx23-warning-re@-1 {{direct base '(lambda at {{.+}})' is inaccessible due to ambiguity: + struct cwg2881::Ambiguous<class (lambda at {{.+}})> -> Indirect<(lambda at {{.+}})> -> class (lambda at {{.+}}) + struct cwg2881::Ambiguous<class (lambda at {{.+}})> -> class (lambda at {{.+}})}}*/ +// since-cxx23-note-re@#cwg2881-f4 {{in instantiation of template class 'cwg2881::Ambiguous<(lambda at {{.+}})>' requested here}} +// since-cxx34-note-re@#cwg2881-f4-call {{while substituting deduced template arguments into function template 'f4' [with L = (lambda at {{.+}})]}} using Indirect<T>::operator(); }; template <typename L> -constexpr auto f3(L l) -> decltype(Private<L>{l}()) { return l(); } -// expected-note@-1 {{must derive publicly from the lambda}} +constexpr auto f3(L l) -> decltype(Private<L>{l}()) { return l(); } // #cwg2881-f3 template <typename L> -constexpr auto f4(L l) -> decltype(Ambiguous<L>{{l}, l}()) { return l(); } -// expected-note@-1 {{is inaccessible due to ambiguity}} -// expected-note@-2 {{in instantiation of template class}} +constexpr auto f4(L l) -> decltype(Ambiguous<L>{{l}, l}()) { return l(); } // #cwg2881-f4 template<typename T> concept is_callable = requires(T t) { { t() }; }; @@ -277,15 +296,19 @@ concept is_callable = requires(T t) { { t() }; }; void g() { int x = 0; auto lambda = [x](this auto self) {}; - f3(lambda); // expected-error {{no matching function for call to 'f3'}} - f4(lambda); // expected-error {{no matching function for call to 'f4'}} - // expected-note@-1 {{while substituting deduced template arguments into function template 'f4'}} + f3(lambda); + // since-cxx23-error@-1 {{no matching function for call to 'f3'}} + // since-cxx23-note-re@#cwg2881-f3 {{candidate template ignored: substitution failure [with L = (lambda at {{.+}})]: invalid explicit object parameter type 'cwg2881::Private<(lambda at {{.+}})>' in lambda with capture; the type must derive publicly from the lambda}} + f4(lambda); // #cwg2881-f4-call + // expected-error@-1 {{no matching function for call to 'f4'}} + // expected-note-re@-2 {{while substituting deduced template arguments into function template 'f4' [with L = (lambda at {{.+}})]}} + /* expected-note-re@#cwg2881-f4 {{candidate template ignored: substitution failure [with L = (lambda at {{.+}})]: lambda '(lambda at {{.+}})' is inaccessible due to ambiguity: + struct cwg2881::Ambiguous<class (lambda at {{.+}})> -> Indirect<(lambda at {{.+}})> -> class (lambda at {{.+}}) + struct cwg2881::Ambiguous<class (lambda at {{.+}})> -> class (lambda at {{.+}})}}*/ static_assert(!is_callable<Private<decltype(lambda)>>); static_assert(!is_callable<Ambiguous<decltype(lambda)>>); } - #endif - } // namespace cwg2881 namespace cwg2882 { // cwg2882: 2.7 diff --git a/clang/test/CXX/drs/cwg29xx.cpp b/clang/test/CXX/drs/cwg29xx.cpp index 9629bdd41a2a..aeb62b8d6871 100644 --- a/clang/test/CXX/drs/cwg29xx.cpp +++ b/clang/test/CXX/drs/cwg29xx.cpp @@ -1,12 +1,14 @@ // RUN: %clang_cc1 -std=c++98 -pedantic-errors -verify=expected,cxx98 %s -// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected %s +// RUN: %clang_cc1 -std=c++11 -pedantic-errors -verify=expected,since-cxx11 %s +// RUN: %clang_cc1 -std=c++14 -pedantic-errors -verify=expected,since-cxx11 %s +// RUN: %clang_cc1 -std=c++17 -pedantic-errors -verify=expected,since-cxx11 %s +// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify=expected,since-cxx11,since-cxx20 %s +// RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected,since-cxx11,since-cxx20,since-cxx23 %s +// RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected,since-cxx11,since-cxx20,since-cxx23,since-cxx26 %s -namespace cwg2913 { // cwg2913: 20 tentatively ready 2024-08-16 +// cxx98-no-diagnostics + +namespace cwg2913 { // cwg2913: 20 #if __cplusplus >= 202002L @@ -20,60 +22,66 @@ template<typename T> R(T) -> R<T> requires true; template<typename T> -R(T, T) requires true -> R<T>; // expected-error {{expected function body after function declarator}} +R(T, T) requires true -> R<T>; +// since-cxx20-error@-1 {{expected function body after function declarator}} #endif } // namespace cwg2913 -namespace cwg2915 { // cwg2915: 20 tentatively ready 2024-08-16 +namespace cwg2915 { // cwg2915: 20 #if __cplusplus >= 202302L struct A { - void f(this void); // expected-error {{explicit object parameter cannot have 'void' type}} + void f(this void); + // since-cxx23-error@-1 {{explicit object parameter cannot have 'void' type}} }; #endif -} +} // namespace cwg2915 namespace cwg2917 { // cwg2917: 20 review 2024-07-30 +#if __cplusplus >= 201103L template <typename> class Foo; -template<class ...> // cxx98-error {{variadic templates are a C++11 extension}} +template<class ...> struct C { struct Nested { }; }; struct S { template <typename> - friend class Foo, int; // expected-error {{a friend declaration that befriends a template must contain exactly one type-specifier}} + friend class Foo, int; + // since-cxx11-error@-1 {{a friend declaration that befriends a template must contain exactly one type-specifier}} - template <typename ...Ts> // cxx98-error {{variadic templates are a C++11 extension}} - friend class C<Ts>::Nested...; // expected-error {{friend declaration expands pack 'Ts' that is declared it its own template parameter list}} + template <typename ...Ts> + friend class C<Ts>::Nested...; + // since-cxx11-error@-1 {{friend declaration expands pack 'Ts' that is declared it its own template parameter list}} }; +#endif } // namespace cwg2917 -#if __cplusplus >= 202400L - +#if __cplusplus > 202302L namespace std { using size_t = decltype(sizeof(0)); -}; +} // namespace std void *operator new(std::size_t, void *p) { return p; } -void* operator new[] (std::size_t, void* p) {return p;} - +void* operator new[] (std::size_t, void* p) {return p; } +#endif -namespace cwg2922 { // cwg2922: 20 tentatively ready 2024-07-10 +namespace cwg2922 { // cwg2922: 20 +#if __cplusplus > 202302L union U { int a, b; }; constexpr U nondeterministic(bool i) { if(i) { U u; - new (&u) int(); - // expected-note@-1 {{placement new would change type of storage from 'U' to 'int'}} + new (&u) int(); // #cwg2922-placement-new return u; } return {}; } constexpr U _ = nondeterministic(true); -// expected-error@-1 {{constexpr variable '_' must be initialized by a constant expression}} \ -// expected-note@-1 {{in call to 'nondeterministic(true)'}} -} +// since-cxx26-error@-1 {{constexpr variable '_' must be initialized by a constant expression}} +// since-cxx26-note@#cwg2922-placement-new {{placement new would change type of storage from 'U' to 'int'}} +// since-cxx26-note@-3 {{in call to 'nondeterministic(true)'}} #endif +} // namespace cwg2922 diff --git a/clang/test/CXX/drs/cwg2xx.cpp b/clang/test/CXX/drs/cwg2xx.cpp index ec37b420880e..0d644bae7838 100644 --- a/clang/test/CXX/drs/cwg2xx.cpp +++ b/clang/test/CXX/drs/cwg2xx.cpp @@ -2,8 +2,9 @@ // RUN: %clang_cc1 -std=c++11 %s -verify=expected,since-cxx11,cxx98-11,cxx98-14,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++14 %s -verify=expected,since-cxx11,since-cxx14,cxx98-14,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,cxx98-17 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors // FIXME: diagnostic above is emitted only on Windows platforms // PR13819 -- __SIZE_TYPE__ is incompatible. @@ -29,7 +30,7 @@ namespace cwg200 { // cwg200: dup 214 void g() { f<int>(1); } -} +} // namespace cwg200 // cwg201 is in cwg201.cpp @@ -39,11 +40,146 @@ namespace cwg202 { // cwg202: 3.1 static_assert(__enable_constant_folding(g == &f<int>), ""); }; template struct X<f>; +} // namespace cwg202 + +namespace cwg203 { // cwg203: 3.0 +namespace ex1 { +struct B { + int i; +}; +struct D1 : B {}; +struct D2 : B {}; + +int(D1::*pmD1) = &D2::i; +} // namespace ex1 + +#if __cplusplus >= 202002L +namespace ex2 { +struct A { + int i; + virtual void f() = 0; // #cwg203-ex2-A-f +}; + +struct B : A { + int j; + constexpr B() : j(5) {} + virtual void f(); +}; + +struct C : B { + constexpr C() { j = 10; } +}; + +template <class T> +constexpr int DefaultValue(int(T::*m)) { + return T().*m; + // since-cxx20-error@-1 {{allocating an object of abstract class type 'cwg203::ex2::A'}} + // since-cxx20-note@#cwg203-ex2-a {{in instantiation of function template specialization 'cwg203::ex2::DefaultValue<cwg203::ex2::A>' requested here}} + // since-cxx20-note@#cwg203-ex2-A-f {{unimplemented pure virtual method 'f' in 'A'}} +} // #cwg203-ex2-DefaultValue + +int a = DefaultValue(&B::i); // #cwg203-ex2-a +static_assert(DefaultValue(&C::j) == 5, ""); +} // namespace ex2 +#endif + +namespace ex3 { +class Base { +public: + int func() const; +}; + +class Derived : public Base {}; + +template <class T> class Templ { // #cwg203-ex3-Templ +public: + template <class S> Templ(S (T::*ptmf)() const); // #cwg203-ex3-Templ-ctor +}; + +void foo() { Templ<Derived> x(&Derived::func); } +// expected-error@-1 {{no matching constructor for initialization of 'Templ<Derived>'}} +// expected-note@#cwg203-ex3-Templ {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int (cwg203::ex3::Base::*)() const' to 'const Templ<Derived>' for 1st argument}} +// since-cxx11-note@#cwg203-ex3-Templ {{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int (cwg203::ex3::Base::*)() const' to 'Templ<Derived>' for 1st argument}} +// expected-note@#cwg203-ex3-Templ-ctor {{candidate template ignored: could not match 'cwg203::ex3::Derived' against 'cwg203::ex3::Base'}} +} // namespace ex3 + +namespace ex4 { +struct Very_base { + int a; +}; +struct Base1 : Very_base {}; +struct Base2 : Very_base {}; +struct Derived : Base1, Base2 { +}; + +int f() { + Derived d; + // FIXME: in the diagnostic below, Very_base is fully qualified, but Derived is not + int Derived::*a_ptr = &Derived::Base1::a; + /* expected-error@-1 + {{ambiguous conversion from pointer to member of base class 'cwg203::ex4::Very_base' to pointer to member of derived class 'Derived': + struct cwg203::ex4::Derived -> Base1 -> Very_base + struct cwg203::ex4::Derived -> Base2 -> Very_base}}*/ +} +} // namespace ex4 + +namespace ex5 { +struct Base { + int a; +}; +struct Derived : Base { + int b; +}; + +template <typename Class, typename Member_type, Member_type Base::*ptr> +Member_type get(Class &c) { + return c.*ptr; +} + +void call(int (*f)(Derived &)); // #cwg203-ex5-call + +int f() { + // ill-formed, contrary to Core issue filing: + // `&Derived::b` yields `int Derived::*`, which can't initialize NTTP of type `int Base::*`, + // because (implicit) pointer-to-member conversion doesn't upcast. + call(&get<Derived, int, &Derived::b>); + // expected-error@-1 {{no matching function for call to 'call'}} + // expected-note@#cwg203-ex5-call {{candidate function not viable: no overload of 'get' matching 'int (*)(Derived &)' for 1st argument}} + + // well-formed, contrary to Core issue filing: + // `&Derived::a` yields `int Base::*`, + // which can initialize NTTP of type `int Base::*`. + call(&get<Derived, int, &Derived::a>); + + call(&get<Base, int, &Derived::a>); + // expected-error@-1 {{no matching function for call to 'call'}} + // expected-note@#cwg203-ex5-call {{candidate function not viable: no overload of 'get' matching 'int (*)(Derived &)' for 1st argument}} +} +} // namespace ex5 + +namespace ex6 { +struct Base { + int a; +}; +struct Derived : private Base { // #cwg203-ex6-Derived +public: + using Base::a; // make `a` accessible +}; + +int f() { + Derived d; + int b = d.a; + // FIXME: in the diagnostic below, Base is fully qualified, but Derived is not + int Derived::*ptr = &Derived::a; + // expected-error@-1 {{cannot cast private base class 'cwg203::ex6::Base' to 'Derived'}} + // expected-note@#cwg203-ex6-Derived {{declared private here}} } +} // namespace ex6 +} // namespace cwg203 // cwg204: sup 820 -namespace cwg206 { // cwg206: yes +namespace cwg206 { // cwg206: 2.7 struct S; // #cwg206-S template<typename T> struct Q { S s; }; // expected-error@-1 {{field has incomplete type 'S'}} @@ -51,9 +187,9 @@ namespace cwg206 { // cwg206: yes template<typename T> void f() { S s; } // expected-error@-1 {{variable has incomplete type 'S'}} // expected-note@#cwg206-S {{forward declaration of 'cwg206::S'}} -} +} // namespace cwg206 -namespace cwg207 { // cwg207: yes +namespace cwg207 { // cwg207: 2.7 class A { protected: static void f() {} @@ -66,7 +202,7 @@ namespace cwg207 { // cwg207: yes f(); } }; -} +} // namespace cwg207 // cwg208 FIXME: write codegen test @@ -79,11 +215,11 @@ namespace cwg209 { // cwg209: 3.2 // expected-error@-1 {{friend function 'f' is a private member of 'cwg209::A'}} // expected-note@#cwg209-A-f {{implicitly declared private here}} }; -} +} // namespace cwg209 // cwg210 is in cwg210.cpp -namespace cwg211 { // cwg211: yes +namespace cwg211 { // cwg211: 2.7 struct A { A() try { throw 0; @@ -92,9 +228,9 @@ namespace cwg211 { // cwg211: yes // expected-error@-1 {{return in the catch of a function try block of a constructor is illegal}} } }; -} +} // namespace cwg211 -namespace cwg213 { // cwg213: yes +namespace cwg213 { // cwg213: 2.7 template <class T> struct A : T { void h(T t) { char &r1 = f(t); @@ -111,9 +247,9 @@ namespace cwg213 { // cwg213: yes char &f(B); template void A<B>::h(B); // #cwg213-instantiation -} +} // namespace cwg213 -namespace cwg214 { // cwg214: yes +namespace cwg214 { // cwg214: 2.7 template<typename T, typename U> T checked_cast(U from) { U::error; } template<typename T, typename U> T checked_cast(U *from); class C {}; @@ -124,7 +260,7 @@ namespace cwg214 { // cwg214: yes void g() { f<int>(1); } -} +} // namespace cwg214 namespace cwg215 { // cwg215: 2.9 template<typename T> class X { @@ -134,7 +270,7 @@ namespace cwg215 { // cwg215: 2.9 struct Y { void foo() { (void)+X<Y>().n; } }; -} +} // namespace cwg215 namespace cwg216 { // cwg216: no // FIXME: Should reject this: 'f' has linkage but its type does not, @@ -150,17 +286,17 @@ namespace cwg216 { // cwg216: no void f(E); }; void g(S s, S::E e) { s.f(e); } -} +} // namespace cwg216 -namespace cwg217 { // cwg217: yes +namespace cwg217 { // cwg217: 2.7 template<typename T> struct S { void f(int); }; template<typename T> void S<T>::f(int = 0) {} // expected-error@-1 {{default arguments cannot be added to an out-of-line definition of a member of a class template}} -} +} // namespace cwg217 -namespace cwg218 { // cwg218: yes +namespace cwg218 { // cwg218: 2.7 // NB: also dup 405 namespace A { struct S {}; @@ -222,7 +358,7 @@ namespace cwg218 { // cwg218: yes template<typename A, typename B> struct C {}; } void testG(G::C<G::X::A, G::Y::B> gc) { f(gc); } -} +} // namespace cwg218 // cwg219: na // cwg220: na @@ -259,7 +395,7 @@ namespace cwg221 { // cwg221: 3.6 // expected-note@#cwg221-S {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'float' to 'const A' for 1st argument}} a += f; } -} +} // namespace cwg221 namespace cwg222 { // cwg222: dup 637 void f(int a, int b, int c, int *x) { @@ -279,7 +415,7 @@ namespace cwg222 { // cwg222: dup 637 a = (b = ++a); #pragma clang diagnostic pop } -} +} // namespace cwg222 // cwg223: na @@ -351,7 +487,7 @@ namespace cwg224 { // cwg224: 16 return i; } } -} +} // namespace cwg224 // cwg225: yes template<typename T> void cwg225_f(T t) { cwg225_g(t); } @@ -409,30 +545,32 @@ namespace cwg226 { // cwg226: no template<typename, typename X, typename=void, typename Y> int foo(X, Y); // cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}} int x = foo(0, 0); -} +} // namespace cwg226 -void cwg227(bool b) { // cwg227: yes +namespace cwg227 { // cwg227: 2.7 +void f(bool b) { if (b) int n; else int n; } +} // namespace cwg227 -namespace cwg228 { // cwg228: yes +namespace cwg228 { // cwg228: 2.7 template <class T> struct X { void f(); }; template <class T> struct Y { void g(X<T> x) { x.template X<T>::f(); } }; -} +} // namespace cwg228 namespace cwg229 { // cwg229: 2.9 template<typename T> void f(); template<typename T> void f<T*>() {} // expected-error@-1 {{function template partial specialization is not allowed}} template<> void f<int>() {} -} +} // namespace cwg229 namespace cwg230 { // cwg230: 3.0 struct S { @@ -441,9 +579,9 @@ namespace cwg230 { // cwg230: 3.0 // expected-note@#cwg230-f {{'f' declared here}} virtual void f() = 0; // #cwg230-f }; -} +} // namespace cwg230 -namespace cwg231 { // cwg231: yes +namespace cwg231 { // cwg231: 2.7 namespace outer { namespace inner { int i; // #cwg231-i @@ -453,7 +591,7 @@ namespace cwg231 { // cwg231: yes // expected-error@-1 {{use of undeclared identifier 'i'; did you mean 'inner::i'?}} // expected-note@#cwg231-i {{'inner::i' declared here}} } -} +} // namespace cwg231 // cwg234: na // cwg235: na @@ -462,15 +600,15 @@ namespace cwg236 { // cwg236: 3.2 void *p = int(); // cxx98-warning@-1 {{expression which evaluates to zero treated as a null pointer constant of type 'void *'}} // since-cxx11-error@-2 {{cannot initialize a variable of type 'void *' with an rvalue of type 'int'}} -} +} // namespace cwg236 namespace cwg237 { // cwg237: dup 470 template<typename T> struct A { void f() { T::error; } }; template<typename T> struct B : A<T> {}; template struct B<int>; // ok -} +} // namespace cwg237 -namespace cwg239 { // cwg239: yes +namespace cwg239 { // cwg239: 2.7 namespace NS { class T {}; void f(T); @@ -484,11 +622,11 @@ namespace cwg239 { // cwg239: yes extern int &g(NS::T, float); int &s = g(parm, 1); } -} +} // namespace cwg239 // cwg240: dup 616 -namespace cwg241 { // cwg241: yes +namespace cwg241 { // cwg241: 9 namespace A { struct B {}; template <int X> void f(); // #cwg241-A-f @@ -523,9 +661,9 @@ namespace cwg241 { // cwg241: yes // expected-note@#cwg241-A-f {{candidate function template not viable: requires 0 arguments, but 1 was provided}} g<3>(b); } -} +} // namespace cwg241 -namespace cwg243 { // cwg243: yes +namespace cwg243 { // cwg243: 2.8 struct B; struct A { A(B); // #cwg243-A @@ -539,7 +677,7 @@ namespace cwg243 { // cwg243: yes // expected-error@-1 {{conversion from 'struct B' to 'A' is ambiguous}} // expected-note@#cwg243-A {{candidate constructor}} // expected-note@#cwg243-B {{candidate function has been explicitly deleted}} -} +} // namespace cwg243 namespace cwg244 { // cwg244: 11 // NB: this test is reused by cwg399 @@ -633,16 +771,16 @@ namespace cwg244 { // cwg244: 11 } template void g(N::S<int>::Inner *); } -} +} // namespace cwg244 -namespace cwg245 { // cwg245: yes +namespace cwg245 { // cwg245: 2.8 struct S { enum E {}; // #cwg245-E class E *p; // expected-error@-1 {{use of 'E' with tag type that does not match previous declaration}} // expected-note@#cwg245-E {{previous use is here}} }; -} +} // namespace cwg245 namespace cwg246 { // cwg246: 3.2 struct S { @@ -655,9 +793,9 @@ X: ; // expected-note@#cwg246-try {{jump bypasses initialization of try block}} } }; -} +} // namespace cwg246 -namespace cwg247 { // cwg247: yes +namespace cwg247 { // cwg247: 2.7 struct A {}; struct B : A { void f(); @@ -681,18 +819,18 @@ namespace cwg247 { // cwg247: yes void f(int); }; void (F::*i)() = &F::f; -} +} // namespace cwg247 namespace cwg248 { // cwg248: sup P1949 int \u040d\u040e = 0; -} +} // namespace cwg248 -namespace cwg249 { // cwg249: yes +namespace cwg249 { // cwg249: 2.7 template<typename T> struct X { void f(); }; template<typename T> void X<T>::f() {} -} +} // namespace cwg249 -namespace cwg250 { // cwg250: yes +namespace cwg250 { // cwg250: 2.7 typedef void (*FPtr)(double x[]); template<int I> void f(double x[]); @@ -701,7 +839,7 @@ namespace cwg250 { // cwg250: yes template<int I = 3> void g(double x[]); // cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}} FPtr gp = &g<>; -} +} // namespace cwg250 namespace cwg252 { // cwg252: 3.1 struct A { @@ -752,7 +890,7 @@ namespace cwg252 { // cwg252: 3.1 virtual ~G(); }; G::~G() {} -} +} // namespace cwg252 namespace cwg254 { // cwg254: 2.9 template<typename T> struct A { @@ -767,12 +905,12 @@ namespace cwg254 { // cwg254: 2.9 struct C { typedef struct {} type; }; // #cwg254-C A<B>::type n; A<C>::type n; // #cwg254-instantiation -} +} // namespace cwg254 -namespace cwg255 { // cwg255: yes +namespace cwg255 { // cwg255: 2.7 struct S { - void operator delete(void *){}; - void operator delete(void *, int){}; + void operator delete(void *){} + void operator delete(void *, int){} }; void f(S *p) { delete p; } } // namespace cwg255 @@ -794,7 +932,7 @@ namespace cwg257 { // cwg257: 3.4 // expected-note@#cwg257-A {{'cwg257::A' declared here}} void f(); }; -} +} // namespace cwg257 namespace cwg258 { // cwg258: 2.8 struct A { @@ -832,7 +970,7 @@ namespace cwg258 { // cwg258: 2.8 } f; // expected-error@-1 {{variable type 'struct F' is an abstract class}} // expected-note@#cwg258-E-f {{unimplemented pure virtual method 'f' in 'F'}} -} +} // namespace cwg258 namespace cwg259 { // cwg259: 4 template<typename T> struct A {}; @@ -867,7 +1005,7 @@ namespace cwg259 { // cwg259: 4 template struct B<float>; // expected-warning@-1 {{explicit instantiation of 'B<float>' that occurs after an explicit specialization has no effect}} // expected-note@#cwg259-B-float {{previous template specialization is here}} -} +} // namespace cwg259 // FIXME: When cwg260 is resolved, also add tests for CWG507. @@ -904,14 +1042,14 @@ namespace cwg261 { // cwg261: no // expected-warning@-1 {{'operator delete' was marked unused but was used}} #pragma clang diagnostic pop -} +} // namespace cwg261 -namespace cwg262 { // cwg262: yes +namespace cwg262 { // cwg262: 2.7 int f(int = 0, ...); int k = f(); int l = f(0); int m = f(0, 0); -} +} // namespace cwg262 namespace cwg263 { // cwg263: 3.3 struct X {}; @@ -931,14 +1069,14 @@ namespace cwg263 { // cwg263: 3.3 Y::~Y(); // expected-error@-1 {{extra qualification on member '~Y'}} }; -} +} // namespace cwg263 // cwg265: dup 353 // cwg266: na // cwg269: na // cwg270: na -namespace cwg272 { // cwg272: yes +namespace cwg272 { // cwg272: 2.7 struct X { void f() { this->~X(); @@ -947,23 +1085,9 @@ namespace cwg272 { // cwg272: yes // expected-error@-1 {{invalid argument type 'X' to unary expression}} } }; -} - -#include <stdarg.h> -#include <stddef.h> -namespace cwg273 { // cwg273: yes - struct A { - int n; - }; - void operator&(A); - void f(A a, ...) { - offsetof(A, n); - va_list val; - va_start(val, a); - va_end(val); - } -} +} // namespace cwg272 +// cwg273 is in cwg273.cpp // cwg274: na namespace cwg275 { // cwg275: no @@ -1022,7 +1146,7 @@ namespace cwg275 { // cwg275: no // expected-error@-1 {{partial ordering for explicit instantiation of 'f' is ambiguous}} // expected-note@#cwg275-f {{explicit instantiation candidate function 'cwg275::f<short>' template here [with T = short]}} // expected-note@#cwg275-N-f {{explicit instantiation candidate function 'cwg275::N::f<short>' template here [with T = short]}} -} +} // namespace cwg275 // cwg276: na @@ -1030,7 +1154,7 @@ namespace cwg277 { // cwg277: 3.1 typedef int *intp; int *p = intp(); static_assert(__enable_constant_folding(!intp()), ""); -} +} // namespace cwg277 // cwg279 is in cwg279.cpp @@ -1085,7 +1209,7 @@ namespace cwg280 { // cwg280: 2.9 // expected-note@#cwg280-B-f3 {{conversion candidate of type 'void (*)(int, int, int)'}} // expected-note@#cwg280-C-f3 {{conversion candidate of type 'void (*)(int, int, int)'}} } -} +} // namespace cwg280 namespace cwg281 { // cwg281: no void a(); @@ -1102,9 +1226,9 @@ namespace cwg281 { // cwg281: no friend inline void e() {} friend inline void f() {} }; -} +} // namespace cwg281 -namespace cwg283 { // cwg283: yes +namespace cwg283 { // cwg283: 2.7 template<typename T> // #cwg283-template struct S { friend class T; @@ -1114,7 +1238,7 @@ namespace cwg283 { // cwg283: yes // expected-error@-1 {{declaration of 'T' shadows template parameter}} // expected-note@#cwg283-template {{template parameter is declared here}} }; -} +} // namespace cwg283 namespace cwg284 { // cwg284: no namespace A { @@ -1152,16 +1276,16 @@ namespace cwg284 { // cwg284: no struct D::X {}; // FIXME: ill-formed enum D::Y e2; // ok per cwg417 class D::Z z2; // ok per cwg417 -} +} // namespace cwg284 -namespace cwg285 { // cwg285: yes +namespace cwg285 { // cwg285: 2.7 template<typename T> void f(T, int); // #cwg285-f-T-int template<typename T> void f(int, T); // #cwg285-f-int-T template<> void f<int>(int, int) {} // expected-error@-1 {{function template specialization 'f' ambiguously refers to more than one function template; explicitly specify additional template arguments to identify a particular function template}} // expected-note@#cwg285-f-int-T {{function template 'cwg285::f<int>' matches specialization [with T = int]}} // expected-note@#cwg285-f-T-int {{function template 'cwg285::f<int>' matches specialization [with T = int]}} -} +} // namespace cwg285 namespace cwg286 { // cwg286: 2.8 template<class T> struct A { @@ -1177,11 +1301,11 @@ namespace cwg286 { // cwg286: 2.8 A<short>::C::B<int*> absip; // expected-error@-1 {{'B' is a private member of 'cwg286::A<short>::C'}} // expected-note@#cwg286-B {{implicitly declared private here}} -} +} // namespace cwg286 // cwg288: na -namespace cwg289 { // cwg289: yes +namespace cwg289 { // cwg289: 2.7 struct A; // #cwg289-A struct B : A {}; // expected-error@-1 {{base class has incomplete type}} @@ -1191,7 +1315,7 @@ namespace cwg289 { // cwg289: yes // expected-error@-1 {{type 'int' cannot be used prior to '::' because it has no members}} // expected-note@#cwg289-C-int {{in instantiation of template class 'cwg289::C<int>' requested here}} struct D : C<int> {}; // #cwg289-C-int -} +} // namespace cwg289 // cwg290: na // cwg291: dup 391 @@ -1223,7 +1347,7 @@ namespace cwg294 { // cwg294: no // since-cxx17-error@-1 {{ISO C++17 does not allow dynamic exception specifications}} // since-cxx17-note@-2 {{use 'noexcept(false)' instead}} } -} +} // namespace cwg294 namespace cwg295 { // cwg295: 3.7 typedef int f(); @@ -1242,14 +1366,14 @@ namespace cwg295 { // cwg295: 3.7 typedef int (*V)(); typedef volatile U *V; // expected-warning@-1 {{'volatile' qualifier on function type 'U' (aka 'int ()') has no effect}} -} +} // namespace cwg295 -namespace cwg296 { // cwg296: yes +namespace cwg296 { // cwg296: 2.7 struct A { static operator int() { return 0; } // expected-error@-1 {{conversion function must be a non-static member function}} }; -} +} // namespace cwg296 namespace cwg298 { // cwg298: 3.1 struct A { @@ -1288,7 +1412,7 @@ namespace cwg298 { // cwg298: 3.1 }; typedef const F G; G::~F() {} // ok -} +} // namespace cwg298 namespace cwg299 { // cwg299: 2.8 c++11 struct S { @@ -1308,4 +1432,4 @@ namespace cwg299 { // cwg299: 2.8 c++11 // since-cxx14-error-re@#cwg299-q {{{{conversion from 'T' to 'unsigned (long long|long|int)' is ambiguous}}}} // since-cxx14-note@#cwg299-int {{candidate function}} // since-cxx14-note@#cwg299-ushort {{candidate function}} -} +} // namespace cwg299 diff --git a/clang/test/CXX/drs/cwg3xx.cpp b/clang/test/CXX/drs/cwg3xx.cpp index 26b0f975effa..b5e07a66bb4e 100644 --- a/clang/test/CXX/drs/cwg3xx.cpp +++ b/clang/test/CXX/drs/cwg3xx.cpp @@ -1,9 +1,10 @@ -// RUN: %clang_cc1 -std=c++23 -verify=expected,cxx20-23,cxx23,since-cxx11,since-cxx17,since-cxx23 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 -verify=expected,cxx98-20,cxx20-23,since-cxx11,since-cxx17 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 -verify=expected,cxx98-17,cxx98-20,since-cxx11,since-cxx17 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 -verify=expected,cxx98-14,cxx98-17,cxx98-20,cxx11-14,since-cxx11 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 -verify=expected,cxx98-14,cxx98-17,cxx98-20,cxx11-14,since-cxx11 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++98 -verify=expected,cxx98-14,cxx98-17,cxx98-20,cxx98 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 -verify=expected,cxx98-14,cxx98-17,cxx98-20,cxx11-14,since-cxx11 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 -verify=expected,cxx98-14,cxx98-17,cxx98-20,cxx11-14,since-cxx11 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 -verify=expected,cxx98-17,cxx98-20,since-cxx11,since-cxx17 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 -verify=expected,cxx98-20,cxx20-23,since-cxx11,since-cxx17 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 -verify=expected,cxx20-23,cxx23,since-cxx11,since-cxx17,since-cxx23 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c -verify=expected,cxx20-23,cxx23,since-cxx11,since-cxx17,since-cxx23 -triple %itanium_abi_triple %s -fexceptions -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -16,11 +17,11 @@ #define __enable_constant_folding #endif -namespace cwg300 { // cwg300: yes +namespace cwg300 { // cwg300: 2.7 template<typename R, typename A> void f(R (&)(A)) {} int g(int); void h() { f(g); } -} +} // namespace cwg300 namespace cwg301 { // cwg301: 3.5 // see also cwg38 @@ -75,7 +76,7 @@ namespace cwg301 { // cwg301: 3.5 // expected-error@-1 {{expected identifier}} // expected-error@-2 {{declaration of anonymous class must be a definition}} // expected-error@-3 {{declaration does not declare anything}} -} +} // namespace cwg301 namespace cwg302 { // cwg302: 3.0 struct A { A(); ~A(); }; @@ -108,7 +109,7 @@ namespace cwg302 { // cwg302: 3.0 const int n = 0; } d = D(); #endif -} +} // namespace cwg302 // cwg303: na @@ -123,7 +124,7 @@ namespace cwg304 { // cwg304: 2.9 int m = S().b; // #cwg304-m // since-cxx11-error@-1 {{call to implicitly-deleted default constructor of 'S'}} // since-cxx11-note@#cwg304-S {{default constructor of 'S' is implicitly deleted because field 'b' of reference type 'int &' would not be initialized}} -} +} // namespace cwg304 namespace cwg305 { // cwg305: no struct A { @@ -169,9 +170,9 @@ namespace cwg305 { // cwg305: no }; void k(Z *z) { z->~T1<int>(); - // expected-error@-1 {{no member named 'T1' in 'cwg305::Z'}} + // since-cxx11-error@-1 {{no member named 'T1' in 'cwg305::Z'}} z->~T2<int>(); - // expected-error@-1 {{no member named '~int' in 'cwg305::Z'}} + // since-cxx11-error@-1 {{no member named '~int' in 'cwg305::Z'}} z->~T2<Z>(); } @@ -181,9 +182,9 @@ namespace cwg305 { // cwg305: no } template<typename A> using R = Q::R<int>; void qr(Q::R<int> x) { x.~R<char>(); } - // expected-error@-1 {{no member named '~R' in 'cwg305::Q::R<int>'}} + // since-cxx11-error@-1 {{no member named '~R' in 'cwg305::Q::R<int>'}} #endif -} +} // namespace cwg305 namespace cwg306 { // cwg306: dup 39 struct A { struct B {}; }; @@ -199,7 +200,7 @@ namespace cwg306 { // cwg306: dup 39 // expected-error@-1 {{member 'X' found in multiple base classes of different types}} // expected-note@#cwg306-X {{member type 'cwg306::X' found}} // expected-note@#cwg306-typedef-X {{member type 'const cwg306::X' found}} -} +} // namespace cwg306 // cwg307: na @@ -229,7 +230,7 @@ namespace cwg308 { // cwg308: 3.7 // get here instead } } -} +} // namespace cwg308 // cwg309: dup 485 @@ -247,7 +248,7 @@ namespace cwg311 { // cwg311: 3.0 // expected-warning@-2 {{extra qualification on member 'X'}} // expected-error@-3 {{a type specifier is required for all declarations}} // expected-error@-4 {{expected ';' after top level declarator}} -} +} // namespace cwg311 // cwg312: dup 616 @@ -256,7 +257,7 @@ namespace cwg313 { // cwg313: dup 299 c++11 // FIXME: should this be available in c++98 mode? int *p = new int[A()]; // cxx98-error@-1 {{implicit conversion from array size expression of type 'A' to integral type 'int' is a C++11 extension}} -} +} // namespace cwg313 namespace cwg314 { // cwg314: no // NB: dup 1710 @@ -292,12 +293,12 @@ namespace cwg317 { // cwg317: 3.5 inline int h(); // expected-error@-1 {{inline declaration of 'h' follows non-inline definition}} // expected-note@#cwg317-h {{previous definition is here}} -} +} // namespace cwg317 namespace cwg318 { // cwg318: sup 1310 struct A {}; struct A::A a; -} +} // namespace cwg318 namespace cwg319 { // cwg319: no // FIXME: dup cwg389 @@ -334,9 +335,9 @@ namespace cwg319 { // cwg319: no extern C c; // ok X<C> xc; } -} +} // namespace cwg319 -namespace cwg320 { // cwg320: yes +namespace cwg320 { // cwg320: 3.1 #if __cplusplus >= 201103L struct X { constexpr X() {} @@ -347,7 +348,7 @@ namespace cwg320 { // cwg320: yes constexpr unsigned g(X x) { return x.copies; } static_assert(f(X()).copies == g(X()) + 1, "expected one extra copy for return value"); #endif -} +} // namespace cwg320 namespace cwg321 { // cwg321: dup 557 namespace N { @@ -367,7 +368,7 @@ namespace cwg321 { // cwg321: dup 557 } N::I<int> i, j; bool x = i == j; -} +} // namespace cwg321 namespace cwg322 { // cwg322: 2.8 struct A { @@ -375,7 +376,7 @@ namespace cwg322 { // cwg322: 2.8 } a; int &r = static_cast<int&>(a); int &s = a; -} +} // namespace cwg322 // cwg323: sup 820 @@ -403,12 +404,12 @@ namespace cwg324 { // cwg324: 3.6 // expected-error@-1 {{address of bit-field requested}} int *i = &++s.n; // expected-error@-1 {{address of bit-field requested}} -} +} // namespace cwg324 namespace cwg326 { // cwg326: 3.1 struct S {}; static_assert(__is_trivially_constructible(S, const S&), ""); -} +} // namespace cwg326 namespace cwg327 { // cwg327: dup 538 struct A; @@ -416,9 +417,9 @@ namespace cwg327 { // cwg327: dup 538 class B; struct B {}; -} +} // namespace cwg327 -namespace cwg328 { // cwg328: yes +namespace cwg328 { // cwg328: 2.7 struct A; // #cwg328-A struct B { A a; }; // expected-error@-1 {{field has incomplete type 'A'}} @@ -429,7 +430,7 @@ namespace cwg328 { // cwg328: yes A *p = new A[0]; // expected-error@-1 {{allocation of incomplete type 'A'}} // expected-note@#cwg328-A {{forward declaration of 'cwg328::A'}} -} +} // namespace cwg328 namespace cwg329 { // cwg329: 3.5 struct B {}; @@ -449,7 +450,7 @@ namespace cwg329 { // cwg329: 3.5 void test() { h(a); // #cwg329-h-call } -} +} // namespace cwg329 namespace cwg330 { // cwg330: 7 // Conversions between P and Q will be allowed by P0388. @@ -543,7 +544,7 @@ namespace cwg330 { // cwg330: 7 (void) reinterpret_cast<B4*>(a); } } -} +} // namespace cwg330 namespace cwg331 { // cwg331: 11 struct A { @@ -555,7 +556,7 @@ namespace cwg331 { // cwg331: 11 const A b(a); // expected-error@-1 {{no matching constructor for initialization of 'const A'}} // expected-note@#cwg331-A-ctor {{candidate constructor not viable: 1st argument ('const A') would lose const qualifier}} -} +} // namespace cwg331 namespace cwg332 { // cwg332: dup 577 void f(volatile void); @@ -566,16 +567,16 @@ namespace cwg332 { // cwg332: dup 577 void h(int n, volatile void); // expected-error@-1 {{'void' must be the first and only parameter if specified}} // cxx20-23-warning@-2 {{volatile-qualified parameter type 'volatile void' is deprecated}} -} +} // namespace cwg332 -namespace cwg333 { // cwg333: yes +namespace cwg333 { // cwg333: 2.7 int n = 0; int f(int(n)); int g((int(n))); int h = f(g); -} +} // namespace cwg333 -namespace cwg334 { // cwg334: yes +namespace cwg334 { // cwg334: 2.7 template<typename T> void f() { T x; f((x, 123)); @@ -585,11 +586,11 @@ namespace cwg334 { // cwg334: yes friend void f(S); }; template void f<S>(); -} +} // namespace cwg334 // cwg335: sup 820 -namespace cwg336 { // cwg336: yes +namespace cwg336 { // cwg336: 2.7 namespace Pre { template<class T1> class A { template<class T2> class B { @@ -619,9 +620,9 @@ namespace cwg336 { // cwg336: yes template<class Y> template<> void A<Y>::B<double>::mf2() {} // expected-error@-1 {{nested name specifier 'A<Y>::B<double>::' for declaration does not refer into a class, class template or class template partial specialization}} } -} +} // namespace cwg336 -namespace cwg337 { // cwg337: yes +namespace cwg337 { // cwg337: 2.7 template<typename T> void f(T (*)[1]); template<typename T> int &f(...); @@ -635,7 +636,7 @@ namespace cwg337 { // cwg337: yes int &s = f<B>(0); // expected-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'void'}} struct B { virtual ~B() = 0; }; -} +} // namespace cwg337 // cwg338: dup 1884 @@ -670,14 +671,14 @@ namespace cwg339 { // cwg339: 2.8 static_assert(conv_int<char>::value, ""); bool b = conv_int2<char>(A<1>()); A<1> c = make_A<char>(); -} +} // namespace cwg339 -namespace cwg340 { // cwg340: yes +namespace cwg340 { // cwg340: 2.7 struct A { A(int); }; struct B { B(A, A, int); }; int x, y; B b(A(x), A(y), 3); -} +} // namespace cwg340 namespace cwg341 { // cwg341: sup 1708 namespace A { @@ -711,7 +712,7 @@ namespace cwg341 { namespace B { extern "C" void cwg341_e(); } // expected-error@-1 {{redefinition of 'cwg341_e' as different kind of symbol}} // expected-note@#cwg341_e {{previous definition is here}} -} +} // namespace cwg341 // cwg342: na @@ -726,14 +727,14 @@ namespace cwg343 { // cwg343: no C() : A<T>::B<T>() {} // expected-error@-1 {{use 'template' keyword to treat 'B' as a dependent template name}} }; -} +} // namespace cwg343 namespace cwg344 { // cwg344: dup 1435 struct A { inline virtual ~A(); }; struct B { friend A::~A(); }; -} +} // namespace cwg344 -namespace cwg345 { // cwg345: yes +namespace cwg345 { // cwg345: 2.7 struct A { struct X {}; int X; // #cwg345-int-X @@ -749,11 +750,11 @@ namespace cwg345 { // cwg345: yes f(b); f(a); // #cwg345-f-a } -} +} // namespace cwg345 // cwg346: na -namespace cwg347 { // cwg347: yes +namespace cwg347 { // cwg347: 2.7 struct base { struct nested; static int n; @@ -773,7 +774,7 @@ namespace cwg347 { // cwg347: yes void derived::g() {} // expected-error@-1 {{out-of-line definition of 'g' does not match any declaration in 'cwg347::derived'}} // expected-note@#cwg347-derived {{defined here}} -} +} // namespace cwg347 // cwg348: na @@ -802,7 +803,7 @@ namespace cwg349 { // cwg349: no // FIXME: This is invalid. B b; const int *const *const *p2 = b; -} +} // namespace cwg349 // cwg351: na @@ -944,11 +945,11 @@ namespace cwg352 { // cwg352: 2.8 f(a1, a2); } } -} +} // namespace cwg352 // cwg353 needs an IRGen test. -namespace cwg354 { // cwg354: yes c++11 +namespace cwg354 { // cwg354: 3.1 c++11 // FIXME: Should we allow this in C++98 too? struct S {}; @@ -1004,16 +1005,18 @@ namespace cwg354 { // cwg354: yes c++11 // cxx11-14-error@#cwg354-m3 {{null non-type template argument of type 'int *' does not match template parameter of type 'int S::*'}} // cxx11-14-note@#cwg354-ptr_mem {{template parameter is declared here}} // since-cxx17-error@#cwg354-m3 {{value of type 'int *' is not implicitly convertible to 'int S::*'}} -} +} // namespace cwg354 -struct cwg355_S; // cwg355: yes +struct cwg355_S; // cwg355: 2.7 struct ::cwg355_S {}; // expected-warning@-1 {{extra qualification on member 'cwg355_S'}} -namespace cwg355 { struct ::cwg355_S s; } +namespace cwg355 { +struct ::cwg355_S s; +} // namespace cwg355 // cwg356: na -namespace cwg357 { // cwg357: yes +namespace cwg357 { // cwg357: 2.7 template<typename T> struct A { // #cwg357-A void f() const; // #cwg357-f }; @@ -1028,17 +1031,17 @@ namespace cwg357 { // cwg357: yes template<typename T> void B::f() const {} // expected-error@-1 {{out-of-line definition of 'f' does not match any declaration in 'cwg357::B'}} // expected-note@#cwg357-B {{defined here}} -} +} // namespace cwg357 -namespace cwg358 { // cwg358: yes +namespace cwg358 { // cwg358: 2.7 extern "C" void cwg358_f(); namespace N { int var; extern "C" void cwg358_f() { var = 10; } } -} +} // namespace cwg358 -namespace cwg359 { // cwg359: yes +namespace cwg359 { // cwg359: 3.3 // Note, the example in the DR is wrong; it doesn't contain an anonymous // union. struct E { @@ -1065,9 +1068,9 @@ namespace cwg359 { // cwg359: yes }; }; }; -} +} // namespace cwg359 -namespace cwg360 { // cwg360: yes +namespace cwg360 { // cwg360: 2.8 struct A { int foo(); int bar(); @@ -1099,7 +1102,7 @@ int main() { // cwg362: na // cwg363: na -namespace cwg364 { // cwg364: yes +namespace cwg364 { // cwg364: 2.7 struct S { static void f(int); void f(char); @@ -1110,13 +1113,14 @@ namespace cwg364 { // cwg364: yes // expected-error@-1 {{call to non-static member function without an object argument}} S::f(0); } -} +} // namespace cwg364 -// cwg366: yes +namespace cwg366 { // cwg366: 2.7 #if "foo" // expected-error {{invalid token at start of a preprocessor expression}} #endif +} // namespace cwg366 -namespace cwg367 { // cwg367: yes +namespace cwg367 { // cwg367: 2.7 static_assert(__enable_constant_folding(true ? throw 0 : 4), ""); // expected-error@-1 {{expression is not an integral constant expression}} static_assert(__enable_constant_folding(true ? 4 : throw 0), ""); @@ -1124,8 +1128,7 @@ namespace cwg367 { // cwg367: yes // expected-error@-1 {{expression is not an integral constant expression}} // expected-note@-2 {{read of uninitialized object is not allowed in a constant expression}} static_assert(__enable_constant_folding(true ? 4 : *new int), ""); - -} +} // namespace cwg367 namespace cwg368 { // cwg368: 3.6 template<typename T, T> struct S {}; // #cwg368-S @@ -1142,7 +1145,7 @@ namespace cwg368 { // cwg368: 3.6 // cxx20-23-error@#cwg368-g-call {{call to 'g' is ambiguous}} // cxx20-23-note@#cwg368-g {{candidate function [with T = cwg368::X]}} // cxx20-23-note@#cwg368-g-2 {{candidate function [with T = cwg368::X]}} -} +} // namespace cwg368 // cwg370: na @@ -1248,7 +1251,7 @@ namespace cwg372 { // cwg372: no // expected-error@-1 {{'B' is a protected member of 'cwg372::badwolf::A'}} // expected-note@#cwg372-B {{declared protected here}} } -} +} // namespace cwg372 namespace cwg373 { // cwg373: 5 namespace X { int cwg373; } @@ -1270,7 +1273,7 @@ namespace cwg373 { // cwg373: 5 using namespace A::B; // expected-error@-1 {{expected namespace name}} // expected-note@#cwg373-A {{'A' declared here}} -} +} // namespace cwg373 namespace cwg374 { // cwg374: 7 // NB 2.9 c++11 @@ -1281,12 +1284,12 @@ namespace cwg374 { // cwg374: 7 template<> void N::f<char>() {} template<> void N::A<char>::f() {} template<> struct N::A<int> {}; -} +} // namespace cwg374 // cwg375: dup 345 // cwg376: na -namespace cwg377 { // cwg377: yes +namespace cwg377 { // cwg377: 2.7 enum E { // expected-error@-1 {{enumeration values exceed range of largest integer}} a = -__LONG_LONG_MAX__ - 1, @@ -1295,12 +1298,12 @@ namespace cwg377 { // cwg377: yes // cxx98-error@-1 {{'long long' is a C++11 extension}} // cxx98-error@-2 {{'long long' is a C++11 extension}} }; -} +} // namespace cwg377 // cwg378: dup 276 // cwg379: na -namespace cwg381 { // cwg381: yes +namespace cwg381 { // cwg381: 2.7 struct A { int a; }; @@ -1318,9 +1321,9 @@ namespace cwg381 { // cwg381: yes F f; f.A::a = 1; } -} +} // namespace cwg381 -namespace cwg382 { // cwg382: yes c++11 +namespace cwg382 { // cwg382: 2.7 c++11 // FIXME: Should we allow this in C++98 mode? struct A { typedef int T; }; typename A::T t; @@ -1329,17 +1332,17 @@ namespace cwg382 { // cwg382: yes c++11 // cxx98-error@-1 {{'typename' occurs outside of a template}} typename A b; // expected-error@-1 {{expected a qualified name after 'typename'}} -} +} // namespace cwg382 -namespace cwg383 { // cwg383: yes +namespace cwg383 { // cwg383: 2.7 struct A { A &operator=(const A&); }; struct B { ~B(); }; union C { C &operator=(const C&); }; union D { ~D(); }; static_assert(!__is_pod(A) && !__is_pod(B) && !__is_pod(C) && !__is_pod(D), ""); -} +} // namespace cwg383 -namespace cwg384 { // cwg384: yes +namespace cwg384 { // cwg384: 2.7 namespace N1 { template<typename T> struct Base {}; template<typename T> struct X { @@ -1359,7 +1362,7 @@ namespace cwg384 { // cwg384: yes N1::X<N2::Z> v; v.f(0); } -} +} // namespace cwg384 namespace cwg385 { // cwg385: 2.8 struct A { protected: void f(); }; @@ -1374,7 +1377,7 @@ namespace cwg385 { // cwg385: 2.8 // expected-error@-1 {{'n' is a protected member of 'cwg385::D'}} // expected-note@#cwg385-E {{constrained by protected inheritance here}} // expected-note@#cwg385-n {{member is declared here}} -} +} // namespace cwg385 namespace cwg386 { // cwg386: no namespace example1 { @@ -1482,7 +1485,7 @@ namespace cwg387 { // cwg387: 2.8 // expected-error@-1 {{use of undeclared identifier 'gcd'}} } } -} +} // namespace cwg387 // FIXME: cwg388 needs libc++abi test @@ -1606,7 +1609,7 @@ namespace cwg389 { // cwg389: no // FIXME: This is ill-formed. extern WithoutLinkage1 withoutLinkageLocal; } -} +} // namespace cwg389 namespace cwg390 { // cwg390: 3.3 template<typename T> @@ -1625,7 +1628,7 @@ namespace cwg390 { // cwg390: 3.3 struct B : A<int> { // #cwg390-A-int void f() {} } b; -} +} // namespace cwg390 namespace cwg391 { // cwg391: 2.8 c++11 // FIXME: Should this apply to C++98 too? @@ -1648,7 +1651,7 @@ namespace cwg391 { // cwg391: 2.8 c++11 }; C<int> fc(); const C<int> &c = fc(); -} +} // namespace cwg391 // cwg392 is in cwg392.cpp @@ -1718,9 +1721,9 @@ namespace cwg395 { // cwg395: 3.0 template<class T, class U> operator ptr_mem_fun_t<T, U>() const { return 0; }; } null2; int (S::*q)() = null2; -} +} // namespace cwg395 -namespace cwg396 { // cwg396: yes +namespace cwg396 { // cwg396: 3.0 void f() { auto int a(); // since-cxx11-error@-1 {{'auto' storage class specifier is not permitted in C++11, and will not be supported in future releases}} @@ -1731,11 +1734,11 @@ namespace cwg396 { // cwg396: yes // expected-error@-2 {{redefinition of 'i'}} // expected-note@#cwg396-i {{previous definition is here}} } -} +} // namespace cwg396 // cwg397: sup 1823 -namespace cwg398 { // cwg398: yes +namespace cwg398 { // cwg398: 2.7 namespace example1 { struct S { static int const I = 42; @@ -1778,7 +1781,7 @@ namespace cwg398 { // cwg398: yes // expected-note@#cwg398-h {{candidate template ignored: substitution failure [with T = D]: 'TT' following the 'template' keyword does not refer to a template}} } } -} +} // namespace cwg398 namespace cwg399 { // cwg399: 11 // NB: reuse cwg244 test @@ -1872,4 +1875,4 @@ namespace cwg399 { // cwg399: 11 } template void g(N::S<int>::Inner *); } -} +} // namespace cwg399 diff --git a/clang/test/CXX/drs/cwg492.cpp b/clang/test/CXX/drs/cwg492.cpp index 7fc46b04d72b..caa27cf8cc71 100644 --- a/clang/test/CXX/drs/cwg492.cpp +++ b/clang/test/CXX/drs/cwg492.cpp @@ -16,7 +16,7 @@ namespace std { struct type_info { const char* name() const NOTHROW; }; -} +} // namespace std namespace cwg492 { // cwg492: 2.7 diff --git a/clang/test/CXX/drs/cwg4xx.cpp b/clang/test/CXX/drs/cwg4xx.cpp index 825065840f11..bcaf7db04ad3 100644 --- a/clang/test/CXX/drs/cwg4xx.cpp +++ b/clang/test/CXX/drs/cwg4xx.cpp @@ -16,7 +16,7 @@ __extension__ typedef __SIZE_TYPE__ size_t; namespace std { struct type_info; } -namespace cwg400 { // cwg400: yes +namespace cwg400 { // cwg400: 2.7 struct A { int a; struct a {}; }; // #cwg400-A struct B { int a; struct a {}; }; // #cwg400-B struct C : A, B { using A::a; struct a b; }; @@ -36,7 +36,7 @@ namespace cwg400 { // cwg400: yes // expected-error@-1 {{member 'a' found in multiple base classes of different types}} // expected-note@#cwg400-A {{member type 'cwg400::A::a' found by ambiguous name lookup}} // expected-note@#cwg400-B {{member type 'cwg400::B::a' found by ambiguous name lookup}} -} +} // namespace cwg400 namespace cwg401 { // cwg401: 2.8 template<class T, class U = typename T::type> class A : public T {}; // #cwg401-A @@ -87,9 +87,9 @@ namespace cwg401 { // cwg401: 2.8 void g(B b) { f(b); } // #cwg402-f-b // since-cxx11-error@-1 {{no matching function for call to 'f'}} // since-cxx11-note@#cwg402-f {{candidate template ignored: substitution failure [with T = B, U = typename B::type]: 'type' is a protected member of 'cwg401::B'}} -} +} // namespace cwg401 -namespace cwg403 { // cwg403: yes +namespace cwg403 { // cwg403: 2.7 namespace A { struct S {}; int f(void*); @@ -101,13 +101,13 @@ namespace cwg403 { // cwg403: yes // referring to an elaborated-type-specifier naming a // injected-class-name, which is about as far from a // template-id as we can make it. -} +} // namespace cwg403 // cwg404: na // (NB: also sup 594) -namespace cwg405 { // cwg405: yes - // NB: also dup 218 +namespace cwg405 { // cwg405: 2.7 + // NB: also dup 218 namespace A { struct S {}; void f(S); @@ -148,7 +148,7 @@ namespace cwg405 { // cwg405: yes } void testE(E::S es) { f(es); } // expected-error@-1 {{use of undeclared identifier 'f'}} -} +} // namespace cwg405 namespace cwg406 { // cwg406: 2.9 typedef struct { @@ -159,7 +159,7 @@ namespace cwg406 { // cwg406: 2.9 static int n; // expected-error@-1 {{static data member 'n' not allowed in anonymous union}} } B; -} +} // namespace cwg406 namespace cwg407 { // cwg407: 3.8 // NB: reused by cwg1894 and cwg2199 @@ -219,7 +219,7 @@ namespace cwg407 { // cwg407: 3.8 struct S s; } } -} +} // namespace cwg407 namespace cwg408 { // cwg408: 3.4 template<int N> void g() { static_assert(N != 1, ""); } @@ -248,9 +248,9 @@ namespace cwg408 { // cwg408: 3.4 } template<> int R<int>::arr[2]; template void R<int>::f(); -} +} // namespace cwg408 -namespace cwg409 { // cwg409: yes +namespace cwg409 { // cwg409: 2.7 template<typename T> struct A { typedef int B; B b1; @@ -259,7 +259,7 @@ namespace cwg409 { // cwg409: yes A<T*>::B b4; // cxx98-17-error@-1 {{missing 'typename' prior to dependent type name A<T *>::B; implicit 'typename' is a C++20 extension}} }; -} +} // namespace cwg409 namespace cwg410 { // cwg410: no template<class T> void f(T); @@ -286,11 +286,11 @@ namespace cwg410 { // cwg410: no void g(int) { M::A::z(); } // expected-error@-1 {{'z' is a private member of 'cwg410::M::A'}} // expected-note@#cwg410-z {{declared private here}} -} +} // namespace cwg410 // cwg412 is in cwg412.cpp -namespace cwg413 { // cwg413: yes +namespace cwg413 { // cwg413: 2.7 struct S { int a; int : 17; @@ -309,7 +309,7 @@ namespace cwg413 { // cwg413: yes T t2 = { 1, 2 }; // expected-error@-1 {{initializer for aggregate with no elements requires explicit braces}} // expected-note@#cwg413-T {{'cwg413::T' declared here}} -} +} // namespace cwg413 namespace cwg414 { // cwg414: dup 305 struct X {}; @@ -318,21 +318,21 @@ namespace cwg414 { // cwg414: dup 305 struct X {}; x.~X(); } -} +} // namespace cwg414 -namespace cwg415 { // cwg415: yes +namespace cwg415 { // cwg415: 2.7 template<typename T> void f(T, ...) { T::error; } void f(int, int); void g() { f(0, 0); } // ok -} +} // namespace cwg415 -namespace cwg416 { // cwg416: yes +namespace cwg416 { // cwg416: 2.7 extern struct A a; int &operator+(const A&, const A&); int &k = a + a; struct A { float &operator+(A&); }; float &f = a + a; -} +} // namespace cwg416 namespace cwg417 { // cwg417: no struct A; @@ -367,7 +367,7 @@ namespace cwg417 { // cwg417: no struct cwg417::H {}; // expected-error@-1 {{cannot define or redeclare 'H' here because namespace 'M' does not enclose namespace 'cwg417'}} } -} +} // namespace cwg417 namespace cwg418 { // cwg418: no namespace example1 { @@ -464,17 +464,17 @@ namespace cwg420 { // cwg420: 9 q->A::template id<int>::~id<int>(); } #endif -} +} // namespace cwg420 -namespace cwg421 { // cwg421: yes +namespace cwg421 { // cwg421: 2.7 struct X { X(); int n; int &r; }; int *p = &X().n; // cxx98-error@-1 {{taking the address of a temporary object of type 'int'}} // since-cxx11-error@-2 {{cannot take the address of an rvalue of type 'int'}} int *q = &X().r; -} +} // namespace cwg421 -namespace cwg422 { // cwg422: yes +namespace cwg422 { // cwg422: 2.7 template<typename T, typename U> void f() { typedef T type; // #cwg422-typedef-T typedef U type; @@ -484,14 +484,14 @@ namespace cwg422 { // cwg422: yes } template void f<int, int>(); template void f<int, char>(); // #cwg422-f-int-char -} +} // namespace cwg422 -namespace cwg423 { // cwg423: yes +namespace cwg423 { // cwg423: 2.7 template<typename T> struct X { operator T&(); }; void f(X<int> x) { x += 1; } -} +} // namespace cwg423 -namespace cwg424 { // cwg424: yes +namespace cwg424 { // cwg424: 2.7 struct A { typedef int N; // #cwg424-N typedef int N; @@ -519,13 +519,13 @@ namespace cwg424 { // cwg424: yes // expected-error@-1 {{redefinition of 'M'}} // expected-note@#cwg424-M {{previous definition is here}} }; -} +} // namespace cwg424 -namespace cwg425 { // cwg425: yes +namespace cwg425 { // cwg425: 2.7 struct A { template<typename T> operator T() const; } a; float f = 1.0f * a; // expected-error@-1 {{use of overloaded operator '*' is ambiguous (with operand types 'float' and 'struct A')}} - // expected-note@-2 +{{built-in candidate}} + // expected-note@-2 +{{built-in candidate operator*}} template<typename T> struct is_float; template<> struct is_float<float> { typedef void type; }; @@ -535,9 +535,9 @@ namespace cwg425 { // cwg425: yes // cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}} } b; float g = 1.0f * b; // ok -} +} // namespace cwg425 -namespace cwg427 { // cwg427: yes +namespace cwg427 { // cwg427: 2.7 struct B {}; struct D : public B { D(B &) = delete; // #cwg427-D @@ -551,33 +551,33 @@ namespace cwg427 { // cwg427: yes const D &d4(b); // expected-error@-1 {{conversion function from 'B' to 'const D' invokes a deleted function}} // expected-note@#cwg427-D {{'D' has been explicitly marked deleted here}} -} +} // namespace cwg427 -namespace cwg428 { // cwg428: yes +namespace cwg428 { // cwg428: 2.7 template<typename T> T make(); extern struct X x; // #cwg428-X void f() { throw void(); - // expected-error@-1 {{cannot throw}} + // expected-error@-1 {{cannot throw object of incomplete type 'void'}} throw make<void*>(); throw make<const volatile void*>(); throw x; - // expected-error@-1 {{cannot throw}} + // expected-error@-1 {{cannot throw object of incomplete type 'struct X'}} // expected-note@#cwg428-X {{forward declaration of 'cwg428::X'}} throw make<X&>(); - // expected-error@-1 {{cannot throw}} + // expected-error@-1 {{cannot throw object of incomplete type 'cwg428::X'}} // expected-note@#cwg428-X {{forward declaration of 'cwg428::X'}} throw make<X*>(); - // expected-error@-1 {{cannot throw}} + // expected-error@-1 {{cannot throw pointer to object of incomplete type 'cwg428::X'}} // expected-note@#cwg428-X {{forward declaration of 'cwg428::X'}} throw make<const volatile X&>(); - // expected-error@-1 {{cannot throw}} + // expected-error@-1 {{cannot throw object of incomplete type 'cwg428::X'}} // expected-note@#cwg428-X {{forward declaration of 'cwg428::X'}} throw make<const volatile X*>(); - // expected-error@-1 {{cannot throw}} + // expected-error@-1 {{cannot throw pointer to object of incomplete type 'const volatile cwg428::X'}} // expected-note@#cwg428-X {{forward declaration of 'cwg428::X'}} } -} +} // namespace cwg428 namespace cwg429 { // cwg429: 2.8 c++11 // FIXME: This rule is obviously intended to apply to C++98 as well. @@ -592,18 +592,18 @@ namespace cwg429 { // cwg429: 2.8 c++11 static void operator delete(void*); static void operator delete(void*, size_t); } *b = new (0) B; // ok, second delete is not a non-placement deallocation function -} +} // namespace cwg429 -namespace cwg430 { // cwg430: yes c++11 +namespace cwg430 { // cwg430: 2.7 c++11 // resolved by n2239 // FIXME: This should apply in C++98 too. void f(int n) { int a[] = { n++, n++, n++ }; // cxx98-warning@-1 {{multiple unsequenced modifications to 'n'}} } -} +} // namespace cwg430 -namespace cwg431 { // cwg431: yes +namespace cwg431 { // cwg431: 2.8 struct A { template<typename T> T *get(); template<typename T> struct B { @@ -633,7 +633,7 @@ namespace cwg431 { // cwg431: yes // expected-error@-1 {{use 'template' keyword to treat 'get' as a dependent template name}} c->template get<int>(); } -} +} // namespace cwg431 namespace cwg432 { // cwg432: 3.0 template<typename T> struct A {}; @@ -646,9 +646,9 @@ namespace cwg432 { // cwg432: 3.0 // since-cxx11-error@-1 {{use of class template 'D' requires template arguments}} // since-cxx11-note@-2 {{template is declared here}} #endif -} +} // namespace cwg432 -namespace cwg433 { // cwg433: yes +namespace cwg433 { // cwg433: 2.7 template<class T> struct S { void f(union U*); }; @@ -656,7 +656,7 @@ namespace cwg433 { // cwg433: yes template<class T> void S<T>::f(union U*) {} S<int> s; -} +} // namespace cwg433 namespace cwg434 { // cwg434: sup 2352 void f() { @@ -674,16 +674,16 @@ namespace cwg434 { // cwg434: sup 2352 const int * const &rcpci = pi; static_assert(&rcpci == &pi, ""); #endif -} +} // namespace cwg434 // cwg435: na -namespace cwg436 { // cwg436: yes +namespace cwg436 { // cwg436: 2.7 enum E { f }; // #cwg436-f void f(); // expected-error@-1 {{redefinition of 'f' as different kind of symbol}} // expected-note@#cwg436-f {{previous definition is here}} -} +} // namespace cwg436 namespace cwg437 { // cwg437: sup 1308 // This is superseded by 1308, which is in turn superseded by 1330, @@ -702,7 +702,7 @@ namespace cwg437 { // cwg437: sup 1308 // since-cxx17-note@-2 {{use 'noexcept(false)' instead}} struct U {}; }; -} +} // namespace cwg437 // cwg438 is in cwg438.cpp // cwg439 is in cwg439.cpp @@ -710,7 +710,7 @@ namespace cwg437 { // cwg437: sup 1308 // cwg442: sup 348 // cwg443: na -namespace cwg444 { // cwg444: yes +namespace cwg444 { // cwg444: 2.7 struct D; struct B { // #cwg444-B D &operator=(D &) = delete; // #cwg444-deleted @@ -728,7 +728,7 @@ namespace cwg444 { // cwg444: yes // since-cxx11-note@#cwg444-B {{candidate function (the implicit move assignment operator) not viable: expects an rvalue for 1st argument}} // since-cxx11-note@#cwg444-D {{candidate function (the implicit move assignment operator) not viable: expects an rvalue for 1st argument}} } -} +} // namespace cwg444 namespace cwg445 { // cwg445: 3.2 class A { void f(); }; // #cwg445-f @@ -737,7 +737,7 @@ namespace cwg445 { // cwg445: 3.2 // expected-error@-1 {{friend function 'f' is a private member of 'cwg445::A'}} // expected-note@#cwg445-f {{implicitly declared private here}} }; -} +} // namespace cwg445 namespace cwg446 { // cwg446: 2.8 struct C; @@ -771,9 +771,9 @@ namespace cwg446 { // cwg446: 2.8 // cxx98-14-error@-1 {{call to deleted constructor of 'A'}} // cxx98-14-note@#cwg446-deleted {{'A' has been explicitly marked deleted here}} } -} +} // namespace cwg446 -namespace cwg447 { // cwg447: yes +namespace cwg447 { // cwg447: 2.8 struct A { int n; int a[4]; }; template<int> struct U { typedef int type; @@ -799,7 +799,7 @@ namespace cwg447 { // cwg447: yes // expected-error@-1 {{expected ';' after expression}} // expected-error@-2 {{use of undeclared identifier 'd'}} } -} +} // namespace cwg447 namespace cwg448 { // cwg448: 2.8 template<typename T = int> void f(int); // #cwg448-f-int @@ -817,11 +817,11 @@ namespace cwg448 { // cwg448: 2.8 namespace HideFromADL { struct X {}; } template void g(int); // ok template void g(HideFromADL::X); // #cwg448-g -} +} // namespace cwg448 // cwg449: na -namespace cwg450 { // cwg450: yes +namespace cwg450 { // cwg450: 3.2 typedef int A[3]; void f1(const A &); void f2(A &); // #cwg450-f2 @@ -836,13 +836,13 @@ namespace cwg450 { // cwg450: yes void h() { f1(A{}); f2(A{}); - // expected-error@-1 {{no matching function for call to 'f2'}}} - // expected-note@#cwg450-f2 {{candidate function not viable: expects an lvalue for 1st argument}} + // since-cxx11-error@-1 {{no matching function for call to 'f2'}}} + // since-cxx11-note@#cwg450-f2 {{candidate function not viable: expects an lvalue for 1st argument}} } #endif -} +} // namespace cwg450 -namespace cwg451 { // cwg451: yes +namespace cwg451 { // cwg451: 2.7 const int a = 1 / 0; // expected-warning@-1 {{division by zero is undefined}} const int b = 1 / 0; // #cwg451-b @@ -851,20 +851,20 @@ namespace cwg451 { // cwg451: yes // expected-error@-1 {{expression is not an integral constant expression}} // expected-note@-2 {{initializer of 'b' is not a constant expression}} // expected-note@#cwg451-b {{declared here}} -} +} // namespace cwg451 -namespace cwg452 { // cwg452: yes +namespace cwg452 { // cwg452: 2.7 struct A { int a, b, c; A *p; int f(); A() : a(f()), b(this->f() + a), c(this->a), p(this) {} }; -} +} // namespace cwg452 // cwg454 FIXME write a codegen test -namespace cwg456 { // cwg456: yes +namespace cwg456 { // cwg456: 3.4 // sup 903 c++11 const int null = 0; void *p = null; @@ -875,9 +875,9 @@ namespace cwg456 { // cwg456: yes void *q = f; // cxx98-warning@-1 {{initialization of pointer of type 'void *' to null from a constant boolean}} // since-cxx11-error@-2 {{cannot initialize a variable of type 'void *' with an lvalue of type 'const bool'}} -} +} // namespace cwg456 -namespace cwg457 { // cwg457: yes +namespace cwg457 { // cwg457: 2.7 const int a = 1; const volatile int b = 1; static_assert(a, ""); @@ -891,7 +891,7 @@ namespace cwg457 { // cwg457: yes // expected-error@-1 {{expression is not an integral constant expression}} // expected-note@-2 {{read of volatile-qualified type 'const volatile int' is not allowed in a constant expression}} }; -} +} // namespace cwg457 namespace cwg458 { // cwg458: 11 struct A { @@ -932,9 +932,9 @@ namespace cwg458 { // cwg458: 11 // expected-error@-1 {{'T' does not refer to a value}} // expected-note@#cwg458-h-T {{declared here}} } -} +} // namespace cwg458 -namespace cwg460 { // cwg460: yes +namespace cwg460 { // cwg460: 2.7 namespace X { namespace Q { int n; } } namespace Y { using X; @@ -946,7 +946,7 @@ namespace cwg460 { // cwg460: yes // expected-error@-1 {{using declaration cannot refer to a namespace}} // expected-note@-2 {{did you mean 'using namespace'?}} } -} +} // namespace cwg460 // cwg461: na // cwg462 is in cwg462.cpp @@ -983,9 +983,9 @@ void g(int a, CI b, VI c) { c.CI::~CI(); c.VI::~VI(); } -} +} // namespace cwg466 -namespace cwg467 { // cwg467: yes +namespace cwg467 { // cwg467: 2.7 int stuff(); int f() { @@ -1005,9 +1005,9 @@ namespace cwg467 { // cwg467: yes later: return k; } -} +} // namespace cwg467 -namespace cwg468 { // cwg468: yes c++11 +namespace cwg468 { // cwg468: 2.7 c++11 // FIXME: Should we allow this in C++98 too? template<typename> struct A { template<typename> struct B { @@ -1017,7 +1017,7 @@ namespace cwg468 { // cwg468: yes c++11 int k = cwg468::template A<int>::template B<char>::C; // cxx98-error@-1 {{'template' keyword outside of a template}} // cxx98-error@-2 {{'template' keyword outside of a template}} -} +} // namespace cwg468 namespace cwg469 { // cwg469: no template<typename T> struct X; // #cwg469-X @@ -1025,9 +1025,9 @@ namespace cwg469 { // cwg469: no X<int&> x; // expected-error@-1 {{implicit instantiation of undefined template 'cwg469::X<int &>'}} // expected-note@#cwg469-X {{template is declared here}} -} +} // namespace cwg469 -namespace cwg470 { // cwg470: yes +namespace cwg470 { // cwg470: 2.7 template<typename T> struct A { struct B {}; }; @@ -1042,7 +1042,7 @@ namespace cwg470 { // cwg470: yes // ok, instantiating C<char> doesn't instantiate base class members. template struct A<char>; template struct C<char>; -} +} // namespace cwg470 namespace cwg471 { // cwg471: 2.8 struct A { int n; }; @@ -1060,7 +1060,7 @@ namespace cwg471 { // cwg471: 2.8 struct H : B, G { int f() { return n; } }; // expected-error@-1 {{'n' is a private member of 'cwg471::G'}} // expected-note@#cwg471-G-using {{declared private here}} -} +} // namespace cwg471 namespace cwg472 { // cwg472: no drafting 2011-04 struct B { @@ -1077,7 +1077,7 @@ struct D : public I { bp->i = 5; } }; -} +} // namespace cwg472 namespace cwg474 { // cwg474: 3.4 namespace N { @@ -1094,7 +1094,7 @@ namespace cwg474 { // cwg474: 3.4 // expected-error@-1 {{functions that differ only in their return type cannot be overloaded}} // expected-note@#cwg474-g {{previous declaration is here}} } -} +} // namespace cwg474 // cwg475 FIXME write a libc++abi test @@ -1113,15 +1113,15 @@ namespace cwg477 { // cwg477: 3.5 // expected-error@-1 {{can only be specified inside the class definition}} virtual void A::f() {} // expected-error@-1 {{can only be specified inside the class definition}} -} +} // namespace cwg477 -namespace cwg478 { // cwg478: yes +namespace cwg478 { // cwg478: 2.7 struct A { virtual void f() = 0; }; // #cwg478-f void f(A *a); void f(A a[10]); // expected-error@-1 {{array of abstract class type 'A'}} // expected-note@#cwg478-f {{unimplemented pure virtual method 'f' in 'A'}} -} +} // namespace cwg478 namespace cwg479 { // cwg479: 2.8 struct S { @@ -1162,9 +1162,9 @@ namespace cwg479 { // cwg479: 2.8 // expected-note@#cwg479-S-dtor {{declared private here}} } } -} +} // namespace cwg479 -namespace cwg480 { // cwg480: yes +namespace cwg480 { // cwg480: 2.7 struct A { int n; }; struct B : A {}; struct C : virtual B {}; @@ -1187,7 +1187,7 @@ namespace cwg480 { // cwg480: yes A &j = i; D &k = static_cast<D&>(j); // expected-error@-1 {{cannot cast 'A' to 'D &' via virtual base 'cwg480::B'}} -} +} // namespace cwg480 namespace cwg481 { // cwg481: 2.8 template<class T, T U> class A { T *x; }; @@ -1232,7 +1232,7 @@ namespace cwg481 { // cwg481: 2.8 template<N X, typename N, template<N Y> class T> struct I; template<char*> struct J; I<123, char*, J> *j; -} +} // namespace cwg481 namespace cwg482 { // cwg482: 3.5 extern int a; @@ -1274,12 +1274,12 @@ namespace cwg482 { // cwg482: 3.5 #if __cplusplus >= 201103L enum class C; enum class A::C {}; - // expected-error@-1 {{extra qualification on member 'C'}} + // since-cxx11-error@-1 {{extra qualification on member 'C'}} #endif }; -} +} // namespace cwg482 -namespace cwg483 { // cwg483: yes +namespace cwg483 { // cwg483: 2.7 namespace climits { static_assert(__SCHAR_MAX__ >= 127, ""); static_assert(__SHRT_MAX__ >= 32767, ""); @@ -1294,9 +1294,9 @@ namespace cwg483 { // cwg483: yes static_assert(__WCHAR_WIDTH__ >= 8, ""); static_assert(__WINT_WIDTH__ >= 16, ""); } -} +} // namespace cwg483 -namespace cwg484 { // cwg484: yes +namespace cwg484 { // cwg484: 2.8 struct A { A(); void f(); @@ -1332,9 +1332,9 @@ namespace cwg484 { // cwg484: yes S(); // expected-error@-1 {{a type specifier is required for all declarations}} } S; -} +} // namespace cwg484 -namespace cwg485 { // cwg485: yes +namespace cwg485 { // cwg485: 2.7 namespace N { struct S {}; int operator+(S, S); @@ -1345,9 +1345,9 @@ namespace cwg485 { // cwg485: yes N::S s; int a = operator+(s, s); int b = f<int>(s); -} +} // namespace cwg485 -namespace cwg486 { // cwg486: yes +namespace cwg486 { // cwg486: 2.7 template<typename T> T f(T *); // #cwg486-f int &f(...); @@ -1364,18 +1364,18 @@ namespace cwg486 { // cwg486: yes // expected-error@-1 {{no matching function for call to 'f'}} // expected-note@#cwg486-f {{candidate template ignored: substitution failure [with T = int[10]]: function cannot return array type 'int[10]'}} } -} +} // namespace cwg486 -namespace cwg487 { // cwg487: yes +namespace cwg487 { // cwg487: 2.7 enum E { e }; int operator+(int, E); // #cwg487-operator-plus static_assert(4 + e, ""); // expected-error@-1 {{expression is not an integral constant expression}} // since-cxx11-note@-2 {{non-constexpr function 'operator+' cannot be used in a constant expression}} // since-cxx11-note@#cwg487-operator-plus {{declared here}} -} +} // namespace cwg487 -namespace cwg488 { // cwg488: yes c++11 +namespace cwg488 { // cwg488: 2.9 c++11 template <typename T> void f(T); void f(int); void g() { @@ -1387,7 +1387,7 @@ namespace cwg488 { // cwg488: yes c++11 f(e); // cxx98-error@-1 {{template argument uses local type 'E'}} } -} +} // namespace cwg488 // cwg489: na @@ -1433,13 +1433,13 @@ namespace cwg490 { // cwg490: 2.8 // the class of the conversion function first. friend A::operator X<T>(); }; -} +} // namespace cwg490 namespace cwg491 { // cwg491: dup 413 struct A {} a, b[3] = { a, {} }; A c[2] = { a, {}, b[1] }; // expected-error@-1 {{excess elements in array initializer}} -} +} // namespace cwg491 // cwg492 is in cwg492.cpp @@ -1451,7 +1451,7 @@ namespace cwg493 { // cwg493: dup 976 if (X()) { } } -} +} // namespace cwg493 namespace cwg494 { // cwg494: dup 372 class A { @@ -1464,7 +1464,7 @@ namespace cwg494 { // cwg494: dup 372 A::B y; }; }; -} +} // namespace cwg494 namespace cwg495 { // cwg495: 3.5 template<typename T> @@ -1482,7 +1482,7 @@ namespace cwg495 { // cwg495: 3.5 }; S2<int> s2; long n2 = s2; -} +} // namespace cwg495 namespace cwg496 { // cwg496: sup 2094 struct A { int n; }; @@ -1494,7 +1494,7 @@ namespace cwg496 { // cwg496: sup 2094 static_assert(__is_trivially_constructible(B, const B&), ""); static_assert(__is_trivially_assignable(A, const A&), ""); static_assert(__is_trivially_assignable(B, const B&), ""); -} +} // namespace cwg496 namespace cwg497 { // cwg497: sup 253 void before() { @@ -1517,9 +1517,9 @@ namespace cwg497 { // cwg497: sup 253 cs.*pm = 88; // expected-error@-1 {{read-only variable is not assignable}} } -} +} // namespace cwg497 -namespace cwg499 { // cwg499: yes +namespace cwg499 { // cwg499: 2.7 extern char str[]; void f() { throw str; } -} +} // namespace cwg499 diff --git a/clang/test/CXX/drs/cwg571.cpp b/clang/test/CXX/drs/cwg571.cpp index 9f0f455fb727..09d12e1197b5 100644 --- a/clang/test/CXX/drs/cwg571.cpp +++ b/clang/test/CXX/drs/cwg571.cpp @@ -12,7 +12,7 @@ namespace cwg571 { // cwg571: 2.7 const ir r = n; // expected-warning@-1 {{'const' qualifier on reference type 'ir' (aka 'int &') has no effect}} ir r2 = n; -} +} // namespace cwg571 // Entities have external linkage by default. diff --git a/clang/test/CXX/drs/cwgr593.cpp b/clang/test/CXX/drs/cwg593.cpp index d747f4e4a161..d747f4e4a161 100644 --- a/clang/test/CXX/drs/cwgr593.cpp +++ b/clang/test/CXX/drs/cwg593.cpp diff --git a/clang/test/CXX/drs/cwg5xx.cpp b/clang/test/CXX/drs/cwg5xx.cpp index 9219a4c857b1..1fdfe5785c5c 100644 --- a/clang/test/CXX/drs/cwg5xx.cpp +++ b/clang/test/CXX/drs/cwg5xx.cpp @@ -17,16 +17,16 @@ __extension__ typedef __SIZE_TYPE__ size_t; void *operator new(size_t); // #cwg5xx-global-operator-new // cxx98-error@-1 {{'operator new' is missing exception specification 'throw(std::bad_alloc)'}} -#if __cplusplus > 201402L +#if __cplusplus >= 201703L namespace std { enum class align_val_t : size_t {}; -} +} // namespace std void *operator new(size_t, std::align_val_t); // #cwg5xx-global-operator-new-aligned #endif namespace std { struct type_info; -} +} // namespace std namespace cwg500 { // cwg500: dup 372 class D; @@ -38,9 +38,9 @@ namespace cwg500 { // cwg500: dup 372 class A::B {}; class A::C : public A::B {}; class D : public A::B {}; -} +} // namespace cwg500 -namespace cwg501 { // cwg501: yes +namespace cwg501 { // cwg501: 2.7 struct A { friend void f() {} void g() { @@ -48,9 +48,9 @@ namespace cwg501 { // cwg501: yes // expected-error@-1 {{use of undeclared identifier 'f'}} } }; -} +} // namespace cwg501 -namespace cwg502 { // cwg502: yes +namespace cwg502 { // cwg502: 2.7 struct Q {}; template<typename T> struct A { enum E { e = 1 }; @@ -63,9 +63,9 @@ namespace cwg502 { // cwg502: yes int f(A<int>::E); template<int N> int f(Q (&)[N]); template struct A<int>; -} +} // namespace cwg502 -namespace cwg505 { // cwg505: yes +namespace cwg505 { // cwg505: 2.7 const char *exts = "\e\(\{\[\%"; // expected-error@-1 {{use of non-standard escape character '\e'}} // expected-error@-2 {{use of non-standard escape character '\('}} @@ -74,15 +74,15 @@ namespace cwg505 { // cwg505: yes // expected-error@-5 {{use of non-standard escape character '\%'}} const char *unknown = "\Q"; // expected-error@-1 {{unknown escape sequence '\Q'}} -} +} // namespace cwg505 -namespace cwg506 { // cwg506: yes +namespace cwg506 { // cwg506: 2.7 struct NonPod { ~NonPod(); }; void f(...); void g(NonPod np) { f(np); } // cxx98-error@-1 {{cannot pass object of non-POD type 'NonPod' through variadic function; call will abort at runtime}} // since-cxx11-error@-2 {{cannot pass object of non-trivial type 'NonPod' through variadic function; call will abort at runtime}} -} +} // namespace cwg506 // FIXME: Add tests here once CWG260 is resolved. // cwg507: dup 260 @@ -91,7 +91,7 @@ namespace cwg506 { // cwg506: yes // cwg509: na // cwg510: na -namespace cwg512 { // cwg512: yes +namespace cwg512 { // cwg512: 3.0 struct A { // #cwg512-A A(int); // #cwg512-A-ctor }; @@ -99,14 +99,14 @@ namespace cwg512 { // cwg512: yes // cxx98-error@-1 {{union member 'a' has a non-trivial default constructor}} // cxx98-note@#cwg512-A {{because type 'cwg512::A' has no default constructor}} // cxx98-note@#cwg512-A-ctor {{implicit default constructor suppressed by user-declared constructor}} -} +} // namespace cwg512 // cwg513: na -namespace cwg514 { // cwg514: yes +namespace cwg514 { // cwg514: 2.7 namespace A { extern int x, y; } int A::x = y; -} +} // namespace cwg514 namespace cwg515 { // cwg515: sup 1017 // FIXME: cwg1017 reverses the wording of cwg515, but the current draft has @@ -121,7 +121,7 @@ namespace cwg515 { // cwg515: sup 1017 struct A { int a; }; struct B { void f() { int k = sizeof(A::a); } }; // cxx98-error@-1 {{invalid use of non-static data member 'a'}} -} +} // namespace cwg515 // cwg516: na @@ -144,12 +144,12 @@ namespace cwg517 { // cwg517: no // FIXME: These are both ill-formed. template<typename T> struct S<T&> {}; template<typename T> int v<T&> = 0; -} +} // namespace cwg517 -namespace cwg518 { // cwg518: yes c++11 +namespace cwg518 { // cwg518: 2.7 c++11 enum E { e, }; // cxx98-error@-1 {{commas at the end of enumerator lists are a C++11 extension}} -} +} // namespace cwg518 // cwg519 is in cwg519.cpp // cwg520: na @@ -158,7 +158,7 @@ namespace cwg518 { // cwg518: yes c++11 // FIXME: The wording here is broken. It's not reasonable to expect a // diagnostic here. Once the relevant DR gets a number, mark this as a dup. -namespace cwg522 { // cwg522: yes +namespace cwg522 { // cwg522: 2.7 struct S {}; template<typename T> void b1(volatile T &); template<typename T> void b2(volatile T * const *); @@ -188,9 +188,9 @@ namespace cwg522 { // cwg522: yes b3(d); b3(cd); } -} +} // namespace cwg522 -namespace cwg524 { // cwg524: yes +namespace cwg524 { // cwg524: 2.7 template<typename T> void f(T a, T b) { operator+(a, b); } // expected-error@-1 {{call to function 'operator+' that is neither visible in the template definition nor found by argument-dependent lookup}} // expected-note@#cwg524-f-N-S {{in instantiation of function template specialization 'cwg524::f<cwg524::N::S>' requested here}} @@ -203,9 +203,9 @@ namespace cwg524 { // cwg524: yes namespace N { struct S {}; } void operator+(N::S, N::S); // #cwg524-operator-plus template void f(N::S, N::S); // #cwg524-f-N-S -} +} // namespace cwg524 -namespace cwg525 { // cwg525: yes +namespace cwg525 { // cwg525: 2.7 namespace before { // Note, the example was correct prior to the change; instantiation is // required for cases like this: @@ -222,9 +222,9 @@ namespace cwg525 { // cwg525: yes delete ppp; // #cwg525-ppp } } -} +} // namespace cwg525 -namespace cwg526 { // cwg526: yes +namespace cwg526 { // cwg526: 2.7 template<int> struct S {}; template<int N> void f1(S<N> s); template<int N> void f2(S<(N)> s); // #cwg526-f2 @@ -258,7 +258,7 @@ namespace cwg526 { // cwg526: yes X<+N>::type v3; // cxx98-17-error@-1 {{missing 'typename' prior to dependent type name X<+N>::type; implicit 'typename' is a C++20 extension}} }; -} +} // namespace cwg526 namespace cwg527 { // cwg527: na // This DR is meaningless. It removes a required diagnostic from the case @@ -273,7 +273,7 @@ namespace cwg527 { // cwg527: na namespace { struct F { static P f; }; } int ax = a.x, bx = b.x, cx = c.x, dx = d.x, ex = E::e->x, fx = F::f->x; -} +} // namespace cwg527 namespace cwg528 { // cwg528: 2.7 @@ -287,14 +287,14 @@ void f() { } // namespace cwg528 -namespace cwg530 { // cwg530: yes +namespace cwg530 { // cwg530: 2.7 template<int*> struct S { enum { N = 1 }; }; template<void(*)()> struct T { enum { N = 1 }; }; int n; void f(); int a[S<&n>::N]; int b[T<&f>::N]; -} +} // namespace cwg530 namespace cwg531 { // cwg531: partial namespace good { @@ -412,7 +412,7 @@ namespace cwg531 { // cwg531: partial // cxx98-17-error@-1 {{template parameter list matching the non-templated nested type 'cwg531::nested::A<int>::B<char>' should be empty ('template<>')}} #endif } -} +} // namespace cwg531 // PR8130 namespace cwg532 { // cwg532: 3.5 @@ -428,7 +428,7 @@ namespace cwg532 { // cwg532: 3.5 B<A> b; int &ir = b * a; } -} +} // namespace cwg532 // cwg533: na @@ -437,9 +437,9 @@ namespace cwg534 { // cwg534: 2.9 template<typename T> void operator+(S, T); template<typename T> void operator+<T*>(S, T*) {} // expected-error@-1 {{function template partial specialization is not allowed}} -} +} // namespace cwg534 -namespace cwg535 { // cwg535: yes +namespace cwg535 { // cwg535: 3.1 class X { private: X(const X&); }; struct A { X x; @@ -468,14 +468,14 @@ namespace cwg535 { // cwg535: yes // ok, copy is elided constexpr C x = c(); #endif -} +} // namespace cwg535 // cwg536: na // cwg537: na // cwg538: na -// cwg539: yes -const cwg539( +namespace cwg539 { // cwg539: 3.4 +const f( // expected-error@-1 {{a type specifier is required for all declarations}} const a) { // expected-error@-1 {{unknown type name 'a'}} @@ -509,11 +509,11 @@ const cwg539( int arr[3]; // FIXME: The extra braces here are to avoid the parser getting too // badly confused when recovering here. We should fix this recovery. - { for (const n + { for (const n // #cwg539-for // since-cxx11-error@-1 {{unknown type name 'n'}} - // since-cxx11-note@-2 {{}} : arr) ; {} } // since-cxx11-error@-1 +{{}} + // since-cxx11-note@#cwg539-for {{}} (void) [](const) {}; // since-cxx11-error@-1 {{a type specifier is required for all declarations}} (void) [](const n) {}; @@ -526,8 +526,9 @@ const cwg539( // since-cxx11-error@-1 {{expected a type}} #endif } +} // namespace cwg539 -namespace cwg540 { // cwg540: yes +namespace cwg540 { // cwg540: 2.7 typedef int &a; typedef const a &a; // expected-warning@-1 {{'const' qualifier on reference type 'a' (aka 'int &') has no effect}} @@ -539,9 +540,9 @@ namespace cwg540 { // cwg540: yes // expected-error@#cwg540-typedef-b-c {{typedef redefinition with different types ('const int &' vs 'int &')}} // expected-note@#cwg540-typedef-a-c {{previous definition is here}} // expected-warning@#cwg540-typedef-b-c {{'const' qualifier on reference type 'b' (aka 'const int &') has no effect}} -} +} // namespace cwg540 -namespace cwg541 { // cwg541: yes +namespace cwg541 { // cwg541: 2.7 template<int> struct X { typedef int type; }; template<typename T> struct S { int f(T); @@ -569,9 +570,9 @@ namespace cwg541 { // cwg541: yes typename X<sizeof(h(0))>::type b; } }; -} +} // namespace cwg541 -namespace cwg542 { // cwg542: yes +namespace cwg542 { // cwg542: 3.5 #if __cplusplus >= 201103L // In C++20 A and B are no longer aggregates and thus the constructor is // called, which fails. @@ -591,7 +592,7 @@ namespace cwg542 { // cwg542: yes // since-cxx20-error@-1 {{calling a private constructor of class 'cwg542::B'}} // since-cxx20-note@#cwg542-B-ctor {{declared private here}} #endif -} +} // namespace cwg542 namespace cwg543 { // cwg543: 3.0 // In C++98+CWG543, this is valid because value-initialization doesn't call a @@ -607,22 +608,22 @@ namespace cwg543 { // cwg543: 3.0 A a = A(); // since-cxx11-error@-1 {{call to implicitly-deleted default constructor of 'A'}} // since-cxx11-note@#cwg543-A-n {{default constructor of 'A' is implicitly deleted because field 'n' of const-qualified type 'const int' would not be initialized}} -} +} // namespace cwg543 -namespace cwg544 { // cwg544: yes +namespace cwg544 { // cwg544: 2.7 int *n; template<class T> struct A { int n; }; template<class T> struct B : A<T> { int get(); }; template<> int B<int>::get() { return n; } int k = B<int>().get(); -} +} // namespace cwg544 -namespace cwg546 { // cwg546: yes +namespace cwg546 { // cwg546: 2.7 template<typename T> struct A { void f(); }; template struct A<int>; template<typename T> void A<T>::f() { T::error; } -} +} // namespace cwg546 namespace cwg547 { // cwg547: 3.2 template<typename T> struct X; @@ -631,18 +632,18 @@ namespace cwg547 { // cwg547: 3.2 struct S { void f() const; }; X<void() const> x = f(&S::f); -} +} // namespace cwg547 namespace cwg548 { // cwg548: dup 482 template<typename T> struct S {}; template<typename T> void f() {} template struct cwg548::S<int>; template void cwg548::f<int>(); -} +} // namespace cwg548 // cwg550: dup 393 -namespace cwg551 { // cwg551: yes c++11 +namespace cwg551 { // cwg551: 2.7 c++11 // FIXME: This obviously should apply in C++98 mode too. template<typename T> void f() {} template inline void f<int>(); @@ -657,13 +658,13 @@ namespace cwg551 { // cwg551: yes c++11 }; template inline void X<int>::f(); // since-cxx11-error@-1 {{explicit instantiation cannot be 'inline'}} -} +} // namespace cwg551 -namespace cwg552 { // cwg552: yes +namespace cwg552 { // cwg552: 2.7 template<typename T, typename T::U> struct X {}; struct Y { typedef int U; }; X<Y, 0> x; -} +} // namespace cwg552 // cwg553: 2.7 struct cwg553_class { @@ -683,7 +684,7 @@ namespace cwg553 { friend void *operator new(size_t, namespace_scope); // expected-error@-1 {{'operator new' cannot be declared inside a namespace}} }; -} +} // namespace cwg553 // cwg554: na @@ -753,7 +754,7 @@ namespace cwg557 { // cwg557: 3.1 f(p); g(q); } -} +} // namespace cwg557 namespace cwg558 { // cwg558: 2.9 wchar_t a = L'\uD7FF'; @@ -766,9 +767,11 @@ namespace cwg558 { // cwg558: 2.9 wchar_t f = L'\xDFFF'; wchar_t g = L'\uE000'; wchar_t h = L'\xE000'; -} +} // namespace cwg558 -template<typename> struct cwg559 { typedef int T; cwg559::T u; }; // cwg559: yes +namespace cwg559 { // cwg559: 2.7 +template<typename> struct S { typedef int T; S::T u; }; +} // namespace cwg559 namespace cwg560 { // cwg560: 16 @@ -784,7 +787,7 @@ Outer<T>::Inner* Outer<T>::Inner::self() { return this; } } // namespace cwg560 -namespace cwg561 { // cwg561: yes +namespace cwg561 { // cwg561: 2.7 template<typename T> void f(int); template<typename T> void g(T t) { f<T>(t); @@ -796,19 +799,19 @@ namespace cwg561 { // cwg561: yes void h(S s) { g(s); } -} +} // namespace cwg561 // cwg562: na // cwg563 is in cwg563.cpp -namespace cwg564 { // cwg564: yes +namespace cwg564 { // cwg564: 2.7 extern "C++" void f(int); void f(int); // ok extern "C++" { extern int n; } int n; // ok -} +} // namespace cwg564 -namespace cwg565 { // cwg565: yes +namespace cwg565 { // cwg565: 2.7 namespace N { template<typename T> int f(T); // #cwg565-f } @@ -822,13 +825,13 @@ namespace cwg565 { // cwg565: yes // expected-error@-1 {{declaration conflicts with target of using declaration already in scope}} // expected-note@#cwg565-f {{target of using declaration}} // expected-note@#cwg565-using {{using declaration}} -} +} // namespace cwg565 -namespace cwg566 { // cwg566: yes +namespace cwg566 { // cwg566: 3.1 #if __cplusplus >= 201103L static_assert(int(-3.99) == -3, ""); #endif -} +} // namespace cwg566 // cwg567: na @@ -871,14 +874,14 @@ namespace cwg568 { // cwg568: 3.0 c++11 trivial t; // #cwg568-t x: ; } -} +} // namespace cwg568 -namespace cwg569 { // cwg569: yes c++11 +namespace cwg569 { // cwg569: 2.7 c++11 // FIXME: This is a DR issue against C++98, so should probably apply there // too. ;;;;; // cxx98-error@-1 {{C++11 extension}} -} +} // namespace cwg569 namespace cwg570 { // cwg570: dup 633 int n; @@ -886,14 +889,14 @@ namespace cwg570 { // cwg570: dup 633 int &r = n; // expected-error@-1 {{redefinition of 'r'}} // expected-note@#cwg570-r {{previous definition is here}} -} +} // namespace cwg570 // cwg571 is in cwg571.cpp -namespace cwg572 { // cwg572: yes +namespace cwg572 { // cwg572: 2.7 enum E { a = 1, b = 2 }; static_assert(a + b == 3, ""); -} +} // namespace cwg572 namespace cwg573 { // cwg573: no void *a; @@ -910,7 +913,7 @@ namespace cwg573 { // cwg573: no // FIXME: This is ill-formed. template<void*> struct S; template<int*> struct T; -} +} // namespace cwg573 namespace cwg574 { // cwg574: 3.0 struct A { @@ -965,9 +968,9 @@ namespace cwg574 { // cwg574: 3.0 // since-cxx11-note@#cwg574-D-copy-assign {{candidate function}} #endif }; -} +} // namespace cwg574 -namespace cwg575 { // cwg575: yes +namespace cwg575 { // cwg575: 2.7 template<typename T, typename U = typename T::type> void a(T); void a(...); // cxx98-error@-1 {{default template arguments for a function template are a C++11 extension}} template<typename T, typename T::type U = 0> void b(T); void b(...); @@ -993,7 +996,7 @@ namespace cwg575 { // cwg575: yes template<typename T> T &h(T *); template<typename T> T *h(T *); void *p = h((void*)0); -} +} // namespace cwg575 namespace cwg576 { // cwg576: 3.5 typedef void f() {} @@ -1001,7 +1004,7 @@ namespace cwg576 { // cwg576: 3.5 void f(typedef int n); // expected-error@-1 {{invalid storage class specifier in function declarator}} void f(char c) { typedef int n; } -} +} // namespace cwg576 namespace cwg577 { // cwg577: 3.5 typedef void V; @@ -1036,7 +1039,7 @@ namespace cwg577 { // cwg577: 3.5 // expected-error@-1 {{no matching function for call to 'j'}} // expected-note@#cwg577-j {{candidate template ignored: substitution failure [with T = const void]: argument may not have 'void' type}} } -} +} // namespace cwg577 namespace cwg580 { // cwg580: partial class C; @@ -1086,7 +1089,7 @@ namespace cwg580 { // cwg580: partial // expected-note@#cwg580-C-ctor {{implicitly declared private here}} // expected-error@#cwg580-c {{variable of type 'C' has private destructor}} // expected-note@#cwg580-C-dtor {{implicitly declared private here}} -} +} // namespace cwg580 // cwg582: na @@ -1101,7 +1104,7 @@ namespace cwg583 { // cwg583: 4 // expected-error@-1 {{ordered comparison between pointer and zero ('int *' and 'int')}} bool b4 = p >= 0; // expected-error@-1 {{ordered comparison between pointer and zero ('int *' and 'int')}} -} +} // namespace cwg583 // cwg584: na @@ -1127,7 +1130,7 @@ namespace cwg585 { // cwg585: 3.0 template<typename U> friend T<U>; // expected-error@-1 {{friend type templates must use an elaborated type}} }; -} +} // namespace cwg585 // cwg586: na @@ -1138,9 +1141,9 @@ namespace cwg587 { // cwg587: 3.2 struct S {}; template void f(bool, const int, int); template void f(bool, const S, S); -} +} // namespace cwg587 -namespace cwg588 { // cwg588: yes +namespace cwg588 { // cwg588: 2.7 struct A { int n; }; // #cwg588-A template<typename T> int f() { struct S : A, T { int f() { return n; } } s; @@ -1153,9 +1156,9 @@ namespace cwg588 { // cwg588: yes } struct B { int n; }; // #cwg588-B int k = f<B>(); // #cwg588-k -} +} // namespace cwg588 -namespace cwg589 { // cwg589: yes +namespace cwg589 { // cwg589: 2.7 struct B { }; struct D : B { }; D f(); @@ -1165,9 +1168,9 @@ namespace cwg589 { // cwg589: yes // expected-error@-1 {{taking the address of a temporary object of type 'const B'}} const B *q = &(a ? D() : b); // expected-error@-1 {{taking the address of a temporary object of type 'const B'}} -} +} // namespace cwg589 -namespace cwg590 { // cwg590: yes +namespace cwg590 { // cwg590: 2.7 template<typename T> struct A { struct B { struct C { @@ -1176,7 +1179,7 @@ namespace cwg590 { // cwg590: yes }; }; template<typename T> typename A<T>::B::C A<T>::B::C::f(A<T>::B::C) {} -} +} // namespace cwg590 namespace cwg591 { // cwg591: 20 template<typename T> struct A { @@ -1245,7 +1248,7 @@ namespace cwg591 { // cwg591: 20 M m; // expected-error@-1 {{field has incomplete type 'M' (aka 'void'}} }; -} +} // namespace cwg591 // cwg592: na // cwg593 is in cwg593.cpp @@ -1260,11 +1263,11 @@ namespace cwg595 { // cwg595: dup 1330 struct S { X<S> xs; }; -} +} // namespace cwg595 // cwg597: na -namespace cwg598 { // cwg598: yes +namespace cwg598 { // cwg598: 2.7 namespace N { void f(int); void f(char); @@ -1284,7 +1287,7 @@ namespace cwg598 { // cwg598: yes int &s = h(N::f); // expected-error@-1 {{use of undeclared identifier 'h'}} int &t = h(N::i); -} +} // namespace cwg598 namespace cwg599 { // cwg599: partial typedef int Fn(); @@ -1311,4 +1314,4 @@ namespace cwg599 { // cwg599: partial // expected-note@#cwg599-U {{conversion to pointer type 'void *'}} delete v; } -} +} // namespace cwg599 diff --git a/clang/test/CXX/drs/cwg6xx.cpp b/clang/test/CXX/drs/cwg6xx.cpp index 1c56dd390715..fb6acde459d9 100644 --- a/clang/test/CXX/drs/cwg6xx.cpp +++ b/clang/test/CXX/drs/cwg6xx.cpp @@ -1,9 +1,10 @@ -// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98-17,cxx98-14,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking -// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx11-20,cxx98-17,cxx11-17,cxx98-14,since-cxx11,cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking -// RUN: %clang_cc1 -std=c++14 %s -verify=expected,cxx11-20,cxx98-17,cxx11-17,cxx98-14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking -// RUN: %clang_cc1 -std=c++17 %s -verify=expected,cxx11-20,cxx98-17,cxx11-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking -// RUN: %clang_cc1 -std=c++20 %s -verify=expected,cxx11-20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking -// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -fno-spell-checking +// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98-17,cxx98-14,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx11-20,cxx98-17,cxx11-17,cxx98-14,since-cxx11,cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 %s -verify=expected,cxx11-20,cxx98-17,cxx11-17,cxx98-14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify=expected,cxx11-20,cxx98-17,cxx11-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 %s -verify=expected,cxx11-20,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -32,7 +33,7 @@ namespace std { __extension__ typedef __SIZE_TYPE__ size_t; } // namespace std -namespace cwg601 { // cwg601: yes +namespace cwg601 { // cwg601: 2.7 #if __cplusplus >= 201103L #define MAX __LLONG_MAX__ #else @@ -60,9 +61,9 @@ static_assert(0x8000000000000000 < -1, "0x8000000000000000 should be unsigned"); #endif #undef MAX -} +} // namespace cwg601 -namespace cwg602 { // cwg602: yes +namespace cwg602 { // cwg602: 2.7 template<class T> struct A { template<class U> friend struct A; }; @@ -75,14 +76,14 @@ namespace cwg602 { // cwg602: yes typename C::type ct; // ok, befriended }; B<int> b; -} +} // namespace cwg602 -namespace cwg603 { // cwg603: yes +namespace cwg603 { // cwg603: 3.1 template<unsigned char> struct S {}; typedef S<'\001'> S1; typedef S<(1ul << __CHAR_BIT__) + 1> S1; - // since-cxx11-error@-1 {{cannot be narrowed}} -} + // since-cxx11-error@-1 {{non-type template argument evaluates to 257, which cannot be narrowed to type 'unsigned char'}} +} // namespace cwg603 // cwg604: na // cwg605 is in cwg605.cpp @@ -107,9 +108,9 @@ namespace cwg606 { // cwg606: 3.0 h(test); // ok, an rvalue reference can bind to a function lvalue } #endif -} +} // namespace cwg606 -namespace cwg607 { // cwg607: yes +namespace cwg607 { // cwg607: 2.7 namespace example1 { struct Y {}; @@ -137,23 +138,25 @@ N::D::D() : typedef_B(0) {} } // namespace example2 } // namespace cwg607 -namespace cwg608 { // cwg608: yes +namespace cwg608 { // cwg608: 2.7 struct A { virtual void f(); }; struct B : A {}; struct C : A { void f(); }; struct D : B, C {}; -} +} // namespace cwg608 -static_assert(-0u == 0u, ""); // cwg610: yes +namespace cwg610 { // cwg610: 2.7 +static_assert(-0u == 0u, ""); +} // namespace cwg610 -namespace cwg611 { // cwg611: yes +namespace cwg611 { // cwg611: 2.7 int k; struct S { int &r; } s = { k ? k : k }; -} +} // namespace cwg611 // cwg612: na -namespace cwg613 { // cwg613: yes c++11 +namespace cwg613 { // cwg613: 3.1 c++11 // see also n2253 struct A { int n; static void f(); }; int f(int); @@ -188,15 +191,17 @@ namespace cwg613 { // cwg613: yes c++11 // cxx98-error@-1 {{invalid use of member 'n' in static member function}} // since-cxx11-error@-2 {{invalid use of non-static data member 'n'}} } -} +} // namespace cwg613 -static_assert((-1) / 2 == 0, ""); // cwg614: yes +namespace cwg614 { // cwg614: 2.7 +static_assert((-1) / 2 == 0, ""); static_assert((-1) % 2 == -1, ""); +} // namespace cwg614 -namespace cwg615 { // cwg615: yes +namespace cwg615 { // cwg615: 2.7 int f(); static int n = f(); -} +} // namespace cwg615 namespace cwg616 { // cwg616: 4 #if __cplusplus >= 201103L @@ -214,15 +219,15 @@ namespace cwg616 { // cwg616: 4 using U = decltype(static_cast<S&&>(s).n); using U = int; #endif -} +} // namespace cwg616 -namespace cwg618 { // cwg618: yes +namespace cwg618 { // cwg618: 2.7 #if (unsigned)-1 > 0 #error wrong #endif -} +} // namespace cwg618 -namespace cwg619 { // cwg619: yes +namespace cwg619 { // cwg619: 3.4 extern int x[10]; struct S { static int x[10]; }; @@ -239,24 +244,24 @@ namespace cwg619 { // cwg619: yes sizeof(x); // expected-error@-1 {{invalid application of 'sizeof' to an incomplete type 'int[]'}} } -} +} // namespace cwg619 // cwg620: dup 568 -namespace cwg621 { // cwg621: yes +namespace cwg621 { // cwg621: 2.7 template<typename T> T f(); template<> int f() {} // #cwg621-f template<> int f<int>() {} // expected-error@-1 {{redefinition of 'f<int>'}} // expected-note@#cwg621-f {{previous definition is here}} -} +} // namespace cwg621 // cwg623: na // FIXME: Add documentation saying we allow invalid pointer values. // cwg624 needs a libc++abi test. -namespace cwg625 { // cwg625: yes +namespace cwg625 { // cwg625: 2.9 template<typename T> struct A {}; A<auto> x = A<int>(); // cxx98-error@-1 {{'auto' type specifier is a C++11 extension}} @@ -265,16 +270,16 @@ namespace cwg625 { // cwg625: yes void (*p)(auto) = f; // cxx98-error@-1 {{'auto' type specifier is a C++11 extension}} // expected-error@-2 {{'auto' not allowed in function prototype}} -} +} // namespace cwg625 -namespace cwg626 { // cwg626: yes +namespace cwg626 { // cwg626: 2.7 #define STR(x) #x char c[2] = STR(c); // ok, type matches wchar_t w[2] = STR(w); // expected-error@-1 {{initializing wide char array with non-wide string literal}} -} +} // namespace cwg626 -namespace cwg627 { // cwg627: yes +namespace cwg627 { // cwg627: 2.7 void f() { // FIXME: emitted diagnostic have a room for improvement true a = 0; @@ -282,7 +287,7 @@ namespace cwg627 { // cwg627: yes // expected-error@-2 {{use of undeclared identifier 'a'}} // expected-warning@-3 {{expression result unused}} } -} +} // namespace cwg627 // cwg628: na @@ -297,9 +302,9 @@ namespace cwg629 { // cwg629: 2.9 // since-cxx11-error@-1 {{redefinition of 'T'}} // since-cxx11-note@#cwg629-T {{previous definition is here}} } -} +} // namespace cwg629 -namespace cwg630 { // cwg630: yes +namespace cwg630 { // cwg630: 2.7 const bool MB_EQ_WC = ' ' == L' ' && '\t' == L'\t' && '\v' == L'\v' && '\r' == L'\r' && '\n' == L'\n' && // @@ -331,19 +336,19 @@ static_assert(!MB_EQ_WC, "__STDC_MB_MIGHT_NEQ_WC__ but all basic source characte #else static_assert(MB_EQ_WC, "!__STDC_MB_MIGHT_NEQ_WC__ but some character differs"); #endif -} +} // namespace cwg630 // cwg631: na -namespace cwg632 { // cwg632: yes +namespace cwg632 { // cwg632: 2.7 struct S { int n; } s = {{5}}; // expected-warning@-1 {{braces around scalar initializer}} -} +} // namespace cwg632 // cwg633: na // see also n2993 -namespace cwg634 { // cwg634: yes +namespace cwg634 { // cwg634: 2.7 struct S { S(); S(const S&); virtual void f(); ~S(); }; int f(...); char f(int); @@ -353,9 +358,9 @@ namespace cwg634 { // cwg634: yes int k = f(S()); // cxx98-error@-1 {{cannot pass object of non-POD type 'S' through variadic function; call will abort at runtime}} // since-cxx11-error@-2 {{cannot pass object of non-trivial type 'S' through variadic function; call will abort at runtime}} -} +} // namespace cwg634 -namespace cwg635 { // cwg635: yes +namespace cwg635 { // cwg635: 2.7 template<typename T> struct A { A(); ~A(); }; template<typename T> A<T>::A<T>() {} // expected-error@-1 {{out-of-line constructor for 'A' cannot have template arguments}} @@ -380,15 +385,15 @@ namespace cwg635 { // cwg635: yes // expected-error@#cwg635-D-T {{out-of-line constructor for 'D' cannot have template arguments}} // expected-error@#cwg635-D-T {{redefinition of 'D<T>'}} // expected-note@#cwg635-D {{previous definition is here}} -} +} // namespace cwg635 -namespace cwg637 { // cwg637: yes +namespace cwg637 { // cwg637: 3.0 void f(int i) { i = ++i + 1; i = i++ + 1; // cxx98-14-warning@-1 {{multiple unsequenced modifications to 'i'}} } -} +} // namespace cwg637 namespace cwg638 { // cwg638: no template<typename T> struct A { @@ -423,16 +428,16 @@ namespace cwg638 { // cwg638: no void h() { X::type e; } // FIXME: private }; }; -} +} // namespace cwg638 namespace cwg639 { // cwg639: 3.3 void f(int i) { void((i = 0) + (i = 0)); // expected-warning@-1 {{multiple unsequenced modifications to 'i'}} } -} +} // namespace cwg639 -namespace cwg641 { // cwg641: yes +namespace cwg641 { // cwg641: 2.7 namespace std_example { struct abc; @@ -480,9 +485,9 @@ namespace cwg641 { // cwg641: yes (void)A(); (void)ca; } -} +} // namespace cwg641 -namespace cwg642 { // cwg642: yes +namespace cwg642 { // cwg642: 2.7 void f() { const int i = 2; { @@ -496,10 +501,10 @@ namespace cwg642 { // cwg642: yes struct s *p = new struct s; p->a = s; } -} +} // namespace cwg642 -#if __cplusplus >= 201103L namespace cwg643 { // cwg643: 3.2 +#if __cplusplus >= 201103L struct A { int x; auto f() -> decltype(this->x); @@ -513,11 +518,11 @@ namespace cwg643 { // cwg643: 3.2 // since-cxx11-error@-1 {{use of undeclared identifier 'y'}} int y; }; -} #endif +} // namespace cwg643 -#if __cplusplus >= 201103L namespace cwg644 { // cwg644: partial +#if __cplusplus >= 201103L struct A { A() = default; int x, y; @@ -540,15 +545,15 @@ namespace cwg644 { // cwg644: partial constexpr E() = default; }; static_assert(!__is_literal_type(E<C>), ""); -} #endif +} // namespace cwg644 // cwg645 increases permission to optimize; it's not clear that it's possible to // test for this. // cwg645: na -#if __cplusplus >= 201103L namespace cwg646 { // cwg646: sup 981 +#if __cplusplus >= 201103L struct A { constexpr A(const A&) = default; // ok }; @@ -558,11 +563,11 @@ namespace cwg646 { // cwg646: sup 981 B(B&); }; constexpr B b = {}; // ok -} #endif +} // namespace cwg646 -#if __cplusplus >= 201103L namespace cwg647 { // cwg647: 3.1 +#if __cplusplus >= 201103L // This is partially superseded by cwg1358. struct A { constexpr virtual void f() const; @@ -619,20 +624,20 @@ namespace cwg647 { // cwg647: 3.1 : n(get()), d(D(0) + f) {} // #cwg647-float-d }; -} #endif +} // namespace cwg647 +namespace cwg648 { // cwg648: 2.7 #if __cplusplus >= 201103L -namespace cwg648 { // cwg648: yes int f(); constexpr int a = (true ? 1 : f()); constexpr int b = false && f(); constexpr int c = true || f(); -} #endif +} // namespace cwg648 -#if __cplusplus >= 201103L namespace cwg649 { // cwg649: 3.5 +#if __cplusplus >= 201103L // Maximum alignment is 8192 bytes for Windows, and 4 GB for Linux alignas(0x200000000) int n; // since-cxx11-error-re@-1 {{{{requested alignment must be (8192|4294967296) bytes or smaller}}}} @@ -645,13 +650,13 @@ struct Y { struct alignas(256) Z {}; // This part is superseded by cwg2130 and eventually by aligned allocation support. auto *p = new Z; -} #endif +} // namespace cwg649 // cwg650 is in cwg650.cpp +namespace cwg651 { // cwg651: 2.7 #if __cplusplus >= 201103L -namespace cwg651 { // cwg651: yes struct X { virtual X &f(); }; @@ -660,20 +665,20 @@ namespace cwg651 { // cwg651: yes }; using T = decltype(((X&&)Y()).f()); using T = X &; -} #endif +} // namespace cwg651 +namespace cwg652 { // cwg652: 3.1 #if __cplusplus >= 201103L -namespace cwg652 { // cwg652: yes constexpr int n = 1.2 * 3.4; static_assert(n == 4, ""); -} #endif +} // namespace cwg652 // cwg653 is in cwg653.cpp -#if __cplusplus >= 201103L namespace cwg654 { // cwg654: sup 1423 +#if __cplusplus >= 201103L void f() { if (nullptr) {} // since-cxx11-warning@-1 {{implicit conversion of nullptr constant to 'bool'}} @@ -696,10 +701,10 @@ namespace cwg654 { // cwg654: sup 1423 void(true ? nullptr : 0); void(true ? 0 : nullptr); } -} #endif +} // namespace cwg654 -namespace cwg655 { // cwg655: yes +namespace cwg655 { // cwg655: 3.0 struct A { A(int); }; // #cwg655-A struct B : A { A a; // #cwg655-a @@ -715,9 +720,9 @@ namespace cwg655 { // cwg655: yes // expected-note@#cwg655-a {{member is declared here}} // expected-note@#cwg655-A {{'cwg655::A' declared here}} }; -} +} // namespace cwg655 -namespace cwg656 { // cwg656: yes +namespace cwg656 { // cwg656: 2.8 struct A { A(const A&) = delete; }; // cxx98-error@-1 {{deleted function definitions are a C++11 extension}} struct B : A {}; @@ -756,7 +761,7 @@ namespace cwg656 { // cwg656: yes // expected-note@#cwg656-Y {{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}} accept<const D&>(c); } -} +} // namespace cwg656 namespace cwg657 { // cwg657: partial struct Abs { virtual void x() = 0; }; // #cwg657-Abs @@ -794,12 +799,12 @@ namespace cwg657 { // cwg657: partial // FIXME: We should reject this too. Cnvt2<Abs>::type err; -} +} // namespace cwg657 // cwg658 is in cwg658.cpp -#if __cplusplus >= 201103L namespace cwg659 { // cwg659: 3.0 +#if __cplusplus >= 201103L static_assert(alignof(char) == alignof(char&), ""); static_assert(alignof(int) == alignof(int&), ""); int n = alignof(int(&)()); @@ -808,11 +813,11 @@ namespace cwg659 { // cwg659: 3.0 int m = alignof(A&); // since-cxx11-error@-1 {{invalid application of 'alignof' to an incomplete type 'A'}} // since-cxx11-note@#cwg659-A {{forward declaration of 'cwg659::A'}} -} #endif +} // namespace cwg659 -#if __cplusplus >= 201103L namespace cwg660 { // cwg660: 3.0 +#if __cplusplus >= 201103L enum : int { a }; enum class { b }; // since-cxx11-error@-1 {{scoped enumeration requires a name}} @@ -824,12 +829,12 @@ namespace cwg660 { // cwg660: 3.0 // since-cxx11-error@-1 {{scoped enumeration requires a name}} }; auto y = X::a; -} #endif +} // namespace cwg660 // cwg661 is in cwg661.cpp -namespace cwg662 { // cwg662: yes +namespace cwg662 { // cwg662: 2.7 template <typename T> void f(T t) { T &tr = t; T *tp = &t; @@ -840,22 +845,22 @@ namespace cwg662 { // cwg662: yes #endif } void g(int n) { f<int&>(n); } // #cwg662-f-call -} +} // namespace cwg662 namespace cwg663 { // cwg663: sup P1949 int ЍЎ = 123; -} +} // namespace cwg663 +namespace cwg664 { // cwg664: 2.7 #if __cplusplus >= 201103L -namespace cwg664 { // cwg664: yes struct A { A(const A&) = delete; }; A &&f(A &&a, int n) { if (n) return f(static_cast<A&&>(a), n - 1); return static_cast<A&&>(a); } -} #endif +} // namespace cwg664 namespace cwg665 { // cwg665: 2.8 struct A { virtual ~A(); }; @@ -882,7 +887,7 @@ namespace cwg665 { // cwg665: 2.8 // expected-note@#cwg665-VC {{declared private here}} (void)dynamic_cast<A*>(vd); } -} +} // namespace cwg665 namespace cwg666 { // cwg666: 2.8 struct P { friend P operator*(P, P); P(int); } p(0); @@ -901,11 +906,11 @@ namespace cwg666 { // cwg666: 2.8 struct Y { typedef int type; }; int a = f<X>(); int b = f<Y>(); // #cwg666-f-Y -} +} // namespace cwg666 // Triviality is entirely different in C++98. -#if __cplusplus >= 201103L namespace cwg667 { // cwg667: 8 +#if __cplusplus >= 201103L struct A { A() = default; // #cwg667-A-ctor // since-cxx11-warning@-1 {{explicitly defaulted default constructor is implicitly deleted}} @@ -926,13 +931,13 @@ namespace cwg667 { // cwg667: 8 struct F { F &operator=(F&&) = delete; }; struct G : F {}; static_assert(!__is_trivially_assignable(G, G&&), ""); -} #endif +} // namespace cwg667 // cwg668 needs an libc++abi test +namespace cwg669 { // cwg669: 3.1 #if __cplusplus >= 201103L -namespace cwg669 { // cwg669: yes void f() { int n; using T = decltype(n); @@ -957,8 +962,8 @@ namespace cwg669 { // cwg669: yes } }; } -} #endif +} // namespace cwg669 namespace cwg671 { // cwg671: 2.9 enum class E { e }; @@ -967,11 +972,11 @@ namespace cwg671 { // cwg671: 2.9 int n = static_cast<int>(E::e); // cxx98-error@-1 {{use of enumeration in a nested name specifier is a C++11 extension}} int m = static_cast<int>(e); -} +} // namespace cwg671 // cwg672 is in cwg672.cpp -namespace cwg673 { // cwg673: yes +namespace cwg673 { // cwg673: 2.7 template<typename> struct X { static const int n = 0; }; class A { @@ -979,15 +984,15 @@ namespace cwg673 { // cwg673: yes class C *f(); void f(class D *); enum { e = X<struct E>::n }; - void g() { extern struct F *p; } + void g() { extern struct FF *p; } }; B *b; C *c; D *d; E *e; - F *f; - // expected-error@-1 {{unknown type name 'F'}} -} + FF *ff; + // expected-error@-1 {{unknown type name 'FF'}} +} // namespace cwg673 namespace cwg674 { // cwg674: 8 template<typename T> int f(T); @@ -1053,7 +1058,7 @@ namespace cwg674 { // cwg674: 8 template int Y::f<>(int); template int Y::g<>(int); // #cwg674-Y-g-int template int Y::h<>(int); -} +} // namespace cwg674 namespace cwg675 { // cwg675: dup 739 template<typename T> struct A { T n : 1; }; @@ -1065,7 +1070,7 @@ namespace cwg675 { // cwg675: dup 739 static_assert(A<long long>{1}.n < 0, ""); // since-cxx11-warning@-1 {{implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1}} #endif -} +} // namespace cwg675 // cwg676: na @@ -1091,23 +1096,23 @@ namespace cwg677 { // cwg677: no B::~B() {} // expected-error@-1 {{attempt to use a deleted function}} // expected-note@#cwg677-B-delete {{'operator delete' has been explicitly marked deleted here}} -} +} // namespace cwg677 // cwg678 FIXME: check that the modules ODR check catches this -namespace cwg679 { // cwg679: yes +namespace cwg679 { // cwg679: 2.7 struct X {}; template<int> void operator+(X, X); template<> void operator+<0>(X, X) {} // #cwg679-def template<> void operator+<0>(X, X) {} // expected-error@-1 {{redefinition of 'operator+<0>'}} // expected-note@#cwg679-def {{previous definition is here}} -} +} // namespace cwg679 // cwg680: na -#if __cplusplus >= 201103L namespace cwg681 { // cwg681: partial +#if __cplusplus >= 201103L auto *a() -> int; // since-cxx11-error@-1 {{function with trailing return type must specify return type 'auto', not 'auto *'}} auto (*b)() -> int; @@ -1126,11 +1131,11 @@ namespace cwg681 { // cwg681: partial auto f() -> int (*)(); auto g() -> auto (*)() -> int; -} #endif +} // namespace cwg681 +namespace cwg683 { // cwg683: 3.3 #if __cplusplus >= 201103L -namespace cwg683 { // cwg683: yes struct A { A() = default; A(const A&) = default; @@ -1144,22 +1149,22 @@ namespace cwg683 { // cwg683: yes static_assert(__is_trivially_constructible(B, const B&), ""); static_assert(__is_trivially_constructible(B, B&), ""); static_assert(__is_trivial(B), ""); -} #endif +} // namespace cwg683 -#if __cplusplus >= 201103L namespace cwg684 { // cwg684: sup 1454 +#if __cplusplus >= 201103L void f() { int a; // #cwg684-a constexpr int *p = &a; - // expected-error@-1 {{constexpr variable 'p' must be initialized by a constant expression}} - // expected-note@-2 {{pointer to 'a' is not a constant expression}} - // expected-note@#cwg684-a {{here}} + // since-cxx11-error@-1 {{constexpr variable 'p' must be initialized by a constant expression}} + // since-cxx11-note@-2 {{pointer to 'a' is not a constant expression}} + // since-cxx11-note@#cwg684-a {{here}} } -} #endif +} // namespace cwg684 -namespace cwg685 { // cwg685: yes +namespace cwg685 { // cwg685: 10 enum E : long { e }; // cxx98-error@-1 {{enumeration types with a fixed underlying type are a C++11 extension}} void f(int); @@ -1187,7 +1192,7 @@ namespace cwg685 { // cwg685: yes int k(short); void k(int); int x = k(g); -} +} // namespace cwg685 namespace cwg686 { // cwg686: 3.0 void f() { @@ -1244,18 +1249,18 @@ namespace cwg686 { // cwg686: 3.0 // expected-note@-2 {{forward declaration of 'P'}} catch (struct P {} *) {} // expected-error@-1 {{'P' cannot be defined in a type specifier}} -#if __cplusplus < 201703L +#if __cplusplus <= 201402L void g() throw(struct Q); - // cxx98-17-error@-1 {{incomplete type 'struct Q' is not allowed in exception specification}} - // cxx98-17-note@-2 {{forward declaration of 'Q'}} + // cxx98-14-error@-1 {{incomplete type 'struct Q' is not allowed in exception specification}} + // cxx98-14-note@-2 {{forward declaration of 'Q'}} void h() throw(struct Q {}); - // cxx98-17-error@-1 {{'Q' cannot be defined in a type specifier}} + // cxx98-14-error@-1 {{'Q' cannot be defined in a type specifier}} #endif } template<struct R *> struct X; template<struct R {} *> struct Y; // expected-error@-1 {{'cwg686::R' cannot be defined in a type specifier}} -} +} // namespace cwg686 namespace cwg687 { // cwg687 (9 c++20, but the issue is still considered open) template<typename T> void f(T a) { @@ -1267,7 +1272,7 @@ namespace cwg687 { // cwg687 (9 c++20, but the issue is still considered open) template g<int>(a); // expected-error@-1 {{expected '<' after 'template'}} } -} +} // namespace cwg687 namespace cwg692 { // cwg692: 16 // Also see cwg1395. @@ -1358,7 +1363,7 @@ namespace cwg692 { // cwg692: 16 template<class T> void f(T){} template void f(int*); } -} +} // namespace cwg692 namespace cwg696 { // cwg696: 3.1 void f(const int*); @@ -1384,4 +1389,4 @@ namespace cwg696 { // cwg696: 3.1 // since-cxx11-note@-7 {{default capture by reference}} #endif } -} +} // namespace cwg696 diff --git a/clang/test/CXX/drs/cwg722.cpp b/clang/test/CXX/drs/cwg722.cpp index 6e7d4569c553..1d95e14c5ff2 100644 --- a/clang/test/CXX/drs/cwg722.cpp +++ b/clang/test/CXX/drs/cwg722.cpp @@ -12,7 +12,7 @@ #if __cplusplus >= 201103L namespace std { using nullptr_t = decltype(nullptr); -} +} // namespace std void f(std::nullptr_t, ...); std::nullptr_t g(); diff --git a/clang/test/CXX/drs/cwg7xx.cpp b/clang/test/CXX/drs/cwg7xx.cpp index 507eb8fb7143..a8ab2e220716 100644 --- a/clang/test/CXX/drs/cwg7xx.cpp +++ b/clang/test/CXX/drs/cwg7xx.cpp @@ -2,14 +2,16 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 %s -verify=expected,cxx98-14,cxx98-11,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++14 %s -verify=expected,cxx98-14,since-cxx14,since-cxx11,cxx14 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++17 %s -verify=expected,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++2a %s -verify=expected,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %s -verify=expected,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++23 %s -verify=expected,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++2c %s -verify=expected,since-cxx14,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) // cxx98-error@-1 {{variadic macros are a C99 feature}} #endif -namespace cwg705 { // cwg705: yes +namespace cwg705 { // cwg705: 2.7 namespace N { struct S {}; void f(S); // #cwg705-f @@ -22,7 +24,7 @@ namespace cwg705 { // cwg705: yes // expected-error@-1 {{use of undeclared identifier 'f'}} // expected-note@#cwg705-f {{'N::f' declared here}} } -} +} // namespace cwg705 namespace cwg712 { // cwg712: partial void use(int); @@ -74,7 +76,7 @@ namespace cwg712 { // cwg712: partial }; } #endif -} +} // namespace cwg712 namespace cwg713 { // cwg713: 3.0 template<typename T> @@ -322,7 +324,7 @@ namespace cwg727 { // cwg727: partial // expected-note@#cwg727-S2-T {{previous}} }; Collision<int, int> c; // #cwg727-Collision-int-int -} +} // namespace cwg727 namespace cwg777 { // cwg777: 3.7 #if __cplusplus >= 201103L @@ -336,4 +338,16 @@ void g(int i = 0, T ...args, T ...args2) {} template <typename... T> void h(int i = 0, T ...args, int j = 1) {} #endif -} +} // namespace cwg777 + +namespace cwg794 { // cwg794: 2.7 +struct B {}; +struct D : B {}; +struct X { + D d; +}; +struct Y : X {}; +B Y::*pm = &X::d; +// expected-error@-1 {{cannot initialize a variable of type 'B Y::*' with an rvalue of type 'D cwg794::X::*': different classes ('Y' vs 'cwg794::X')}} +// FIXME: why diagnostic says just `Y` and not `cwg794::Y`, like `cwg794::X`? +} // namespace cwg794 diff --git a/clang/test/CXX/drs/cwg8xx.cpp b/clang/test/CXX/drs/cwg8xx.cpp index 38bff3adf262..ecb9113ccfe6 100644 --- a/clang/test/CXX/drs/cwg8xx.cpp +++ b/clang/test/CXX/drs/cwg8xx.cpp @@ -13,7 +13,7 @@ export template <class T> struct B {}; export template<typename T> void f() {} // cxx98-17-warning@-1 {{exported templates are unsupported}} // since-cxx20-error@-2 {{export declaration can only be used within a module purview}} -} +} // namespace cwg820 namespace cwg873 { // cwg873: 3.0 #if __cplusplus >= 201103L diff --git a/clang/test/CXX/drs/cwg9xx.cpp b/clang/test/CXX/drs/cwg9xx.cpp index d4f54bcdad6e..96e46742650d 100644 --- a/clang/test/CXX/drs/cwg9xx.cpp +++ b/clang/test/CXX/drs/cwg9xx.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors // RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors namespace std { __extension__ typedef __SIZE_TYPE__ size_t; @@ -12,7 +13,7 @@ namespace std { const T *p; size_t n; initializer_list(const T *p, size_t n); }; -} +} // namespace std namespace cwg930 { // cwg930: 2.7 #if __cplusplus >= 201103L @@ -48,7 +49,7 @@ namespace cwg948 { // cwg948: 3.7 while (constexpr A i = 0) { } } #endif -} +} // namespace cwg948 namespace cwg952 { // cwg952: 2.8 namespace example1 { @@ -143,15 +144,15 @@ class B : A { } // namespace cwg960 -namespace cwg974 { // cwg974: yes +namespace cwg974 { // cwg974: 3.3 #if __cplusplus >= 201103L void test() { auto lam = [](int x = 42) { return x; }; } #endif -} +} // namespace cwg974 -namespace cwg977 { // cwg977: yes +namespace cwg977 { // cwg977: 2.7 enum E { e = E() }; // #cwg977-E #if !defined(_WIN32) || defined(__MINGW32__) // expected-error@#cwg977-E {{invalid use of incomplete type 'E'}} @@ -197,4 +198,4 @@ namespace cwg990 { // cwg990: 3.5 }; D d{}; #endif -} +} // namespace cwg990 diff --git a/clang/test/CodeGen/AArch64/fmv-dependencies.c b/clang/test/CodeGen/AArch64/fmv-dependencies.c index 3a524b89496e..097b85e989d8 100644 --- a/clang/test/CodeGen/AArch64/fmv-dependencies.c +++ b/clang/test/CodeGen/AArch64/fmv-dependencies.c @@ -42,7 +42,7 @@ __attribute__((target_version("flagm"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Mflagm2() #[[flagm2:[0-9]+]] { __attribute__((target_version("flagm2"))) int fmv(void) { return 0; } -// CHECK: define dso_local i32 @fmv._Mfp() #[[default:[0-9]+]] { +// CHECK: define dso_local i32 @fmv._Mfp() #[[fp:[0-9]+]] { __attribute__((target_version("fp"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Mfp16() #[[fp16:[0-9]+]] { @@ -99,7 +99,7 @@ __attribute__((target_version("sha2"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Msha3() #[[sha3:[0-9]+]] { __attribute__((target_version("sha3"))) int fmv(void) { return 0; } -// CHECK: define dso_local i32 @fmv._Msimd() #[[default]] { +// CHECK: define dso_local i32 @fmv._Msimd() #[[simd:[0-9]+]] { __attribute__((target_version("simd"))) int fmv(void) { return 0; } // CHECK: define dso_local i32 @fmv._Msm4() #[[sm4:[0-9]+]] { @@ -150,48 +150,49 @@ int caller() { return fmv(); } -// CHECK: attributes #[[aes]] = { {{.*}} "target-features"="+aes,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[bf16]] = { {{.*}} "target-features"="+bf16,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[bti]] = { {{.*}} "target-features"="+bti,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[crc]] = { {{.*}} "target-features"="+crc,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[dit]] = { {{.*}} "target-features"="+dit,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[dotprod]] = { {{.*}} "target-features"="+dotprod,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[dpb]] = { {{.*}} "target-features"="+ccpp,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[dpb2]] = { {{.*}} "target-features"="+ccdp,+ccpp,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[f32mm]] = { {{.*}} "target-features"="+f32mm,+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a" -// CHECK: attributes #[[f64mm]] = { {{.*}} "target-features"="+f64mm,+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a" -// CHECK: attributes #[[fcma]] = { {{.*}} "target-features"="+complxnum,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[flagm]] = { {{.*}} "target-features"="+flagm,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[flagm2]] = { {{.*}} "target-features"="+altnzcv,+flagm,+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[default]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[fp16]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[fp16fml]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fp16fml,+fullfp16,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[frintts]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fptoint,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[i8mm]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+i8mm,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[jscvt]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+jsconv,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[ls64]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+ls64,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[lse]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+lse,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[memtag]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+mte,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[mops]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+mops,+neon,+outline-atomics,+v8a" -// CHECK: attributes #[[predres]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+predres,+v8a" -// CHECK: attributes #[[rcpc]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+rcpc,+v8a" -// CHECK: attributes #[[rcpc2]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+rcpc,+rcpc-immo,+v8a" -// CHECK: attributes #[[rcpc3]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+rcpc,+rcpc-immo,+rcpc3,+v8a" -// CHECK: attributes #[[rdm]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+rdm,+v8a" -// CHECK: attributes #[[rng]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+rand,+v8a" -// CHECK: attributes #[[sb]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+sb,+v8a" -// CHECK: attributes #[[sha2]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+sha2,+v8a" -// CHECK: attributes #[[sha3]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+sha2,+sha3,+v8a" -// CHECK: attributes #[[sm4]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+sm4,+v8a" -// CHECK: attributes #[[sme]] = { {{.*}} "target-features"="+bf16,+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+v8a" -// CHECK: attributes #[[sme_f64f64]] = { {{.*}} "target-features"="+bf16,+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+sme-f64f64,+v8a" -// CHECK: attributes #[[sme_i16i64]] = { {{.*}} "target-features"="+bf16,+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+sme-i16i64,+v8a" -// CHECK: attributes #[[sme2]] = { {{.*}} "target-features"="+bf16,+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+sme2,+v8a" -// CHECK: attributes #[[ssbs]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+ssbs,+v8a" -// CHECK: attributes #[[sve]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a" -// CHECK: attributes #[[sve2]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+v8a" -// CHECK: attributes #[[sve2_aes]] = { {{.*}} "target-features"="+aes,+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve-aes,+sve2,+sve2-aes,+v8a" -// CHECK: attributes #[[sve2_bitperm]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-bitperm,+v8a" -// CHECK: attributes #[[sve2_sha3]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sha2,+sha3,+sve,+sve2,+sve2-sha3,+v8a" -// CHECK: attributes #[[sve2_sm4]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sm4,+sve,+sve2,+sve2-sm4,+v8a" -// CHECK: attributes #[[wfxt]] = { {{.*}} "target-features"="+fmv,+fp-armv8,+neon,+outline-atomics,+v8a,+wfxt" +// CHECK: attributes #[[aes]] = { {{.*}} "target-features"="+aes,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[bf16]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[bti]] = { {{.*}} "target-features"="+bti,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[crc]] = { {{.*}} "target-features"="+crc,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[dit]] = { {{.*}} "target-features"="+dit,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[dotprod]] = { {{.*}} "target-features"="+dotprod,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[dpb]] = { {{.*}} "target-features"="+ccpp,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[dpb2]] = { {{.*}} "target-features"="+ccdp,+ccpp,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[f32mm]] = { {{.*}} "target-features"="+f32mm,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a" +// CHECK: attributes #[[f64mm]] = { {{.*}} "target-features"="+f64mm,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a" +// CHECK: attributes #[[fcma]] = { {{.*}} "target-features"="+complxnum,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[flagm]] = { {{.*}} "target-features"="+flagm,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[flagm2]] = { {{.*}} "target-features"="+altnzcv,+flagm,+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[fp]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[fp16]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[fp16fml]] = { {{.*}} "target-features"="+fp-armv8,+fp16fml,+fullfp16,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[frintts]] = { {{.*}} "target-features"="+fp-armv8,+fptoint,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[i8mm]] = { {{.*}} "target-features"="+fp-armv8,+i8mm,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[jscvt]] = { {{.*}} "target-features"="+fp-armv8,+jsconv,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[ls64]] = { {{.*}} "target-features"="+fp-armv8,+ls64,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[lse]] = { {{.*}} "target-features"="+fp-armv8,+lse,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[memtag]] = { {{.*}} "target-features"="+fp-armv8,+mte,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[mops]] = { {{.*}} "target-features"="+fp-armv8,+mops,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[predres]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+predres,+v8a" +// CHECK: attributes #[[rcpc]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+v8a" +// CHECK: attributes #[[rcpc2]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+rcpc-immo,+v8a" +// CHECK: attributes #[[rcpc3]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+rcpc-immo,+rcpc3,+v8a" +// CHECK: attributes #[[rdm]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rdm,+v8a" +// CHECK: attributes #[[rng]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rand,+v8a" +// CHECK: attributes #[[sb]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sb,+v8a" +// CHECK: attributes #[[sha2]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sha2,+v8a" +// CHECK: attributes #[[sha3]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sha2,+sha3,+v8a" +// CHECK: attributes #[[simd]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a" +// CHECK: attributes #[[sm4]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sm4,+v8a" +// CHECK: attributes #[[sme]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+v8a" +// CHECK: attributes #[[sme_f64f64]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+sme-f64f64,+v8a" +// CHECK: attributes #[[sme_i16i64]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+sme-i16i64,+v8a" +// CHECK: attributes #[[sme2]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sme,+sme2,+v8a" +// CHECK: attributes #[[ssbs]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+ssbs,+v8a" +// CHECK: attributes #[[sve]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a" +// CHECK: attributes #[[sve2]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+v8a" +// CHECK: attributes #[[sve2_aes]] = { {{.*}} "target-features"="+aes,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve-aes,+sve2,+sve2-aes,+v8a" +// CHECK: attributes #[[sve2_bitperm]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-bitperm,+v8a" +// CHECK: attributes #[[sve2_sha3]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sha2,+sha3,+sve,+sve2,+sve2-sha3,+v8a" +// CHECK: attributes #[[sve2_sm4]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sm4,+sve,+sve2,+sve2-sm4,+v8a" +// CHECK: attributes #[[wfxt]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a,+wfxt" diff --git a/clang/test/CodeGen/AArch64/fmv-features.c b/clang/test/CodeGen/AArch64/fmv-features.c new file mode 100644 index 000000000000..f78bf4b5d59c --- /dev/null +++ b/clang/test/CodeGen/AArch64/fmv-features.c @@ -0,0 +1,200 @@ +// Test all of the AArch64 fmv-features metadata without any dependency expansion. +// It is used to propagate the attribute string information from C/C++ source to LLVM IR. + +// RUN: %clang --target=aarch64-linux-gnu --rtlib=compiler-rt -emit-llvm -S -o - %s | FileCheck %s + +// CHECK: define dso_local i32 @fmv._Maes() #[[aes:[0-9]+]] { +// CHECK: define dso_local i32 @fmv._Mbf16() #[[bf16:[0-9]+]] { +__attribute__((target_clones("aes", "bf16"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mbti() #[[bti:[0-9]+]] { +__attribute__((target_version("bti"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mcrc() #[[crc:[0-9]+]] { +__attribute__((target_version("crc"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mdit() #[[dit:[0-9]+]] { +__attribute__((target_version("dit"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mdotprod() #[[dotprod:[0-9]+]] { +__attribute__((target_version("dotprod"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mdpb() #[[dpb:[0-9]+]] { +__attribute__((target_version("dpb"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mdpb2() #[[dpb2:[0-9]+]] { +__attribute__((target_version("dpb2"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mf32mm() #[[f32mm:[0-9]+]] { +__attribute__((target_version("f32mm"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mf64mm() #[[f64mm:[0-9]+]] { +__attribute__((target_version("f64mm"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mfcma() #[[fcma:[0-9]+]] { +__attribute__((target_version("fcma"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mflagm() #[[flagm:[0-9]+]] { +__attribute__((target_version("flagm"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mflagm2() #[[flagm2:[0-9]+]] { +__attribute__((target_version("flagm2"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mfp() #[[fp:[0-9]+]] { +__attribute__((target_version("fp"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mfp16() #[[fp16:[0-9]+]] { +__attribute__((target_version("fp16"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mfp16fml() #[[fp16fml:[0-9]+]] { +__attribute__((target_version("fp16fml"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mfrintts() #[[frintts:[0-9]+]] { +__attribute__((target_version("frintts"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mi8mm() #[[i8mm:[0-9]+]] { +__attribute__((target_version("i8mm"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mjscvt() #[[jscvt:[0-9]+]] { +__attribute__((target_version("jscvt"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mls64() #[[ls64:[0-9]+]] { +__attribute__((target_version("ls64"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mlse() #[[lse:[0-9]+]] { +__attribute__((target_version("lse"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mmemtag() #[[memtag:[0-9]+]] { +__attribute__((target_version("memtag"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mmops() #[[mops:[0-9]+]] { +__attribute__((target_version("mops"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mpredres() #[[predres:[0-9]+]] { +__attribute__((target_version("predres"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mrcpc() #[[rcpc:[0-9]+]] { +__attribute__((target_version("rcpc"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mrcpc2() #[[rcpc2:[0-9]+]] { +__attribute__((target_version("rcpc2"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mrcpc3() #[[rcpc3:[0-9]+]] { +__attribute__((target_version("rcpc3"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mrdm() #[[rdm:[0-9]+]] { +__attribute__((target_version("rdm"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mrng() #[[rng:[0-9]+]] { +__attribute__((target_version("rng"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msb() #[[sb:[0-9]+]] { +__attribute__((target_version("sb"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msha2() #[[sha2:[0-9]+]] { +__attribute__((target_version("sha2"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msha3() #[[sha3:[0-9]+]] { +__attribute__((target_version("sha3"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msimd() #[[simd:[0-9]+]] { +__attribute__((target_version("simd"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msm4() #[[sm4:[0-9]+]] { +__attribute__((target_version("sm4"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msme() #[[sme:[0-9]+]] { +__attribute__((target_version("sme"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msme-f64f64() #[[sme_f64f64:[0-9]+]] { +__attribute__((target_version("sme-f64f64"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msme-i16i64() #[[sme_i16i64:[0-9]+]] { +__attribute__((target_version("sme-i16i64"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msme2() #[[sme2:[0-9]+]] { +__attribute__((target_version("sme2"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mssbs() #[[ssbs:[0-9]+]] { +__attribute__((target_version("ssbs"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msve() #[[sve:[0-9]+]] { +__attribute__((target_version("sve"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msve2() #[[sve2:[0-9]+]] { +__attribute__((target_version("sve2"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msve2-aes() #[[sve2_aes:[0-9]+]] { +__attribute__((target_version("sve2-aes"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msve2-bitperm() #[[sve2_bitperm:[0-9]+]] { +__attribute__((target_version("sve2-bitperm"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msve2-sha3() #[[sve2_sha3:[0-9]+]] { +__attribute__((target_version("sve2-sha3"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Msve2-sm4() #[[sve2_sm4:[0-9]+]] { +__attribute__((target_version("sve2-sm4"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._Mwfxt() #[[wfxt:[0-9]+]] { +__attribute__((target_version("wfxt"))) int fmv(void) { return 0; } + +// CHECK: define dso_local i32 @fmv._MaesMbf16MbtiMcrc() #[[multiple_features:[0-9]+]] { +__attribute__((target_version("aes+bf16+bti+crc"))) int fmv(void) { return 0; } + +// CHECK-NOT: define dso_local i32 @fmv._M{{.*}} +__attribute__((target_version("non_existent_extension"))) int fmv(void); + +__attribute__((target_version("default"))) int fmv(void); + +int caller() { + return fmv(); +} + +// CHECK: attributes #[[aes]] = { {{.*}} "fmv-features"="+aes" +// CHECK: attributes #[[bf16]] = { {{.*}} "fmv-features"="+bf16" +// CHECK: attributes #[[bti]] = { {{.*}} "fmv-features"="+bti" +// CHECK: attributes #[[crc]] = { {{.*}} "fmv-features"="+crc" +// CHECK: attributes #[[dit]] = { {{.*}} "fmv-features"="+dit" +// CHECK: attributes #[[dotprod]] = { {{.*}} "fmv-features"="+dotprod" +// CHECK: attributes #[[dpb]] = { {{.*}} "fmv-features"="+dpb" +// CHECK: attributes #[[dpb2]] = { {{.*}} "fmv-features"="+dpb2" +// CHECK: attributes #[[f32mm]] = { {{.*}} "fmv-features"="+f32mm" +// CHECK: attributes #[[f64mm]] = { {{.*}} "fmv-features"="+f64mm" +// CHECK: attributes #[[fcma]] = { {{.*}} "fmv-features"="+fcma" +// CHECK: attributes #[[flagm]] = { {{.*}} "fmv-features"="+flagm" +// CHECK: attributes #[[flagm2]] = { {{.*}} "fmv-features"="+flagm2" +// CHECK: attributes #[[fp]] = { {{.*}} "fmv-features"="+fp" +// CHECK: attributes #[[fp16]] = { {{.*}} "fmv-features"="+fp16" +// CHECK: attributes #[[fp16fml]] = { {{.*}} "fmv-features"="+fp16fml" +// CHECK: attributes #[[frintts]] = { {{.*}} "fmv-features"="+frintts" +// CHECK: attributes #[[i8mm]] = { {{.*}} "fmv-features"="+i8mm" +// CHECK: attributes #[[jscvt]] = { {{.*}} "fmv-features"="+jscvt" +// CHECK: attributes #[[ls64]] = { {{.*}} "fmv-features"="+ls64" +// CHECK: attributes #[[lse]] = { {{.*}} "fmv-features"="+lse" +// CHECK: attributes #[[memtag]] = { {{.*}} "fmv-features"="+memtag" +// CHECK: attributes #[[mops]] = { {{.*}} "fmv-features"="+mops" +// CHECK: attributes #[[predres]] = { {{.*}} "fmv-features"="+predres" +// CHECK: attributes #[[rcpc]] = { {{.*}} "fmv-features"="+rcpc" +// CHECK: attributes #[[rcpc2]] = { {{.*}} "fmv-features"="+rcpc2" +// CHECK: attributes #[[rcpc3]] = { {{.*}} "fmv-features"="+rcpc3" +// CHECK: attributes #[[rdm]] = { {{.*}} "fmv-features"="+rdm" +// CHECK: attributes #[[rng]] = { {{.*}} "fmv-features"="+rng" +// CHECK: attributes #[[sb]] = { {{.*}} "fmv-features"="+sb" +// CHECK: attributes #[[sha2]] = { {{.*}} "fmv-features"="+sha2" +// CHECK: attributes #[[sha3]] = { {{.*}} "fmv-features"="+sha3" +// CHECK: attributes #[[simd]] = { {{.*}} "fmv-features"="+simd" +// CHECK: attributes #[[sm4]] = { {{.*}} "fmv-features"="+sm4" +// CHECK: attributes #[[sme]] = { {{.*}} "fmv-features"="+sme" +// CHECK: attributes #[[sme_f64f64]] = { {{.*}} "fmv-features"="+sme-f64f64" +// CHECK: attributes #[[sme_i16i64]] = { {{.*}} "fmv-features"="+sme-i16i64" +// CHECK: attributes #[[sme2]] = { {{.*}} "fmv-features"="+sme2" +// CHECK: attributes #[[ssbs]] = { {{.*}} "fmv-features"="+ssbs" +// CHECK: attributes #[[sve]] = { {{.*}} "fmv-features"="+sve" +// CHECK: attributes #[[sve2]] = { {{.*}} "fmv-features"="+sve2" +// CHECK: attributes #[[sve2_aes]] = { {{.*}} "fmv-features"="+sve2-aes" +// CHECK: attributes #[[sve2_bitperm]] = { {{.*}} "fmv-features"="+sve2-bitperm" +// CHECK: attributes #[[sve2_sha3]] = { {{.*}} "fmv-features"="+sve2-sha3" +// CHECK: attributes #[[sve2_sm4]] = { {{.*}} "fmv-features"="+sve2-sm4" +// CHECK: attributes #[[wfxt]] = { {{.*}} "fmv-features"="+wfxt" +// CHECK: attributes #[[multiple_features]] = { {{.*}} "fmv-features"="+aes,+bf16,+bti,+crc" diff --git a/clang/test/CodeGen/AArch64/fmv-priority.c b/clang/test/CodeGen/AArch64/fmv-priority.c new file mode 100644 index 000000000000..080bb54736a7 --- /dev/null +++ b/clang/test/CodeGen/AArch64/fmv-priority.c @@ -0,0 +1,55 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --version 5 +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -o - %s | FileCheck %s + +// Priority biskmasks after feature dependency expansion: +// +// MSB LSB +// +// sme2 | ls64 | sme | bf16 | | | fp16 | simd | fp +// -----+------+-----+------+-------+------+------+------+--- +// sme2 | | sme | bf16 | rcpc2 | rcpc | fp16 | simd | fp +// +// Dependencies should not affect priorities, since a +// feature can only depend on lower priority features: +// https://github.com/ARM-software/acle/pull/376 + +__attribute__((target_version("sme2+ls64"))) int fn(void); +__attribute__((target_version("sme2+rcpc2"))) int fn(void); +__attribute__((target_version("default"))) int fn(void) { return 0; } + +int call() { return fn(); } + +// CHECK-LABEL: define dso_local i32 @fn.default( +// CHECK-SAME: ) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: ret i32 0 +// +// +// CHECK-LABEL: define dso_local i32 @call( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[CALL:%.*]] = call i32 @fn() +// CHECK-NEXT: ret i32 [[CALL]] +// +// +// CHECK-LABEL: define weak_odr ptr @fn.resolver() comdat { +// CHECK-NEXT: [[RESOLVER_ENTRY:.*:]] +// CHECK-NEXT: call void @__init_cpu_features_resolver() +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 153126785511392000 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 153126785511392000 +// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] +// CHECK-NEXT: br i1 [[TMP3]], label %[[RESOLVER_RETURN:.*]], label %[[RESOLVER_ELSE:.*]] +// CHECK: [[RESOLVER_RETURN]]: +// CHECK-NEXT: ret ptr @fn._Mls64Msme2 +// CHECK: [[RESOLVER_ELSE]]: +// CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 +// CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 144119586269233920 +// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 144119586269233920 +// CHECK-NEXT: [[TMP7:%.*]] = and i1 true, [[TMP6]] +// CHECK-NEXT: br i1 [[TMP7]], label %[[RESOLVER_RETURN1:.*]], label %[[RESOLVER_ELSE2:.*]] +// CHECK: [[RESOLVER_RETURN1]]: +// CHECK-NEXT: ret ptr @fn._Mrcpc2Msme2 +// CHECK: [[RESOLVER_ELSE2]]: +// CHECK-NEXT: ret ptr @fn.default +// diff --git a/clang/test/CodeGen/AArch64/fmv-streaming.c b/clang/test/CodeGen/AArch64/fmv-streaming.c index dc0c35a9a307..68ba3e5cfaa7 100644 --- a/clang/test/CodeGen/AArch64/fmv-streaming.c +++ b/clang/test/CodeGen/AArch64/fmv-streaming.c @@ -53,10 +53,10 @@ __attribute__((target_version("default"))) void sc_callee(void) __arm_streaming_ // CHECK-LABEL: define {{[^@]+}}@n_caller -// CHECK-SAME: () #[[caller:[0-9]+]] { +// CHECK-SAME: () #[[default]] { // CHECK: call void @n_callee() -// CHECK: call void @s_callee() #[[callsite_streaming:[0-9]+]] -// CHECK: call void @sc_callee() #[[callsite_streaming_compatible:[0-9]+]] +// CHECK: call void @s_callee() #[[streaming:[0-9]+]] +// CHECK: call void @sc_callee() #[[streaming_compatible:[0-9]+]] // void n_caller(void) { n_callee(); @@ -66,10 +66,10 @@ void n_caller(void) { // CHECK-LABEL: define {{[^@]+}}@s_caller -// CHECK-SAME: () #[[caller_streaming:[0-9]+]] { +// CHECK-SAME: () #[[default_streaming]] { // CHECK: call void @n_callee() -// CHECK: call void @s_callee() #[[callsite_streaming]] -// CHECK: call void @sc_callee() #[[callsite_streaming_compatible]] +// CHECK: call void @s_callee() #[[streaming]] +// CHECK: call void @sc_callee() #[[streaming_compatible]] // void s_caller(void) __arm_streaming { n_callee(); @@ -79,10 +79,10 @@ void s_caller(void) __arm_streaming { // CHECK-LABEL: define {{[^@]+}}@sc_caller -// CHECK-SAME: () #[[caller_streaming_compatible:[0-9]+]] { +// CHECK-SAME: () #[[default_streaming_compatible]] { // CHECK: call void @n_callee() -// CHECK: call void @s_callee() #[[callsite_streaming]] -// CHECK: call void @sc_callee() #[[callsite_streaming_compatible]] +// CHECK: call void @s_callee() #[[streaming]] +// CHECK: call void @sc_callee() #[[streaming_compatible]] // void sc_caller(void) __arm_streaming_compatible { n_callee(); @@ -103,8 +103,5 @@ void sc_caller(void) __arm_streaming_compatible { // CHECK: attributes #[[simd_streaming_compatible]] = {{.*}} "aarch64_pstate_sm_compatible" // CHECK: attributes #[[locally_streaming_sme2_streaming_compatible]] = {{.*}} "aarch64_pstate_sm_body" "aarch64_pstate_sm_compatible" // CHECK: attributes #[[default_streaming_compatible]] = {{.*}} "aarch64_pstate_sm_compatible" -// CHECK: attributes #[[caller]] = {{.*}} -// CHECK: attributes #[[caller_streaming]] = {{.*}} "aarch64_pstate_sm_enabled" -// CHECK: attributes #[[caller_streaming_compatible]] = {{.*}} "aarch64_pstate_sm_compatible" -// CHECK: attributes #[[callsite_streaming]] = {{.*}} "aarch64_pstate_sm_enabled" -// CHECK: attributes #[[callsite_streaming_compatible]] = {{.*}} "aarch64_pstate_sm_compatible" +// CHECK: attributes #[[streaming]] = {{.*}} "aarch64_pstate_sm_enabled" +// CHECK: attributes #[[streaming_compatible]] = {{.*}} "aarch64_pstate_sm_compatible" diff --git a/clang/test/CodeGen/AArch64/fpm-helpers.c b/clang/test/CodeGen/AArch64/fpm-helpers.c index 4bced01d5c71..6264b5caeb4f 100644 --- a/clang/test/CodeGen/AArch64/fpm-helpers.c +++ b/clang/test/CodeGen/AArch64/fpm-helpers.c @@ -35,7 +35,7 @@ extern "C" { // fpm_t test_init() { return __arm_fpm_init(); } -// CHECK-LABEL: define dso_local noundef i64 @test_src1_1( +// CHECK-LABEL: define dso_local noundef range(i64 0, -6) i64 @test_src1_1( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 -8 @@ -44,7 +44,7 @@ fpm_t test_src1_1() { return __arm_set_fpm_src1_format(INIT_ONES, __ARM_FPM_E5M2); } -// CHECK-LABEL: define dso_local noundef i64 @test_src1_2( +// CHECK-LABEL: define dso_local noundef range(i64 0, -6) i64 @test_src1_2( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 1 @@ -53,7 +53,7 @@ fpm_t test_src1_2() { return __arm_set_fpm_src1_format(INIT_ZERO, __ARM_FPM_E4M3); } -// CHECK-LABEL: define dso_local noundef i64 @test_src2_1( +// CHECK-LABEL: define dso_local noundef range(i64 0, -48) i64 @test_src2_1( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 -57 @@ -62,7 +62,7 @@ fpm_t test_src2_1() { return __arm_set_fpm_src2_format(INIT_ONES, __ARM_FPM_E5M2); } -// CHECK-LABEL: define dso_local noundef i64 @test_src2_2( +// CHECK-LABEL: define dso_local noundef range(i64 0, -48) i64 @test_src2_2( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 8 @@ -71,7 +71,7 @@ fpm_t test_src2_2() { return __arm_set_fpm_src2_format(INIT_ZERO, __ARM_FPM_E4M3); } -// CHECK-LABEL: define dso_local noundef i64 @test_dst1_1( +// CHECK-LABEL: define dso_local noundef range(i64 0, -384) i64 @test_dst1_1( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 -449 @@ -80,7 +80,7 @@ fpm_t test_dst1_1() { return __arm_set_fpm_dst_format(INIT_ONES, __ARM_FPM_E5M2); } -// CHECK-LABEL: define dso_local noundef i64 @test_dst2_2( +// CHECK-LABEL: define dso_local noundef range(i64 0, -384) i64 @test_dst2_2( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 64 @@ -139,21 +139,21 @@ fpm_t test_lscale() { return __arm_set_fpm_lscale(INIT_ZERO, 127); } // fpm_t test_lscale2() { return __arm_set_fpm_lscale2(INIT_ZERO, 63); } -// CHECK-LABEL: define dso_local noundef range(i64 0, 4294967296) i64 @test_nscale_1( +// CHECK-LABEL: define dso_local noundef range(i64 0, 4278190081) i64 @test_nscale_1( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 2147483648 // fpm_t test_nscale_1() { return __arm_set_fpm_nscale(INIT_ZERO, -128); } -// CHECK-LABEL: define dso_local noundef range(i64 0, 4294967296) i64 @test_nscale_2( +// CHECK-LABEL: define dso_local noundef range(i64 0, 4278190081) i64 @test_nscale_2( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 2130706432 // fpm_t test_nscale_2() { return __arm_set_fpm_nscale(INIT_ZERO, 127); } -// CHECK-LABEL: define dso_local noundef range(i64 0, 4294967296) i64 @test_nscale_3( +// CHECK-LABEL: define dso_local noundef range(i64 0, 4278190081) i64 @test_nscale_3( // CHECK-SAME: ) local_unnamed_addr #[[ATTR0]] { // CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: ret i64 4278190080 diff --git a/clang/test/CodeGen/AArch64/neon-vcmla.c b/clang/test/CodeGen/AArch64/neon-vcmla.c index 02171527cc6a..d860411fe45c 100644 --- a/clang/test/CodeGen/AArch64/neon-vcmla.c +++ b/clang/test/CodeGen/AArch64/neon-vcmla.c @@ -1,444 +1,913 @@ -// RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +neon \ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple arm64 -target-feature +neon \ // RUN: -target-feature +v8.3a \ // RUN: -target-feature +fullfp16 \ -// RUN: -disable-O0-optnone -emit-llvm -o - %s | opt -S -O1 | FileCheck %s +// RUN: -disable-O0-optnone -emit-llvm -o - %s | opt -S -passes="mem2reg,instsimplify" | FileCheck %s // REQUIRES: aarch64-registered-target #include <arm_neon.h> -// CHECK-LABEL: @test_vcmla_f16( -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot0.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> %rhs) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot0.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[RHS]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_F163_I]] +// float16x4_t test_vcmla_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot0.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot0.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[RHS]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_F323_I]] +// float32x2_t test_vcmla_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_f16( -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot0.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> %rhs) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot0.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[RHS]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_F163_I]] +// float16x8_t test_vcmlaq_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_f32( -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot0.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> %rhs) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot0.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[RHS]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_F323_I]] +// float32x4_t test_vcmlaq_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_f64( -// CHECK: [[RES:%.*]] = tail call <2 x double> @llvm.aarch64.neon.vcmla.rot0.v2f64(<2 x double> %acc, <2 x double> %lhs, <2 x double> %rhs) -// CHECK: ret <2 x double> [[RES]] +// CHECK-LABEL: define dso_local <2 x double> @test_vcmlaq_f64( +// CHECK-SAME: <2 x double> noundef [[ACC:%.*]], <2 x double> noundef [[LHS:%.*]], <2 x double> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_F643_I:%.*]] = call <2 x double> @llvm.aarch64.neon.vcmla.rot0.v2f64(<2 x double> [[ACC]], <2 x double> [[LHS]], <2 x double> [[RHS]]) +// CHECK-NEXT: ret <2 x double> [[VCMLAQ_F643_I]] +// float64x2_t test_vcmlaq_f64(float64x2_t acc, float64x2_t lhs, float64x2_t rhs) { return vcmlaq_f64(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_rot90_f16( -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot90.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> %rhs) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot90_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_ROT90_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot90.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[RHS]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT90_F163_I]] +// float16x4_t test_vcmla_rot90_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_rot90_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_rot90_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot90.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot90_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_ROT90_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot90.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[RHS]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT90_F323_I]] +// float32x2_t test_vcmla_rot90_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_rot90_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot90_f16( -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot90.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> %rhs) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot90_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT90_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot90.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[RHS]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT90_F163_I]] +// float16x8_t test_vcmlaq_rot90_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_rot90_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot90_f32( -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot90.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> %rhs) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot90_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT90_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot90.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[RHS]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT90_F323_I]] +// float32x4_t test_vcmlaq_rot90_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_rot90_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot90_f64( -// CHECK: [[RES:%.*]] = tail call <2 x double> @llvm.aarch64.neon.vcmla.rot90.v2f64(<2 x double> %acc, <2 x double> %lhs, <2 x double> %rhs) -// CHECK: ret <2 x double> [[RES]] +// CHECK-LABEL: define dso_local <2 x double> @test_vcmlaq_rot90_f64( +// CHECK-SAME: <2 x double> noundef [[ACC:%.*]], <2 x double> noundef [[LHS:%.*]], <2 x double> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT90_F643_I:%.*]] = call <2 x double> @llvm.aarch64.neon.vcmla.rot90.v2f64(<2 x double> [[ACC]], <2 x double> [[LHS]], <2 x double> [[RHS]]) +// CHECK-NEXT: ret <2 x double> [[VCMLAQ_ROT90_F643_I]] +// float64x2_t test_vcmlaq_rot90_f64(float64x2_t acc, float64x2_t lhs, float64x2_t rhs) { return vcmlaq_rot90_f64(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_rot180_f16( -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot180.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> %rhs) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot180_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_ROT180_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot180.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[RHS]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT180_F163_I]] +// float16x4_t test_vcmla_rot180_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_rot180_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_rot180_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot180.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot180_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_ROT180_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot180.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[RHS]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT180_F323_I]] +// float32x2_t test_vcmla_rot180_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_rot180_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot180_f16( -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot180.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> %rhs) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot180_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT180_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot180.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[RHS]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT180_F163_I]] +// float16x8_t test_vcmlaq_rot180_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_rot180_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot180_f32( -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot180.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> %rhs) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot180_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT180_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot180.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[RHS]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT180_F323_I]] +// float32x4_t test_vcmlaq_rot180_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_rot180_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot180_f64( -// CHECK: [[RES:%.*]] = tail call <2 x double> @llvm.aarch64.neon.vcmla.rot180.v2f64(<2 x double> %acc, <2 x double> %lhs, <2 x double> %rhs) -// CHECK: ret <2 x double> [[RES]] +// CHECK-LABEL: define dso_local <2 x double> @test_vcmlaq_rot180_f64( +// CHECK-SAME: <2 x double> noundef [[ACC:%.*]], <2 x double> noundef [[LHS:%.*]], <2 x double> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT180_F643_I:%.*]] = call <2 x double> @llvm.aarch64.neon.vcmla.rot180.v2f64(<2 x double> [[ACC]], <2 x double> [[LHS]], <2 x double> [[RHS]]) +// CHECK-NEXT: ret <2 x double> [[VCMLAQ_ROT180_F643_I]] +// float64x2_t test_vcmlaq_rot180_f64(float64x2_t acc, float64x2_t lhs, float64x2_t rhs) { return vcmlaq_rot180_f64(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_rot270_f16( -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot270.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> %rhs) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot270_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_ROT270_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot270.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[RHS]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT270_F163_I]] +// float16x4_t test_vcmla_rot270_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_rot270_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_rot270_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot270.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot270_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLA_ROT270_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot270.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[RHS]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT270_F323_I]] +// float32x2_t test_vcmla_rot270_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_rot270_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot270_f16( -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot270.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> %rhs) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot270_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT270_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot270.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[RHS]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT270_F163_I]] +// float16x8_t test_vcmlaq_rot270_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_rot270_f16(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot270_f32( -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot270.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> %rhs) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot270_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT270_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot270.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[RHS]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT270_F323_I]] +// float32x4_t test_vcmlaq_rot270_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_rot270_f32(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmlaq_rot270_f64( -// CHECK: [[RES:%.*]] = tail call <2 x double> @llvm.aarch64.neon.vcmla.rot270.v2f64(<2 x double> %acc, <2 x double> %lhs, <2 x double> %rhs) -// CHECK: ret <2 x double> [[RES]] +// CHECK-LABEL: define dso_local <2 x double> @test_vcmlaq_rot270_f64( +// CHECK-SAME: <2 x double> noundef [[ACC:%.*]], <2 x double> noundef [[LHS:%.*]], <2 x double> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[VCMLAQ_ROT270_F643_I:%.*]] = call <2 x double> @llvm.aarch64.neon.vcmla.rot270.v2f64(<2 x double> [[ACC]], <2 x double> [[LHS]], <2 x double> [[RHS]]) +// CHECK-NEXT: ret <2 x double> [[VCMLAQ_ROT270_F643_I]] +// float64x2_t test_vcmlaq_rot270_f64(float64x2_t acc, float64x2_t lhs, float64x2_t rhs) { return vcmlaq_rot270_f64(acc, lhs, rhs); } -// CHECK-LABEL: @test_vcmla_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot0.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_lane_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_150:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_150:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_150]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_150]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_150]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_150]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_150]], align 8 +// CHECK-NEXT: [[VCMLA_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot0.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_F163_I]] +// float16x4_t test_vcmla_lane_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_lane_f16(acc, lhs, rhs, 1); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <2 x i32> <i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <2 x i32> [[DUP]] to <4 x half> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot0.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP_FLT]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_laneq_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_154:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_154:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_154]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_154]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_154]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_154]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_154]], align 8 +// CHECK-NEXT: [[VCMLA_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot0.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_F163_I]] +// float16x4_t test_vcmla_laneq_f16(float16x4_t acc, float16x4_t lhs, float16x8_t rhs) { return vcmla_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmlaq_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <8 x i32> <i32 2, i32 3, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot0.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_lane_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_152:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_152:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_152]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_152]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_152]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <2 x i32>, ptr [[__REINT_152]], align 8 +// CHECK-NEXT: [[VGET_LANE8:%.*]] = extractelement <2 x i32> [[TMP2]], i32 1 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGET_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <2 x i32>, ptr [[__REINT_152]], align 8 +// CHECK-NEXT: [[VGET_LANE13:%.*]] = extractelement <2 x i32> [[TMP3]], i32 1 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGET_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_152]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_152]], align 16 +// CHECK-NEXT: [[VCMLAQ_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot0.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_F163_I]] +// float16x8_t test_vcmlaq_lane_f16(float16x8_t acc, float16x8_t lhs, float16x4_t rhs) { return vcmlaq_lane_f16(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <4 x i32> <i32 3, i32 3, i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <4 x i32> [[DUP]] to <8 x half> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot0.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP_FLT]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_laneq_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_156:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_156:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_156]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_156]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_156]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x i32>, ptr [[__REINT_156]], align 16 +// CHECK-NEXT: [[VGETQ_LANE8:%.*]] = extractelement <4 x i32> [[TMP2]], i32 3 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGETQ_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <4 x i32>, ptr [[__REINT_156]], align 16 +// CHECK-NEXT: [[VGETQ_LANE13:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGETQ_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_156]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_156]], align 16 +// CHECK-NEXT: [[VCMLAQ_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot0.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_F163_I]] +// float16x8_t test_vcmlaq_laneq_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmla_lane_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot0.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_lane_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_182:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_182:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_182]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_182]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_182]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_182]], align 8 +// CHECK-NEXT: [[VCMLA_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot0.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_F323_I]] +// float32x2_t test_vcmla_lane_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_lane_f32(acc, lhs, rhs, 0); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_laneq_f32( -// CHECK: [[CPLX:%.*]] = bitcast <4 x float> %rhs to <2 x i64> -// CHECK: [[DUP:%.*]] = shufflevector <2 x i64> [[CPLX]], <2 x i64> poison, <1 x i32> <i32 1> -// CHECK: [[DUP_FLT:%.*]] = bitcast <1 x i64> [[DUP]] to <2 x float> -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot0.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> [[DUP_FLT]]) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_laneq_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_186:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_186:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_186]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_186]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_186]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_186]], align 8 +// CHECK-NEXT: [[VCMLA_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot0.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_F323_I]] +// float32x2_t test_vcmla_laneq_f32(float32x2_t acc, float32x2_t lhs, float32x4_t rhs) { return vcmla_laneq_f32(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_lane_f32( -// CHECK: [[CPLX:%.*]] = bitcast <2 x float> %rhs to i64 -// CHECK: [[CPLX_VEC:%.*]] = insertelement <2 x i64> poison, i64 [[CPLX]], i64 0 -// CHECK: [[CPLX2:%.*]] = bitcast <2 x i64> [[CPLX_VEC]] to <4 x float> -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> [[CPLX2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot0.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_lane_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_184:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_184:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_184]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_184]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <1 x i64>, ptr [[__REINT_184]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <1 x i64> [[TMP1]], i32 0 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_184]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_184]], align 16 +// CHECK-NEXT: [[VCMLAQ_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot0.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_F323_I]] +// float32x4_t test_vcmlaq_lane_f32(float32x4_t acc, float32x4_t lhs, float32x2_t rhs) { return vcmlaq_lane_f32(acc, lhs, rhs, 0); } -// CHECK-LABEL: @test_vcmlaq_laneq_f32( -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> %rhs, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot0.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_laneq_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_188:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_188:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_188]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_188]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, ptr [[__REINT_188]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <2 x i64> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_188]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_188]], align 16 +// CHECK-NEXT: [[VCMLAQ_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot0.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_F323_I]] +// float32x4_t test_vcmlaq_laneq_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_laneq_f32(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmla_rot90_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot90.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot90_lane_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_174:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_174:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_174]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_174]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_174]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_174]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_174]], align 8 +// CHECK-NEXT: [[VCMLA_ROT90_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot90.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT90_F163_I]] +// float16x4_t test_vcmla_rot90_lane_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_rot90_lane_f16(acc, lhs, rhs, 1); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_rot90_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <2 x i32> <i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <2 x i32> [[DUP]] to <4 x half> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot90.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP_FLT]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot90_laneq_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_178:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_178:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_178]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_178]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_178]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_178]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_178]], align 8 +// CHECK-NEXT: [[VCMLA_ROT90_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot90.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT90_F163_I]] +// float16x4_t test_vcmla_rot90_laneq_f16(float16x4_t acc, float16x4_t lhs, float16x8_t rhs) { return vcmla_rot90_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmlaq_rot90_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <8 x i32> <i32 2, i32 3, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot90.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot90_lane_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_176:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_176:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_176]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_176]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_176]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <2 x i32>, ptr [[__REINT_176]], align 8 +// CHECK-NEXT: [[VGET_LANE8:%.*]] = extractelement <2 x i32> [[TMP2]], i32 1 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGET_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <2 x i32>, ptr [[__REINT_176]], align 8 +// CHECK-NEXT: [[VGET_LANE13:%.*]] = extractelement <2 x i32> [[TMP3]], i32 1 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGET_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_176]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_176]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT90_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot90.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT90_F163_I]] +// float16x8_t test_vcmlaq_rot90_lane_f16(float16x8_t acc, float16x8_t lhs, float16x4_t rhs) { return vcmlaq_rot90_lane_f16(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_rot90_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <4 x i32> <i32 3, i32 3, i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <4 x i32> [[DUP]] to <8 x half> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot90.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP_FLT]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot90_laneq_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_180:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_180:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_180]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_180]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_180]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x i32>, ptr [[__REINT_180]], align 16 +// CHECK-NEXT: [[VGETQ_LANE8:%.*]] = extractelement <4 x i32> [[TMP2]], i32 3 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGETQ_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <4 x i32>, ptr [[__REINT_180]], align 16 +// CHECK-NEXT: [[VGETQ_LANE13:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGETQ_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_180]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_180]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT90_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot90.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT90_F163_I]] +// float16x8_t test_vcmlaq_rot90_laneq_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_rot90_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmla_rot90_lane_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot90.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot90_lane_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_206:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_206:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_206]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_206]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_206]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_206]], align 8 +// CHECK-NEXT: [[VCMLA_ROT90_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot90.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT90_F323_I]] +// float32x2_t test_vcmla_rot90_lane_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_rot90_lane_f32(acc, lhs, rhs, 0); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_rot90_laneq_f32( -// CHECK: [[CPLX:%.*]] = bitcast <4 x float> %rhs to <2 x i64> -// CHECK: [[DUP:%.*]] = shufflevector <2 x i64> [[CPLX]], <2 x i64> poison, <1 x i32> <i32 1> -// CHECK: [[DUP_FLT:%.*]] = bitcast <1 x i64> [[DUP]] to <2 x float> -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot90.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> [[DUP_FLT]]) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot90_laneq_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_210:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_210:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_210]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_210]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_210]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_210]], align 8 +// CHECK-NEXT: [[VCMLA_ROT90_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot90.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT90_F323_I]] +// float32x2_t test_vcmla_rot90_laneq_f32(float32x2_t acc, float32x2_t lhs, float32x4_t rhs) { return vcmla_rot90_laneq_f32(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_rot90_lane_f32( -// CHECK: [[CPLX:%.*]] = bitcast <2 x float> %rhs to i64 -// CHECK: [[CPLX_VEC:%.*]] = insertelement <2 x i64> poison, i64 [[CPLX]], i64 0 -// CHECK: [[CPLX2:%.*]] = bitcast <2 x i64> [[CPLX_VEC]] to <4 x float> -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> [[CPLX2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot90.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot90_lane_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_208:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_208:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_208]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_208]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <1 x i64>, ptr [[__REINT_208]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <1 x i64> [[TMP1]], i32 0 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_208]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_208]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT90_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot90.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT90_F323_I]] +// float32x4_t test_vcmlaq_rot90_lane_f32(float32x4_t acc, float32x4_t lhs, float32x2_t rhs) { return vcmlaq_rot90_lane_f32(acc, lhs, rhs, 0); } -// CHECK-LABEL: @test_vcmlaq_rot90_laneq_f32( -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> %rhs, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot90.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot90_laneq_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_212:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_212:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_212]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_212]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, ptr [[__REINT_212]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <2 x i64> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_212]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_212]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT90_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot90.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT90_F323_I]] +// float32x4_t test_vcmlaq_rot90_laneq_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_rot90_laneq_f32(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmla_rot180_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot180.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot180_lane_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_158:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_158:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_158]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_158]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_158]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_158]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_158]], align 8 +// CHECK-NEXT: [[VCMLA_ROT180_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot180.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT180_F163_I]] +// float16x4_t test_vcmla_rot180_lane_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_rot180_lane_f16(acc, lhs, rhs, 1); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_rot180_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <2 x i32> <i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <2 x i32> [[DUP]] to <4 x half> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot180.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP_FLT]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot180_laneq_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_162:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_162:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_162]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_162]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_162]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_162]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_162]], align 8 +// CHECK-NEXT: [[VCMLA_ROT180_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot180.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT180_F163_I]] +// float16x4_t test_vcmla_rot180_laneq_f16(float16x4_t acc, float16x4_t lhs, float16x8_t rhs) { return vcmla_rot180_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmlaq_rot180_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <8 x i32> <i32 2, i32 3, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot180.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot180_lane_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_160:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_160:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_160]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_160]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_160]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <2 x i32>, ptr [[__REINT_160]], align 8 +// CHECK-NEXT: [[VGET_LANE8:%.*]] = extractelement <2 x i32> [[TMP2]], i32 1 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGET_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <2 x i32>, ptr [[__REINT_160]], align 8 +// CHECK-NEXT: [[VGET_LANE13:%.*]] = extractelement <2 x i32> [[TMP3]], i32 1 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGET_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_160]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_160]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT180_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot180.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT180_F163_I]] +// float16x8_t test_vcmlaq_rot180_lane_f16(float16x8_t acc, float16x8_t lhs, float16x4_t rhs) { return vcmlaq_rot180_lane_f16(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_rot180_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <4 x i32> <i32 3, i32 3, i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <4 x i32> [[DUP]] to <8 x half> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot180.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP_FLT]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot180_laneq_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_164:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_164:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_164]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_164]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_164]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x i32>, ptr [[__REINT_164]], align 16 +// CHECK-NEXT: [[VGETQ_LANE8:%.*]] = extractelement <4 x i32> [[TMP2]], i32 3 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGETQ_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <4 x i32>, ptr [[__REINT_164]], align 16 +// CHECK-NEXT: [[VGETQ_LANE13:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGETQ_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_164]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_164]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT180_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot180.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT180_F163_I]] +// float16x8_t test_vcmlaq_rot180_laneq_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_rot180_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmla_rot180_lane_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot180.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot180_lane_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_190:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_190:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_190]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_190]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_190]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_190]], align 8 +// CHECK-NEXT: [[VCMLA_ROT180_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot180.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT180_F323_I]] +// float32x2_t test_vcmla_rot180_lane_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_rot180_lane_f32(acc, lhs, rhs, 0); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_rot180_laneq_f32( -// CHECK: [[CPLX:%.*]] = bitcast <4 x float> %rhs to <2 x i64> -// CHECK: [[DUP:%.*]] = shufflevector <2 x i64> [[CPLX]], <2 x i64> poison, <1 x i32> <i32 1> -// CHECK: [[DUP_FLT:%.*]] = bitcast <1 x i64> [[DUP]] to <2 x float> -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot180.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> [[DUP_FLT]]) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot180_laneq_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_194:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_194:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_194]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_194]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_194]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_194]], align 8 +// CHECK-NEXT: [[VCMLA_ROT180_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot180.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT180_F323_I]] +// float32x2_t test_vcmla_rot180_laneq_f32(float32x2_t acc, float32x2_t lhs, float32x4_t rhs) { return vcmla_rot180_laneq_f32(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_rot180_lane_f32( -// CHECK: [[CPLX:%.*]] = bitcast <2 x float> %rhs to i64 -// CHECK: [[CPLX_VEC:%.*]] = insertelement <2 x i64> poison, i64 [[CPLX]], i64 0 -// CHECK: [[CPLX2:%.*]] = bitcast <2 x i64> [[CPLX_VEC]] to <4 x float> -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> [[CPLX2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot180.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot180_lane_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_192:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_192:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_192]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_192]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <1 x i64>, ptr [[__REINT_192]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <1 x i64> [[TMP1]], i32 0 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_192]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_192]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT180_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot180.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT180_F323_I]] +// float32x4_t test_vcmlaq_rot180_lane_f32(float32x4_t acc, float32x4_t lhs, float32x2_t rhs) { return vcmlaq_rot180_lane_f32(acc, lhs, rhs, 0); } -// CHECK-LABEL: @test_vcmlaq_rot180_laneq_f32( -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> %rhs, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot180.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot180_laneq_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_196:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_196:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_196]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_196]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, ptr [[__REINT_196]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <2 x i64> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_196]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_196]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT180_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot180.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT180_F323_I]] +// float32x4_t test_vcmlaq_rot180_laneq_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_rot180_laneq_f32(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmla_rot270_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot270.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot270_lane_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_166:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_166:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_166]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_166]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_166]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_166]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_166]], align 8 +// CHECK-NEXT: [[VCMLA_ROT270_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot270.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT270_F163_I]] +// float16x4_t test_vcmla_rot270_lane_f16(float16x4_t acc, float16x4_t lhs, float16x4_t rhs) { return vcmla_rot270_lane_f16(acc, lhs, rhs, 1); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_rot270_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <2 x i32> <i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <2 x i32> [[DUP]] to <4 x half> -// CHECK: [[RES:%.*]] = tail call <4 x half> @llvm.aarch64.neon.vcmla.rot270.v4f16(<4 x half> %acc, <4 x half> %lhs, <4 x half> [[DUP_FLT]]) -// CHECK: ret <4 x half> [[RES]] +// CHECK-LABEL: define dso_local <4 x half> @test_vcmla_rot270_laneq_f16( +// CHECK-SAME: <4 x half> noundef [[ACC:%.*]], <4 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_170:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_170:%.*]] = alloca <2 x i32>, align 8 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_170]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_170]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_170]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i32> [[VECINIT5]], ptr [[__REINT1_170]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x half>, ptr [[__REINT1_170]], align 8 +// CHECK-NEXT: [[VCMLA_ROT270_F163_I:%.*]] = call <4 x half> @llvm.aarch64.neon.vcmla.rot270.v4f16(<4 x half> [[ACC]], <4 x half> [[LHS]], <4 x half> [[TMP2]]) +// CHECK-NEXT: ret <4 x half> [[VCMLA_ROT270_F163_I]] +// float16x4_t test_vcmla_rot270_laneq_f16(float16x4_t acc, float16x4_t lhs, float16x8_t rhs) { return vcmla_rot270_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmlaq_rot270_lane_f16( -// CHECK: [[DUP:%.*]] = shufflevector <4 x half> %rhs, <4 x half> poison, <8 x i32> <i32 2, i32 3, i32 2, i32 3, i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot270.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot270_lane_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <4 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_168:%.*]] = alloca <4 x half>, align 8 +// CHECK-NEXT: [[__REINT1_168:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <4 x half> [[RHS]], ptr [[__REINT_168]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[__REINT_168]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <2 x i32> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[__REINT_168]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <2 x i32> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <2 x i32>, ptr [[__REINT_168]], align 8 +// CHECK-NEXT: [[VGET_LANE8:%.*]] = extractelement <2 x i32> [[TMP2]], i32 1 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGET_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <2 x i32>, ptr [[__REINT_168]], align 8 +// CHECK-NEXT: [[VGET_LANE13:%.*]] = extractelement <2 x i32> [[TMP3]], i32 1 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGET_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_168]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_168]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT270_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot270.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT270_F163_I]] +// float16x8_t test_vcmlaq_rot270_lane_f16(float16x8_t acc, float16x8_t lhs, float16x4_t rhs) { return vcmlaq_rot270_lane_f16(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_rot270_laneq_f16( -// CHECK: [[CPLX:%.*]] = bitcast <8 x half> %rhs to <4 x i32> -// CHECK: [[DUP:%.*]] = shufflevector <4 x i32> [[CPLX]], <4 x i32> poison, <4 x i32> <i32 3, i32 3, i32 3, i32 3> -// CHECK: [[DUP_FLT:%.*]] = bitcast <4 x i32> [[DUP]] to <8 x half> -// CHECK: [[RES:%.*]] = tail call <8 x half> @llvm.aarch64.neon.vcmla.rot270.v8f16(<8 x half> %acc, <8 x half> %lhs, <8 x half> [[DUP_FLT]]) -// CHECK: ret <8 x half> [[RES]] +// CHECK-LABEL: define dso_local <8 x half> @test_vcmlaq_rot270_laneq_f16( +// CHECK-SAME: <8 x half> noundef [[ACC:%.*]], <8 x half> noundef [[LHS:%.*]], <8 x half> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_172:%.*]] = alloca <8 x half>, align 16 +// CHECK-NEXT: [[__REINT1_172:%.*]] = alloca <4 x i32>, align 16 +// CHECK-NEXT: store <8 x half> [[RHS]], ptr [[__REINT_172]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[__REINT_172]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <4 x i32> [[TMP0]], i32 3 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <4 x i32> poison, i32 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[__REINT_172]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <4 x i32> [[TMP1]], i32 3 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <4 x i32> [[VECINIT]], i32 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x i32>, ptr [[__REINT_172]], align 16 +// CHECK-NEXT: [[VGETQ_LANE8:%.*]] = extractelement <4 x i32> [[TMP2]], i32 3 +// CHECK-NEXT: [[VECINIT10:%.*]] = insertelement <4 x i32> [[VECINIT5]], i32 [[VGETQ_LANE8]], i32 2 +// CHECK-NEXT: [[TMP3:%.*]] = load <4 x i32>, ptr [[__REINT_172]], align 16 +// CHECK-NEXT: [[VGETQ_LANE13:%.*]] = extractelement <4 x i32> [[TMP3]], i32 3 +// CHECK-NEXT: [[VECINIT15:%.*]] = insertelement <4 x i32> [[VECINIT10]], i32 [[VGETQ_LANE13]], i32 3 +// CHECK-NEXT: store <4 x i32> [[VECINIT15]], ptr [[__REINT1_172]], align 16 +// CHECK-NEXT: [[TMP4:%.*]] = load <8 x half>, ptr [[__REINT1_172]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT270_F163_I:%.*]] = call <8 x half> @llvm.aarch64.neon.vcmla.rot270.v8f16(<8 x half> [[ACC]], <8 x half> [[LHS]], <8 x half> [[TMP4]]) +// CHECK-NEXT: ret <8 x half> [[VCMLAQ_ROT270_F163_I]] +// float16x8_t test_vcmlaq_rot270_laneq_f16(float16x8_t acc, float16x8_t lhs, float16x8_t rhs) { return vcmlaq_rot270_laneq_f16(acc, lhs, rhs, 3); } -// CHECK-LABEL: @test_vcmla_rot270_lane_f32( -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot270.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> %rhs) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot270_lane_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_198:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_198:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_198]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_198]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_198]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_198]], align 8 +// CHECK-NEXT: [[VCMLA_ROT270_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot270.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT270_F323_I]] +// float32x2_t test_vcmla_rot270_lane_f32(float32x2_t acc, float32x2_t lhs, float32x2_t rhs) { return vcmla_rot270_lane_f32(acc, lhs, rhs, 0); } // ACLE says this exists, but it won't map to a single instruction if lane > 1. -// CHECK-LABEL: @test_vcmla_rot270_laneq_f32( -// CHECK: [[CPLX:%.*]] = bitcast <4 x float> %rhs to <2 x i64> -// CHECK: [[DUP:%.*]] = shufflevector <2 x i64> [[CPLX]], <2 x i64> poison, <1 x i32> <i32 1> -// CHECK: [[DUP_FLT:%.*]] = bitcast <1 x i64> [[DUP]] to <2 x float> -// CHECK: [[RES:%.*]] = tail call <2 x float> @llvm.aarch64.neon.vcmla.rot270.v2f32(<2 x float> %acc, <2 x float> %lhs, <2 x float> [[DUP_FLT]]) -// CHECK: ret <2 x float> [[RES]] +// CHECK-LABEL: define dso_local <2 x float> @test_vcmla_rot270_laneq_f32( +// CHECK-SAME: <2 x float> noundef [[ACC:%.*]], <2 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_202:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_202:%.*]] = alloca <1 x i64>, align 8 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_202]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_202]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <1 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: store <1 x i64> [[VECINIT]], ptr [[__REINT1_202]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[__REINT1_202]], align 8 +// CHECK-NEXT: [[VCMLA_ROT270_F323_I:%.*]] = call <2 x float> @llvm.aarch64.neon.vcmla.rot270.v2f32(<2 x float> [[ACC]], <2 x float> [[LHS]], <2 x float> [[TMP1]]) +// CHECK-NEXT: ret <2 x float> [[VCMLA_ROT270_F323_I]] +// float32x2_t test_vcmla_rot270_laneq_f32(float32x2_t acc, float32x2_t lhs, float32x4_t rhs) { return vcmla_rot270_laneq_f32(acc, lhs, rhs, 1); } -// CHECK-LABEL: @test_vcmlaq_rot270_lane_f32( -// CHECK: [[CPLX:%.*]] = bitcast <2 x float> %rhs to i64 -// CHECK: [[CPLX_VEC:%.*]] = insertelement <2 x i64> poison, i64 [[CPLX]], i64 0 -// CHECK: [[CPLX2:%.*]] = bitcast <2 x i64> [[DUP]] to <4 x float> -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> [[CPLX2]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot270.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot270_lane_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <2 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_200:%.*]] = alloca <2 x float>, align 8 +// CHECK-NEXT: [[__REINT1_200:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <2 x float> [[RHS]], ptr [[__REINT_200]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i64>, ptr [[__REINT_200]], align 8 +// CHECK-NEXT: [[VGET_LANE:%.*]] = extractelement <1 x i64> [[TMP0]], i32 0 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGET_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <1 x i64>, ptr [[__REINT_200]], align 8 +// CHECK-NEXT: [[VGET_LANE3:%.*]] = extractelement <1 x i64> [[TMP1]], i32 0 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGET_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_200]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_200]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT270_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot270.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT270_F323_I]] +// float32x4_t test_vcmlaq_rot270_lane_f32(float32x4_t acc, float32x4_t lhs, float32x2_t rhs) { return vcmlaq_rot270_lane_f32(acc, lhs, rhs, 0); } -// CHECK-LABEL: @test_vcmlaq_rot270_laneq_f32( -// CHECK: [[DUP:%.*]] = shufflevector <4 x float> %rhs, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3> -// CHECK: [[RES:%.*]] = tail call <4 x float> @llvm.aarch64.neon.vcmla.rot270.v4f32(<4 x float> %acc, <4 x float> %lhs, <4 x float> [[DUP]]) -// CHECK: ret <4 x float> [[RES]] +// CHECK-LABEL: define dso_local <4 x float> @test_vcmlaq_rot270_laneq_f32( +// CHECK-SAME: <4 x float> noundef [[ACC:%.*]], <4 x float> noundef [[LHS:%.*]], <4 x float> noundef [[RHS:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[__REINT_204:%.*]] = alloca <4 x float>, align 16 +// CHECK-NEXT: [[__REINT1_204:%.*]] = alloca <2 x i64>, align 16 +// CHECK-NEXT: store <4 x float> [[RHS]], ptr [[__REINT_204]], align 16 +// CHECK-NEXT: [[TMP0:%.*]] = load <2 x i64>, ptr [[__REINT_204]], align 16 +// CHECK-NEXT: [[VGETQ_LANE:%.*]] = extractelement <2 x i64> [[TMP0]], i32 1 +// CHECK-NEXT: [[VECINIT:%.*]] = insertelement <2 x i64> poison, i64 [[VGETQ_LANE]], i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, ptr [[__REINT_204]], align 16 +// CHECK-NEXT: [[VGETQ_LANE3:%.*]] = extractelement <2 x i64> [[TMP1]], i32 1 +// CHECK-NEXT: [[VECINIT5:%.*]] = insertelement <2 x i64> [[VECINIT]], i64 [[VGETQ_LANE3]], i32 1 +// CHECK-NEXT: store <2 x i64> [[VECINIT5]], ptr [[__REINT1_204]], align 16 +// CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[__REINT1_204]], align 16 +// CHECK-NEXT: [[VCMLAQ_ROT270_F323_I:%.*]] = call <4 x float> @llvm.aarch64.neon.vcmla.rot270.v4f32(<4 x float> [[ACC]], <4 x float> [[LHS]], <4 x float> [[TMP2]]) +// CHECK-NEXT: ret <4 x float> [[VCMLAQ_ROT270_F323_I]] +// float32x4_t test_vcmlaq_rot270_laneq_f32(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) { return vcmlaq_rot270_laneq_f32(acc, lhs, rhs, 1); } diff --git a/clang/test/CodeGen/AArch64/sincos.c b/clang/test/CodeGen/AArch64/sincos.c new file mode 100644 index 000000000000..b77d98ceab48 --- /dev/null +++ b/clang/test/CodeGen/AArch64/sincos.c @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -triple=aarch64-gnu-linux -emit-llvm -O1 %s -o - | FileCheck --check-prefix=NO-MATH-ERRNO %s +// RUN: %clang_cc1 -triple=aarch64-gnu-linux -emit-llvm -fmath-errno %s -o - | FileCheck --check-prefix=MATH-ERRNO %s + +// NO-MATH-ERRNO-LABEL: @sincos_f32 +// NO-MATH-ERRNO: [[SINCOS:%.*]] = tail call { float, float } @llvm.sincos.f32(float {{.*}}) +// NO-MATH-ERRNO-NEXT: [[SIN:%.*]] = extractvalue { float, float } [[SINCOS]], 0 +// NO-MATH-ERRNO-NEXT: [[COS:%.*]] = extractvalue { float, float } [[SINCOS]], 1 +// NO-MATH-ERRNO-NEXT: store float [[SIN]], ptr {{.*}}, align 4, !alias.scope [[SINCOS_ALIAS_SCOPE:![0-9]+]] +// NO-MATH-ERRNO-NEXT: store float [[COS]], ptr {{.*}}, align 4, !noalias [[SINCOS_ALIAS_SCOPE]] +// +// MATH-ERRNO-LABEL: @sincos_f32 +// MATH-ERRNO: call void @sincosf( +// +void sincos_f32(float x, float* fp0, float* fp1) { + __builtin_sincosf(x, fp0, fp1); +} + +// NO-MATH-ERRNO-LABEL: @sincos_f64 +// NO-MATH-ERRNO: [[SINCOS:%.*]] = tail call { double, double } @llvm.sincos.f64(double {{.*}}) +// NO-MATH-ERRNO-NEXT: [[SIN:%.*]] = extractvalue { double, double } [[SINCOS]], 0 +// NO-MATH-ERRNO-NEXT: [[COS:%.*]] = extractvalue { double, double } [[SINCOS]], 1 +// NO-MATH-ERRNO-NEXT: store double [[SIN]], ptr {{.*}}, align 8, !alias.scope [[SINCOS_ALIAS_SCOPE:![0-9]+]] +// NO-MATH-ERRNO-NEXT: store double [[COS]], ptr {{.*}}, align 8, !noalias [[SINCOS_ALIAS_SCOPE]] +// +// MATH-ERRNO-LABEL: @sincos_f64 +// MATH-ERRNO: call void @sincos( +// +void sincos_f64(double x, double* dp0, double* dp1) { + __builtin_sincos(x, dp0, dp1); +} + +// NO-MATH-ERRNO-LABEL: @sincos_f128 +// NO-MATH-ERRNO: [[SINCOS:%.*]] = tail call { fp128, fp128 } @llvm.sincos.f128(fp128 {{.*}}) +// NO-MATH-ERRNO-NEXT: [[SIN:%.*]] = extractvalue { fp128, fp128 } [[SINCOS]], 0 +// NO-MATH-ERRNO-NEXT: [[COS:%.*]] = extractvalue { fp128, fp128 } [[SINCOS]], 1 +// NO-MATH-ERRNO-NEXT: store fp128 [[SIN]], ptr {{.*}}, align 16, !alias.scope [[SINCOS_ALIAS_SCOPE:![0-9]+]] +// NO-MATH-ERRNO-NEXT: store fp128 [[COS]], ptr {{.*}}, align 16, !noalias [[SINCOS_ALIAS_SCOPE]] +// +// MATH-ERRNO-LABEL: @sincos_f128 +// MATH-ERRNO: call void @sincosl( +// +void sincos_f128(long double x, long double* ldp0, long double* ldp1) { + __builtin_sincosl(x, ldp0, ldp1); +} diff --git a/clang/test/CodeGen/AArch64/sme-inline-callees-streaming-attrs.c b/clang/test/CodeGen/AArch64/sme-inline-callees-streaming-attrs.c index ce6f203631fc..2071e66e0d65 100644 --- a/clang/test/CodeGen/AArch64/sme-inline-callees-streaming-attrs.c +++ b/clang/test/CodeGen/AArch64/sme-inline-callees-streaming-attrs.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -target-feature +sme %s -DUSE_FLATTEN -o - | FileCheck %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -target-feature +sme %s -DUSE_ALWAYS_INLINE_STMT -o - | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -target-feature +sme -target-feature +sme2 %s -DUSE_FLATTEN -o - | FileCheck %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -emit-llvm -target-feature +sme -target-feature +sme2 %s -DUSE_ALWAYS_INLINE_STMT -o - | FileCheck %s // REQUIRES: aarch64-registered-target @@ -20,6 +20,7 @@ void fn_streaming_compatible(void) __arm_streaming_compatible { was_inlined(); } void fn_streaming(void) __arm_streaming { was_inlined(); } __arm_locally_streaming void fn_locally_streaming(void) { was_inlined(); } __arm_new("za") void fn_streaming_new_za(void) __arm_streaming { was_inlined(); } +__arm_new("zt0") void fn_streaming_new_zt0(void) __arm_streaming { was_inlined(); } FN_ATTR void caller(void) { @@ -28,6 +29,7 @@ void caller(void) { STMT_ATTR fn_streaming(); STMT_ATTR fn_locally_streaming(); STMT_ATTR fn_streaming_new_za(); + STMT_ATTR fn_streaming_new_zt0(); } // CHECK-LABEL: void @caller() // CHECK-NEXT: entry: @@ -36,6 +38,7 @@ void caller(void) { // CHECK-NEXT: call void @fn_streaming // CHECK-NEXT: call void @fn_locally_streaming // CHECK-NEXT: call void @fn_streaming_new_za +// CHECK-NEXT: call void @fn_streaming_new_zt0 FN_ATTR void caller_streaming_compatible(void) __arm_streaming_compatible { STMT_ATTR fn(); @@ -43,6 +46,7 @@ FN_ATTR void caller_streaming_compatible(void) __arm_streaming_compatible { STMT_ATTR fn_streaming(); STMT_ATTR fn_locally_streaming(); STMT_ATTR fn_streaming_new_za(); + STMT_ATTR fn_streaming_new_zt0(); } // CHECK-LABEL: void @caller_streaming_compatible() // CHECK-NEXT: entry: @@ -51,6 +55,7 @@ FN_ATTR void caller_streaming_compatible(void) __arm_streaming_compatible { // CHECK-NEXT: call void @fn_streaming // CHECK-NEXT: call void @fn_locally_streaming // CHECK-NEXT: call void @fn_streaming_new_za +// CHECK-NEXT: call void @fn_streaming_new_zt0 FN_ATTR void caller_streaming(void) __arm_streaming { STMT_ATTR fn(); @@ -58,6 +63,7 @@ FN_ATTR void caller_streaming(void) __arm_streaming { STMT_ATTR fn_streaming(); STMT_ATTR fn_locally_streaming(); STMT_ATTR fn_streaming_new_za(); + STMT_ATTR fn_streaming_new_zt0(); } // CHECK-LABEL: void @caller_streaming() // CHECK-NEXT: entry: @@ -66,6 +72,7 @@ FN_ATTR void caller_streaming(void) __arm_streaming { // CHECK-NEXT: call void @was_inlined // CHECK-NEXT: call void @was_inlined // CHECK-NEXT: call void @fn_streaming_new_za +// CHECK-NEXT: call void @fn_streaming_new_zt0 FN_ATTR __arm_locally_streaming void caller_locally_streaming(void) { @@ -74,6 +81,7 @@ void caller_locally_streaming(void) { STMT_ATTR fn_streaming(); STMT_ATTR fn_locally_streaming(); STMT_ATTR fn_streaming_new_za(); + STMT_ATTR fn_streaming_new_zt0(); } // CHECK-LABEL: void @caller_locally_streaming() // CHECK-NEXT: entry: @@ -82,3 +90,4 @@ void caller_locally_streaming(void) { // CHECK-NEXT: call void @was_inlined // CHECK-NEXT: call void @was_inlined // CHECK-NEXT: call void @fn_streaming_new_za +// CHECK-NEXT: call void @fn_streaming_new_zt0 diff --git a/clang/test/CodeGen/AArch64/sme-inline-streaming-attrs.c b/clang/test/CodeGen/AArch64/sme-inline-streaming-attrs.c index 9c3d08a25945..68102c9ded40 100644 --- a/clang/test/CodeGen/AArch64/sme-inline-streaming-attrs.c +++ b/clang/test/CodeGen/AArch64/sme-inline-streaming-attrs.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_NONE %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_COMPATIBLE %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_STREAMING %s -// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -verify -DTEST_LOCALLY %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_NONE %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_COMPATIBLE %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_STREAMING %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_LOCALLY %s // REQUIRES: aarch64-registered-target @@ -10,6 +10,8 @@ __ai void inlined_fn(void) {} __ai void inlined_fn_streaming_compatible(void) __arm_streaming_compatible {} __ai void inlined_fn_streaming(void) __arm_streaming {} __ai __arm_locally_streaming void inlined_fn_local(void) {} +__ai __arm_new("za") void inlined_fn_za(void) {} +__ai __arm_new("zt0") void inlined_fn_zt0(void) {} #ifdef TEST_NONE void caller(void) { @@ -17,6 +19,8 @@ void caller(void) { inlined_fn_streaming_compatible(); inlined_fn_streaming(); // expected-error {{always_inline function 'inlined_fn_streaming' and its caller 'caller' have mismatching streaming attributes}} inlined_fn_local(); // expected-error {{always_inline function 'inlined_fn_local' and its caller 'caller' have mismatching streaming attributes}} + inlined_fn_za(); // expected-error {{always_inline function 'inlined_fn_za' has new za state}} + inlined_fn_zt0(); // expected-error {{always_inline function 'inlined_fn_zt0' has new zt0 state}} } #endif diff --git a/clang/test/CodeGen/AArch64/sme-intrinsics/acle_sme_state_funs.c b/clang/test/CodeGen/AArch64/sme-intrinsics/acle_sme_state_funs.c index 9ba1527f2696..72f2d17fc6dc 100644 --- a/clang/test/CodeGen/AArch64/sme-intrinsics/acle_sme_state_funs.c +++ b/clang/test/CodeGen/AArch64/sme-intrinsics/acle_sme_state_funs.c @@ -6,34 +6,53 @@ #include <arm_sme.h> -// CHECK-LABEL: @test_in_streaming_mode( +// CHECK-LABEL: @test_in_streaming_mode_streaming_compatible( // CHECK-NEXT: entry: -// CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3:[0-9]+]] -// CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0 -// CHECK-NEXT: [[AND_I:%.*]] = and i64 [[TMP1]], 1 -// CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp ne i64 [[AND_I]], 0 -// CHECK-NEXT: ret i1 [[TOBOOL_I]] +// CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.aarch64.sme.in.streaming.mode() +// CHECK-NEXT: ret i1 [[TMP0]] // -// CPP-CHECK-LABEL: @_Z22test_in_streaming_modev( +// CPP-CHECK-LABEL: @_Z43test_in_streaming_mode_streaming_compatiblev( // CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3:[0-9]+]] -// CPP-CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0 -// CPP-CHECK-NEXT: [[AND_I:%.*]] = and i64 [[TMP1]], 1 -// CPP-CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp ne i64 [[AND_I]], 0 -// CPP-CHECK-NEXT: ret i1 [[TOBOOL_I]] +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call i1 @llvm.aarch64.sme.in.streaming.mode() +// CPP-CHECK-NEXT: ret i1 [[TMP0]] +// +bool test_in_streaming_mode_streaming_compatible(void) __arm_streaming_compatible { + return __arm_in_streaming_mode(); +} + +// CHECK-LABEL: @test_in_streaming_mode_streaming( +// CHECK-NEXT: entry: +// CHECK-NEXT: ret i1 true +// +// CPP-CHECK-LABEL: @_Z32test_in_streaming_mode_streamingv( +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: ret i1 true +// +bool test_in_streaming_mode_streaming(void) __arm_streaming { +// + return __arm_in_streaming_mode(); +} + +// CHECK-LABEL: @test_in_streaming_mode_non_streaming( +// CHECK-NEXT: entry: +// CHECK-NEXT: ret i1 false +// +// CPP-CHECK-LABEL: @_Z36test_in_streaming_mode_non_streamingv( +// CPP-CHECK-NEXT: entry: +// CPP-CHECK-NEXT: ret i1 false // -bool test_in_streaming_mode(void) __arm_streaming_compatible { +bool test_in_streaming_mode_non_streaming(void) { return __arm_in_streaming_mode(); } // CHECK-LABEL: @test_za_disable( // CHECK-NEXT: entry: -// CHECK-NEXT: tail call void @__arm_za_disable() #[[ATTR3]] +// CHECK-NEXT: tail call void @__arm_za_disable() #[[ATTR7:[0-9]+]] // CHECK-NEXT: ret void // // CPP-CHECK-LABEL: @_Z15test_za_disablev( // CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: tail call void @__arm_za_disable() #[[ATTR3]] +// CPP-CHECK-NEXT: tail call void @__arm_za_disable() #[[ATTR7:[0-9]+]] // CPP-CHECK-NEXT: ret void // void test_za_disable(void) __arm_streaming_compatible { @@ -42,14 +61,14 @@ void test_za_disable(void) __arm_streaming_compatible { // CHECK-LABEL: @test_has_sme( // CHECK-NEXT: entry: -// CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3]] +// CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR7]] // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0 // CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp slt i64 [[TMP1]], 0 // CHECK-NEXT: ret i1 [[TOBOOL_I]] // // CPP-CHECK-LABEL: @_Z12test_has_smev( // CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR3]] +// CPP-CHECK-NEXT: [[TMP0:%.*]] = tail call aarch64_sme_preservemost_from_x2 { i64, i64 } @__arm_sme_state() #[[ATTR7]] // CPP-CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i64, i64 } [[TMP0]], 0 // CPP-CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp slt i64 [[TMP1]], 0 // CPP-CHECK-NEXT: ret i1 [[TOBOOL_I]] @@ -72,12 +91,12 @@ void test_svundef_za(void) __arm_streaming_compatible __arm_out("za") { // CHECK-LABEL: @test_sc_memcpy( // CHECK-NEXT: entry: -// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memcpy(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memcpy(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CHECK-NEXT: ret ptr [[CALL]] // // CPP-CHECK-LABEL: @_Z14test_sc_memcpyPvPKvm( // CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memcpy(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memcpy(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CPP-CHECK-NEXT: ret ptr [[CALL]] // void *test_sc_memcpy(void *dest, const void *src, size_t n) __arm_streaming_compatible { @@ -86,12 +105,12 @@ void *test_sc_memcpy(void *dest, const void *src, size_t n) __arm_streaming_comp // CHECK-LABEL: @test_sc_memmove( // CHECK-NEXT: entry: -// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memmove(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memmove(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CHECK-NEXT: ret ptr [[CALL]] // // CPP-CHECK-LABEL: @_Z15test_sc_memmovePvPKvm( // CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memmove(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memmove(ptr noundef [[DEST:%.*]], ptr noundef [[SRC:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CPP-CHECK-NEXT: ret ptr [[CALL]] // void *test_sc_memmove(void *dest, const void *src, size_t n) __arm_streaming_compatible { @@ -100,12 +119,12 @@ void *test_sc_memmove(void *dest, const void *src, size_t n) __arm_streaming_com // CHECK-LABEL: @test_sc_memset( // CHECK-NEXT: entry: -// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memset(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memset(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CHECK-NEXT: ret ptr [[CALL]] // // CPP-CHECK-LABEL: @_Z14test_sc_memsetPvim( // CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memset(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memset(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CPP-CHECK-NEXT: ret ptr [[CALL]] // void *test_sc_memset(void *s, int c, size_t n) __arm_streaming_compatible { @@ -114,12 +133,12 @@ void *test_sc_memset(void *s, int c, size_t n) __arm_streaming_compatible { // CHECK-LABEL: @test_sc_memchr( // CHECK-NEXT: entry: -// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memchr(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memchr(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CHECK-NEXT: ret ptr [[CALL]] // // CPP-CHECK-LABEL: @_Z14test_sc_memchrPvim( // CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memchr(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR3]] +// CPP-CHECK-NEXT: [[CALL:%.*]] = tail call ptr @__arm_sc_memchr(ptr noundef [[S:%.*]], i32 noundef [[C:%.*]], i64 noundef [[N:%.*]]) #[[ATTR7]] // CPP-CHECK-NEXT: ret ptr [[CALL]] // void *test_sc_memchr(void *s, int c, size_t n) __arm_streaming_compatible { diff --git a/clang/test/CodeGen/X86/math-builtins.c b/clang/test/CodeGen/X86/math-builtins.c index bf107437fc63..d7bf7d57fba2 100644 --- a/clang/test/CodeGen/X86/math-builtins.c +++ b/clang/test/CodeGen/X86/math-builtins.c @@ -38,6 +38,31 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) { // NO__ERRNO-NEXT: [[FREXP_F128_0:%.+]] = extractvalue { fp128, i32 } [[FREXP_F128]], 0 +// NO__ERRNO: [[SINCOS_F64:%.+]] = call { double, double } @llvm.sincos.f64(double %{{.+}}) +// NO__ERRNO-NEXT: [[SINCOS_F64_0:%.+]] = extractvalue { double, double } [[SINCOS_F64]], 0 +// NO__ERRNO-NEXT: [[SINCOS_F64_1:%.+]] = extractvalue { double, double } [[SINCOS_F64]], 1 +// NO__ERRNO-NEXT: store double [[SINCOS_F64_0]], ptr %{{.+}}, align 8 +// NO__ERRNO-NEXT: store double [[SINCOS_F64_1]], ptr %{{.+}}, align 8 + +// NO__ERRNO: [[SINCOS_F32:%.+]] = call { float, float } @llvm.sincos.f32(float %{{.+}}) +// NO__ERRNO-NEXT: [[SINCOS_F32_0:%.+]] = extractvalue { float, float } [[SINCOS_F32]], 0 +// NO__ERRNO-NEXT: [[SINCOS_F32_1:%.+]] = extractvalue { float, float } [[SINCOS_F32]], 1 +// NO__ERRNO-NEXT: store float [[SINCOS_F32_0]], ptr %{{.+}}, align 4 +// NO__ERRNO-NEXT: store float [[SINCOS_F32_1]], ptr %{{.+}}, align 4 + +// NO__ERRNO: [[SINCOS_F80:%.+]] = call { x86_fp80, x86_fp80 } @llvm.sincos.f80(x86_fp80 %{{.+}}) +// NO__ERRNO-NEXT: [[SINCOS_F80_0:%.+]] = extractvalue { x86_fp80, x86_fp80 } [[SINCOS_F80]], 0 +// NO__ERRNO-NEXT: [[SINCOS_F80_1:%.+]] = extractvalue { x86_fp80, x86_fp80 } [[SINCOS_F80]], 1 +// NO__ERRNO-NEXT: store x86_fp80 [[SINCOS_F80_0]], ptr %{{.+}}, align 16 +// NO__ERRNO-NEXT: store x86_fp80 [[SINCOS_F80_1]], ptr %{{.+}}, align 16 + +// NO__ERRNO: [[SINCOS_F128:%.+]] = call { fp128, fp128 } @llvm.sincos.f128(fp128 %{{.+}}) +// NO__ERRNO-NEXT: [[SINCOS_F128_0:%.+]] = extractvalue { fp128, fp128 } [[SINCOS_F128]], 0 +// NO__ERRNO-NEXT: [[SINCOS_F128_1:%.+]] = extractvalue { fp128, fp128 } [[SINCOS_F128]], 1 +// NO__ERRNO-NEXT: store fp128 [[SINCOS_F128_0]], ptr %{{.+}}, align 16 +// NO__ERRNO-NEXT: store fp128 [[SINCOS_F128_1]], ptr %{{.+}}, align 16 + + // HAS_ERRNO: declare double @fmod(double noundef, double noundef) [[NOT_READNONE:#[0-9]+]] // HAS_ERRNO: declare float @fmodf(float noundef, float noundef) [[NOT_READNONE]] // HAS_ERRNO: declare x86_fp80 @fmodl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]] @@ -665,6 +690,16 @@ __builtin_sinh(f); __builtin_sinhf(f); __builtin_sinhl(f); __builtin_ // HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[NOT_READNONE]] // HAS_ERRNO: declare fp128 @sinhf128(fp128 noundef) [[NOT_READNONE]] +__builtin_sincos(f,d,d); __builtin_sincosf(f,fp,fp); __builtin_sincosl(f,l,l); __builtin_sincosf128(f,l,l); +// NO__ERRNO: declare { double, double } @llvm.sincos.f64(double) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare { float, float } @llvm.sincos.f32(float) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @llvm.sincos.f80(x86_fp80) [[READNONE_INTRINSIC]] +// NO__ERRNO: declare { fp128, fp128 } @llvm.sincos.f128(fp128) [[READNONE_INTRINSIC]] +// HAS_ERRNO: declare void @sincos(double noundef, ptr noundef, ptr noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare void @sincosf(float noundef, ptr noundef, ptr noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare void @sincosl(x86_fp80 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]] +// HAS_ERRNO: declare void @sincosf128(fp128 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]] + __builtin_sqrt(f); __builtin_sqrtf(f); __builtin_sqrtl(f); __builtin_sqrtf128(f); // NO__ERRNO: declare double @llvm.sqrt.f64(double) [[READNONE_INTRINSIC]] @@ -733,4 +768,3 @@ __builtin_trunc(f); __builtin_truncf(f); __builtin_truncl(f); __builtin // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} } // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} } - diff --git a/clang/test/CodeGen/attr-target-clones-aarch64.c b/clang/test/CodeGen/attr-target-clones-aarch64.c index 6b7acbbd4fc5..b7e3a328db87 100644 --- a/clang/test/CodeGen/attr-target-clones-aarch64.c +++ b/clang/test/CodeGen/attr-target-clones-aarch64.c @@ -64,20 +64,20 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // CHECK-NEXT: resolver_entry: // CHECK-NEXT: call void @__init_cpu_features_resolver() // CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 33664 -// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 33664 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 69793284352 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 69793284352 // CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] // CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] // CHECK: resolver_return: -// CHECK-NEXT: ret ptr @ftc._MaesMlse +// CHECK-NEXT: ret ptr @ftc._Msve2 // CHECK: resolver_else: // CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 69793284352 -// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 69793284352 +// CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 33664 +// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 33664 // CHECK-NEXT: [[TMP7:%.*]] = and i1 true, [[TMP6]] // CHECK-NEXT: br i1 [[TMP7]], label [[RESOLVER_RETURN1:%.*]], label [[RESOLVER_ELSE2:%.*]] // CHECK: resolver_return1: -// CHECK-NEXT: ret ptr @ftc._Msve2 +// CHECK-NEXT: ret ptr @ftc._MaesMlse // CHECK: resolver_else2: // CHECK-NEXT: ret ptr @ftc.default // @@ -252,56 +252,56 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc.default -// CHECK-SAME: () #[[ATTR9:[0-9]+]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_def.default -// CHECK-SAME: () #[[ATTR9]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_dup1.default -// CHECK-SAME: () #[[ATTR9]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 2 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_dup2.default -// CHECK-SAME: () #[[ATTR9]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 3 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_dup3.default -// CHECK-SAME: () #[[ATTR9]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 4 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline2._Mfp16 -// CHECK-SAME: () #[[ATTR10:[0-9]+]] { +// CHECK-SAME: () #[[ATTR9:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 2 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline2._MfcmaMsve2-bitperm -// CHECK-SAME: () #[[ATTR11:[0-9]+]] { +// CHECK-SAME: () #[[ATTR10:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 2 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline2.default -// CHECK-SAME: () #[[ATTR9]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 2 // @@ -330,28 +330,28 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline1._MrngMsimd -// CHECK-SAME: () #[[ATTR12:[0-9]+]] { +// CHECK-SAME: () #[[ATTR11:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline1._MpredresMrcpc -// CHECK-SAME: () #[[ATTR13:[0-9]+]] { +// CHECK-SAME: () #[[ATTR12:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline1._Msve2-aesMwfxt -// CHECK-SAME: () #[[ATTR14:[0-9]+]] { +// CHECK-SAME: () #[[ATTR13:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline1.default -// CHECK-SAME: () #[[ATTR9]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // @@ -395,14 +395,14 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline3._MsbMsve -// CHECK-SAME: () #[[ATTR15:[0-9]+]] { +// CHECK-SAME: () #[[ATTR14:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 3 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@ftc_inline3.default -// CHECK-SAME: () #[[ATTR9]] { +// CHECK-SAME: () #[[ATTR8]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 3 // @@ -411,20 +411,20 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // CHECK-NEXT: resolver_entry: // CHECK-NEXT: call void @__init_cpu_features_resolver() // CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 70369817985280 -// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 70369817985280 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 1125899906842624 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 1125899906842624 // CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] // CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] // CHECK: resolver_return: -// CHECK-NEXT: ret ptr @ftc_inline3._MsbMsve +// CHECK-NEXT: ret ptr @ftc_inline3._Mbti // CHECK: resolver_else: // CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 1125899906842624 -// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 1125899906842624 +// CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 70369817985280 +// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 70369817985280 // CHECK-NEXT: [[TMP7:%.*]] = and i1 true, [[TMP6]] // CHECK-NEXT: br i1 [[TMP7]], label [[RESOLVER_RETURN1:%.*]], label [[RESOLVER_ELSE2:%.*]] // CHECK: resolver_return1: -// CHECK-NEXT: ret ptr @ftc_inline3._Mbti +// CHECK-NEXT: ret ptr @ftc_inline3._MsbMsve // CHECK: resolver_else2: // CHECK-NEXT: ret ptr @ftc_inline3.default // @@ -521,20 +521,20 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // CHECK-MTE-BTI-NEXT: resolver_entry: // CHECK-MTE-BTI-NEXT: call void @__init_cpu_features_resolver() // CHECK-MTE-BTI-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 33664 -// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 33664 +// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 69793284352 +// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 69793284352 // CHECK-MTE-BTI-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] // CHECK-MTE-BTI-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] // CHECK-MTE-BTI: resolver_return: -// CHECK-MTE-BTI-NEXT: ret ptr @ftc._MaesMlse +// CHECK-MTE-BTI-NEXT: ret ptr @ftc._Msve2 // CHECK-MTE-BTI: resolver_else: // CHECK-MTE-BTI-NEXT: [[TMP4:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-MTE-BTI-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 69793284352 -// CHECK-MTE-BTI-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 69793284352 +// CHECK-MTE-BTI-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 33664 +// CHECK-MTE-BTI-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 33664 // CHECK-MTE-BTI-NEXT: [[TMP7:%.*]] = and i1 true, [[TMP6]] // CHECK-MTE-BTI-NEXT: br i1 [[TMP7]], label [[RESOLVER_RETURN1:%.*]], label [[RESOLVER_ELSE2:%.*]] // CHECK-MTE-BTI: resolver_return1: -// CHECK-MTE-BTI-NEXT: ret ptr @ftc._Msve2 +// CHECK-MTE-BTI-NEXT: ret ptr @ftc._MaesMlse // CHECK-MTE-BTI: resolver_else2: // CHECK-MTE-BTI-NEXT: ret ptr @ftc.default // @@ -548,7 +548,7 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_def._MmemtagMsha2 -// CHECK-MTE-BTI-SAME: () #[[ATTR2]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR3:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 1 // @@ -598,14 +598,14 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_dup2._Mfp -// CHECK-MTE-BTI-SAME: () #[[ATTR3:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR4:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 3 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_dup2._McrcMdotprod -// CHECK-MTE-BTI-SAME: () #[[ATTR4:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR5:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 3 // @@ -634,14 +634,14 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_dup3._Mmemtag -// CHECK-MTE-BTI-SAME: () #[[ATTR5:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR6:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 4 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_dup3._Mbti -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR7:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 4 // @@ -670,7 +670,7 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@foo -// CHECK-MTE-BTI-SAME: () #[[ATTR6:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: [[CALL:%.*]] = call i32 @ftc() // CHECK-MTE-BTI-NEXT: [[CALL1:%.*]] = call i32 @ftc_def() @@ -686,14 +686,14 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_direct -// CHECK-MTE-BTI-SAME: () #[[ATTR6]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 4 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@main -// CHECK-MTE-BTI-SAME: () #[[ATTR6]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 // CHECK-MTE-BTI-NEXT: store i32 0, ptr [[RETVAL]], align 4 @@ -709,56 +709,56 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 0 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_def.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 1 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_dup1.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 2 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_dup2.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 3 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_dup3.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 4 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline2._Mfp16 -// CHECK-MTE-BTI-SAME: () #[[ATTR7:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR9:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 2 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline2._MfcmaMsve2-bitperm -// CHECK-MTE-BTI-SAME: () #[[ATTR8:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR10:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 2 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline2.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 2 // @@ -787,28 +787,28 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline1._MrngMsimd -// CHECK-MTE-BTI-SAME: () #[[ATTR9:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR11:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 1 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline1._MpredresMrcpc -// CHECK-MTE-BTI-SAME: () #[[ATTR10:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR12:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 1 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline1._Msve2-aesMwfxt -// CHECK-MTE-BTI-SAME: () #[[ATTR11:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR13:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 1 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline1.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 1 // @@ -845,21 +845,21 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline3._Mbti -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR7]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 3 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline3._MsbMsve -// CHECK-MTE-BTI-SAME: () #[[ATTR12:[0-9]+]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR14:[0-9]+]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 3 // // // CHECK-MTE-BTI: Function Attrs: noinline nounwind optnone // CHECK-MTE-BTI-LABEL: define {{[^@]+}}@ftc_inline3.default -// CHECK-MTE-BTI-SAME: () #[[ATTR5]] { +// CHECK-MTE-BTI-SAME: () #[[ATTR8]] { // CHECK-MTE-BTI-NEXT: entry: // CHECK-MTE-BTI-NEXT: ret i32 3 // @@ -868,20 +868,20 @@ inline int __attribute__((target_clones("fp16", "sve2-bitperm+fcma", "default")) // CHECK-MTE-BTI-NEXT: resolver_entry: // CHECK-MTE-BTI-NEXT: call void @__init_cpu_features_resolver() // CHECK-MTE-BTI-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 70369817985280 -// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 70369817985280 +// CHECK-MTE-BTI-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 1125899906842624 +// CHECK-MTE-BTI-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 1125899906842624 // CHECK-MTE-BTI-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] // CHECK-MTE-BTI-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] // CHECK-MTE-BTI: resolver_return: -// CHECK-MTE-BTI-NEXT: ret ptr @ftc_inline3._MsbMsve +// CHECK-MTE-BTI-NEXT: ret ptr @ftc_inline3._Mbti // CHECK-MTE-BTI: resolver_else: // CHECK-MTE-BTI-NEXT: [[TMP4:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-MTE-BTI-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 1125899906842624 -// CHECK-MTE-BTI-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 1125899906842624 +// CHECK-MTE-BTI-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 70369817985280 +// CHECK-MTE-BTI-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 70369817985280 // CHECK-MTE-BTI-NEXT: [[TMP7:%.*]] = and i1 true, [[TMP6]] // CHECK-MTE-BTI-NEXT: br i1 [[TMP7]], label [[RESOLVER_RETURN1:%.*]], label [[RESOLVER_ELSE2:%.*]] // CHECK-MTE-BTI: resolver_return1: -// CHECK-MTE-BTI-NEXT: ret ptr @ftc_inline3._Mbti +// CHECK-MTE-BTI-NEXT: ret ptr @ftc_inline3._MsbMsve // CHECK-MTE-BTI: resolver_else2: // CHECK-MTE-BTI-NEXT: ret ptr @ftc_inline3.default // diff --git a/clang/test/CodeGen/attr-target-version.c b/clang/test/CodeGen/attr-target-version.c index 951401c498de..336d8b0a4dff 100644 --- a/clang/test/CodeGen/attr-target-version.c +++ b/clang/test/CodeGen/attr-target-version.c @@ -141,6 +141,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // CHECK: @fmv_two = weak_odr ifunc i32 (), ptr @fmv_two.resolver // CHECK: @fmv_e = weak_odr ifunc i32 (), ptr @fmv_e.resolver // CHECK: @fmv_d = internal ifunc i32 (), ptr @fmv_d.resolver +// CHECK: @fmv_default = weak_odr ifunc i32 (), ptr @fmv_default.resolver // CHECK: @fmv_c = weak_odr ifunc void (), ptr @fmv_c.resolver // CHECK: @fmv_inline = weak_odr ifunc i32 (), ptr @fmv_inline.resolver // CHECK: @reca = weak_odr ifunc void (), ptr @reca.resolver @@ -271,7 +272,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@foo -// CHECK-SAME: () #[[ATTR15:[0-9]+]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: [[CALL:%.*]] = call i32 @fmv() // CHECK-NEXT: [[CALL1:%.*]] = call i32 @fmv_one() @@ -297,7 +298,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@fmv_c._Mssbs -// CHECK-SAME: () #[[ATTR17:[0-9]+]] { +// CHECK-SAME: () #[[ATTR15:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret void // @@ -311,7 +312,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@goo -// CHECK-SAME: () #[[ATTR15]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: [[CALL:%.*]] = call i32 @fmv_inline() // CHECK-NEXT: [[CALL1:%.*]] = call i32 @fmv_e() @@ -323,7 +324,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@recur -// CHECK-SAME: () #[[ATTR15]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: call void @reca() // CHECK-NEXT: ret void @@ -331,7 +332,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@hoo -// CHECK-SAME: () #[[ATTR15]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: [[FP1:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[FP2:%.*]] = alloca ptr, align 8 @@ -348,28 +349,28 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_with_forward_default_decl._Mmops -// CHECK-SAME: () #[[ATTR19:[0-9]+]] { +// CHECK-SAME: () #[[ATTR17:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_with_implicit_extern_forward_default_decl._Mdotprod -// CHECK-SAME: () #[[ATTR20:[0-9]+]] { +// CHECK-SAME: () #[[ATTR18:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_with_default_decl._Maes -// CHECK-SAME: () #[[ATTR5]] { +// CHECK-SAME: () #[[ATTR19:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_with_default_def._Msve -// CHECK-SAME: () #[[ATTR21:[0-9]+]] { +// CHECK-SAME: () #[[ATTR20:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // @@ -383,7 +384,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_with_implicit_default_def._Mfp16 -// CHECK-SAME: () #[[ATTR22:[0-9]+]] { +// CHECK-SAME: () #[[ATTR21:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // @@ -397,49 +398,49 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_with_implicit_forward_default_def.default -// CHECK-SAME: () #[[ATTR15]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_with_implicit_forward_default_def._Mlse -// CHECK-SAME: () #[[ATTR23:[0-9]+]] { +// CHECK-SAME: () #[[ATTR22:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@unused_without_default._Mrdm -// CHECK-SAME: () #[[ATTR24:[0-9]+]] { +// CHECK-SAME: () #[[ATTR23:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@default_def_with_version_decls.default -// CHECK-SAME: () #[[ATTR15]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 0 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@used_def_without_default_decl._Mjscvt -// CHECK-SAME: () #[[ATTR26:[0-9]+]] { +// CHECK-SAME: () #[[ATTR25:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@used_def_without_default_decl._Mrdm -// CHECK-SAME: () #[[ATTR24]] { +// CHECK-SAME: () #[[ATTR26:[0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 2 // // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@caller -// CHECK-SAME: () #[[ATTR15]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: [[CALL:%.*]] = call i32 @used_def_without_default_decl() // CHECK-NEXT: [[CALL1:%.*]] = call i32 @used_decl_without_default_decl() @@ -462,12 +463,12 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // CHECK-NEXT: resolver_entry: // CHECK-NEXT: call void @__init_cpu_features_resolver() // CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 66315 -// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 66315 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 144119586256651008 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 144119586256651008 // CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] // CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] // CHECK: resolver_return: -// CHECK-NEXT: ret ptr @fmv._MflagmMfp16fmlMrng +// CHECK-NEXT: ret ptr @fmv._Msme2 // CHECK: resolver_else: // CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 // CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 72061992218723078 @@ -478,60 +479,60 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // CHECK-NEXT: ret ptr @fmv._Mflagm2Msme-i16i64 // CHECK: resolver_else2: // CHECK-NEXT: [[TMP8:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 9007199254741776 -// CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 9007199254741776 +// CHECK-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 9007199254742016 +// CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 9007199254742016 // CHECK-NEXT: [[TMP11:%.*]] = and i1 true, [[TMP10]] // CHECK-NEXT: br i1 [[TMP11]], label [[RESOLVER_RETURN3:%.*]], label [[RESOLVER_ELSE4:%.*]] // CHECK: resolver_return3: -// CHECK-NEXT: ret ptr @fmv._MdotprodMls64 +// CHECK-NEXT: ret ptr @fmv._McrcMls64 // CHECK: resolver_else4: // CHECK-NEXT: [[TMP12:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP13:%.*]] = and i64 [[TMP12]], 9007199254742016 -// CHECK-NEXT: [[TMP14:%.*]] = icmp eq i64 [[TMP13]], 9007199254742016 +// CHECK-NEXT: [[TMP13:%.*]] = and i64 [[TMP12]], 9007199254741776 +// CHECK-NEXT: [[TMP14:%.*]] = icmp eq i64 [[TMP13]], 9007199254741776 // CHECK-NEXT: [[TMP15:%.*]] = and i1 true, [[TMP14]] // CHECK-NEXT: br i1 [[TMP15]], label [[RESOLVER_RETURN5:%.*]], label [[RESOLVER_ELSE6:%.*]] // CHECK: resolver_return5: -// CHECK-NEXT: ret ptr @fmv._McrcMls64 +// CHECK-NEXT: ret ptr @fmv._MdotprodMls64 // CHECK: resolver_else6: // CHECK-NEXT: [[TMP16:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP17:%.*]] = and i64 [[TMP16]], 17592186110728 -// CHECK-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP17]], 17592186110728 +// CHECK-NEXT: [[TMP17:%.*]] = and i64 [[TMP16]], 1125899906842624 +// CHECK-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP17]], 1125899906842624 // CHECK-NEXT: [[TMP19:%.*]] = and i1 true, [[TMP18]] // CHECK-NEXT: br i1 [[TMP19]], label [[RESOLVER_RETURN7:%.*]], label [[RESOLVER_ELSE8:%.*]] // CHECK: resolver_return7: -// CHECK-NEXT: ret ptr @fmv._Mfp16fmlMmemtag +// CHECK-NEXT: ret ptr @fmv._Mbti // CHECK: resolver_else8: // CHECK-NEXT: [[TMP20:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP21:%.*]] = and i64 [[TMP20]], 33536 -// CHECK-NEXT: [[TMP22:%.*]] = icmp eq i64 [[TMP21]], 33536 +// CHECK-NEXT: [[TMP21:%.*]] = and i64 [[TMP20]], 17592186110728 +// CHECK-NEXT: [[TMP22:%.*]] = icmp eq i64 [[TMP21]], 17592186110728 // CHECK-NEXT: [[TMP23:%.*]] = and i1 true, [[TMP22]] // CHECK-NEXT: br i1 [[TMP23]], label [[RESOLVER_RETURN9:%.*]], label [[RESOLVER_ELSE10:%.*]] // CHECK: resolver_return9: -// CHECK-NEXT: ret ptr @fmv._MaesMfp +// CHECK-NEXT: ret ptr @fmv._Mfp16fmlMmemtag // CHECK: resolver_else10: // CHECK-NEXT: [[TMP24:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP25:%.*]] = and i64 [[TMP24]], 4992 -// CHECK-NEXT: [[TMP26:%.*]] = icmp eq i64 [[TMP25]], 4992 +// CHECK-NEXT: [[TMP25:%.*]] = and i64 [[TMP24]], 66315 +// CHECK-NEXT: [[TMP26:%.*]] = icmp eq i64 [[TMP25]], 66315 // CHECK-NEXT: [[TMP27:%.*]] = and i1 true, [[TMP26]] // CHECK-NEXT: br i1 [[TMP27]], label [[RESOLVER_RETURN11:%.*]], label [[RESOLVER_ELSE12:%.*]] // CHECK: resolver_return11: -// CHECK-NEXT: ret ptr @fmv._MlseMsha2 +// CHECK-NEXT: ret ptr @fmv._MflagmMfp16fmlMrng // CHECK: resolver_else12: // CHECK-NEXT: [[TMP28:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP29:%.*]] = and i64 [[TMP28]], 144119586256651008 -// CHECK-NEXT: [[TMP30:%.*]] = icmp eq i64 [[TMP29]], 144119586256651008 +// CHECK-NEXT: [[TMP29:%.*]] = and i64 [[TMP28]], 33536 +// CHECK-NEXT: [[TMP30:%.*]] = icmp eq i64 [[TMP29]], 33536 // CHECK-NEXT: [[TMP31:%.*]] = and i1 true, [[TMP30]] // CHECK-NEXT: br i1 [[TMP31]], label [[RESOLVER_RETURN13:%.*]], label [[RESOLVER_ELSE14:%.*]] // CHECK: resolver_return13: -// CHECK-NEXT: ret ptr @fmv._Msme2 +// CHECK-NEXT: ret ptr @fmv._MaesMfp // CHECK: resolver_else14: // CHECK-NEXT: [[TMP32:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 1125899906842624 -// CHECK-NEXT: [[TMP34:%.*]] = icmp eq i64 [[TMP33]], 1125899906842624 +// CHECK-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 4992 +// CHECK-NEXT: [[TMP34:%.*]] = icmp eq i64 [[TMP33]], 4992 // CHECK-NEXT: [[TMP35:%.*]] = and i1 true, [[TMP34]] // CHECK-NEXT: br i1 [[TMP35]], label [[RESOLVER_RETURN15:%.*]], label [[RESOLVER_ELSE16:%.*]] // CHECK: resolver_return15: -// CHECK-NEXT: ret ptr @fmv._Mbti +// CHECK-NEXT: ret ptr @fmv._MlseMsha2 // CHECK: resolver_else16: // CHECK-NEXT: ret ptr @fmv.default // @@ -630,6 +631,11 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // CHECK-NEXT: ret ptr @fmv_d.default // // +// CHECK-LABEL: define {{[^@]+}}@fmv_default.resolver() comdat { +// CHECK-NEXT: resolver_entry: +// CHECK-NEXT: ret ptr @fmv_default.default +// +// // CHECK-LABEL: define {{[^@]+}}@fmv_c.resolver() comdat { // CHECK-NEXT: resolver_entry: // CHECK-NEXT: call void @__init_cpu_features_resolver() @@ -767,60 +773,60 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // CHECK-NEXT: resolver_entry: // CHECK-NEXT: call void @__init_cpu_features_resolver() // CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 4398182892352 -// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 4398182892352 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 864708720653762560 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 864708720653762560 // CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] // CHECK-NEXT: br i1 [[TMP3]], label [[RESOLVER_RETURN:%.*]], label [[RESOLVER_ELSE:%.*]] // CHECK: resolver_return: -// CHECK-NEXT: ret ptr @fmv_inline._MfcmaMfp16MrdmMsme +// CHECK-NEXT: ret ptr @fmv_inline._MmemtagMmopsMrcpc3 // CHECK: resolver_else: // CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 864708720653762560 -// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 864708720653762560 +// CHECK-NEXT: [[TMP5:%.*]] = and i64 [[TMP4]], 19861002584864 +// CHECK-NEXT: [[TMP6:%.*]] = icmp eq i64 [[TMP5]], 19861002584864 // CHECK-NEXT: [[TMP7:%.*]] = and i1 true, [[TMP6]] // CHECK-NEXT: br i1 [[TMP7]], label [[RESOLVER_RETURN1:%.*]], label [[RESOLVER_ELSE2:%.*]] // CHECK: resolver_return1: -// CHECK-NEXT: ret ptr @fmv_inline._MmemtagMmopsMrcpc3 +// CHECK-NEXT: ret ptr @fmv_inline._MmemtagMsve2-sm4 // CHECK: resolver_else2: // CHECK-NEXT: [[TMP8:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 894427038464 -// CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 894427038464 +// CHECK-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 4398182892352 +// CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 4398182892352 // CHECK-NEXT: [[TMP11:%.*]] = and i1 true, [[TMP10]] // CHECK-NEXT: br i1 [[TMP11]], label [[RESOLVER_RETURN3:%.*]], label [[RESOLVER_ELSE4:%.*]] // CHECK: resolver_return3: -// CHECK-NEXT: ret ptr @fmv_inline._Msve2Msve2-aesMsve2-bitperm +// CHECK-NEXT: ret ptr @fmv_inline._MfcmaMfp16MrdmMsme // CHECK: resolver_else4: // CHECK-NEXT: [[TMP12:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP13:%.*]] = and i64 [[TMP12]], 35433583360 -// CHECK-NEXT: [[TMP14:%.*]] = icmp eq i64 [[TMP13]], 35433583360 +// CHECK-NEXT: [[TMP13:%.*]] = and i64 [[TMP12]], 1444182864640 +// CHECK-NEXT: [[TMP14:%.*]] = icmp eq i64 [[TMP13]], 1444182864640 // CHECK-NEXT: [[TMP15:%.*]] = and i1 true, [[TMP14]] // CHECK-NEXT: br i1 [[TMP15]], label [[RESOLVER_RETURN5:%.*]], label [[RESOLVER_ELSE6:%.*]] // CHECK: resolver_return5: -// CHECK-NEXT: ret ptr @fmv_inline._MaesMf64mmMsha2 +// CHECK-NEXT: ret ptr @fmv_inline._Msve2-aesMsve2-sha3 // CHECK: resolver_else6: // CHECK-NEXT: [[TMP16:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP17:%.*]] = and i64 [[TMP16]], 18320798464 -// CHECK-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP17]], 18320798464 +// CHECK-NEXT: [[TMP17:%.*]] = and i64 [[TMP16]], 894427038464 +// CHECK-NEXT: [[TMP18:%.*]] = icmp eq i64 [[TMP17]], 894427038464 // CHECK-NEXT: [[TMP19:%.*]] = and i1 true, [[TMP18]] // CHECK-NEXT: br i1 [[TMP19]], label [[RESOLVER_RETURN7:%.*]], label [[RESOLVER_ELSE8:%.*]] // CHECK: resolver_return7: -// CHECK-NEXT: ret ptr @fmv_inline._Mf32mmMi8mmMsha3 +// CHECK-NEXT: ret ptr @fmv_inline._Msve2Msve2-aesMsve2-bitperm // CHECK: resolver_else8: // CHECK-NEXT: [[TMP20:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP21:%.*]] = and i64 [[TMP20]], 19861002584864 -// CHECK-NEXT: [[TMP22:%.*]] = icmp eq i64 [[TMP21]], 19861002584864 +// CHECK-NEXT: [[TMP21:%.*]] = and i64 [[TMP20]], 35433583360 +// CHECK-NEXT: [[TMP22:%.*]] = icmp eq i64 [[TMP21]], 35433583360 // CHECK-NEXT: [[TMP23:%.*]] = and i1 true, [[TMP22]] // CHECK-NEXT: br i1 [[TMP23]], label [[RESOLVER_RETURN9:%.*]], label [[RESOLVER_ELSE10:%.*]] // CHECK: resolver_return9: -// CHECK-NEXT: ret ptr @fmv_inline._MmemtagMsve2-sm4 +// CHECK-NEXT: ret ptr @fmv_inline._MaesMf64mmMsha2 // CHECK: resolver_else10: // CHECK-NEXT: [[TMP24:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 -// CHECK-NEXT: [[TMP25:%.*]] = and i64 [[TMP24]], 1444182864640 -// CHECK-NEXT: [[TMP26:%.*]] = icmp eq i64 [[TMP25]], 1444182864640 +// CHECK-NEXT: [[TMP25:%.*]] = and i64 [[TMP24]], 18320798464 +// CHECK-NEXT: [[TMP26:%.*]] = icmp eq i64 [[TMP25]], 18320798464 // CHECK-NEXT: [[TMP27:%.*]] = and i1 true, [[TMP26]] // CHECK-NEXT: br i1 [[TMP27]], label [[RESOLVER_RETURN11:%.*]], label [[RESOLVER_ELSE12:%.*]] // CHECK: resolver_return11: -// CHECK-NEXT: ret ptr @fmv_inline._Msve2-aesMsve2-sha3 +// CHECK-NEXT: ret ptr @fmv_inline._Mf32mmMi8mmMsha3 // CHECK: resolver_else12: // CHECK-NEXT: [[TMP28:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 // CHECK-NEXT: [[TMP29:%.*]] = and i64 [[TMP28]], 1208025856 @@ -984,7 +990,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK: Function Attrs: noinline nounwind optnone // CHECK-LABEL: define {{[^@]+}}@func -// CHECK-SAME: () #[[ATTR15]] { +// CHECK-SAME: () #[[ATTR9]] { // CHECK-NEXT: entry: // CHECK-NEXT: ret void // @@ -1008,21 +1014,21 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@fmv -// CHECK-NOFMV-SAME: () #[[ATTR1:[0-9]+]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: ret i32 0 // // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@fmv_one -// CHECK-NOFMV-SAME: () #[[ATTR1]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: ret i32 0 // // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@fmv_two -// CHECK-NOFMV-SAME: () #[[ATTR1]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: ret i32 0 // @@ -1048,21 +1054,21 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@fmv_d -// CHECK-NOFMV-SAME: () #[[ATTR1]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: ret i32 1 // // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@fmv_c -// CHECK-NOFMV-SAME: () #[[ATTR1]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: ret void // // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@fmv_default -// CHECK-NOFMV-SAME: () #[[ATTR1]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: ret i32 111 // @@ -1115,7 +1121,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@main -// CHECK-NOFMV-SAME: () #[[ATTR1]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 // CHECK-NOFMV-NEXT: store i32 0, ptr [[RETVAL]], align 4 @@ -1126,7 +1132,7 @@ int caller(void) { return used_def_without_default_decl() + used_decl_without_de // // CHECK-NOFMV: Function Attrs: noinline nounwind optnone // CHECK-NOFMV-LABEL: define {{[^@]+}}@unused_with_default_def -// CHECK-NOFMV-SAME: () #[[ATTR1]] { +// CHECK-NOFMV-SAME: () #[[ATTR0]] { // CHECK-NOFMV-NEXT: entry: // CHECK-NOFMV-NEXT: ret i32 1 // diff --git a/clang/test/CodeGen/builtin-memfns.c b/clang/test/CodeGen/builtin-memfns.c index 23c3c60b779b..581eb85eb28e 100644 --- a/clang/test/CodeGen/builtin-memfns.c +++ b/clang/test/CodeGen/builtin-memfns.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm < %s| FileCheck %s +// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -fexperimental-new-constant-interpreter < %s| FileCheck %s typedef __WCHAR_TYPE__ wchar_t; typedef __SIZE_TYPE__ size_t; diff --git a/clang/test/CodeGen/code-coverage.c b/clang/test/CodeGen/code-coverage.c index 4e3364df2178..5fa62360c9b5 100644 --- a/clang/test/CodeGen/code-coverage.c +++ b/clang/test/CodeGen/code-coverage.c @@ -3,18 +3,14 @@ /// 4.7 enables cfg_checksum. /// 4.8 (default, compatible with gcov 7) emits the exit block the second. // RUN: rm -rf %t && mkdir %t && cd %t -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='304*' %s -o - | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,304 %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='407*' %s -o - | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,407 %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='B21*' %s -o - | \ +// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,1210 %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null %s -o - | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,408 %s -// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='304*' %s -o - | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,304 %s -// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='407*' %s -o - | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,407 %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,1110 %s +// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='B21*' %s -o - | \ +// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,1210 %s // RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null %s -o - | \ -// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,408 %s +// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,1110 %s // RUN: %clang_cc1 -emit-llvm -disable-red-zone -coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda -debug-info-kind=limited -dwarf-version=4 %s -o - | FileCheck %s --check-prefix GCOV_FILE_INFO @@ -48,12 +44,10 @@ int test2(int b) { // CHECK-SAME: [%emit_function_args_ty { i32 0, i32 {{[-0-9]+}}, i32 {{[-0-9]+}} }, %emit_function_args_ty { i32 1, i32 {{[-0-9]+}}, i32 {{[-0-9]+}} }] // CHECK: @__llvm_internal_gcov_emit_file_info = internal unnamed_addr constant [1 x %file_info] -/// 0x3330342a '3' '0' '4' '*' -// 304-SAME: i32 858797098 -/// 0x3430372a '4' '0' '7' '*' -// 407-SAME: i32 875575082 -/// 0x3430382a '4' '0' '8' '*' -// 408-SAME: i32 875575338 +/// 0x4231312a 'B' '1' '1' '*' +// 1110-SAME: i32 1110520106 +/// 0x4232312a 'B' '2' '1' '*' +// 1210-SAME: i32 1110585642 // Check for gcov initialization function pointers. // CHECK-RT-INIT: @__llvm_covinit_functions = private constant { ptr, ptr } { ptr @__llvm_gcov_writeout, ptr @__llvm_gcov_reset }, section "__llvm_covinit" diff --git a/clang/test/CodeGen/nvptx_attributes.c b/clang/test/CodeGen/nvptx_attributes.c index 7dbd9f1321e2..8b9f3a2c18a1 100644 --- a/clang/test/CodeGen/nvptx_attributes.c +++ b/clang/test/CodeGen/nvptx_attributes.c @@ -10,8 +10,14 @@ // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[RET_ADDR]], align 8 // CHECK-NEXT: store i32 1, ptr [[TMP0]], align 4 // CHECK-NEXT: ret void +// __attribute__((nvptx_kernel)) void foo(int *ret) { *ret = 1; } -// CHECK: !0 = !{ptr @foo, !"kernel", i32 1} +//. +// CHECK: attributes #[[ATTR0]] = { convergent noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_61" "target-features"="+ptx32,+sm_61" } +//. +// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} +// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"} +//. diff --git a/clang/test/CodeGen/sanitize-type-globals.cpp b/clang/test/CodeGen/sanitize-type-globals.cpp index 7cb8de8b238c..1154ab4ca5df 100644 --- a/clang/test/CodeGen/sanitize-type-globals.cpp +++ b/clang/test/CodeGen/sanitize-type-globals.cpp @@ -3,7 +3,10 @@ //. // CHECK: @x = global %struct.CompleteS zeroinitializer, align 8 +// CHECK: @xExtern = external global %struct.CompleteS, align 8 // CHECK: @y = external global %struct.S, align 1 +// CHECK: @d = global %class.b zeroinitializer, align 1 +// CHECK: @_ZN1b1eE = external global %class.a, align 1 // CHECK: @__tysan_shadow_memory_address = external global i64 // CHECK: @__tysan_app_memory_mask = external global i64 // CHECK: @__tysan_v1_Simple_20C_2b_2b_20TBAA = linkonce_odr constant { i64, i64, [16 x i8] } { i64 2, i64 0, [16 x i8] c"Simple C++ TBAA\00" }, comdat @@ -12,8 +15,9 @@ // CHECK: @__tysan_v1_any_20pointer = linkonce_odr constant { i64, i64, ptr, i64, [12 x i8] } { i64 2, i64 1, ptr @__tysan_v1_omnipotent_20char, i64 0, [12 x i8] c"any pointer\00" }, comdat // CHECK: @__tysan_v1_p1_20int = linkonce_odr constant { i64, i64, ptr, i64, [7 x i8] } { i64 2, i64 1, ptr @__tysan_v1_any_20pointer, i64 0, [7 x i8] c"p1 int\00" }, comdat // CHECK: @__tysan_v1___ZTS9CompleteS = linkonce_odr constant { i64, i64, ptr, i64, ptr, i64, [15 x i8] } { i64 2, i64 2, ptr @__tysan_v1_int, i64 0, ptr @__tysan_v1_p1_20int, i64 8, [15 x i8] c"_ZTS9CompleteS\00" }, comdat -// CHECK: @llvm.used = appending global [7 x ptr] [ptr @tysan.module_ctor, ptr @__tysan_v1_Simple_20C_2b_2b_20TBAA, ptr @__tysan_v1_omnipotent_20char, ptr @__tysan_v1_int, ptr @__tysan_v1_any_20pointer, ptr @__tysan_v1_p1_20int, ptr @__tysan_v1___ZTS9CompleteS], section "llvm.metadata" -// CHECK: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @tysan.module_ctor, ptr null }] +// CHECK: @__tysan_v1___ZTS1b = linkonce_odr constant { i64, i64, [7 x i8] } { i64 2, i64 0, [7 x i8] c"_ZTS1b\00" }, comdat +// CHECK: @llvm.used = appending global [8 x ptr] [ptr @tysan.module_ctor, ptr @__tysan_v1_Simple_20C_2b_2b_20TBAA, ptr @__tysan_v1_omnipotent_20char, ptr @__tysan_v1_int, ptr @__tysan_v1_any_20pointer, ptr @__tysan_v1_p1_20int, ptr @__tysan_v1___ZTS9CompleteS, ptr @__tysan_v1___ZTS1b], section "llvm.metadata" +// CHECK: @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_sanitize_type_globals.cpp, ptr null }, { i32, ptr, ptr } { i32 0, ptr @tysan.module_ctor, ptr null }] //. struct CompleteS { int x; @@ -22,13 +26,18 @@ struct CompleteS { void f(CompleteS *); CompleteS x; +extern CompleteS xExtern; // CHECK-LABEL: define dso_local void @_Z1gv( // CHECK-SAME: ) #[[ATTR0:[0-9]+]] { // CHECK: [[ENTRY:.*:]] // CHECK: call void @_Z1fP9CompleteS(ptr noundef @x) +// CHECK: call void @_Z1fP9CompleteS(ptr noundef @xExtern) // CHECK: ret void // -void g() { f(&x); } +void g() { + f(&x); + f(&xExtern); +} typedef struct S IncompleteS; void f(IncompleteS *); @@ -40,11 +49,21 @@ extern IncompleteS y; // CHECK: ret void // void h() { f(&y); } + +class a; +class b { +public: + using c = a; + static c e; + b(int, c & = e); +} d = 0; + //. // CHECK: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone sanitize_type "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } // CHECK: attributes #[[ATTR1:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } -// CHECK: attributes #[[ATTR2:[0-9]+]] = { nounwind "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } -// CHECK: attributes #[[ATTR3:[0-9]+]] = { nounwind } +// CHECK: attributes #[[ATTR2:[0-9]+]] = { noinline nounwind sanitize_type "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } +// CHECK: attributes #[[ATTR3:[0-9]+]] = { nounwind "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } +// CHECK: attributes #[[ATTR4:[0-9]+]] = { nounwind } //. // CHECK: [[META0:![0-9]+]] = !{ptr @x, [[META1:![0-9]+]]} // CHECK: [[META1]] = !{!"_ZTS9CompleteS", [[META2:![0-9]+]], i64 0, [[META5:![0-9]+]], i64 8} @@ -53,6 +72,8 @@ void h() { f(&y); } // CHECK: [[META4]] = !{!"Simple C++ TBAA"} // CHECK: [[META5]] = !{!"p1 int", [[META6:![0-9]+]], i64 0} // CHECK: [[META6]] = !{!"any pointer", [[META3]], i64 0} -// CHECK: [[META7:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} -// CHECK: [[META8:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"} +// CHECK: [[META7:![0-9]+]] = !{ptr @d, [[META8:![0-9]+]]} +// CHECK: [[META8]] = !{!"_ZTS1b"} +// CHECK: [[META9:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} +// CHECK: [[META10:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"} //. diff --git a/clang/test/CodeGen/scoped-atomic-ops.c b/clang/test/CodeGen/scoped-atomic-ops.c index cf98812a07e9..545a6c90892c 100644 --- a/clang/test/CodeGen/scoped-atomic-ops.c +++ b/clang/test/CodeGen/scoped-atomic-ops.c @@ -1,15 +1,17 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 // RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa -ffreestanding \ // RUN: -fvisibility=hidden | FileCheck --check-prefix=AMDGCN %s +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa -ffreestanding \ +// RUN: -cl-std=CL2.0 -fvisibility=hidden | FileCheck --check-prefix=AMDGCN %s // RUN: %clang_cc1 %s -emit-llvm -o - -triple=spirv64-unknown-unknown -ffreestanding \ // RUN: -fvisibility=hidden | FileCheck --check-prefix=SPIRV %s // AMDGCN-LABEL: define hidden i32 @fi1a( -// AMDGCN: [[TMP0:%.*]] = load atomic i32, ptr [[PTR0:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP1:%.*]] = load atomic i32, ptr [[PTR1:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP2:%.*]] = load atomic i32, ptr [[PTR2:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP3:%.*]] = load atomic i32, ptr [[PTR3:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP4:%.*]] = load atomic i32, ptr [[PTR4:.+]] syncscope("singlethread-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = load atomic i32, ptr [[PTR0:.+]] monotonic, align 4 +// AMDGCN: [[TMP1:%.*]] = load atomic i32, ptr [[PTR1:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP2:%.*]] = load atomic i32, ptr [[PTR2:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP3:%.*]] = load atomic i32, ptr [[PTR3:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP4:%.*]] = load atomic i32, ptr [[PTR4:.+]] syncscope("singlethread") monotonic, align 4 // SPIRV: define hidden spir_func i32 @fi1a( // SPIRV: [[TMP0:%.*]] = load atomic i32, ptr [[PTR0:.+]] monotonic, align 4 // SPIRV: [[TMP1:%.*]] = load atomic i32, ptr [[PTR1:.+]] syncscope("device") monotonic, align 4 @@ -27,11 +29,11 @@ int fi1a(int *i) { } // AMDGCN-LABEL: define hidden i32 @fi1b( -// AMDGCN: [[TMP0:%.*]] = load atomic i32, ptr [[PTR0:%.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP1:%.*]] = load atomic i32, ptr [[PTR1:%.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP2:%.*]] = load atomic i32, ptr [[PTR2:%.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP3:%.*]] = load atomic i32, ptr [[PTR3:%.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP4:%.*]] = load atomic i32, ptr [[PTR4:%.+]] syncscope("singlethread-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = load atomic i32, ptr [[PTR0:%.+]] monotonic, align 4 +// AMDGCN: [[TMP1:%.*]] = load atomic i32, ptr [[PTR1:%.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP2:%.*]] = load atomic i32, ptr [[PTR2:%.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP3:%.*]] = load atomic i32, ptr [[PTR3:%.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP4:%.*]] = load atomic i32, ptr [[PTR4:%.+]] syncscope("singlethread") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func i32 @fi1b( // SPIRV: [[TMP0:%.*]] = load atomic i32, ptr [[PTR0:%.+]] monotonic, align 4 // SPIRV: [[TMP1:%.*]] = load atomic i32, ptr [[PTR1:%.+]] syncscope("device") monotonic, align 4 @@ -48,11 +50,11 @@ int fi1b(int *i) { } // AMDGCN-LABEL: define hidden void @fi2a( -// AMDGCN: store atomic i32 [[TMP0:%.+]], ptr [[PTR0:%.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP1:%.+]], ptr [[PTR1:%.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP2:%.+]], ptr [[PTR2:%.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP3:%.+]], ptr [[PTR3:%.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP4:%.+]], ptr [[PTR4:%.+]] syncscope("singlethread-one-as") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP0:%.+]], ptr [[PTR0:%.+]] monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP1:%.+]], ptr [[PTR1:%.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP2:%.+]], ptr [[PTR2:%.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP3:%.+]], ptr [[PTR3:%.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP4:%.+]], ptr [[PTR4:%.+]] syncscope("singlethread") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func void @fi2a( // SPIRV: store atomic i32 [[TMP0:%.+]], ptr [[PTR0:%.+]] monotonic, align 4 // SPIRV: store atomic i32 [[TMP1:%.+]], ptr [[PTR1:%.+]] syncscope("device") monotonic, align 4 @@ -69,11 +71,11 @@ void fi2a(int *i) { } // AMDGCN-LABEL: define hidden void @fi2b( -// AMDGCN: store atomic i32 [[TMP0:%.+]], ptr [[PTR0:%.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP1:%.+]], ptr [[PTR1:%.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP2:%.+]], ptr [[PTR2:%.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP3:%.+]], ptr [[PTR3:%.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: store atomic i32 [[TMP4:%.+]], ptr [[PTR4:%.+]] syncscope("singlethread-one-as") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP0:%.+]], ptr [[PTR0:%.+]] monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP1:%.+]], ptr [[PTR1:%.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP2:%.+]], ptr [[PTR2:%.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP3:%.+]], ptr [[PTR3:%.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: store atomic i32 [[TMP4:%.+]], ptr [[PTR4:%.+]] syncscope("singlethread") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func void @fi2b( // SPIRV: store atomic i32 [[TMP0:%.+]], ptr [[PTR0:%.+]] monotonic, align 4 // SPIRV: store atomic i32 [[TMP1:%.+]], ptr [[PTR1:%.+]] syncscope("device") monotonic, align 4 @@ -89,14 +91,14 @@ void fi2b(int *i) { } // AMDGCN-LABEL: define hidden void @fi3a( -// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("one-as") monotonic, align 4 -// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] monotonic, align 4 +// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] monotonic, align 4 +// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] monotonic, align 4 +// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] monotonic, align 4 +// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] monotonic, align 4 +// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] monotonic, align 4 +// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] monotonic, align 4 +// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] monotonic, align 4 // SPIRV-LABEL: define hidden spir_func void @fi3a( // SPIRV: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] monotonic, align 4 // SPIRV: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] monotonic, align 4 @@ -118,14 +120,14 @@ void fi3a(int *a, int *b, int *c, int *d, int *e, int *f, int *g, int *h) { } // AMDGCN-LABEL: define hidden void @fi3b( -// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("agent-one-as") monotonic, align 4 -// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("agent-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("agent") monotonic, align 4 +// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("agent") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func void @fi3b( // SPIRV: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("device") monotonic, align 4 // SPIRV: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("device") monotonic, align 4 @@ -147,14 +149,14 @@ void fi3b(int *a, int *b, int *c, int *d, int *e, int *f, int *g, int *h) { } // AMDGCN-LABEL: define hidden void @fi3c( -// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("workgroup-one-as") monotonic, align 4 -// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("workgroup-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("workgroup") monotonic, align 4 +// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("workgroup") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func void @fi3c( // SPIRV: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("workgroup") monotonic, align 4 // SPIRV: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("workgroup") monotonic, align 4 @@ -176,14 +178,14 @@ void fi3c(int *a, int *b, int *c, int *d, int *e, int *f, int *g, int *h) { } // AMDGCN-LABEL: define hidden void @fi3d( -// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("wavefront-one-as") monotonic, align 4 -// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("wavefront-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("wavefront") monotonic, align 4 +// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("wavefront") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func void @fi3d( // SPIRV: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("subgroup") monotonic, align 4 // SPIRV: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("subgroup") monotonic, align 4 @@ -205,14 +207,14 @@ void fi3d(int *a, int *b, int *c, int *d, int *e, int *f, int *g, int *h) { } // AMDGCN-LABEL: define hidden void @fi3e( -// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("singlethread-one-as") monotonic, align 4 -// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("singlethread-one-as") monotonic, align 4 -// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("singlethread-one-as") monotonic, align 4 -// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("singlethread-one-as") monotonic, align 4 -// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("singlethread-one-as") monotonic, align 4 -// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("singlethread-one-as") monotonic, align 4 -// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("singlethread-one-as") monotonic, align 4 -// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("singlethread-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("singlethread") monotonic, align 4 +// AMDGCN: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("singlethread") monotonic, align 4 +// AMDGCN: [[TMP2:%.*]] = atomicrmw and ptr [[PTR2:%.+]], i32 [[VAL2:.+]] syncscope("singlethread") monotonic, align 4 +// AMDGCN: [[TMP3:%.*]] = atomicrmw or ptr [[PTR3:%.+]], i32 [[VAL3:.+]] syncscope("singlethread") monotonic, align 4 +// AMDGCN: [[TMP4:%.*]] = atomicrmw xor ptr [[PTR4:%.+]], i32 [[VAL4:.+]] syncscope("singlethread") monotonic, align 4 +// AMDGCN: [[TMP5:%.*]] = atomicrmw nand ptr [[PTR5:%.+]], i32 [[VAL5:.+]] syncscope("singlethread") monotonic, align 4 +// AMDGCN: [[TMP6:%.*]] = atomicrmw min ptr [[PTR6:%.+]], i32 [[VAL6:.+]] syncscope("singlethread") monotonic, align 4 +// AMDGCN: [[TMP7:%.*]] = atomicrmw max ptr [[PTR7:%.+]], i32 [[VAL7:.+]] syncscope("singlethread") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func void @fi3e( // SPIRV: [[TMP0:%.*]] = atomicrmw add ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("singlethread") monotonic, align 4 // SPIRV: [[TMP1:%.*]] = atomicrmw sub ptr [[PTR1:%.+]], i32 [[VAL1:.+]] syncscope("singlethread") monotonic, align 4 @@ -234,7 +236,7 @@ void fi3e(int *a, int *b, int *c, int *d, int *e, int *f, int *g, int *h) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi4a( -// AMDGCN-DAG: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("one-as") acquire acquire, align 4 +// AMDGCN-DAG: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi4a( // SPIRV-DAG: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] acquire acquire, align 4 _Bool fi4a(int *i) { @@ -246,7 +248,7 @@ _Bool fi4a(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi4b( -// AMDGCN-DAG: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("agent-one-as") acquire acquire, align 4 +// AMDGCN-DAG: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("agent") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi4b( // SPIRV-DAG: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("device") acquire acquire, align 4 _Bool fi4b(int *i) { @@ -258,7 +260,7 @@ _Bool fi4b(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi4c( -// AMDGCN: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("workgroup-one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("workgroup") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi4c( // SPIRV: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("workgroup") acquire acquire, align 4 _Bool fi4c(int *i) { @@ -270,7 +272,7 @@ _Bool fi4c(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi4d( -// AMDGCN: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("wavefront-one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("wavefront") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi4d( // SPIRV: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("subgroup") acquire acquire, align 4 _Bool fi4d(int *i) { @@ -282,7 +284,7 @@ _Bool fi4d(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi4e( -// AMDGCN: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("singlethread-one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("singlethread") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi4e( // SPIRV: [[TMP0:%.*]] = cmpxchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("singlethread") acquire acquire, align 4 _Bool fi4e(int *i) { @@ -294,7 +296,7 @@ _Bool fi4e(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi5a( -// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi5a( // SPIRV: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] acquire acquire, align 4 _Bool fi5a(int *i) { @@ -305,7 +307,7 @@ _Bool fi5a(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi5b( -// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("agent-one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("agent") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi5b( // SPIRV: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("device") acquire acquire, align 4 _Bool fi5b(int *i) { @@ -316,7 +318,7 @@ _Bool fi5b(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi5c( -// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("workgroup-one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("workgroup") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi5c( // SPIRV: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("workgroup") acquire acquire, align 4 _Bool fi5c(int *i) { @@ -326,7 +328,7 @@ _Bool fi5c(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi5d( -// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("wavefront-one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("wavefront") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi5d( // SPIRV: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("subgroup") acquire acquire, align 4 _Bool fi5d(int *i) { @@ -336,7 +338,7 @@ _Bool fi5d(int *i) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi5e( -// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("singlethread-one-as") acquire acquire, align 4 +// AMDGCN: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("singlethread") acquire acquire, align 4 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi5e( // SPIRV: [[TMP0:%.*]] = cmpxchg weak ptr [[PTR0:%.+]], i32 [[VAL0:.+]], i32 [[VAL1:.+]] syncscope("singlethread") acquire acquire, align 4 _Bool fi5e(int *i) { @@ -346,7 +348,7 @@ _Bool fi5e(int *i) { } // AMDGCN-LABEL: define hidden i32 @fi6a( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] monotonic, align 4 // SPIRV-LABEL: define hidden spir_func i32 @fi6a( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] monotonic, align 4 int fi6a(int *c, int *d) { @@ -356,7 +358,7 @@ int fi6a(int *c, int *d) { } // AMDGCN-LABEL: define hidden i32 @fi6b( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("agent-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("agent") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func i32 @fi6b( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("device") monotonic, align 4 int fi6b(int *c, int *d) { @@ -366,7 +368,7 @@ int fi6b(int *c, int *d) { } // AMDGCN-LABEL: define hidden i32 @fi6c( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("workgroup-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("workgroup") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func i32 @fi6c( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("workgroup") monotonic, align 4 int fi6c(int *c, int *d) { @@ -376,7 +378,7 @@ int fi6c(int *c, int *d) { } // AMDGCN-LABEL: define hidden i32 @fi6d( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("wavefront-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("wavefront") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func i32 @fi6d( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("subgroup") monotonic, align 4 int fi6d(int *c, int *d) { @@ -386,7 +388,7 @@ int fi6d(int *c, int *d) { } // AMDGCN-LABEL: define hidden i32 @fi6e( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("singlethread-one-as") monotonic, align 4 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("singlethread") monotonic, align 4 // SPIRV-LABEL: define hidden spir_func i32 @fi6e( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i32 [[VAL0:.+]] syncscope("singlethread") monotonic, align 4 int fi6e(int *c, int *d) { @@ -396,7 +398,7 @@ int fi6e(int *c, int *d) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi7a( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("one-as") monotonic, align 1 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] monotonic, align 1 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi7a( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] monotonic, align 1 _Bool fi7a(_Bool *c) { @@ -405,7 +407,7 @@ _Bool fi7a(_Bool *c) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi7b( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("agent-one-as") monotonic, align 1 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("agent") monotonic, align 1 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi7b( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("device") monotonic, align 1 _Bool fi7b(_Bool *c) { @@ -414,7 +416,7 @@ _Bool fi7b(_Bool *c) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi7c( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("workgroup-one-as") monotonic, align 1 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("workgroup") monotonic, align 1 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi7c( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("workgroup") monotonic, align 1 _Bool fi7c(_Bool *c) { @@ -423,7 +425,7 @@ _Bool fi7c(_Bool *c) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi7d( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("wavefront-one-as") monotonic, align 1 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("wavefront") monotonic, align 1 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi7d( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("subgroup") monotonic, align 1 _Bool fi7d(_Bool *c) { @@ -432,7 +434,7 @@ _Bool fi7d(_Bool *c) { } // AMDGCN-LABEL: define hidden zeroext i1 @fi7e( -// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("singlethread-one-as") monotonic, align 1 +// AMDGCN: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("singlethread") monotonic, align 1 // SPIRV-LABEL: define hidden spir_func zeroext i1 @fi7e( // SPIRV: [[TMP0:%.*]] = atomicrmw xchg ptr [[PTR0:%.+]], i8 [[VAL0:.+]] syncscope("singlethread") monotonic, align 1 _Bool fi7e(_Bool *c) { diff --git a/clang/test/CodeGen/scoped-fence-ops.c b/clang/test/CodeGen/scoped-fence-ops.c index 376cb11e84d3..d83ae05b0aea 100644 --- a/clang/test/CodeGen/scoped-fence-ops.c +++ b/clang/test/CodeGen/scoped-fence-ops.c @@ -1,6 +1,8 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 // RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa -ffreestanding \ // RUN: -fvisibility=hidden | FileCheck --check-prefix=AMDGCN %s +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa -ffreestanding \ +// RUN: -cl-std=CL2.0 -fvisibility=hidden | FileCheck --check-prefix=AMDGCN %s // RUN: %clang_cc1 %s -emit-llvm -o - -triple=spirv64-unknown-unknown -ffreestanding \ // RUN: -fvisibility=hidden | FileCheck --check-prefix=SPIRV %s // RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-unknown-linux-gnu -ffreestanding \ @@ -9,7 +11,7 @@ // AMDGCN-LABEL: define hidden void @fe1a( // AMDGCN-SAME: ) #[[ATTR0:[0-9]+]] { // AMDGCN-NEXT: [[ENTRY:.*:]] -// AMDGCN-NEXT: fence syncscope("workgroup-one-as") release +// AMDGCN-NEXT: fence syncscope("workgroup") release // AMDGCN-NEXT: ret void // // SPIRV-LABEL: define hidden spir_func void @fe1a( @@ -45,13 +47,13 @@ void fe1a() { // AMDGCN: [[ATOMIC_SCOPE_CONTINUE]]: // AMDGCN-NEXT: ret void // AMDGCN: [[ACQUIRE]]: -// AMDGCN-NEXT: fence syncscope("workgroup-one-as") acquire +// AMDGCN-NEXT: fence syncscope("workgroup") acquire // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // AMDGCN: [[RELEASE]]: -// AMDGCN-NEXT: fence syncscope("workgroup-one-as") release +// AMDGCN-NEXT: fence syncscope("workgroup") release // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // AMDGCN: [[ACQREL]]: -// AMDGCN-NEXT: fence syncscope("workgroup-one-as") acq_rel +// AMDGCN-NEXT: fence syncscope("workgroup") acq_rel // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // AMDGCN: [[SEQCST]]: // AMDGCN-NEXT: fence syncscope("workgroup") seq_cst @@ -134,19 +136,19 @@ void fe1b(int ord) { // AMDGCN: [[ATOMIC_SCOPE_CONTINUE]]: // AMDGCN-NEXT: ret void // AMDGCN: [[DEVICE_SCOPE]]: -// AMDGCN-NEXT: fence syncscope("agent-one-as") release +// AMDGCN-NEXT: fence syncscope("agent") release // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // AMDGCN: [[SYSTEM_SCOPE]]: -// AMDGCN-NEXT: fence syncscope("one-as") release +// AMDGCN-NEXT: fence release // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // AMDGCN: [[WORKGROUP_SCOPE]]: -// AMDGCN-NEXT: fence syncscope("workgroup-one-as") release +// AMDGCN-NEXT: fence syncscope("workgroup") release // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // AMDGCN: [[WAVEFRONT_SCOPE]]: -// AMDGCN-NEXT: fence syncscope("wavefront-one-as") release +// AMDGCN-NEXT: fence syncscope("wavefront") release // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // AMDGCN: [[SINGLE_SCOPE]]: -// AMDGCN-NEXT: fence syncscope("singlethread-one-as") release +// AMDGCN-NEXT: fence syncscope("singlethread") release // AMDGCN-NEXT: br label %[[ATOMIC_SCOPE_CONTINUE]] // // SPIRV-LABEL: define hidden spir_func void @fe1c( @@ -237,7 +239,7 @@ void fe2a() { // AMDGCN-LABEL: define hidden void @fe2b( // AMDGCN-SAME: ) #[[ATTR0]] { // AMDGCN-NEXT: [[ENTRY:.*:]] -// AMDGCN-NEXT: fence syncscope("one-as") release +// AMDGCN-NEXT: fence release // AMDGCN-NEXT: ret void // // SPIRV-LABEL: define hidden spir_func void @fe2b( diff --git a/clang/test/CodeGen/tbaa-pointers.c b/clang/test/CodeGen/tbaa-pointers.c index 6aee2ff3717a..4aae2552f107 100644 --- a/clang/test/CodeGen/tbaa-pointers.c +++ b/clang/test/CodeGen/tbaa-pointers.c @@ -193,11 +193,10 @@ typedef struct { void unamed_struct_typedef(TypedefS *ptr) { // COMMON-LABEL: define void @unamed_struct_typedef( // COMMON-SAME: ptr noundef [[PTRA:%.+]]) -// COMMON: [[PTR_ADDR:%.+]] = alloca ptr, align 8 +// COMMON: [[PTR_ADDR:%.+]] = alloca ptr, align 8 // DISABLE-NEXT: store ptr [[PTRA]], ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR]] -// DISABLE-NEXT: [[L0:%.+]] = load ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR]] -// DEFAULT-NEXT: store ptr [[PTRA]], ptr [[PTR_ADDR]], align 8, !tbaa [[P1TYPEDEF:!.+]] -// DEFAULT-NEXT: [[L0:%.+]] = load ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[P1TYPEDEF]] +// DEFAULT-NEXT: store ptr [[PTRA]], ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR:!.+]] +// COMMON-NEXT: [[L0:%.+]] = load ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR]] // COMMON-NEXT: [[GEP:%.+]] = getelementptr inbounds nuw %struct.TypedefS, ptr [[L0]], i32 0, i32 0 // COMMON-NEXT: store i32 0, ptr [[GEP]], align 4 // COMMON-NEXT: ret void @@ -205,6 +204,24 @@ void unamed_struct_typedef(TypedefS *ptr) { ptr->i1 = 0; } +int void_ptrs(void **ptr) { +// COMMON-LABEL: define i32 @void_ptrs( +// COMMON-SAME: ptr noundef [[PTRA:%.+]]) +// COMMON: [[PTR_ADDR:%.+]] = alloca ptr, align 8 +// DISABLE-NEXT: store ptr [[PTRA]], ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR]] +// DISABLE-NEXT: [[L0:%.+]] = load ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR]] +// DISABLE-NEXT: [[L1:%.+]] = load ptr, ptr [[L0]], align 8, !tbaa [[ANYPTR]] +// DEFAULT-NEXT: store ptr [[PTRA]], ptr [[PTR_ADDR]], align 8, !tbaa [[P2VOID:!.+]] +// DEFAULT-NEXT: [[L0:%.+]] = load ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[P2VOID]] +// DEFAULT-NEXT: [[L1:%.+]] = load ptr, ptr [[L0]], align 8, !tbaa [[P1VOID:!.+]] +// COMMON-NEXT: [[BOOL:%.+]] = icmp ne ptr [[L1]], null +// COMMON-NEXT: [[BOOL_EXT:%.+]] = zext i1 [[BOOL]] to i64 +// COMMON-NEXT: [[COND:%.+]] = select i1 [[BOOL]], i32 0, i32 1 +// COMMON-NEXT: ret i32 [[COND]] + + return *ptr ? 0 : 1; +} + // DEFAULT: [[P2INT_0]] = !{[[P2INT:!.+]], [[P2INT]], i64 0} // DEFAULT: [[P2INT]] = !{!"p2 int", [[ANY_POINTER:!.+]], i64 0} // DISABLE: [[ANYPTR]] = !{[[ANY_POINTER:!.+]], [[ANY_POINTER]], i64 0} @@ -236,4 +253,8 @@ void unamed_struct_typedef(TypedefS *ptr) { // DISABLE: [[S2_TY]] = !{!"S2", [[ANY_POINTER]], i64 0} // COMMON: [[INT_TAG]] = !{[[INT_TY:!.+]], [[INT_TY]], i64 0} // COMMON: [[INT_TY]] = !{!"int", [[CHAR]], i64 0} -// DEFAULT: [[P1TYPEDEF]] = !{[[ANY_POINTER]], [[ANY_POINTER]], i64 0} +// DEFAULT: [[ANYPTR]] = !{[[ANY_POINTER]], [[ANY_POINTER]], i64 0} +// DEFAULT: [[P2VOID]] = !{[[P2VOID_TY:!.+]], [[P2VOID_TY]], i64 0} +// DEFAULT: [[P2VOID_TY]] = !{!"p2 void", [[ANY_POINTER]], i64 0} +// DEFAULT: [[P1VOID]] = !{[[P1VOID_TY:!.+]], [[P1VOID_TY]], i64 0} +// DEFAULT: [[P1VOID_TY]] = !{!"p1 void", [[ANY_POINTER]], i64 0} diff --git a/clang/test/CodeGen/xcore-abi.c b/clang/test/CodeGen/xcore-abi.c index bb8d2fec46bd..40e2f418f730 100644 --- a/clang/test/CodeGen/xcore-abi.c +++ b/clang/test/CodeGen/xcore-abi.c @@ -76,7 +76,8 @@ void testva (int n, ...) { // CHECK: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[V5]], ptr align 4 [[P]], i32 20, i1 false) // CHECK: call void @f(ptr noundef [[V5]]) - int* v6 = va_arg (ap, int[4]); // an unusual aggregate type + // an unusual aggregate type + int* v6 = va_arg (ap, int[4]); // expected-warning{{second argument to 'va_arg' is of array type 'int[4]'}} f(v6); // CHECK: [[I:%[a-z0-9]+]] = load ptr, ptr [[AP]] // CHECK: [[P:%[a-z0-9]+]] = load ptr, ptr [[I]] diff --git a/clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu b/clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu index 0e5fe8fa35cf..47fa3967fe23 100644 --- a/clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu +++ b/clang/test/CodeGenCUDA/amdgpu-atomic-ops.cu @@ -26,10 +26,10 @@ __global__ void ffp1(float *p) { // SAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 4{{$}} // SAFEIR: atomicrmw fmax ptr {{.*}} monotonic, align 4{{$}} // SAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 4{{$}} - // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE:[0-9]+]]{{$}} - // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE:[0-9]+]]{{$}} + // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} // UNSAFEIR: atomicrmw fadd ptr {{.*}} monotonic, align 4, !amdgpu.no.fine.grained.memory !{{[0-9]+}}, !amdgpu.ignore.denormal.mode !{{[0-9]+$}} // UNSAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 4, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} @@ -37,8 +37,8 @@ __global__ void ffp1(float *p) { // UNSAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 4, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fadd ptr {{.*}} monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE:[0-9]+]], !amdgpu.no.fine.grained.memory !{{[0-9]+}}, !amdgpu.ignore.denormal.mode !{{[0-9]+$}} // UNSAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // SAFE: _Z4ffp1Pf // SAFE: global_atomic_cmpswap @@ -73,19 +73,19 @@ __global__ void ffp2(double *p) { // SAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 8{{$}} // SAFEIR: atomicrmw fmax ptr {{.*}} monotonic, align 8{{$}} // SAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 8{{$}} - // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} // UNSAFEIR: atomicrmw fadd ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fmax ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // SAFE-LABEL: @_Z4ffp2Pd // SAFE: global_atomic_cmpswap_b64 @@ -119,19 +119,19 @@ __global__ void ffp3(long double *p) { // SAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 8{{$}} // SAFEIR: atomicrmw fmax ptr {{.*}} monotonic, align 8{{$}} // SAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 8{{$}} - // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} // UNSAFEIR: atomicrmw fadd ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fmax ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 8, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // SAFE-LABEL: @_Z4ffp3Pe // SAFE: global_atomic_cmpswap_b64 @@ -185,10 +185,10 @@ __global__ void ffp6(_Float16 *p) { // SAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 2{{$}} // SAFEIR: atomicrmw fmax ptr {{.*}} monotonic, align 2{{$}} // SAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 2{{$}} - // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent-one-as") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} - // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fadd ptr {{.*}} syncscope("agent") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fsub ptr {{.*}} syncscope("workgroup") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} + // SAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} // UNSAFEIR: atomicrmw fadd ptr {{.*}} monotonic, align 2, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 2, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} @@ -196,8 +196,8 @@ __global__ void ffp6(_Float16 *p) { // UNSAFEIR: atomicrmw fmin ptr {{.*}} monotonic, align 2, !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fadd ptr {{.*}} monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // UNSAFEIR: atomicrmw fsub ptr {{.*}} monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent-one-as") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} - // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup-one-as") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmax ptr {{.*}} syncscope("agent") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} + // UNSAFEIR: atomicrmw fmin ptr {{.*}} syncscope("workgroup") monotonic, align 2, !noalias.addrspace ![[$NO_PRIVATE]], !amdgpu.no.fine.grained.memory !{{[0-9]+$}} // SAFE: _Z4ffp6PDF16 // SAFE: global_atomic_cmpswap @@ -228,8 +228,8 @@ __global__ void ffp6(_Float16 *p) { // CHECK-LABEL: @_Z12test_cmpxchgPiii // CHECK: cmpxchg ptr %{{.+}}, i32 %{{.+}}, i32 %{{.+}} acquire acquire, align 4{{$}} // CHECK: cmpxchg weak ptr %{{.+}}, i32 %{{.+}}, i32 %{{.+}} acquire acquire, align 4{{$}} -// CHECK: cmpxchg ptr %{{.+}}, i32 %{{.+}}, i32 %{{.+}} syncscope("workgroup-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} -// CHECK: cmpxchg weak ptr %{{.+}}, i32 %{{.+}}, i32 %{{.+}} syncscope("workgroup-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} +// CHECK: cmpxchg ptr %{{.+}}, i32 %{{.+}}, i32 %{{.+}} syncscope("workgroup") monotonic monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} +// CHECK: cmpxchg weak ptr %{{.+}}, i32 %{{.+}}, i32 %{{.+}} syncscope("workgroup") monotonic monotonic, align 4, !noalias.addrspace ![[$NO_PRIVATE]]{{$}} __device__ int test_cmpxchg(int *ptr, int cmp, int desired) { bool flag = __atomic_compare_exchange(ptr, &cmp, &desired, 0, memory_order_acquire, memory_order_acquire); flag = __atomic_compare_exchange_n(ptr, &cmp, desired, 1, memory_order_acquire, memory_order_acquire); diff --git a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu index fab87aac1831..19730e392551 100644 --- a/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu +++ b/clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu @@ -33,7 +33,7 @@ // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel1Pi( -// CHECK-SPIRV-SAME: ptr addrspace(1) noundef [[X_COERCE:%.*]]) addrspace(4) #[[ATTR0:[0-9]+]] { +// CHECK-SPIRV-SAME: ptr addrspace(1) noundef [[X_COERCE:%.*]]) addrspace(4) #[[ATTR0:[0-9]+]] !max_work_group_size [[META5:![0-9]+]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[X:%.*]] = alloca ptr addrspace(4), align 8 // CHECK-SPIRV-NEXT: [[X_ADDR:%.*]] = alloca ptr addrspace(4), align 8 @@ -58,7 +58,7 @@ // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel1Pi( -// OPT-SPIRV-SAME: ptr addrspace(1) noundef [[X_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0:[0-9]+]] { +// OPT-SPIRV-SAME: ptr addrspace(1) noundef [[X_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0:[0-9]+]] !max_work_group_size [[META5:![0-9]+]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = ptrtoint ptr addrspace(1) [[X_COERCE]] to i64 // OPT-SPIRV-NEXT: [[TMP1:%.*]] = inttoptr i64 [[TMP0]] to ptr addrspace(4) @@ -102,7 +102,7 @@ __global__ void kernel1(int *x) { // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel2Ri( -// CHECK-SPIRV-SAME: ptr addrspace(1) noundef align 4 dereferenceable(4) [[X_COERCE:%.*]]) addrspace(4) #[[ATTR0]] { +// CHECK-SPIRV-SAME: ptr addrspace(1) noundef align 4 dereferenceable(4) [[X_COERCE:%.*]]) addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[X:%.*]] = alloca ptr addrspace(4), align 8 // CHECK-SPIRV-NEXT: [[X_ADDR:%.*]] = alloca ptr addrspace(4), align 8 @@ -126,7 +126,7 @@ __global__ void kernel1(int *x) { // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel2Ri( -// OPT-SPIRV-SAME: ptr addrspace(1) noundef align 4 dereferenceable(4) [[X_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] { +// OPT-SPIRV-SAME: ptr addrspace(1) noundef align 4 dereferenceable(4) [[X_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = ptrtoint ptr addrspace(1) [[X_COERCE]] to i64 // OPT-SPIRV-NEXT: [[TMP1:%.*]] = inttoptr i64 [[TMP0]] to ptr addrspace(4) @@ -171,7 +171,7 @@ __global__ void kernel2(int &x) { // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel3PU3AS2iPU3AS1i( -// CHECK-SPIRV-SAME: ptr addrspace(2) noundef [[X:%.*]], ptr addrspace(1) noundef [[Y:%.*]]) addrspace(4) #[[ATTR0]] { +// CHECK-SPIRV-SAME: ptr addrspace(2) noundef [[X:%.*]], ptr addrspace(1) noundef [[Y:%.*]]) addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[X_ADDR:%.*]] = alloca ptr addrspace(2), align 8 // CHECK-SPIRV-NEXT: [[Y_ADDR:%.*]] = alloca ptr addrspace(1), align 8 @@ -195,7 +195,7 @@ __global__ void kernel2(int &x) { // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel3PU3AS2iPU3AS1i( -// OPT-SPIRV-SAME: ptr addrspace(2) nocapture noundef readonly [[X:%.*]], ptr addrspace(1) nocapture noundef writeonly initializes((0, 4)) [[Y:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR1:[0-9]+]] { +// OPT-SPIRV-SAME: ptr addrspace(2) nocapture noundef readonly [[X:%.*]], ptr addrspace(1) nocapture noundef writeonly initializes((0, 4)) [[Y:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR1:[0-9]+]] !max_work_group_size [[META5]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = load i32, ptr addrspace(2) [[X]], align 4 // OPT-SPIRV-NEXT: store i32 [[TMP0]], ptr addrspace(1) [[Y]], align 4 @@ -302,7 +302,7 @@ struct S { // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel41S( -// CHECK-SPIRV-SAME: [[STRUCT_S:%.*]] [[S_COERCE:%.*]]) addrspace(4) #[[ATTR0]] { +// CHECK-SPIRV-SAME: [[STRUCT_S:%.*]] [[S_COERCE:%.*]]) addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[S:%.*]] = alloca [[STRUCT_S]], align 8 // CHECK-SPIRV-NEXT: [[S1:%.*]] = addrspacecast ptr [[S]] to ptr addrspace(4) @@ -343,7 +343,7 @@ struct S { // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel41S( -// OPT-SPIRV-SAME: [[STRUCT_S:%.*]] [[S_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] { +// OPT-SPIRV-SAME: [[STRUCT_S:%.*]] [[S_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = extractvalue [[STRUCT_S]] [[S_COERCE]], 0 // OPT-SPIRV-NEXT: [[TMP1:%.*]] = extractvalue [[STRUCT_S]] [[S_COERCE]], 1 @@ -406,7 +406,7 @@ __global__ void kernel4(struct S s) { // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel5P1S( -// CHECK-SPIRV-SAME: ptr addrspace(1) noundef [[S_COERCE:%.*]]) addrspace(4) #[[ATTR0]] { +// CHECK-SPIRV-SAME: ptr addrspace(1) noundef [[S_COERCE:%.*]]) addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[S:%.*]] = alloca ptr addrspace(4), align 8 // CHECK-SPIRV-NEXT: [[S_ADDR:%.*]] = alloca ptr addrspace(4), align 8 @@ -432,7 +432,7 @@ __global__ void kernel4(struct S s) { // CHECK-SPIRV-NEXT: ret void // // OPT-LABEL: define dso_local amdgpu_kernel void @_Z7kernel5P1S( -// OPT-SAME: ptr addrspace(1) nocapture noundef readonly [[S_COERCE:%.*]]) local_unnamed_addr #[[ATTR3:[0-9]+]] { +// OPT-SAME: ptr addrspace(1) nocapture noundef readonly [[S_COERCE:%.*]]) local_unnamed_addr #[[ATTR2]] { // OPT-NEXT: [[ENTRY:.*:]] // OPT-NEXT: [[TMP0:%.*]] = load ptr, ptr addrspace(1) [[S_COERCE]], align 8 // OPT-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4 @@ -446,7 +446,7 @@ __global__ void kernel4(struct S s) { // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel5P1S( -// OPT-SPIRV-SAME: ptr addrspace(1) noundef [[S_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] { +// OPT-SPIRV-SAME: ptr addrspace(1) noundef [[S_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = ptrtoint ptr addrspace(1) [[S_COERCE]] to i64 // OPT-SPIRV-NEXT: [[TMP1:%.*]] = inttoptr i64 [[TMP0]] to ptr addrspace(4) @@ -511,7 +511,7 @@ struct T { // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel61T( -// CHECK-SPIRV-SAME: [[STRUCT_T:%.*]] [[T_COERCE:%.*]]) addrspace(4) #[[ATTR0]] { +// CHECK-SPIRV-SAME: [[STRUCT_T:%.*]] [[T_COERCE:%.*]]) addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[T:%.*]] = alloca [[STRUCT_T]], align 8 // CHECK-SPIRV-NEXT: [[T1:%.*]] = addrspacecast ptr [[T]] to ptr addrspace(4) @@ -551,7 +551,7 @@ struct T { // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel61T( -// OPT-SPIRV-SAME: [[STRUCT_T:%.*]] [[T_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] { +// OPT-SPIRV-SAME: [[STRUCT_T:%.*]] [[T_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = extractvalue [[STRUCT_T]] [[T_COERCE]], 0 // OPT-SPIRV-NEXT: [[DOTFCA_0_EXTRACT:%.*]] = extractvalue [2 x ptr addrspace(4)] [[TMP0]], 0 @@ -606,7 +606,7 @@ __global__ void kernel6(struct T t) { // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel7Pi( -// CHECK-SPIRV-SAME: ptr addrspace(1) noalias noundef [[X_COERCE:%.*]]) addrspace(4) #[[ATTR0]] { +// CHECK-SPIRV-SAME: ptr addrspace(1) noalias noundef [[X_COERCE:%.*]]) addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[X:%.*]] = alloca ptr addrspace(4), align 8 // CHECK-SPIRV-NEXT: [[X_ADDR:%.*]] = alloca ptr addrspace(4), align 8 @@ -631,7 +631,7 @@ __global__ void kernel6(struct T t) { // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel7Pi( -// OPT-SPIRV-SAME: ptr addrspace(1) noalias noundef [[X_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] { +// OPT-SPIRV-SAME: ptr addrspace(1) noalias noundef [[X_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = ptrtoint ptr addrspace(1) [[X_COERCE]] to i64 // OPT-SPIRV-NEXT: [[TMP1:%.*]] = inttoptr i64 [[TMP0]] to ptr addrspace(4) @@ -677,7 +677,7 @@ struct SS { // CHECK-NEXT: ret void // // CHECK-SPIRV-LABEL: define spir_kernel void @_Z7kernel82SS( -// CHECK-SPIRV-SAME: [[STRUCT_SS:%.*]] [[A_COERCE:%.*]]) addrspace(4) #[[ATTR0]] { +// CHECK-SPIRV-SAME: [[STRUCT_SS:%.*]] [[A_COERCE:%.*]]) addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // CHECK-SPIRV-NEXT: [[ENTRY:.*:]] // CHECK-SPIRV-NEXT: [[A:%.*]] = alloca [[STRUCT_SS]], align 8 // CHECK-SPIRV-NEXT: [[A1:%.*]] = addrspacecast ptr [[A]] to ptr addrspace(4) @@ -700,7 +700,7 @@ struct SS { // OPT-NEXT: ret void // // OPT-SPIRV-LABEL: define spir_kernel void @_Z7kernel82SS( -// OPT-SPIRV-SAME: [[STRUCT_SS:%.*]] [[A_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] { +// OPT-SPIRV-SAME: [[STRUCT_SS:%.*]] [[A_COERCE:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR0]] !max_work_group_size [[META5]] { // OPT-SPIRV-NEXT: [[ENTRY:.*:]] // OPT-SPIRV-NEXT: [[TMP0:%.*]] = extractvalue [[STRUCT_SS]] [[A_COERCE]], 0 // OPT-SPIRV-NEXT: [[TMP1:%.*]] = load float, ptr addrspace(4) [[TMP0]], align 4 @@ -727,5 +727,9 @@ __global__ void kernel8(struct SS a) { *a.x += 3.f; } //. +// CHECK-SPIRV: [[META5]] = !{i32 1024, i32 1, i32 1} +//. // OPT: [[META4]] = !{} //. +// OPT-SPIRV: [[META5]] = !{i32 1024, i32 1, i32 1} +//. diff --git a/clang/test/CodeGenCUDA/amdgpu-kernel-attrs.cu b/clang/test/CodeGenCUDA/amdgpu-kernel-attrs.cu index 11a133fd1351..253ac0898f54 100644 --- a/clang/test/CodeGenCUDA/amdgpu-kernel-attrs.cu +++ b/clang/test/CodeGenCUDA/amdgpu-kernel-attrs.cu @@ -4,6 +4,9 @@ // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa --gpu-max-threads-per-block=1024 \ // RUN: -fcuda-is-device -emit-llvm -o - -x hip %s \ // RUN: | FileCheck -check-prefixes=CHECK,MAX1024 %s +// RUN: %clang_cc1 -triple spirv64-amd-amdhsa --gpu-max-threads-per-block=1024 \ +// RUN: -fcuda-is-device -emit-llvm -o - -x hip %s \ +// RUN: | FileCheck -check-prefixes=CHECK-SPIRV,MAX1024-SPIRV %s // RUN: %clang_cc1 -triple nvptx \ // RUN: -fcuda-is-device -emit-llvm -o - %s | FileCheck %s \ // RUN: -check-prefix=NAMD @@ -21,12 +24,14 @@ __global__ void flat_work_group_size_default() { // CHECK: define{{.*}} amdgpu_kernel void @_Z28flat_work_group_size_defaultv() [[FLAT_WORK_GROUP_SIZE_DEFAULT:#[0-9]+]] +// CHECK-SPIRV: define{{.*}} spir_kernel void @_Z28flat_work_group_size_defaultv(){{.*}} !max_work_group_size [[MAX_WORK_GROUP_SIZE_DEFAULT:![0-9]+]] // NOUB: define{{.*}} void @_Z28flat_work_group_size_defaultv() [[NOUB:#[0-9]+]] } __attribute__((amdgpu_flat_work_group_size(32, 64))) // expected-no-diagnostics __global__ void flat_work_group_size_32_64() { // CHECK: define{{.*}} amdgpu_kernel void @_Z26flat_work_group_size_32_64v() [[FLAT_WORK_GROUP_SIZE_32_64:#[0-9]+]] +// CHECK-SPIRV: define{{.*}} spir_kernel void @_Z26flat_work_group_size_32_64v(){{.*}} !max_work_group_size [[MAX_WORK_GROUP_SIZE_64:![0-9]+]] } __attribute__((amdgpu_waves_per_eu(2))) // expected-no-diagnostics __global__ void waves_per_eu_2() { @@ -82,7 +87,9 @@ template __global__ void template_32_4_a_max_num_work_groups<2>(); // DEFAULT-DAG: attributes [[FLAT_WORK_GROUP_SIZE_DEFAULT]] = {{.*}}"amdgpu-flat-work-group-size"="1,1024"{{.*}}"uniform-work-group-size"="true" // MAX1024-DAG: attributes [[FLAT_WORK_GROUP_SIZE_DEFAULT]] = {{.*}}"amdgpu-flat-work-group-size"="1,1024" +// MAX1024-SPIRV-DAG: [[MAX_WORK_GROUP_SIZE_DEFAULT]] = !{i32 1024, i32 1, i32 1} // CHECK-DAG: attributes [[FLAT_WORK_GROUP_SIZE_32_64]] = {{.*}}"amdgpu-flat-work-group-size"="32,64" +// CHECK-SPIRV-DAG: [[MAX_WORK_GROUP_SIZE_64]] = !{i32 64, i32 1, i32 1} // CHECK-DAG: attributes [[WAVES_PER_EU_2]] = {{.*}}"amdgpu-waves-per-eu"="2" // CHECK-DAG: attributes [[NUM_SGPR_32]] = {{.*}}"amdgpu-num-sgpr"="32" // CHECK-DAG: attributes [[NUM_VGPR_64]] = {{.*}}"amdgpu-num-vgpr"="64" diff --git a/clang/test/CodeGenCUDA/atomic-ops.cu b/clang/test/CodeGenCUDA/atomic-ops.cu index 1accd1712bec..d8489b438015 100644 --- a/clang/test/CodeGenCUDA/atomic-ops.cu +++ b/clang/test/CodeGenCUDA/atomic-ops.cu @@ -2,18 +2,18 @@ #include "Inputs/cuda.h" // CHECK-LABEL: @_Z24atomic32_op_singlethreadPiii -// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK:[0-9]+]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: load atomic i32, ptr {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4{{$}} -// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("singlethread-one-as") monotonic, align 4{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK:[0-9]+]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: load atomic i32, ptr {{%[0-9]+}} syncscope("singlethread") monotonic, align 4{{$}} +// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("singlethread") monotonic, align 4{{$}} __device__ int atomic32_op_singlethread(int *ptr, int val, int desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); @@ -31,8 +31,8 @@ __device__ int atomic32_op_singlethread(int *ptr, int val, int desired) { } // CHECK-LABEL: @_Z25atomicu32_op_singlethreadPjjj -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("singlethread") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} __device__ unsigned int atomicu32_op_singlethread(unsigned int *ptr, unsigned int val, unsigned int desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); @@ -40,18 +40,18 @@ __device__ unsigned int atomicu32_op_singlethread(unsigned int *ptr, unsigned in } // CHECK-LABEL: @_Z21atomic32_op_wavefrontPiii -// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: load atomic i32, ptr {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4{{$}} -// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("wavefront-one-as") monotonic, align 4{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: load atomic i32, ptr {{%[0-9]+}} syncscope("wavefront") monotonic, align 4{{$}} +// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("wavefront") monotonic, align 4{{$}} __device__ int atomic32_op_wavefront(int *ptr, int val, int desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); @@ -69,8 +69,8 @@ __device__ int atomic32_op_wavefront(int *ptr, int val, int desired) { } // CHECK-LABEL: @_Z22atomicu32_op_wavefrontPjjj -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("wavefront") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} __device__ unsigned int atomicu32_op_wavefront(unsigned int *ptr, unsigned int val, unsigned int desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); @@ -78,17 +78,17 @@ __device__ unsigned int atomicu32_op_wavefront(unsigned int *ptr, unsigned int v } // CHECK-LABEL: @_Z21atomic32_op_workgroupPiii -// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("workgroup-one-as") monotonic, align 4{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("workgroup") monotonic, align 4{{$}} __device__ int atomic32_op_workgroup(int *ptr, int val, int desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); @@ -105,8 +105,8 @@ __device__ int atomic32_op_workgroup(int *ptr, int val, int desired) { } // CHECK-LABEL: @_Z22atomicu32_op_workgroupPjjj -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("workgroup") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} __device__ unsigned int atomicu32_op_workgroup(unsigned int *ptr, unsigned int val, unsigned int desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); @@ -114,17 +114,17 @@ __device__ unsigned int atomicu32_op_workgroup(unsigned int *ptr, unsigned int v } // CHECK-LABEL: @_Z17atomic32_op_agentPiii -// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("agent-one-as") monotonic, align 4{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("agent") monotonic, align 4{{$}} __device__ int atomic32_op_agent(int *ptr, int val, int desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); @@ -141,8 +141,8 @@ __device__ int atomic32_op_agent(int *ptr, int val, int desired) { } // CHECK-LABEL: @_Z18atomicu32_op_agentPjjj -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("agent") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} __device__ unsigned int atomicu32_op_agent(unsigned int *ptr, unsigned int val, unsigned int desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); @@ -150,18 +150,18 @@ __device__ unsigned int atomicu32_op_agent(unsigned int *ptr, unsigned int val, } // CHECK-LABEL: @_Z18atomic32_op_systemPiii -// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} // CHECK: load i32, ptr %{{.*}}, align 4{{$}} -// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} syncscope("one-as") monotonic, align 4{{$}} +// CHECK: store atomic i32 %{{.*}}, ptr %{{.*}} monotonic, align 4{{$}} __device__ int atomic32_op_system(int *ptr, int val, int desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); @@ -179,8 +179,8 @@ __device__ int atomic32_op_system(int *ptr, int val, int desired) { } // CHECK-LABEL: @_Z19atomicu32_op_systemPjjj -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} syncscope("one-as") monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i32 {{%[0-9]+}} monotonic, align 4, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} __device__ unsigned int atomicu32_op_system(unsigned int *ptr, unsigned int val, unsigned int desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); @@ -188,17 +188,17 @@ __device__ unsigned int atomicu32_op_system(unsigned int *ptr, unsigned int val, } // CHECK-LABEL: @_Z24atomic64_op_singlethreadPxS_xx -// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("singlethread-one-as") monotonic, align 8{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("singlethread") monotonic, align 8{{$}} __device__ long long atomic64_op_singlethread(long long *ptr, long long *ptr2, long long val, long long desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); @@ -215,10 +215,10 @@ __device__ long long atomic64_op_singlethread(long long *ptr, long long *ptr2, l } // CHECK-LABEL: @_Z25atomicu64_op_singlethreadPyS_yy -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: load atomic i64, ptr %{{.*}} syncscope("singlethread-one-as") monotonic, align 8{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("singlethread-one-as") monotonic, align 8{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("singlethread") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: load atomic i64, ptr %{{.*}} syncscope("singlethread") monotonic, align 8{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("singlethread") monotonic, align 8{{$}} __device__ unsigned long long atomicu64_op_singlethread(unsigned long long *ptr, unsigned long long *ptr2, unsigned long long val, unsigned long long desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SINGLETHREAD); @@ -228,18 +228,18 @@ __device__ unsigned long long atomicu64_op_singlethread(unsigned long long *ptr, } // CHECK-LABEL: @_Z21atomic64_op_wavefrontPxS_xx -// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: load atomic i64, ptr {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("wavefront-one-as") monotonic, align 8{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: load atomic i64, ptr {{%[0-9]+}} syncscope("wavefront") monotonic, align 8{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("wavefront") monotonic, align 8{{$}} __device__ long long atomic64_op_wavefront(long long *ptr, long long *ptr2, long long val, long long desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); @@ -257,10 +257,10 @@ __device__ long long atomic64_op_wavefront(long long *ptr, long long *ptr2, long } // CHECK-LABEL: @_Z22atomicu64_op_wavefrontPyS_yy -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: load atomic i64, ptr {{%[0-9]+}} syncscope("wavefront-one-as") monotonic, align 8{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("wavefront-one-as") monotonic, align 8{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("wavefront") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: load atomic i64, ptr {{%[0-9]+}} syncscope("wavefront") monotonic, align 8{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("wavefront") monotonic, align 8{{$}} __device__ unsigned long long atomicu64_op_wavefront(unsigned long long *ptr, unsigned long long *ptr2, unsigned long long val, unsigned long long desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WAVEFRONT); @@ -270,17 +270,17 @@ __device__ unsigned long long atomicu64_op_wavefront(unsigned long long *ptr, un } // CHECK-LABEL: @_Z21atomic64_op_workgroupPxS_xx -// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("workgroup-one-as") monotonic, align 8{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("workgroup") monotonic, align 8{{$}} __device__ long long atomic64_op_workgroup(long long *ptr, long long *ptr2, long long val, long long desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); @@ -297,9 +297,9 @@ __device__ long long atomic64_op_workgroup(long long *ptr, long long *ptr2, long } // CHECK-LABEL: @_Z22atomicu64_op_workgroupPyS_yy -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("workgroup-one-as") monotonic, align 8{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("workgroup") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("workgroup") monotonic, align 8{{$}} __device__ unsigned long long atomicu64_op_workgroup(unsigned long long *ptr, unsigned long long *ptr2, unsigned long long val, unsigned long long desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_WORKGROUP); @@ -308,17 +308,17 @@ __device__ unsigned long long atomicu64_op_workgroup(unsigned long long *ptr, un } // CHECK-LABEL: @_Z17atomic64_op_agentPxS_xx -// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("agent-one-as") monotonic, align 8{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("agent") monotonic, align 8{{$}} __device__ long long atomic64_op_agent(long long *ptr, long long *ptr2, long long val, long long desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); @@ -335,9 +335,9 @@ __device__ long long atomic64_op_agent(long long *ptr, long long *ptr2, long lon } // CHECK-LABEL: @_Z18atomicu64_op_agentPyS_yy -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent-one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("agent-one-as") monotonic, align 8{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("agent") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("agent") monotonic, align 8{{$}} __device__ unsigned long long atomicu64_op_agent(unsigned long long *ptr, unsigned long long *ptr2, unsigned long long val, unsigned long long desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_AGENT); @@ -346,18 +346,18 @@ __device__ unsigned long long atomicu64_op_agent(unsigned long long *ptr, unsign } // CHECK-LABEL: @_Z18atomic64_op_systemPxS_xx -// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: cmpxchg weak ptr {{%[0-9]+}}, i64 {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw add ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw and ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw or ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw xor ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw min ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw max ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} // CHECK: load i64, ptr %{{.*}}, align 8 -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("one-as") monotonic, align 8{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} monotonic, align 8{{$}} __device__ long long atomic64_op_system(long long *ptr, long long *ptr2, long long val, long long desired) { bool flag = __hip_atomic_compare_exchange_strong(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); flag = __hip_atomic_compare_exchange_weak(ptr, &val, desired, __ATOMIC_RELAXED, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); @@ -375,10 +375,10 @@ __device__ long long atomic64_op_system(long long *ptr, long long *ptr2, long lo } // CHECK-LABEL: @_Z19atomicu64_op_systemPyS_yy -// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} -// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} syncscope("one-as") monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umin ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} +// CHECK: atomicrmw umax ptr {{%[0-9]+}}, i64 {{%[0-9]+}} monotonic, align 8, !noalias.addrspace ![[$NOALIAS_ADDRSPACE_STACK]]{{$}} // CHECK: load i64, ptr %{{.*}}, align 8 -// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} syncscope("one-as") monotonic, align 8{{$}} +// CHECK: store atomic i64 %{{.*}}, ptr %{{.*}} monotonic, align 8{{$}} __device__ unsigned long long atomicu64_op_system(unsigned long long *ptr, unsigned long long *ptr2, unsigned long long val, unsigned long long desired) { val = __hip_atomic_fetch_min(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); val = __hip_atomic_fetch_max(ptr, val, __ATOMIC_RELAXED, __HIP_MEMORY_SCOPE_SYSTEM); diff --git a/clang/test/CodeGenCUDA/device-fun-linkage.cu b/clang/test/CodeGenCUDA/device-fun-linkage.cu index 54899e0e9c0f..bdac62d1d03e 100644 --- a/clang/test/CodeGenCUDA/device-fun-linkage.cu +++ b/clang/test/CodeGenCUDA/device-fun-linkage.cu @@ -17,8 +17,8 @@ template __device__ void func<int>(); // RDC: define weak_odr void @_Z4funcIiEvv() template __global__ void kernel<int>(); -// NORDC: define void @_Z6kernelIiEvv() -// RDC: define weak_odr void @_Z6kernelIiEvv() +// NORDC: define ptx_kernel void @_Z6kernelIiEvv() +// RDC: define weak_odr ptx_kernel void @_Z6kernelIiEvv() // Ensure that unused static device function is eliminated static __device__ void static_func() {} @@ -28,5 +28,5 @@ static __device__ void static_func() {} // Ensure that kernel function has external or weak_odr // linkage regardless static specifier static __global__ void static_kernel() {} -// NORDC: define void @_ZL13static_kernelv() -// RDC: define weak_odr void @_ZL13static_kernelv[[FILEID:.*]]() +// NORDC: define ptx_kernel void @_ZL13static_kernelv() +// RDC: define weak_odr ptx_kernel void @_ZL13static_kernelv[[FILEID:.*]]() diff --git a/clang/test/CodeGenCUDA/grid-constant.cu b/clang/test/CodeGenCUDA/grid-constant.cu index 8d4be9c9dc7e..e7000cab3cda 100644 --- a/clang/test/CodeGenCUDA/grid-constant.cu +++ b/clang/test/CodeGenCUDA/grid-constant.cu @@ -21,11 +21,11 @@ void foo() { } //. //. -// CHECK: [[META0:![0-9]+]] = !{ptr @_Z6kernel1Sii, !"kernel", i32 1, !"grid_constant", [[META1:![0-9]+]]} +// CHECK: [[META0:![0-9]+]] = !{ptr @_Z6kernel1Sii, !"grid_constant", [[META1:![0-9]+]]} // CHECK: [[META1]] = !{i32 1, i32 3} -// CHECK: [[META2:![0-9]+]] = !{ptr @_Z13tkernel_constIK1SEvT_, !"kernel", i32 1, !"grid_constant", [[META3:![0-9]+]]} +// CHECK: [[META2:![0-9]+]] = !{ptr @_Z13tkernel_constIK1SEvT_, !"grid_constant", [[META3:![0-9]+]]} // CHECK: [[META3]] = !{i32 1} -// CHECK: [[META4:![0-9]+]] = !{ptr @_Z13tkernel_constI1SEvT_, !"kernel", i32 1, !"grid_constant", [[META3]]} -// CHECK: [[META5:![0-9]+]] = !{ptr @_Z7tkernelIK1SEviT_, !"kernel", i32 1, !"grid_constant", [[META6:![0-9]+]]} +// CHECK: [[META4:![0-9]+]] = !{ptr @_Z13tkernel_constI1SEvT_, !"grid_constant", [[META3]]} +// CHECK: [[META5:![0-9]+]] = !{ptr @_Z7tkernelIK1SEviT_, !"grid_constant", [[META6:![0-9]+]]} // CHECK: [[META6]] = !{i32 2} //. diff --git a/clang/test/CodeGenCUDA/offload_via_llvm.cu b/clang/test/CodeGenCUDA/offload_via_llvm.cu index 434eba99c179..62942d8dc075 100644 --- a/clang/test/CodeGenCUDA/offload_via_llvm.cu +++ b/clang/test/CodeGenCUDA/offload_via_llvm.cu @@ -7,7 +7,7 @@ #define __OFFLOAD_VIA_LLVM__ 1 #include "Inputs/cuda.h" -// HST-LABEL: define dso_local void @_Z18__device_stub__fooisPvS_( +// HST-LABEL: define dso_local ptx_kernel void @_Z18__device_stub__fooisPvS_( // HST-SAME: i32 noundef [[TMP0:%.*]], i16 noundef signext [[TMP1:%.*]], ptr noundef [[TMP2:%.*]], ptr noundef [[TMP3:%.*]]) #[[ATTR0:[0-9]+]] { // HST-NEXT: [[ENTRY:.*:]] // HST-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4 @@ -50,7 +50,7 @@ // HST: [[SETUP_END]]: // HST-NEXT: ret void // -// DEV-LABEL: define dso_local void @_Z3fooisPvS_( +// DEV-LABEL: define dso_local ptx_kernel void @_Z3fooisPvS_( // DEV-SAME: i32 noundef [[TMP0:%.*]], i16 noundef signext [[TMP1:%.*]], ptr noundef [[TMP2:%.*]], ptr noundef [[TMP3:%.*]]) #[[ATTR0:[0-9]+]] { // DEV-NEXT: [[ENTRY:.*:]] // DEV-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4 diff --git a/clang/test/CodeGenCUDA/ptx-kernels.cu b/clang/test/CodeGenCUDA/ptx-kernels.cu index b7172b773692..a7d5e11bd496 100644 --- a/clang/test/CodeGenCUDA/ptx-kernels.cu +++ b/clang/test/CodeGenCUDA/ptx-kernels.cu @@ -10,7 +10,7 @@ extern "C" __device__ void device_function() {} -// CHECK-LABEL: define{{.*}} void @global_function +// CHECK-LABEL: define{{.*}} ptx_kernel void @global_function extern "C" __global__ void global_function() { // CHECK: call void @device_function @@ -19,7 +19,7 @@ __global__ void global_function() { // Make sure host-instantiated kernels are preserved on device side. template <typename T> __global__ void templated_kernel(T param) {} -// CHECK-DAG: define{{.*}} void @_Z16templated_kernelIiEvT_( +// CHECK-DAG: define{{.*}} ptx_kernel void @_Z16templated_kernelIiEvT_( namespace { __global__ void anonymous_ns_kernel() {} @@ -30,6 +30,3 @@ void host_function() { templated_kernel<<<0, 0>>>(0); anonymous_ns_kernel<<<0,0>>>(); } - -// CHECK: !{{[0-9]+}} = !{ptr @global_function, !"kernel", i32 1} -// CHECK: !{{[0-9]+}} = !{ptr @_Z16templated_kernelIiEvT_, !"kernel", i32 1} diff --git a/clang/test/CodeGenCUDA/usual-deallocators.cu b/clang/test/CodeGenCUDA/usual-deallocators.cu index b85a706813fc..64560efb7413 100644 --- a/clang/test/CodeGenCUDA/usual-deallocators.cu +++ b/clang/test/CodeGenCUDA/usual-deallocators.cu @@ -109,7 +109,7 @@ __host__ __device__ void tests_hd(void *t) { } // Make sure that we've generated the kernel used by A::~A. -// DEVICE-LABEL: define void @_Z1fIiEvT_ +// DEVICE-LABEL: define ptx_kernel void @_Z1fIiEvT_ // Make sure we've picked deallocator for the correct side of compilation. @@ -147,5 +147,3 @@ __host__ __device__ void tests_hd(void *t) { // COMMON-LABEL: define linkonce_odr void @_ZN8H1H2D1D2dlEPv(ptr noundef %0) // DEVICE: call void @dev_fn() // HOST: call void @host_fn() - -// DEVICE: !0 = !{ptr @_Z1fIiEvT_, !"kernel", i32 1} diff --git a/clang/test/CodeGenCXX/matrix-vector-bit-int.cpp b/clang/test/CodeGenCXX/matrix-vector-bit-int.cpp index 040615f41708..ffbce9ff8d6f 100644 --- a/clang/test/CodeGenCXX/matrix-vector-bit-int.cpp +++ b/clang/test/CodeGenCXX/matrix-vector-bit-int.cpp @@ -1,3 +1,4 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 // RUN: %clang_cc1 -fenable-matrix %s -emit-llvm -triple x86_64-unknown-linux -disable-llvm-passes -o - -std=c++11 | FileCheck %s using i8x3 = _BitInt(8) __attribute__((ext_vector_type(3))); @@ -7,92 +8,104 @@ using i32x3x3 = _BitInt(32) __attribute__((matrix_type(3, 3))); using i512x3 = _BitInt(512) __attribute__((ext_vector_type(3))); using i512x3x3 = _BitInt(512) __attribute__((matrix_type(3, 3))); -// CHECK-LABEL: define dso_local i32 @_Z2v1Dv3_DB8_(i32 %a.coerce) +// CHECK-LABEL: define dso_local i32 @_Z2v1Dv3_DB8_( +// CHECK-SAME: i32 [[A_COERCE:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[RETVAL:%.*]] = alloca <3 x i8>, align 4 +// CHECK-NEXT: [[A:%.*]] = alloca <3 x i8>, align 4 +// CHECK-NEXT: [[A_ADDR:%.*]] = alloca <3 x i8>, align 4 +// CHECK-NEXT: store i32 [[A_COERCE]], ptr [[A]], align 4 +// CHECK-NEXT: [[LOADVEC4:%.*]] = load <4 x i8>, ptr [[A]], align 4 +// CHECK-NEXT: [[A1:%.*]] = shufflevector <4 x i8> [[LOADVEC4]], <4 x i8> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[EXTRACTVEC:%.*]] = shufflevector <3 x i8> [[A1]], <3 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison> +// CHECK-NEXT: store <4 x i8> [[EXTRACTVEC]], ptr [[A_ADDR]], align 4 +// CHECK-NEXT: [[LOADVEC42:%.*]] = load <4 x i8>, ptr [[A_ADDR]], align 4 +// CHECK-NEXT: [[EXTRACTVEC3:%.*]] = shufflevector <4 x i8> [[LOADVEC42]], <4 x i8> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[LOADVEC44:%.*]] = load <4 x i8>, ptr [[A_ADDR]], align 4 +// CHECK-NEXT: [[EXTRACTVEC5:%.*]] = shufflevector <4 x i8> [[LOADVEC44]], <4 x i8> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[ADD:%.*]] = add <3 x i8> [[EXTRACTVEC3]], [[EXTRACTVEC5]] +// CHECK-NEXT: store <3 x i8> [[ADD]], ptr [[RETVAL]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[RETVAL]], align 4 +// CHECK-NEXT: ret i32 [[TMP0]] +// i8x3 v1(i8x3 a) { - // CHECK-NEXT: entry: - // CHECK-NEXT: %retval = alloca <3 x i8>, align 4 - // CHECK-NEXT: %a = alloca <3 x i8>, align 4 - // CHECK-NEXT: %a.addr = alloca <3 x i8>, align 4 - // CHECK-NEXT: store i32 %a.coerce, ptr %a, align 4 - // CHECK-NEXT: %loadVec4 = load <4 x i8>, ptr %a, align 4 - // CHECK-NEXT: %a1 = shufflevector <4 x i8> %loadVec4, <4 x i8> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %extractVec = shufflevector <3 x i8> %a1, <3 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison> - // CHECK-NEXT: store <4 x i8> %extractVec, ptr %a.addr, align 4 - // CHECK-NEXT: %loadVec42 = load <4 x i8>, ptr %a.addr, align 4 - // CHECK-NEXT: %extractVec3 = shufflevector <4 x i8> %loadVec42, <4 x i8> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %loadVec44 = load <4 x i8>, ptr %a.addr, align 4 - // CHECK-NEXT: %extractVec5 = shufflevector <4 x i8> %loadVec44, <4 x i8> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %add = add <3 x i8> %extractVec3, %extractVec5 - // CHECK-NEXT: store <3 x i8> %add, ptr %retval, align 4 - // CHECK-NEXT: %0 = load i32, ptr %retval, align 4 - // CHECK-NEXT: ret i32 %0 return a + a; } -// CHECK-LABEL: define dso_local noundef <3 x i32> @_Z2v2Dv3_DB32_(<3 x i32> noundef %a) +// CHECK-LABEL: define dso_local noundef <3 x i32> @_Z2v2Dv3_DB32_( +// CHECK-SAME: <3 x i32> noundef [[A:%.*]]) #[[ATTR1:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[A_ADDR:%.*]] = alloca <3 x i32>, align 16 +// CHECK-NEXT: [[EXTRACTVEC:%.*]] = shufflevector <3 x i32> [[A]], <3 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison> +// CHECK-NEXT: store <4 x i32> [[EXTRACTVEC]], ptr [[A_ADDR]], align 16 +// CHECK-NEXT: [[LOADVEC4:%.*]] = load <4 x i32>, ptr [[A_ADDR]], align 16 +// CHECK-NEXT: [[EXTRACTVEC1:%.*]] = shufflevector <4 x i32> [[LOADVEC4]], <4 x i32> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[LOADVEC42:%.*]] = load <4 x i32>, ptr [[A_ADDR]], align 16 +// CHECK-NEXT: [[EXTRACTVEC3:%.*]] = shufflevector <4 x i32> [[LOADVEC42]], <4 x i32> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[ADD:%.*]] = add <3 x i32> [[EXTRACTVEC1]], [[EXTRACTVEC3]] +// CHECK-NEXT: ret <3 x i32> [[ADD]] +// i32x3 v2(i32x3 a) { - // CHECK-NEXT: entry: - // CHECK-NEXT: %a.addr = alloca <3 x i32>, align 16 - // CHECK-NEXT: %extractVec = shufflevector <3 x i32> %a, <3 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison> - // CHECK-NEXT: store <4 x i32> %extractVec, ptr %a.addr, align 16 - // CHECK-NEXT: %loadVec4 = load <4 x i32>, ptr %a.addr, align 16 - // CHECK-NEXT: %extractVec1 = shufflevector <4 x i32> %loadVec4, <4 x i32> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %loadVec42 = load <4 x i32>, ptr %a.addr, align 16 - // CHECK-NEXT: %extractVec3 = shufflevector <4 x i32> %loadVec42, <4 x i32> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %add = add <3 x i32> %extractVec1, %extractVec3 - // CHECK-NEXT: ret <3 x i32> %add return a + a; } -// CHECK-LABEL: define dso_local noundef <3 x i512> @_Z2v3Dv3_DB512_(ptr noundef byval(<3 x i512>) align 256 %0) +// CHECK-LABEL: define dso_local noundef <3 x i512> @_Z2v3Dv3_DB512_( +// CHECK-SAME: ptr noundef byval(<3 x i512>) align 256 [[TMP0:%.*]]) #[[ATTR2:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[A_ADDR:%.*]] = alloca <3 x i512>, align 256 +// CHECK-NEXT: [[LOADVEC4:%.*]] = load <4 x i512>, ptr [[TMP0]], align 256 +// CHECK-NEXT: [[A:%.*]] = shufflevector <4 x i512> [[LOADVEC4]], <4 x i512> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[EXTRACTVEC:%.*]] = shufflevector <3 x i512> [[A]], <3 x i512> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison> +// CHECK-NEXT: store <4 x i512> [[EXTRACTVEC]], ptr [[A_ADDR]], align 256 +// CHECK-NEXT: [[LOADVEC41:%.*]] = load <4 x i512>, ptr [[A_ADDR]], align 256 +// CHECK-NEXT: [[EXTRACTVEC2:%.*]] = shufflevector <4 x i512> [[LOADVEC41]], <4 x i512> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[LOADVEC43:%.*]] = load <4 x i512>, ptr [[A_ADDR]], align 256 +// CHECK-NEXT: [[EXTRACTVEC4:%.*]] = shufflevector <4 x i512> [[LOADVEC43]], <4 x i512> poison, <3 x i32> <i32 0, i32 1, i32 2> +// CHECK-NEXT: [[ADD:%.*]] = add <3 x i512> [[EXTRACTVEC2]], [[EXTRACTVEC4]] +// CHECK-NEXT: ret <3 x i512> [[ADD]] +// i512x3 v3(i512x3 a) { - // CHECK-NEXT: entry: - // CHECK-NEXT: %a.addr = alloca <3 x i512>, align 256 - // CHECK-NEXT: %loadVec4 = load <4 x i512>, ptr %0, align 256 - // CHECK-NEXT: %a = shufflevector <4 x i512> %loadVec4, <4 x i512> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %extractVec = shufflevector <3 x i512> %a, <3 x i512> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 poison> - // CHECK-NEXT: store <4 x i512> %extractVec, ptr %a.addr, align 256 - // CHECK-NEXT: %loadVec41 = load <4 x i512>, ptr %a.addr, align 256 - // CHECK-NEXT: %extractVec2 = shufflevector <4 x i512> %loadVec41, <4 x i512> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %loadVec43 = load <4 x i512>, ptr %a.addr, align 256 - // CHECK-NEXT: %extractVec4 = shufflevector <4 x i512> %loadVec43, <4 x i512> poison, <3 x i32> <i32 0, i32 1, i32 2> - // CHECK-NEXT: %add = add <3 x i512> %extractVec2, %extractVec4 - // CHECK-NEXT: ret <3 x i512> %add return a + a; } -// CHECK-LABEL: define dso_local noundef <9 x i8> @_Z2m1u11matrix_typeILm3ELm3EDB8_E(<9 x i8> noundef %a) +// CHECK-LABEL: define dso_local noundef <9 x i8> @_Z2m1u11matrix_typeILm3ELm3EDB8_E( +// CHECK-SAME: <9 x i8> noundef [[A:%.*]]) #[[ATTR3:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[A_ADDR:%.*]] = alloca [9 x i8], align 1 +// CHECK-NEXT: store <9 x i8> [[A]], ptr [[A_ADDR]], align 1 +// CHECK-NEXT: [[TMP0:%.*]] = load <9 x i8>, ptr [[A_ADDR]], align 1 +// CHECK-NEXT: [[TMP1:%.*]] = load <9 x i8>, ptr [[A_ADDR]], align 1 +// CHECK-NEXT: [[TMP2:%.*]] = add <9 x i8> [[TMP0]], [[TMP1]] +// CHECK-NEXT: ret <9 x i8> [[TMP2]] +// i8x3x3 m1(i8x3x3 a) { - // CHECK-NEXT: entry: - // CHECK-NEXT: %a.addr = alloca [9 x i8], align 1 - // CHECK-NEXT: store <9 x i8> %a, ptr %a.addr, align 1 - // CHECK-NEXT: %0 = load <9 x i8>, ptr %a.addr, align 1 - // CHECK-NEXT: %1 = load <9 x i8>, ptr %a.addr, align 1 - // CHECK-NEXT: %2 = add <9 x i8> %0, %1 - // CHECK-NEXT: ret <9 x i8> %2 return a + a; } -// CHECK-LABEL: define dso_local noundef <9 x i32> @_Z2m2u11matrix_typeILm3ELm3EDB32_E(<9 x i32> noundef %a) +// CHECK-LABEL: define dso_local noundef <9 x i32> @_Z2m2u11matrix_typeILm3ELm3EDB32_E( +// CHECK-SAME: <9 x i32> noundef [[A:%.*]]) #[[ATTR4:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[A_ADDR:%.*]] = alloca [9 x i32], align 4 +// CHECK-NEXT: store <9 x i32> [[A]], ptr [[A_ADDR]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = load <9 x i32>, ptr [[A_ADDR]], align 4 +// CHECK-NEXT: [[TMP1:%.*]] = load <9 x i32>, ptr [[A_ADDR]], align 4 +// CHECK-NEXT: [[TMP2:%.*]] = add <9 x i32> [[TMP0]], [[TMP1]] +// CHECK-NEXT: ret <9 x i32> [[TMP2]] +// i32x3x3 m2(i32x3x3 a) { - // CHECK-NEXT: entry: - // CHECK-NEXT: %a.addr = alloca [9 x i32], align 4 - // CHECK-NEXT: store <9 x i32> %a, ptr %a.addr, align 4 - // CHECK-NEXT: %0 = load <9 x i32>, ptr %a.addr, align 4 - // CHECK-NEXT: %1 = load <9 x i32>, ptr %a.addr, align 4 - // CHECK-NEXT: %2 = add <9 x i32> %0, %1 - // CHECK-NEXT: ret <9 x i32> %2 return a + a; } -// CHECK-LABEL: define dso_local noundef <9 x i512> @_Z2m3u11matrix_typeILm3ELm3EDB512_E(<9 x i512> noundef %a) +// CHECK-LABEL: define dso_local noundef <9 x i512> @_Z2m3u11matrix_typeILm3ELm3EDB512_E( +// CHECK-SAME: <9 x i512> noundef [[A:%.*]]) #[[ATTR5:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[A_ADDR:%.*]] = alloca [9 x i512], align 8 +// CHECK-NEXT: store <9 x i512> [[A]], ptr [[A_ADDR]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load <9 x i512>, ptr [[A_ADDR]], align 8 +// CHECK-NEXT: [[TMP1:%.*]] = load <9 x i512>, ptr [[A_ADDR]], align 8 +// CHECK-NEXT: [[TMP2:%.*]] = add <9 x i512> [[TMP0]], [[TMP1]] +// CHECK-NEXT: ret <9 x i512> [[TMP2]] +// i512x3x3 m3(i512x3x3 a) { - // CHECK-NEXT: entry: - // CHECK-NEXT: %a.addr = alloca [9 x i512], align 8 - // CHECK-NEXT: store <9 x i512> %a, ptr %a.addr, align 8 - // CHECK-NEXT: %0 = load <9 x i512>, ptr %a.addr, align 8 - // CHECK-NEXT: %1 = load <9 x i512>, ptr %a.addr, align 8 - // CHECK-NEXT: %2 = add <9 x i512> %0, %1 - // CHECK-NEXT: ret <9 x i512> %2 return a + a; } diff --git a/clang/test/CodeGenHLSL/builtins/RWBuffer-subscript.hlsl b/clang/test/CodeGenHLSL/builtins/RWBuffer-subscript.hlsl index 4428b77dd9ec..2ad5b82a0291 100644 --- a/clang/test/CodeGenHLSL/builtins/RWBuffer-subscript.hlsl +++ b/clang/test/CodeGenHLSL/builtins/RWBuffer-subscript.hlsl @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -o - -O0 %s | FileCheck %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -o - -O0 %s | FileCheck %s --check-prefixes=DXC,CHECK +// RUN: %clang_cc1 -triple spirv1.6-pc-vulkan1.3-compute -emit-llvm -o - -O0 %s | FileCheck %s --check-prefixes=SPIRV,CHECK RWBuffer<int> In; RWBuffer<int> Out; @@ -7,15 +8,19 @@ RWBuffer<int> Out; void main(unsigned GI : SV_GroupIndex) { // CHECK: define void @main() - // CHECK: %[[INPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // DXC: %[[INPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // SPIRV: %[[INPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %{{.*}}, i32 %{{.*}}) // CHECK: %[[LOAD:.*]] = load i32, ptr %[[INPTR]] - // CHECK: %[[OUTPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // DXC: %[[OUTPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // SPIRV: %[[OUTPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %{{.*}}, i32 %{{.*}}) // CHECK: store i32 %[[LOAD]], ptr %[[OUTPTR]] Out[GI] = In[GI]; - // CHECK: %[[INPTR:.*]] = call ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // DXC: %[[INPTR:.*]] = call ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // SPIRV: %[[INPTR:.*]] = call ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %{{.*}}, i32 %{{.*}}) // CHECK: %[[LOAD:.*]] = load i32, ptr %[[INPTR]] - // CHECK: %[[OUTPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // DXC: %[[OUTPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_i32_1_0_1t(target("dx.TypedBuffer", i32, 1, 0, 1) %{{.*}}, i32 %{{.*}}) + // SPIRV: %[[OUTPTR:.*]] = call noundef nonnull align 4 dereferenceable(4) ptr @llvm.spv.resource.getpointer.p0.tspirv.Image_i32_5_2_0_0_2_0t(target("spirv.Image", i32, 5, 2, 0, 0, 2, 0) %{{.*}}, i32 %{{.*}}) // CHECK: store i32 %[[LOAD]], ptr %[[OUTPTR]] Out[GI] = In.Load(GI); } diff --git a/clang/test/CodeGenHLSL/debug/rwbuffer_debug_info.hlsl b/clang/test/CodeGenHLSL/debug/rwbuffer_debug_info.hlsl new file mode 100644 index 000000000000..db0388e41eae --- /dev/null +++ b/clang/test/CodeGenHLSL/debug/rwbuffer_debug_info.hlsl @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s -debug-info-kind=standalone -dwarf-version=4 | FileCheck %s + + +// CHECK: [[DWTag:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "RWBuffer<float>", +// CHECK: [[RWBuffer:![0-9]+]] = distinct !DISubprogram(name: "RWBuffer", +// CHECK-SAME: scope: [[DWTag]] +// CHECK: [[FirstThis:![0-9]+]] = !DILocalVariable(name: "this", arg: 1, scope: [[RWBuffer]], type: [[thisType:![0-9]+]] +// CHECK: [[thisType]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: [[DWTag]], size: 32) +RWBuffer<float> Out : register(u7, space4); + +[numthreads(8,1,1)] +void main(int GI : SV_GroupIndex) { + Out[GI] = 0; +} diff --git a/clang/test/CodeGenHLSL/semantics/SV_GroupID.hlsl b/clang/test/CodeGenHLSL/semantics/SV_GroupID.hlsl index 5e09f0fe06d4..3aa054afc904 100644 --- a/clang/test/CodeGenHLSL/semantics/SV_GroupID.hlsl +++ b/clang/test/CodeGenHLSL/semantics/SV_GroupID.hlsl @@ -1,32 +1,36 @@ -// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL -DTARGET=dx +// RUN: %clang_cc1 -triple spirv-linux-vulkan-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV -DTARGET=spv -// Make sure SV_GroupID translated into dx.group.id. +// Make sure SV_GroupID translated into dx.group.id for directx target and spv.group.id for spirv target. -// CHECK: define void @foo() -// CHECK: %[[#ID:]] = call i32 @llvm.dx.group.id(i32 0) -// CHECK: call void @{{.*}}foo{{.*}}(i32 %[[#ID]]) +// CHECK: define void @foo() +// CHECK: %[[#ID:]] = call i32 @llvm.[[TARGET]].group.id(i32 0) +// CHECK-DXIL: call void @{{.*}}foo{{.*}}(i32 %[[#ID]]) +// CHECK-SPIRV: call spir_func void @{{.*}}foo{{.*}}(i32 %[[#ID]]) [shader("compute")] [numthreads(8,8,1)] void foo(uint Idx : SV_GroupID) {} -// CHECK: define void @bar() -// CHECK: %[[#ID_X:]] = call i32 @llvm.dx.group.id(i32 0) -// CHECK: %[[#ID_X_:]] = insertelement <2 x i32> poison, i32 %[[#ID_X]], i64 0 -// CHECK: %[[#ID_Y:]] = call i32 @llvm.dx.group.id(i32 1) -// CHECK: %[[#ID_XY:]] = insertelement <2 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1 -// CHECK: call void @{{.*}}bar{{.*}}(<2 x i32> %[[#ID_XY]]) +// CHECK: define void @bar() +// CHECK: %[[#ID_X:]] = call i32 @llvm.[[TARGET]].group.id(i32 0) +// CHECK: %[[#ID_X_:]] = insertelement <2 x i32> poison, i32 %[[#ID_X]], i64 0 +// CHECK: %[[#ID_Y:]] = call i32 @llvm.[[TARGET]].group.id(i32 1) +// CHECK: %[[#ID_XY:]] = insertelement <2 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1 +// CHECK-DXIL: call void @{{.*}}bar{{.*}}(<2 x i32> %[[#ID_XY]]) +// CHECK-SPIRV: call spir_func void @{{.*}}bar{{.*}}(<2 x i32> %[[#ID_XY]]) [shader("compute")] [numthreads(8,8,1)] void bar(uint2 Idx : SV_GroupID) {} // CHECK: define void @test() -// CHECK: %[[#ID_X:]] = call i32 @llvm.dx.group.id(i32 0) +// CHECK: %[[#ID_X:]] = call i32 @llvm.[[TARGET]].group.id(i32 0) // CHECK: %[[#ID_X_:]] = insertelement <3 x i32> poison, i32 %[[#ID_X]], i64 0 -// CHECK: %[[#ID_Y:]] = call i32 @llvm.dx.group.id(i32 1) +// CHECK: %[[#ID_Y:]] = call i32 @llvm.[[TARGET]].group.id(i32 1) // CHECK: %[[#ID_XY:]] = insertelement <3 x i32> %[[#ID_X_]], i32 %[[#ID_Y]], i64 1 -// CHECK: %[[#ID_Z:]] = call i32 @llvm.dx.group.id(i32 2) +// CHECK: %[[#ID_Z:]] = call i32 @llvm.[[TARGET]].group.id(i32 2) // CHECK: %[[#ID_XYZ:]] = insertelement <3 x i32> %[[#ID_XY]], i32 %[[#ID_Z]], i64 2 -// CHECK: call void @{{.*}}test{{.*}}(<3 x i32> %[[#ID_XYZ]]) +// CHECK-DXIL: call void @{{.*}}test{{.*}}(<3 x i32> %[[#ID_XYZ]]) +// CHECK-SPIRV: call spir_func void @{{.*}}test{{.*}}(<3 x i32> %[[#ID_XYZ]]) [shader("compute")] [numthreads(8,8,1)] void test(uint3 Idx : SV_GroupID) {} diff --git a/clang/test/CodeGenOpenCL/ptx-calls.cl b/clang/test/CodeGenOpenCL/ptx-calls.cl index 0081152ae40e..ae187173b173 100644 --- a/clang/test/CodeGenOpenCL/ptx-calls.cl +++ b/clang/test/CodeGenOpenCL/ptx-calls.cl @@ -7,7 +7,5 @@ void device_function() { __kernel void kernel_function() { device_function(); } -// CHECK-LABEL: define{{.*}} spir_kernel void @kernel_function() +// CHECK-LABEL: define{{.*}} ptx_kernel void @kernel_function() // CHECK: call void @device_function() -// CHECK: !{{[0-9]+}} = !{ptr @kernel_function, !"kernel", i32 1} - diff --git a/clang/test/CodeGenOpenCL/ptx-kernels.cl b/clang/test/CodeGenOpenCL/ptx-kernels.cl index 210e5682ac72..eac0df4abfbe 100644 --- a/clang/test/CodeGenOpenCL/ptx-kernels.cl +++ b/clang/test/CodeGenOpenCL/ptx-kernels.cl @@ -6,6 +6,4 @@ void device_function() { __kernel void kernel_function() { } -// CHECK-LABEL: define{{.*}} spir_kernel void @kernel_function() - -// CHECK: !{{[0-9]+}} = !{ptr @kernel_function, !"kernel", i32 1} +// CHECK-LABEL: define{{.*}} ptx_kernel void @kernel_function() diff --git a/clang/test/CodeGenOpenCL/reflect.cl b/clang/test/CodeGenOpenCL/reflect.cl index 9ae4a5f027d3..f5b618f6a35d 100644 --- a/clang/test/CodeGenOpenCL/reflect.cl +++ b/clang/test/CodeGenOpenCL/reflect.cl @@ -12,8 +12,8 @@ bool device_function() { return __nvvm_reflect("__CUDA_ARCH") >= 700; } -// CHECK-LABEL: define dso_local spir_kernel void @kernel_function( -// CHECK-SAME: ptr addrspace(1) noundef align 4 [[I:%.*]]) #[[ATTR2:[0-9]+]] !kernel_arg_addr_space !4 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_base_type !6 !kernel_arg_type_qual !7 { +// CHECK-LABEL: define dso_local ptx_kernel void @kernel_function( +// CHECK-SAME: ptr addrspace(1) noundef align 4 [[I:%.*]]) #[[ATTR2:[0-9]+]] !kernel_arg_addr_space [[META3:![0-9]+]] !kernel_arg_access_qual [[META4:![0-9]+]] !kernel_arg_type [[META5:![0-9]+]] !kernel_arg_base_type [[META5]] !kernel_arg_type_qual [[META6:![0-9]+]] { // CHECK-NEXT: entry: // CHECK-NEXT: [[I_ADDR:%.*]] = alloca ptr addrspace(1), align 4 // CHECK-NEXT: store ptr addrspace(1) [[I]], ptr [[I_ADDR]], align 4 @@ -26,3 +26,9 @@ bool device_function() { __kernel void kernel_function(__global int *i) { *i = device_function(); } +//. +// CHECK: [[META3]] = !{i32 1} +// CHECK: [[META4]] = !{!"none"} +// CHECK: [[META5]] = !{!"int*"} +// CHECK: [[META6]] = !{!""} +//. diff --git a/clang/test/CodeGenSPIRV/Builtins/distance.c b/clang/test/CodeGenSPIRV/Builtins/distance.c new file mode 100644 index 000000000000..76c684b932c1 --- /dev/null +++ b/clang/test/CodeGenSPIRV/Builtins/distance.c @@ -0,0 +1,31 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 + +// RUN: %clang_cc1 -O1 -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s + +typedef float float2 __attribute__((ext_vector_type(2))); +typedef float float3 __attribute__((ext_vector_type(3))); +typedef float float4 __attribute__((ext_vector_type(4))); + +// CHECK-LABEL: define spir_func float @test_distance_float2( +// CHECK-SAME: <2 x float> noundef [[X:%.*]], <2 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[SPV_DISTANCE:%.*]] = tail call float @llvm.spv.distance.v2f32(<2 x float> [[X]], <2 x float> [[Y]]) +// CHECK-NEXT: ret float [[SPV_DISTANCE]] +// +float test_distance_float2(float2 X, float2 Y) { return __builtin_spirv_distance(X, Y); } + +// CHECK-LABEL: define spir_func float @test_distance_float3( +// CHECK-SAME: <3 x float> noundef [[X:%.*]], <3 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[SPV_DISTANCE:%.*]] = tail call float @llvm.spv.distance.v3f32(<3 x float> [[X]], <3 x float> [[Y]]) +// CHECK-NEXT: ret float [[SPV_DISTANCE]] +// +float test_distance_float3(float3 X, float3 Y) { return __builtin_spirv_distance(X, Y); } + +// CHECK-LABEL: define spir_func float @test_distance_float4( +// CHECK-SAME: <4 x float> noundef [[X:%.*]], <4 x float> noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[SPV_DISTANCE:%.*]] = tail call float @llvm.spv.distance.v4f32(<4 x float> [[X]], <4 x float> [[Y]]) +// CHECK-NEXT: ret float [[SPV_DISTANCE]] +// +float test_distance_float4(float4 X, float4 Y) { return __builtin_spirv_distance(X, Y); } diff --git a/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/include/.keep b/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/include/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/include/.keep diff --git a/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/local/include/.keep b/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/local/include/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/clang/test/Driver/Inputs/MacOSX15.1.sdk/embedded/usr/local/include/.keep diff --git a/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/include/c++/v1/.keep b/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/include/c++/v1/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/include/c++/v1/.keep diff --git a/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/local/include/.keep b/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/local/include/.keep new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/clang/test/Driver/Inputs/MacOSX15.1.sdk/usr/local/include/.keep diff --git a/clang/test/Driver/Inputs/config-zos/clang.cfg b/clang/test/Driver/Inputs/config-zos/clang.cfg new file mode 100644 index 000000000000..43a5dbfaa618 --- /dev/null +++ b/clang/test/Driver/Inputs/config-zos/clang.cfg @@ -0,0 +1 @@ +-DABC=123 diff --git a/clang/test/Driver/Inputs/config-zos/def.cfg b/clang/test/Driver/Inputs/config-zos/def.cfg new file mode 100644 index 000000000000..156f9c85fb4f --- /dev/null +++ b/clang/test/Driver/Inputs/config-zos/def.cfg @@ -0,0 +1 @@ +-DDEF=456 diff --git a/clang/test/Driver/Inputs/config-zos/tst/def.cfg b/clang/test/Driver/Inputs/config-zos/tst/def.cfg new file mode 100644 index 000000000000..156f9c85fb4f --- /dev/null +++ b/clang/test/Driver/Inputs/config-zos/tst/def.cfg @@ -0,0 +1 @@ +-DDEF=456 diff --git a/clang/test/Driver/Inputs/spirv-openmp/lib/libomptarget-spirv64.bc b/clang/test/Driver/Inputs/spirv-openmp/lib/libomptarget-spirv64.bc new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/clang/test/Driver/Inputs/spirv-openmp/lib/libomptarget-spirv64.bc diff --git a/clang/test/Driver/amdgpu-openmp-toolchain.c b/clang/test/Driver/amdgpu-openmp-toolchain.c index f596708047c1..1c2ee2617313 100644 --- a/clang/test/Driver/amdgpu-openmp-toolchain.c +++ b/clang/test/Driver/amdgpu-openmp-toolchain.c @@ -81,3 +81,7 @@ // RUN: %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp --offload-arch=gfx803 \ // RUN: -stdlib=libc++ -nogpulib %s 2>&1 | FileCheck %s --check-prefix=LIBCXX // LIBCXX-NOT: include/amdgcn-amd-amdhsa/c++/v1 + +// RUN: %clang -### -target x86_64-pc-linux-gnu -nogpulib -fopenmp --offload-arch=gfx90a \ +// RUN: -ftime-report %s 2>&1 | FileCheck %s --check-prefix=CHECK-TIME-REPORT +// CHECK-TIME-REPORT: clang-linker-wrapper{{.*}}"--device-compiler=-ftime-report" diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index c975727839c0..29a0fcbc17ac 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -739,6 +739,8 @@ // RUN: -fimplicit-modules \ // RUN: -fno-implicit-modules \ // RUN: -ftrivial-auto-var-init=zero \ +// RUN: -fwrapv \ +// RUN: -fno-wrapv \ // RUN: --version \ // RUN: -Werror /Zs -- %s 2>&1 diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c index ddbf1fd951c8..2b72068eae1e 100644 --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -364,6 +364,7 @@ // RUN: -fno-devirtualize-speculatively \ // RUN: -fslp-vectorize-aggressive \ // RUN: -fno-slp-vectorize-aggressive \ +// RUN: -forder-file-instrumentation \ // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s // CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported // CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported @@ -423,6 +424,7 @@ // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is not supported // CHECK-WARNING-DAG: the flag '-fslp-vectorize-aggressive' has been deprecated and will be ignored // CHECK-WARNING-DAG: the flag '-fno-slp-vectorize-aggressive' has been deprecated and will be ignored +// CHECK-WARNING-DAG: argument '-forder-file-instrumentation' is deprecated, use '-mllvm -pgo-temporal-instrumentation' instead // Test that we mute the warning on these // RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument \ diff --git a/clang/test/Driver/config-zos.c b/clang/test/Driver/config-zos.c new file mode 100644 index 000000000000..8de02ec101b9 --- /dev/null +++ b/clang/test/Driver/config-zos.c @@ -0,0 +1,17 @@ +// REQUIRES: shell +// REQUIRES: systemz-registered-target + +// RUN: unset CLANG_NO_DEFAULT_CONFIG +// RUN: rm -rf %t && mkdir %t + +// RUN: mkdir -p %t/testbin +// RUN: mkdir -p %t/etc +// RUN: ln -s %clang %t/testbin/clang +// RUN: echo "-DXYZ=789" >%t/etc/clang.cfg +// RUN: %t/testbin/clang --target=s390x-ibm-zos -c -### -no-canonical-prefixes %s 2>&1 | FileCheck -DDIR=%t %s +// RUN: %t/testbin/clang --target=s390x-ibm-zos -c -### -no-canonical-prefixes --no-default-config %s 2>&1 | FileCheck -check-prefix=NOCONFIG %s +// +// CHECK: Configuration file: [[DIR]]/etc/clang.cfg +// CHECK: "-D" "XYZ=789" +// NOCONFIG-NOT: Configuration file: {{.*}}/etc/clang.cfg +// NOCONFIG-NOT: "-D" "XYZ=789" diff --git a/clang/test/Driver/config-zos1.c b/clang/test/Driver/config-zos1.c new file mode 100644 index 000000000000..5b1012d00736 --- /dev/null +++ b/clang/test/Driver/config-zos1.c @@ -0,0 +1,23 @@ +// REQUIRES: shell +// REQUIRES: systemz-registered-target + +// RUN: unset CLANG_NO_DEFAULT_CONFIG + +// RUN: export CLANG_CONFIG_PATH=%S/Inputs/config-zos +// RUN: %clang --target=s390x-ibm-zos -c -### %s 2>&1 | FileCheck %s +// CHECK: Configuration file: {{.*}}/Inputs/config-zos/clang.cfg +// CHECK: "-D" "ABC=123" + +// RUN: export CLANG_CONFIG_PATH=%S/Inputs/config-zos/def.cfg +// RUN: %clang --target=s390x-ibm-zos -c -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEF +// CHECK-DEF: Configuration file: {{.*}}/Inputs/config-zos/def.cfg +// CHECK-DEF: "-D" "DEF=456" + +// RUN: export CLANG_CONFIG_PATH=%S/Inputs/config-zos/Garbage +// RUN: not %clang --target=s390x-ibm-zos -c -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-ERR +// CHECK-ERR: error: configuration file '{{.*}}/Inputs/config-zos/Garbage' cannot be found + +// The directory exists but no clang.cfg in it +// RUN: export CLANG_CONFIG_PATH=%S/Inputs/config-zos/tst +// RUN: not %clang --target=s390x-ibm-zos -c -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-ERRDIR +// CHECK-ERRDIR: error: configuration file '{{.*}}/Inputs/config-zos/tst/clang.cfg' cannot be found diff --git a/clang/test/Driver/darwin-embedded-search-paths-libcxx.c b/clang/test/Driver/darwin-embedded-search-paths-libcxx.c new file mode 100644 index 000000000000..0f9a8467b061 --- /dev/null +++ b/clang/test/Driver/darwin-embedded-search-paths-libcxx.c @@ -0,0 +1,45 @@ +// REQUIRES: default-cxx-stdlib=libc++ +// UNSUPPORTED: system-windows +// Windows is unsupported because we use the Unix path separator `/` in the test. + +// Unlike the Darwin driver, the MachO driver doesn't add any framework search paths, +// only the normal header ones. +// RUN: %clang -x c -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,NO-CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// Unlike the Darwin driver, the MachO driver doesn't default to libc++, but when +// CLANG_DEFAULT_CXX_STDLIB is libc++ then the MachO driver should find the search path. +// RUN: %clang -x c++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// If the user requests libc++, the MachO driver should still find the search path. +// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// Verify that embedded uses can swap in alternate usr/include and usr/local/include directories. +// usr/local/include is specified in the driver as -internal-isystem, however, the driver generated +// paths come before the paths in the driver arguments. In order to keep usr/local/include in the +// same position, -isystem has to be used instead of -Xclang -internal-isystem. There isn't an +// -externc-isystem, but it's ok to use -Xclang -internal-externc-isystem since the driver doesn't +// use that if -nostdlibinc or -nostdinc is passed. +// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk \ +// RUN: -nostdlibinc -isystem %S/Inputs/MacOSX15.1.sdk/embedded/usr/local/include \ +// RUN: -Xclang -internal-externc-isystem -Xclang %S/Inputs/MacOSX15.1.sdk/embedded/usr/include \ +// RUN: -### -c %s 2>&1 | FileCheck --check-prefixes=CC1,NO-CXX,EULI,CI,EUI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + + +// The ordering of these flags doesn't matter, and so this test is a little +// fragile. i.e. all of the -internal-isystem paths will be searched before the +// -internal-externc-isystem ones, and their order on the command line doesn't +// matter. The line order here is just the current order that the driver writes +// the cc1 arguments. + +// CC1: "-cc1" +// NO-CXX-NOT: "-internal-isystem" "{{.*}}/include/c++/v1" +// CXX-SAME: "-internal-isystem" "{{.*}}/include/c++/v1" +// ULI-SAME: "-internal-isystem" "[[SDKROOT]]/usr/local/include" +// EULI-SAME: "-isystem" "[[SDKROOT]]/embedded/usr/local/include" +// CI-SAME: "-internal-isystem" "{{.*}}/clang/{{[[:digit:].]*}}/include" +// UI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/usr/include" +// EUI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/embedded/usr/include" +// NO-FW-NOT: "-internal-iframework" diff --git a/clang/test/Driver/darwin-embedded-search-paths.c b/clang/test/Driver/darwin-embedded-search-paths.c new file mode 100644 index 000000000000..bd651b7a1cd1 --- /dev/null +++ b/clang/test/Driver/darwin-embedded-search-paths.c @@ -0,0 +1,46 @@ +// REQUIRES: !(default-cxx-stdlib=libc++) +// UNSUPPORTED: system-windows +// Windows is unsupported because we use the Unix path separator `/` in the test. + +// Unlike the Darwin driver, the MachO driver doesn't add any framework search paths, +// only the normal header ones. +// RUN: %clang -x c -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,NO-CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// Unlike the Darwin driver, the MachO driver doesn't default to libc++, and unless +// CLANG_DEFAULT_CXX_STDLIB is libc++ it won't add any search paths. +// RUN: %clang -x c++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,NO-CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// However, if the user requests libc++, the MachO driver should find the search path. +// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk -### -c %s 2>&1 \ +// RUN: | FileCheck --check-prefixes=CC1,CXX,ULI,CI,UI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + +// Verify that embedded uses can swap in alternate usr/include and usr/local/include directories. +// usr/local/include is specified in the driver as -internal-isystem, however, the driver generated +// paths come before the paths in the driver arguments. In order to keep usr/local/include in the +// same position, -isystem has to be used instead of -Xclang -internal-isystem. There isn't an +// -externc-isystem, but it's ok to use -Xclang -internal-externc-isystem since the driver doesn't +// use that if -nostdlibinc or -nostdinc is passed. +// RUN: %clang -x c++ -stdlib=libc++ -target arm64-apple-none-macho -isysroot %S/Inputs/MacOSX15.1.sdk \ +// RUN: -nostdlibinc -isystem %S/Inputs/MacOSX15.1.sdk/embedded/usr/local/include \ +// RUN: -Xclang -internal-externc-isystem -Xclang %S/Inputs/MacOSX15.1.sdk/embedded/usr/include \ +// RUN: -### -c %s 2>&1 | FileCheck --check-prefixes=CC1,NO-CXX,EULI,CI,EUI,NO-FW -DSDKROOT=%S/Inputs/MacOSX15.1.sdk %s + + +// The ordering of these flags doesn't matter, and so this test is a little +// fragile. i.e. all of the -internal-isystem paths will be searched before the +// -internal-externc-isystem ones, and their order on the command line doesn't +// matter. The line order here is just the current order that the driver writes +// the cc1 arguments. + +// CC1: "-cc1" +// CC1: "-resource-dir" "[[RESOURCE_DIR:[^"]*]]" +// NO-CXX-NOT: "-internal-isystem" "{{.*}}/include/c++/v1" +// CXX-SAME: "-internal-isystem" "{{.*}}/include/c++/v1" +// ULI-SAME: "-internal-isystem" "[[SDKROOT]]/usr/local/include" +// EULI-SAME: "-isystem" "[[SDKROOT]]/embedded/usr/local/include" +// CI-SAME: "-internal-isystem" "[[RESOURCE_DIR]]/include" +// UI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/usr/include" +// EUI-SAME: "-internal-externc-isystem" "[[SDKROOT]]/embedded/usr/include" +// NO-FW-NOT: "-internal-iframework" diff --git a/clang/test/Driver/hip-device-libs.hip b/clang/test/Driver/hip-device-libs.hip index 6f1d31508e33..317fd7924269 100644 --- a/clang/test/Driver/hip-device-libs.hip +++ b/clang/test/Driver/hip-device-libs.hip @@ -253,5 +253,5 @@ // NOABI4-NOT: error: // NOABI4-NOT: "-mlink-builtin-bitcode" "{{.*}}oclc_abi_version_400.bc" // NOABI4-NOT: "-mlink-builtin-bitcode" "{{.*}}oclc_abi_version_500.bc" -// NOABI5: error: cannot find ROCm device libraryfor ABI version 5; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library -// NOABI6: error: cannot find ROCm device libraryfor ABI version 6; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library +// NOABI5: error: cannot find ROCm device library for ABI version 5; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library +// NOABI6: error: cannot find ROCm device library for ABI version 6; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library diff --git a/clang/test/Driver/lto.c b/clang/test/Driver/lto.c index 5be95013f00d..a85f953af37a 100644 --- a/clang/test/Driver/lto.c +++ b/clang/test/Driver/lto.c @@ -114,3 +114,9 @@ // // CHECK-GISEL: "-plugin-opt=-global-isel=1" // CHECK-DISABLE-GISEL: "-plugin-opt=-global-isel=0" + +// -flto passes -time-passes when -ftime-report is passed +// RUN: %clang --target=x86_64-unknown-linux-gnu -### %s -flto -ftime-report 2> %t +// RUN: FileCheck --check-prefix=CHECK-TIME-REPORT < %t %s + +// CHECK-TIME-REPORT: "-plugin-opt=-time-passes" diff --git a/clang/test/Driver/mingw.cpp b/clang/test/Driver/mingw.cpp index 9790c86a364f..66da0c97f416 100644 --- a/clang/test/Driver/mingw.cpp +++ b/clang/test/Driver/mingw.cpp @@ -85,6 +85,10 @@ // RUN: | FileCheck %s --check-prefix CHECK_MINGW_EC_LINK // CHECK_MINGW_EC_LINK: "-m" "arm64ecpe" +// RUN: %clang --target=mipsel-windows-gnu -### -o /dev/null %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK_MINGW_MIPSPE +// CHECK_MINGW_MIPSPE: "-m" "mipspe" + // RUN: %clang --target=i686-windows-gnu -fms-hotpatch -### -- %s 2>&1 \ // RUN: | FileCheck %s --check-prefix=FUNCTIONPADMIN // FUNCTIONPADMIN: "--functionpadmin" diff --git a/clang/test/Driver/print-supported-extensions-riscv.c b/clang/test/Driver/print-supported-extensions-riscv.c index 8344c1aa3997..a8d9fcd8569c 100644 --- a/clang/test/Driver/print-supported-extensions-riscv.c +++ b/clang/test/Driver/print-supported-extensions-riscv.c @@ -185,10 +185,15 @@ // CHECK-NEXT: zalasr 0.1 'Zalasr' (Load-Acquire and Store-Release Instructions) // CHECK-NEXT: zvbc32e 0.7 'Zvbc32e' (Vector Carryless Multiplication with 32-bits elements) // CHECK-NEXT: zvkgs 0.7 'Zvkgs' (Vector-Scalar GCM instructions for Cryptography) +// CHECK-NEXT: sdext 1.0 'Sdext' (External debugger) +// CHECK-NEXT: sdtrig 1.0 'Sdtrig' (Debugger triggers) // CHECK-NEXT: smctr 1.0 'Smctr' (Control Transfer Records Machine Level) // CHECK-NEXT: ssctr 1.0 'Ssctr' (Control Transfer Records Supervisor Level) // CHECK-NEXT: svukte 0.3 'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses) // CHECK-NEXT: xqcia 0.2 'Xqcia' (Qualcomm uC Arithmetic Extension) +// CHECK-NEXT: xqciac 0.2 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension) +// CHECK-NEXT: xqcicli 0.2 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension) +// CHECK-NEXT: xqcicm 0.2 'Xqcicm' (Qualcomm uC Conditional Move Extension) // CHECK-NEXT: xqcics 0.2 'Xqcics' (Qualcomm uC Conditional Select Extension) // CHECK-NEXT: xqcicsr 0.2 'Xqcicsr' (Qualcomm uC CSR Extension) // CHECK-NEXT: xqcilsm 0.2 'Xqcilsm' (Qualcomm uC Load Store Multiple Extension) diff --git a/clang/test/Driver/riscv-cpus.c b/clang/test/Driver/riscv-cpus.c index 1b09945620f8..e97b6940662d 100644 --- a/clang/test/Driver/riscv-cpus.c +++ b/clang/test/Driver/riscv-cpus.c @@ -433,6 +433,19 @@ // MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvkt" // MCPU-SIFIVE-P470-SAME: "-target-abi" "lp64d" +// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-p550 | FileCheck -check-prefix=MCPU-SIFIVE-P550 %s +// MCPU-SIFIVE-P550: "-nostdsysteminc" "-target-cpu" "sifive-p550" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+m" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+a" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+f" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+d" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+c" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+zicsr" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+zifencei" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+zba" +// MCPU-SIFIVE-P550-SAME: "-target-feature" "+zbb" +// MCPU-SIFIVE-P550-SAME: "-target-abi" "lp64d" + // RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-p670 | FileCheck -check-prefix=MCPU-SIFIVE-P670 %s // MCPU-SIFIVE-P670: "-target-cpu" "sifive-p670" // MCPU-SIFIVE-P670-SAME: "-target-feature" "+m" diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c index 17766cef86d2..71078342b361 100644 --- a/clang/test/Driver/sanitizer-ld.c +++ b/clang/test/Driver/sanitizer-ld.c @@ -15,7 +15,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-LINUX // -// CHECK-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-LINUX-NOT: "-lc" // CHECK-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan_static.a" "--no-whole-archive" // CHECK-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" @@ -33,7 +33,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // RUN: %clang -fsanitize=address -fno-sanitize-link-runtime -### %s 2>&1 \ // RUN: --target=arm64e-apple-macosx -fuse-ld=ld \ @@ -41,7 +41,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-DARWIN // -// CHECK-ASAN-NO-LINK-RUNTIME-DARWIN: "{{.*}}ld" +// CHECK-ASAN-NO-LINK-RUNTIME-DARWIN: "{{.*}}ld{{(.exe)?}}" // RUN: %clang -fsanitize=address -### %s 2>&1 \ // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \ @@ -80,7 +80,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-SHARED-ASAN-LINUX // -// CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SHARED-ASAN-LINUX-NOT: "-lc" // CHECK-SHARED-ASAN-LINUX: libclang_rt.asan.so" // CHECK-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan-preinit.a" "--no-whole-archive" @@ -98,7 +98,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX // -// CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-DSO-SHARED-ASAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-DSO-SHARED-ASAN-LINUX-NOT: "-lc" // CHECK-DSO-SHARED-ASAN-LINUX: libclang_rt.asan.so" // CHECK-DSO-SHARED-ASAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan_static.a" "--no-whole-archive" @@ -115,7 +115,7 @@ // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-FREEBSD // -// CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-FREEBSD: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-FREEBSD-NOT: "-lc" // CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan_static.a" // CHECK-ASAN-FREEBSD: freebsd{{/|\\+}}libclang_rt.asan.a" @@ -130,7 +130,7 @@ // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-FREEBSD-LDL // -// CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-FREEBSD-LDL: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-FREEBSD-LDL-NOT: "-ldl" // CHECK-ASAN-FREEBSD-LDL: "--whole-archive" "{{.*}}libclang_rt.asan_static.a" "--no-whole-archive" // CHECK-ASAN-FREEBSD-LDL: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" @@ -148,7 +148,7 @@ // RUN: -fsanitize-link-c++-runtime \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-LINUX-CXX -// CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-LINUX-CXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-LINUX-CXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive" // CHECK-ASAN-LINUX-CXX-NOT: "--dynamic-list" @@ -167,7 +167,7 @@ // RUN: -fno-sanitize-link-c++-runtime \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-LINUX-CNOCXX -// CHECK-ASAN-LINUX-CNOCXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-LINUX-CNOCXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-LINUX-CNOCXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-LINUX-CNOCXX-SAME: "--export-dynamic" // CHECK-ASAN-LINUX-CNOCXX-NOT: stdc++ @@ -184,7 +184,7 @@ // RUN: -fno-sanitize-link-c++-runtime \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-LINUX-NOCXX -// CHECK-ASAN-LINUX-NOCXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-LINUX-NOCXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-LINUX-NOCXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-LINUX-NOCXX-SAME: "--export-dynamic" // CHECK-ASAN-LINUX-NOCXX-SAME: "-lstdc++" @@ -201,7 +201,7 @@ // RUN: -nostdlib++ \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-LINUX-NOSTDCXX -// CHECK-ASAN-LINUX-NOSTDCXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-LINUX-NOSTDCXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-LINUX-NOSTDCXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-LINUX-NOSTDCXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan_cxx.a" "--no-whole-archive" // CHECK-ASAN-LINUX-NOSTDCXX-SAME: "--export-dynamic" @@ -217,7 +217,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree -lstdc++ -static 2>&1 \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC // -// CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-LINUX-CXX-STATIC: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-LINUX-CXX-STATIC-NOT: stdc++ // CHECK-ASAN-LINUX-CXX-STATIC: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-LINUX-CXX-STATIC: "--dynamic-list={{.*}}libclang_rt.asan.a.syms" @@ -228,7 +228,7 @@ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-ARM // -// CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-ARM-NOT: "-lc" // CHECK-ASAN-ARM: libclang_rt.asan_static.a" // CHECK-ASAN-ARM: libclang_rt.asan.a" @@ -238,7 +238,7 @@ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-ARMv7 // -// CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld" +// CHECK-ASAN-ARMv7: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-ASAN-ARMv7-NOT: "-lc" // CHECK-ASAN-ARMv7: libclang_rt.asan_static.a" // CHECK-ASAN-ARMv7: libclang_rt.asan.a" @@ -332,8 +332,8 @@ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN // // CHECK-ASAN-ANDROID-SHARED-LIBASAN-NOT: argument unused during compilation: '-shared-libsan' -// CHECK-ASAN-ANDROID-SHARED-LIBASAN: libclang_rt.asan.so" -// CHECK-ASAN-ANDROID-SHARED-LIBASAN: libclang_rt.asan_static.a" +// CHECK-ASAN-ANDROID-SHARED-LIBASAN: libclang_rt.asan{{.*}}.so" +// CHECK-ASAN-ANDROID-SHARED-LIBASAN: libclang_rt.asan_static{{.*}}.a" // // RUN: %clang -### %s 2>&1 \ // RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \ @@ -357,7 +357,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-TYSAN-LINUX-CXX // -// CHECK-TYSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-TYSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-TYSAN-LINUX-CXX-NOT: stdc++ // CHECK-TYSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tysan{{[^.]*}}.a" "--no-whole-archive" // CHECK-TYSAN-LINUX-CXX: stdc++ @@ -368,7 +368,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-TYSAN-DARWIN-CXX -// CHECK-TYSAN-DARWIN-CXX: "{{.*}}ld" +// CHECK-TYSAN-DARWIN-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-TYSAN-DARWIN-CXX: libclang_rt.tysan_osx_dynamic.dylib // CHECK-TYSAN-DARWIN-CXX-NOT: -lc++abi @@ -379,7 +379,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-TSAN-LINUX-CXX // -// CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-TSAN-LINUX-CXX-NOT: stdc++ // CHECK-TSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan.a" "--no-whole-archive" // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan.a.syms" @@ -398,7 +398,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-LINUX // -// CHECK-TSAN-NO-LINK-RUNTIME-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-TSAN-NO-LINK-RUNTIME-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // RUN: not %clang -fsanitize=thread -fno-sanitize-link-runtime -### %s 2>&1 \ // RUN: --target=arm64e-apple-ios -fuse-ld=ld \ @@ -406,7 +406,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-TSAN-NO-LINK-RUNTIME-DARWIN // -// CHECK-TSAN-NO-LINK-RUNTIME-DARWIN: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-TSAN-NO-LINK-RUNTIME-DARWIN: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // RUN: %clangxx -### %s 2>&1 \ // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ \ @@ -415,7 +415,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-MSAN-LINUX-CXX // -// CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-MSAN-LINUX-CXX-NOT: stdc++ // CHECK-MSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan.a" "--no-whole-archive" // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan.a.syms" @@ -434,7 +434,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-MSAN-NO-LINK-RUNTIME-LINUX // -// CHECK-MSAN-NO-LINK-RUNTIME-LINUX: "{{.*}}ld" +// CHECK-MSAN-NO-LINK-RUNTIME-LINUX: "{{.*}}ld{{(.exe)?}}" // RUN: %clang -fsanitize=undefined -### %s 2>&1 \ // RUN: --target=x86_64-unknown-linux-gnux32 -fuse-ld=ld \ @@ -455,7 +455,7 @@ // RUN: -static-libsan \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-LINUX -// CHECK-UBSAN-LINUX: "{{.*}}ld" +// CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive" // CHECK-UBSAN-LINUX-NOT: "-lstdc++" // CHECK-UBSAN-LINUX: "-lpthread" @@ -467,7 +467,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-LINUX // -// CHECK-UBSAN-NO-LINK-RUNTIME-LINUX: "{{.*}}ld" +// CHECK-UBSAN-NO-LINK-RUNTIME-LINUX: "{{.*}}ld{{(.exe)?}}" // RUN: %clang -fsanitize=undefined -fno-sanitize-link-runtime -### %s 2>&1 \ // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \ @@ -475,7 +475,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-NO-LINK-RUNTIME-DARWIN // -// CHECK-UBSAN-NO-LINK-RUNTIME-DARWIN: "{{.*}}ld" +// CHECK-UBSAN-NO-LINK-RUNTIME-DARWIN: "{{.*}}ld{{(.exe)?}}" // RUN: %clang -fsanitize=fuzzer -fno-sanitize-link-runtime -### %s 2>&1 \ // RUN: --target=arm64e-apple-watchos -fuse-ld=ld \ @@ -483,7 +483,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN // -// CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN: "{{.*}}ld" +// CHECK-FUZZER-NO-LINK-RUNTIME-DARWIN: "{{.*}}ld{{(.exe)?}}" // RUN: %clang -fsanitize=undefined -### %s 2>&1 \ // RUN: --target=i386-unknown-linux -fuse-ld=ld \ @@ -506,7 +506,7 @@ // RUN: -shared -shared-libsan \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-LINUX-SHAREDLIBASAN -// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld" +// CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-SHAREDLIBASAN: "{{.*}}libclang_rt.ubsan_standalone.so{{.*}}" // RUN: %clang -fsanitize=undefined -fsanitize-link-c++-runtime -### %s 2>&1 \ @@ -523,7 +523,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-LINUX-CXX -// CHECK-UBSAN-LINUX-CXX: "{{.*}}ld" +// CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive" // CHECK-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx.a" "--no-whole-archive" // CHECK-UBSAN-LINUX-CXX: "-lstdc++" @@ -535,7 +535,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-MINIMAL-LINUX -// CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld" +// CHECK-UBSAN-MINIMAL-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-MINIMAL-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_minimal.a" "--no-whole-archive" // CHECK-UBSAN-MINIMAL-LINUX: "-lpthread" // CHECK-UBSAN-MINIMAL-LINUX: "-lresolv" @@ -544,7 +544,7 @@ // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-MINIMAL-DARWIN -// CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}ld" +// CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}libclang_rt.ubsan_minimal_osx_dynamic.dylib" // RUN: not %clang -fsanitize=undefined -### %s 2>&1 \ @@ -570,7 +570,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-UBSAN-LINUX -// CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld" +// CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-ASAN-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan_static.a" "--no-whole-archive" // CHECK-ASAN-UBSAN-LINUX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-UBSAN-LINUX: "--dynamic-list={{.*}}libclang_rt.asan.a.syms" @@ -583,7 +583,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX -// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld" +// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan_static.a" "--no-whole-archive" // CHECK-ASAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-UBSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.asan.a.syms" @@ -598,7 +598,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-UBSAN-NOVPTR-LINUX-CXX -// CHECK-ASAN-UBSAN-NOVPTR-LINUX-CXX: "{{.*}}ld" +// CHECK-ASAN-UBSAN-NOVPTR-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-ASAN-UBSAN-NOVPTR-LINUX-CXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan_static.a" "--no-whole-archive" // CHECK-ASAN-UBSAN-NOVPTR-LINUX-CXX-SAME: "--whole-archive" "{{.*}}libclang_rt.asan.a" "--no-whole-archive" // CHECK-ASAN-UBSAN-NOVPTR-LINUX-CXX-SAME: "--dynamic-list={{.*}}libclang_rt.asan.a.syms" @@ -612,7 +612,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX -// CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld" +// CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-MSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan.a" "--no-whole-archive" // CHECK-MSAN-UBSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan.a.syms" // CHECK-MSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.msan_cxx.a" "--no-whole-archive" @@ -624,7 +624,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX -// CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld" +// CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-TSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan.a" "--no-whole-archive" // CHECK-TSAN-UBSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan.a.syms" // CHECK-TSAN-UBSAN-LINUX-CXX: "--whole-archive" "{{.*}}libclang_rt.tsan_cxx.a" "--no-whole-archive" @@ -637,7 +637,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: -shared \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-LINUX-SHARED -// CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld" +// CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic // CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list @@ -647,7 +647,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-LSAN-LINUX // -// CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-LSAN-LINUX-NOT: "-lc" // CHECK-LSAN-LINUX: libclang_rt.lsan.a" // CHECK-LSAN-LINUX: "-lpthread" @@ -660,7 +660,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-LSAN-NO-LINK-RUNTIME-LINUX // -// CHECK-LSAN-NO-LINK-RUNTIME-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-LSAN-NO-LINK-RUNTIME-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // RUN: %clang -### %s 2>&1 \ // RUN: --target=x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak -fsanitize-coverage=func \ @@ -668,7 +668,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-LSAN-COV-LINUX // -// CHECK-LSAN-COV-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-LSAN-COV-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-LSAN-COV-LINUX-NOT: "-lc" // CHECK-LSAN-COV-LINUX: libclang_rt.lsan.a // CHECK-LSAV-COV-LINUX: libclang_rt.lsan-x86_64.a" @@ -681,7 +681,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-LSAN-ASAN-LINUX -// CHECK-LSAN-ASAN-LINUX: "{{.*}}ld" +// CHECK-LSAN-ASAN-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan_static // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan // CHECK-LSAN-ASAN-LINUX: "--dynamic-list={{.*}}libclang_rt.asan.a.syms" @@ -691,7 +691,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-COV-LINUX -// CHECK-ASAN-COV-LINUX: "{{.*}}ld" +// CHECK-ASAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-ASAN-COV-LINUX: libclang_rt.asan_static // CHECK-ASAN-COV-LINUX: libclang_rt.asan // CHECK-ASAN-COV-LINUX: "--dynamic-list={{.*}}libclang_rt.asan.a.syms" @@ -704,7 +704,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-MSAN-COV-LINUX -// CHECK-MSAN-COV-LINUX: "{{.*}}ld" +// CHECK-MSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-MSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.msan.a" "--no-whole-archive" // CHECK-MSAN-COV-LINUX: "--dynamic-list={{.*}}libclang_rt.msan.a.syms" // CHECK-MSAN-COV-LINUX-NOT: "-lstdc++" @@ -716,7 +716,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-DFSAN-COV-LINUX -// CHECK-DFSAN-COV-LINUX: "{{.*}}ld" +// CHECK-DFSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-DFSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.dfsan.a" "--no-whole-archive" // CHECK-DFSAN-COV-LINUX-NOT: "-lstdc++" // CHECK-DFSAN-COV-LINUX: "-lpthread" @@ -727,7 +727,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-UBSAN-COV-LINUX -// CHECK-UBSAN-COV-LINUX: "{{.*}}ld" +// CHECK-UBSAN-COV-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive" // CHECK-UBSAN-COV-LINUX-NOT: "-lstdc++" // CHECK-UBSAN-COV-LINUX: "-lpthread" @@ -738,7 +738,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-COV-LINUX -// CHECK-COV-LINUX: "{{.*}}ld" +// CHECK-COV-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-COV-LINUX: "--whole-archive" "{{.*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive" // CHECK-COV-LINUX-NOT: "-lstdc++" // CHECK-COV-LINUX: "-lpthread" @@ -750,7 +750,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-NSAN-LINUX // -// CHECK-NSAN-LINUX: "{{.*}}ld" +// CHECK-NSAN-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-NSAN-LINUX-NOT: "-lc" // CHECK-NSAN-LINUX: libclang_rt.nsan.a" // CHECK-NSAN-LINUX: "-lpthread" "-lrt" "-lm" "-ldl" "-lresolv" @@ -778,7 +778,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-CFI-LINUX -// CHECK-CFI-LINUX: "{{.*}}ld" +// CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}" // CFI with diagnostics links the UBSan runtime. // RUN: not %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \ @@ -787,7 +787,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-CFI-DIAG-LINUX -// CHECK-CFI-DIAG-LINUX: "{{.*}}ld" +// CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive" // Cross-DSO CFI links the CFI runtime. @@ -796,7 +796,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-CFI-CROSS-DSO-LINUX -// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld" +// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-CFI-CROSS-DSO-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi.a" "--no-whole-archive" // CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic @@ -807,7 +807,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX -// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld" +// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.cfi_diag.a" "--no-whole-archive" // CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic @@ -836,7 +836,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-ASAN-DARWIN106-CXX -// CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld" +// CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib // CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi @@ -846,7 +846,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-LSAN-DARWIN106-CXX -// CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld" +// CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib // CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi @@ -856,7 +856,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-SAFESTACK-LINUX // -// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SAFESTACK-LINUX-NOT: "-lc" // CHECK-SAFESTACK-LINUX-NOT: whole-archive // CHECK-SAFESTACK-LINUX: "-u" "__safestack_init" @@ -869,7 +869,7 @@ // RUN: --target=x86_64-unknown-linux -fuse-ld=ld \ // RUN: | %{filecheck} --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-X86-64 // CHECK-SHADOWCALLSTACK-LINUX-X86-64-NOT: error: -// CHECK-SHADOWCALLSTACK-LINUX-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SHADOWCALLSTACK-LINUX-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // RUN: not %clang -fsanitize=shadow-call-stack -### %s 2>&1 \ // RUN: --target=aarch64-unknown-linux -fuse-ld=ld \ @@ -886,7 +886,7 @@ // RUN: --target=riscv64-unknown-linux -fuse-ld=ld \ // RUN: | %{filecheck} --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-RISCV64 // CHECK-SHADOWCALLSTACK-LINUX-RISCV64-NOT: error: -// CHECK-SHADOWCALLSTACK-LINUX-RISCV64: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SHADOWCALLSTACK-LINUX-RISCV64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // RUN: %clang -target riscv64-linux-android -fsanitize=shadow-call-stack %s -### 2>&1 \ // RUN: | %{filecheck} --check-prefix=CHECK-SHADOWCALLSTACK-ANDROID-RISCV64 @@ -906,7 +906,7 @@ // RUN: --target=arm64-unknown-ios -fuse-ld=ld \ // RUN: | %{filecheck} --check-prefix=CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18 // CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18-NOT: error: -// CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SHADOWCALLSTACK-LINUX-AARCH64-X18: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // RUN: %clang -fsanitize=shadow-call-stack -### %s 2>&1 \ // RUN: --target=aarch64-unknown-linux-android -fuse-ld=ld \ @@ -923,7 +923,7 @@ // RUN: -fsanitize=safe-stack --target=x86_64-unknown-linux -fuse-ld=ld \ // RUN: | %{filecheck} --check-prefix=CHECK-SHADOWCALLSTACK-SAFESTACK // CHECK-SHADOWCALLSTACK-SAFESTACK-NOT: error: -// CHECK-SHADOWCALLSTACK-SAFESTACK: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SHADOWCALLSTACK-SAFESTACK: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SHADOWCALLSTACK-SAFESTACK: libclang_rt.safestack.a // RUN: not %clang -fsanitize=cfi -fsanitize-stats -### %s 2>&1 \ @@ -931,7 +931,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-CFI-STATS-LINUX -// CHECK-CFI-STATS-LINUX: "{{.*}}ld" +// CHECK-CFI-STATS-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-CFI-STATS-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.stats_client.a" "--no-whole-archive" // CHECK-CFI-STATS-LINUX-NOT: "--whole-archive" // CHECK-CFI-STATS-LINUX: "{{[^"]*}}libclang_rt.stats.a" @@ -940,7 +940,7 @@ // RUN: --target=x86_64-apple-darwin -fuse-ld=ld \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-CFI-STATS-DARWIN -// CHECK-CFI-STATS-DARWIN: "{{.*}}ld" +// CHECK-CFI-STATS-DARWIN: "{{.*}}ld{{(.exe)?}}" // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_client_osx.a" // CHECK-CFI-STATS-DARWIN: "{{[^"]*}}libclang_rt.stats_osx_dynamic.dylib" @@ -1066,7 +1066,7 @@ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-SCUDO-LINUX -// CHECK-SCUDO-LINUX: "{{.*}}ld" +// CHECK-SCUDO-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-SCUDO-LINUX: "--whole-archive" "{{.*}}libclang_rt.scudo_standalone.a" "--no-whole-archive" // CHECK-SCUDO-LINUX-NOT: "-lstdc++" // CHECK-SCUDO-LINUX: "-lpthread" @@ -1079,7 +1079,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-SCUDO-SHARED-LINUX // -// CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SCUDO-SHARED-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SCUDO-SHARED-LINUX-NOT: "-lc" // CHECK-SCUDO-SHARED-LINUX: libclang_rt.scudo_standalone.so" // CHECK-SCUDO-SHARED-LINUX-NOT: "-lpthread" @@ -1122,7 +1122,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-HWASAN-X86-64-LINUX // -// CHECK-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-HWASAN-X86-64-LINUX-NOT: "-lc" // CHECK-HWASAN-X86-64-LINUX: libclang_rt.hwasan.a" // CHECK-HWASAN-X86-64-LINUX-NOT: "--export-dynamic" @@ -1139,7 +1139,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-SHARED-HWASAN-X86-64-LINUX // -// CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc" // CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so" // CHECK-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan-preinit.a" @@ -1156,7 +1156,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-DSO-SHARED-HWASAN-X86-64-LINUX // -// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lc" // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX: libclang_rt.hwasan.so" // CHECK-DSO-SHARED-HWASAN-X86-64-LINUX-NOT: "-lpthread" @@ -1172,7 +1172,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-HWASAN-AARCH64-LINUX // -// CHECK-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-HWASAN-AARCH64-LINUX-NOT: "-lc" // CHECK-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.a" // CHECK-HWASAN-AARCH64-LINUX-NOT: "--export-dynamic" @@ -1190,7 +1190,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-SHARED-HWASAN-AARCH64-LINUX // -// CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc" // CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so" // CHECK-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan-preinit.a" @@ -1207,7 +1207,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | %{filecheck} --check-prefix=CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX // -// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld" +// CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lc" // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX: libclang_rt.hwasan.so" // CHECK-DSO-SHARED-HWASAN-AARCH64-LINUX-NOT: "-lpthread" diff --git a/clang/test/Driver/spirv-openmp-toolchain.c b/clang/test/Driver/spirv-openmp-toolchain.c new file mode 100644 index 000000000000..3a94d978c2d7 --- /dev/null +++ b/clang/test/Driver/spirv-openmp-toolchain.c @@ -0,0 +1,64 @@ +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=spirv64-intel \ +// RUN: --libomptarget-spirv-bc-path=%t/ -nogpulib %s 2>&1 \ +// RUN: | FileCheck %s + +// verify the tools invocations +// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-llvm-bc"{{.*}}"-x" "c" +// CHECK: "-cc1" "-triple" "spirv64-intel" "-aux-triple" "x86_64-unknown-linux-gnu" +// CHECK: llvm-spirv{{.*}} +// CHECK: "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}}"-emit-obj" +// CHECK: clang-linker-wrapper{{.*}} "-o" "a.out" + +// RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=spirv64-intel %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PHASES %s + +// CHECK-PHASES: 0: input, "[[INPUT:.+]]", c, (host-openmp) +// CHECK-PHASES: 1: preprocessor, {0}, cpp-output, (host-openmp) +// CHECK-PHASES: 2: compiler, {1}, ir, (host-openmp) +// CHECK-PHASES: 3: input, "[[INPUT]]", c, (device-openmp) +// CHECK-PHASES: 4: preprocessor, {3}, cpp-output, (device-openmp) +// CHECK-PHASES: 5: compiler, {4}, ir, (device-openmp) +// CHECK-PHASES: 6: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp (spirv64-intel)" {5}, ir +// CHECK-PHASES: 7: backend, {6}, assembler, (device-openmp) +// CHECK-PHASES: 8: assembler, {7}, object, (device-openmp) +// CHECK-PHASES: 9: offload, "device-openmp (spirv64-intel)" {8}, object +// CHECK-PHASES: 10: clang-offload-packager, {9}, image, (device-openmp) +// CHECK-PHASES: 11: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp (x86_64-unknown-linux-gnu)" {10}, ir +// CHECK-PHASES: 12: backend, {11}, assembler, (host-openmp) +// CHECK-PHASES: 13: assembler, {12}, object, (host-openmp) +// CHECK-PHASES: 14: clang-linker-wrapper, {13}, image, (host-openmp) + +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=spirv64-intel -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-BINDINGS +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp -fopenmp-targets=spirv64-intel -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-BINDINGS + +// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[HOST_BC:.+]]" +// CHECK-BINDINGS: "spirv64-intel" - "clang", inputs: ["[[INPUT]]", "[[HOST_BC]]"], output: "[[DEVICE_TEMP_BC:.+]]" +// CHECK-BINDINGS: "spirv64-intel" - "SPIR-V::Translator", inputs: ["[[DEVICE_TEMP_BC]]"], output: "[[DEVICE_SPV:.+]]" +// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Packager", inputs: ["[[DEVICE_SPV]]"], output: "[[DEVICE_IMAGE:.+]]" +// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[HOST_BC]]", "[[DEVICE_IMAGE]]"], output: "[[HOST_OBJ:.+]]" +// CHECK-BINDINGS: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[HOST_OBJ]]"], output: "a.out" + +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -save-temps -fopenmp=libomp -fopenmp-targets=spirv64-intel -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-BINDINGS-TEMPS +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -save-temps -fopenmp=libomp -fopenmp-targets=spirv64-intel %s 2>&1 | FileCheck %s --check-prefix=CHECK-BINDINGS-TEMPS +// CHECK-BINDINGS-TEMPS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[INPUT:.+]]"], output: "[[HOST_PP:.+]]" +// CHECK-BINDINGS-TEMPS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[HOST_PP]]"], output: "[[HOST_BC:.+]]" +// CHECK-BINDINGS-TEMPS: "spirv64-intel" - "clang", inputs: ["[[INPUT]]"], output: "[[DEVICE_PP:.+]]" +// CHECK-BINDINGS-TEMPS: "spirv64-intel" - "clang", inputs: ["[[DEVICE_PP]]", "[[HOST_BC]]"], output: "[[DEVICE_TEMP_BC:.+]]" +// CHECK-BINDINGS-TEMPS: "spirv64-intel" - "SPIR-V::Translator", inputs: ["[[DEVICE_TEMP_BC]]"], output: "[[DEVICE_ASM:.+]]" +// CHECK-BINDINGS-TEMPS: "spirv64-intel" - "SPIR-V::Translator", inputs: ["[[DEVICE_ASM]]"], output: "[[DEVICE_SPV:.+]]" +// CHECK-BINDINGS-TEMPS: "x86_64-unknown-linux-gnu" - "Offload::Packager", inputs: ["[[DEVICE_SPV]]"], output: "[[DEVICE_IMAGE:.+]]" +// CHECK-BINDINGS-TEMPS: "x86_64-unknown-linux-gnu" - "clang", inputs: ["[[HOST_BC]]", "[[DEVICE_IMAGE]]"], output: "[[HOST_ASM:.+]]" +// CHECK-BINDINGS-TEMPS: "x86_64-unknown-linux-gnu" - "clang::as", inputs: ["[[HOST_ASM]]"], output: "[[HOST_OBJ:.+]]" +// CHECK-BINDINGS-TEMPS: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[HOST_OBJ]]"], output: "a.out" + +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp=libomp -fopenmp-targets=spirv64-intel -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-EMIT-LLVM-IR +// CHECK-EMIT-LLVM-IR: "-cc1" "-triple" "spirv64-intel"{{.*}}"-emit-llvm-bc" + +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp -fopenmp-targets=spirv64-intel \ +// RUN: --sysroot=%S/Inputs/spirv-openmp/ %s 2>&1 | FileCheck --check-prefix=CHECK-GPULIB %s +// CHECK-GPULIB: "-cc1" "-triple" "spirv64-intel"{{.*}}"-mlink-builtin-bitcode" "{{.*}}libomptarget-spirv64.bc" + +// RUN: not %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp --offload-arch=spirv64-intel \ +// RUN: --libomptarget-spirv-bc-path=%t/ -nogpulib %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-OFFLOAD-ARCH-ERROR +// CHECK-OFFLOAD-ARCH-ERROR: error: failed to deduce triple for target architecture 'spirv64-intel'; specify the triple using '-fopenmp-targets' and '-Xopenmp-target' instead diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp new file mode 100644 index 000000000000..eb192e08a3bc --- /dev/null +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -0,0 +1,50 @@ +/// Perform several driver tests for SYCL offloading for JIT + +/// Check the phases graph with -fsycl. Use of -fsycl enables offload +// RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=CHK-PHASES %s +// RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -- %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=CHK-PHASES %s +// CHK-PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl) +// CHK-PHASES-NEXT: 1: preprocessor, {0}, c++-cpp-output, (host-sycl) +// CHK-PHASES-NEXT: 2: compiler, {1}, ir, (host-sycl) +// CHK-PHASES-NEXT: 3: input, "[[INPUT]]", c++, (device-sycl) +// CHK-PHASES-NEXT: 4: preprocessor, {3}, c++-cpp-output, (device-sycl) +// CHK-PHASES-NEXT: 5: compiler, {4}, ir, (device-sycl) +// CHK-PHASES-NEXT: 6: backend, {5}, ir, (device-sycl) +// CHK-PHASES-NEXT: 7: offload, "device-sycl (spirv64-unknown-unknown)" {6}, ir +// CHK-PHASES-NEXT: 8: clang-offload-packager, {7}, image, (device-sycl) +// CHK-PHASES-NEXT: 9: offload, "host-sycl (x86_64{{.*}})" {2}, "device-sycl (x86_64{{.*}})" {8}, ir +// CHK-PHASES-NEXT: 10: backend, {9}, assembler, (host-sycl) +// CHK-PHASES-NEXT: 11: assembler, {10}, object, (host-sycl) +// CHK-PHASES-NEXT: 12: clang-linker-wrapper, {11}, image, (host-sycl) + +/// Check expected default values for device compilation when using -fsycl as +/// well as clang-offload-packager inputs. +// RUN: %clang -### -fsycl -c --target=x86_64-unknown-linux-gnu %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-DEVICE-TRIPLE %s +// CHK-DEVICE-TRIPLE: "-cc1"{{.*}} "-triple" "spirv64-unknown-unknown" +// CHK-DEVICE-TRIPLE-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" +// CHK-DEVICE-TRIPLE-SAME: "-fsycl-is-device" +// CHK-DEVICE-TRIPLE-SAME: "-O2" +// CHK-DEVICE-TRIPLE: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spirv64-unknown-unknown,arch=,kind=sycl" + +/// Check -fsycl-is-device is passed when compiling for the device. +/// Check -fsycl-is-host is passed when compiling for host. +// RUN: %clang -### -fsycl -c %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s +// RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s +// RUN: %clang_cl -### -fsycl -c -- %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s +// RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s +// CHK-FSYCL-IS-DEVICE: "-cc1"{{.*}} "-fsycl-is-device" {{.*}} "-emit-llvm-bc" +// CHK-FSYCL-IS-HOST: "-cc1"{{.*}} "-fsycl-is-host" + +/// Check for option incompatibility with -fsycl +// RUN: not %clang -### -fsycl -ffreestanding %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-INCOMPATIBILITY %s -DINCOMPATOPT=-ffreestanding +// RUN: not %clang -### -fsycl --offload-new-driver -static-libstdc++ %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHK-INCOMPATIBILITY %s -DINCOMPATOPT=-static-libstdc++ +// CHK-INCOMPATIBILITY: error: invalid argument '[[INCOMPATOPT]]' not allowed with '-fsycl' diff --git a/clang/test/Driver/uefi-constructed-args.c b/clang/test/Driver/uefi-constructed-args.c index e90857bb6fb5..3cc5abe69745 100644 --- a/clang/test/Driver/uefi-constructed-args.c +++ b/clang/test/Driver/uefi-constructed-args.c @@ -4,6 +4,7 @@ // CHECK-SAME: "-triple" "x86_64-unknown-uefi" // CHECK-SAME: "-mrelocation-model" "pic" "-pic-level" "2" // CHECK-SAME: "-mframe-pointer=all" +// CHECK-SAME: "-fms-extensions" // CHECK-NEXT: "-nologo" // CHECK-SAME: "-subsystem:efi_application" // CHECK-SAME: "-entry:EfiMain" diff --git a/clang/test/Frontend/dependency-gen-symlink.c b/clang/test/Frontend/dependency-gen-symlink.c index 2fa339ad2abf..15664a46b90c 100644 --- a/clang/test/Frontend/dependency-gen-symlink.c +++ b/clang/test/Frontend/dependency-gen-symlink.c @@ -15,7 +15,7 @@ // CHECK: dependency-gen-symlink.c.o // CHECK: dependency-gen-symlink.c // CHECK: a/header.h -// CHECK: b/header.h +// CHECK-NOT: b/header.h // CHECK-NOT: with-header-guard.h #include "a/header.h" #include "b/header.h" diff --git a/clang/test/Frontend/dependency-gen-windows-duplicates.c b/clang/test/Frontend/dependency-gen-windows-duplicates.c index abd351377dc3..0ecc23226fb9 100644 --- a/clang/test/Frontend/dependency-gen-windows-duplicates.c +++ b/clang/test/Frontend/dependency-gen-windows-duplicates.c @@ -9,7 +9,7 @@ // RUN: %clang -MD -MF - %t.dir/test.c -fsyntax-only -I %t.dir/subdir | FileCheck %s // CHECK: test.o: // CHECK-NEXT: \test.c -// CHECK-NEXT: \SubDir\X.h +// CHECK-NEXT: \subdir\x.h // File x.h must appear only once (case insensitive check). // CHECK-NOT: {{\\|/}}{{x|X}}.{{h|H}} diff --git a/clang/test/Headers/gpuintrin.c b/clang/test/Headers/gpuintrin.c index 2e45f73692f5..281339716c3e 100644 --- a/clang/test/Headers/gpuintrin.c +++ b/clang/test/Headers/gpuintrin.c @@ -44,7 +44,7 @@ // AMDGPU-NEXT: call void @__gpu_exit() #[[ATTR8:[0-9]+]] // AMDGPU-NEXT: unreachable // -// NVPTX-LABEL: define protected void @foo( +// NVPTX-LABEL: define protected ptx_kernel void @foo( // NVPTX-SAME: ) #[[ATTR0:[0-9]+]] { // NVPTX-NEXT: [[ENTRY:.*:]] // NVPTX-NEXT: [[CALL:%.*]] = call i32 @__gpu_num_blocks_x() #[[ATTR6:[0-9]+]] diff --git a/clang/test/Misc/target-invalid-cpu-note/riscv.c b/clang/test/Misc/target-invalid-cpu-note/riscv.c index fc8536d99cb8..fb54dcb5b3a9 100644 --- a/clang/test/Misc/target-invalid-cpu-note/riscv.c +++ b/clang/test/Misc/target-invalid-cpu-note/riscv.c @@ -29,6 +29,7 @@ // RISCV64-SAME: {{^}}, rocket-rv64 // RISCV64-SAME: {{^}}, sifive-p450 // RISCV64-SAME: {{^}}, sifive-p470 +// RISCV64-SAME: {{^}}, sifive-p550 // RISCV64-SAME: {{^}}, sifive-p670 // RISCV64-SAME: {{^}}, sifive-s21 // RISCV64-SAME: {{^}}, sifive-s51 @@ -77,6 +78,7 @@ // TUNE-RISCV64-SAME: {{^}}, rocket-rv64 // TUNE-RISCV64-SAME: {{^}}, sifive-p450 // TUNE-RISCV64-SAME: {{^}}, sifive-p470 +// TUNE-RISCV64-SAME: {{^}}, sifive-p550 // TUNE-RISCV64-SAME: {{^}}, sifive-p670 // TUNE-RISCV64-SAME: {{^}}, sifive-s21 // TUNE-RISCV64-SAME: {{^}}, sifive-s51 diff --git a/clang/test/Modules/expose-static-inline-from-gmf-1.cppm b/clang/test/Modules/expose-static-inline-from-gmf-1.cppm new file mode 100644 index 000000000000..4de9b583dac8 --- /dev/null +++ b/clang/test/Modules/expose-static-inline-from-gmf-1.cppm @@ -0,0 +1,37 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm \ +// RUN: -DTEST_INLINE +// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify \ +// RUN: -DTEST_INLINE +// +// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm +// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify + +//--- a.h +#ifdef TEST_INLINE +#define INLINE inline +#else +#define INLINE +#endif +static INLINE void func(long) {} +template <typename T = long> void a() { func(T{}); } + +//--- a.cppm +module; +#include "a.h" +export module a; +export using ::a; + +//--- test.cc +import a; +auto m = (a(), 0); + +#ifdef TEST_INLINE +// expected-no-diagnostics +#else +// expected-error@a.h:7 {{no matching function for call to 'func'}} +// expected-note@test.cc:2 {{in instantiation of function template specialization 'a<long>' requested here}} +#endif diff --git a/clang/test/Modules/expose-static-inline-from-gmf-2.cppm b/clang/test/Modules/expose-static-inline-from-gmf-2.cppm new file mode 100644 index 000000000000..c89b613f5074 --- /dev/null +++ b/clang/test/Modules/expose-static-inline-from-gmf-2.cppm @@ -0,0 +1,22 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm +// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify + +//--- a.h +template <typename G> static inline void func() {} +template <typename T = long> void a() { func<T>(); } + +//--- a.cppm +module; +#include "a.h" +export module a; +export using ::a; + +//--- test.cc +import a; +auto m = (a(), 0); + +// expected-no-diagnostics diff --git a/clang/test/Modules/expose-static-inline-from-gmf-3.cppm b/clang/test/Modules/expose-static-inline-from-gmf-3.cppm new file mode 100644 index 000000000000..dee7cddafdf7 --- /dev/null +++ b/clang/test/Modules/expose-static-inline-from-gmf-3.cppm @@ -0,0 +1,24 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm +// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify + +//--- a.h +namespace ns { +template <typename G> static void func() {} +template <typename T = long> void a() { func<T>(); } +} + +//--- a.cppm +module; +#include "a.h" +export module a; +export using ns::a; + +//--- test.cc +import a; +auto m = (a(), 0); + +// expected-no-diagnostics diff --git a/clang/test/Modules/expose-static-inline-from-gmf-4.cppm b/clang/test/Modules/expose-static-inline-from-gmf-4.cppm new file mode 100644 index 000000000000..09c6b1ffd9c7 --- /dev/null +++ b/clang/test/Modules/expose-static-inline-from-gmf-4.cppm @@ -0,0 +1,40 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm \ +// RUN: -DTEST_INLINE +// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify \ +// RUN: -DTEST_INLINE +// +// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm +// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify + +//--- a.h +#ifdef TEST_INLINE +#define INLINE inline +#else +#define INLINE +#endif +namespace ns { +template <typename G> static void func() {} +template <> INLINE void func<long>() {} +template <typename T = long> void a() { func<T>(); } +} + +//--- a.cppm +module; +#include "a.h" +export module a; +export using ns::a; + +//--- test.cc +import a; +auto m = (a(), 0); + +#ifdef TEST_INLINE +// expected-no-diagnostics +#else +// expected-error@a.h:9 {{no matching function for call to 'func'}} +// expected-note@test.cc:2 {{in instantiation of function template specialization 'ns::a<long>' requested here}} +#endif diff --git a/clang/test/Modules/expose-static-inline-from-gmf-5.cppm b/clang/test/Modules/expose-static-inline-from-gmf-5.cppm new file mode 100644 index 000000000000..334af845a693 --- /dev/null +++ b/clang/test/Modules/expose-static-inline-from-gmf-5.cppm @@ -0,0 +1,26 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm +// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify + +//--- a.h +namespace ns { +namespace { +template <typename G> void func() {} +} +template <typename T = long> void a() { func<T>(); } +} + +//--- a.cppm +module; +#include "a.h" +export module a; +export using ns::a; + +//--- test.cc +import a; +auto m = (a(), 0); + +// expected-no-diagnostics diff --git a/clang/test/Modules/missing-body-in-import.cpp b/clang/test/Modules/missing-body-in-import.cpp new file mode 100644 index 000000000000..b52ebba15087 --- /dev/null +++ b/clang/test/Modules/missing-body-in-import.cpp @@ -0,0 +1,42 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t + +// RUN: %clang_cc1 -std=c++23 mod1.cppm -emit-module-interface -o mod1.pcm -fallow-pcm-with-compiler-errors -verify +// RUN: %clang_cc1 -std=c++23 mod2.cppm -emit-module-interface -o mod2.pcm -fmodule-file=mod1=mod1.pcm -verify -fallow-pcm-with-compiler-errors +// RUN: %clang_cc1 -std=c++23 mod3.cppm -emit-module-interface -o mod3.pcm -fmodule-file=mod1=mod1.pcm -fmodule-file=mod2=mod2.pcm -verify -fallow-pcm-with-compiler-errors +// RUN: %clang_cc1 -std=c++23 main.cpp -fmodule-file=mod1=mod1.pcm -fmodule-file=mod2=mod2.pcm -fmodule-file=mod3=mod3.pcm -verify -fallow-pcm-with-compiler-errors -ast-dump-all + +//--- mod1.cppm +export module mod1; + +export template <unsigned N, unsigned M> +class A { +public: + constexpr A(const char[], const char[]) { + auto x = BrokenExpr; // expected-error {{use of undeclared identifier 'BrokenExpr'}} + } +}; + +export template<A<1,1> NTTP> +struct B {}; + +template < unsigned N, unsigned M > +A(const char (&)[N], const char (&)[M]) -> A< 1, 1 >; + +//--- mod2.cppm +export module mod2; +import mod1; + +struct C: B <A{"a", "b"}> { // expected-error {{non-type template argument is not a constant expression}} + constexpr C(int a) { } +}; + +//--- mod3.cppm +// expected-no-diagnostics +export module mod3; +export import mod2; + +//--- main.cpp +// expected-no-diagnostics +import mod3; // no crash diff --git a/clang/test/Modules/pcm-with-errors.cpp b/clang/test/Modules/pcm-with-errors.cpp new file mode 100644 index 000000000000..1bbc3865ee3e --- /dev/null +++ b/clang/test/Modules/pcm-with-errors.cpp @@ -0,0 +1,26 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: cd %t + +// RUN: %clang_cc1 -std=c++23 m.cppm -emit-module-interface -o m.pcm -fallow-pcm-with-compiler-errors -verify +// RUN: %clang_cc1 -std=c++23 main.cpp -fmodule-file=m=m.pcm -verify -fallow-pcm-with-compiler-errors -verify + +// RUN: %clang_cc1 -std=c++23 m.cppm -fmodules-reduced-bmi -emit-module-interface -o m.pcm -fallow-pcm-with-compiler-errors -verify +// RUN: %clang_cc1 -std=c++23 main.cpp -fmodule-file=m=m.pcm -verify -fallow-pcm-with-compiler-errors -verify + +//--- m.cppm +export module m; + +export int f() { + return 0; +} + +export struct Foo { + __Int bar; // expected-error {{unknown type name '__Int'}} +}; + +//--- main.cpp +// expected-no-diagnostics +import m; // ok + +static_assert(__is_same(decltype(f), int())); // ok diff --git a/clang/test/OpenMP/declare_simd_aarch64.c b/clang/test/OpenMP/declare_simd_aarch64.c index 21c83c225963..e9538e7446ee 100644 --- a/clang/test/OpenMP/declare_simd_aarch64.c +++ b/clang/test/OpenMP/declare_simd_aarch64.c @@ -1,8 +1,8 @@ // REQUIRES: aarch64-registered-target // -fopemp and -fopenmp-simd behavior are expected to be the same. -// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s --check-prefix=AARCH64 -// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s --check-prefix=AARCH64 +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fmath-errno -fopenmp -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s --check-prefix=AARCH64 +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fmath-errno -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s --check-prefix=AARCH64 #pragma omp declare simd #pragma omp declare simd simdlen(2) diff --git a/clang/test/OpenMP/irbuilder_simd_aligned.cpp b/clang/test/OpenMP/irbuilder_simd_aligned.cpp index 1c3dc49b717e..721fde6d9549 100644 --- a/clang/test/OpenMP/irbuilder_simd_aligned.cpp +++ b/clang/test/OpenMP/irbuilder_simd_aligned.cpp @@ -70,8 +70,11 @@ void simple(float *a, float *b, int *c) { // CHECK-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP3:![0-9]+]] // CHECK: for.end: // CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[A_ADDR]], align 8 +// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[TMP4]], i64 128) ] // CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[P]], align 8 +// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[TMP5]], i64 64) ] // CHECK-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [32 x i32], ptr [[D]], i64 0, i64 0 +// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[ARRAYDECAY]], i64 16) ] // CHECK-NEXT: store i32 3, ptr [[I1]], align 4 // CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON]], ptr [[AGG_CAPTURED]], i32 0, i32 0 // CHECK-NEXT: store ptr [[I1]], ptr [[TMP6]], align 8 @@ -82,9 +85,6 @@ void simple(float *a, float *b, int *c) { // CHECK-NEXT: [[DOTCOUNT:%.*]] = load i32, ptr [[DOTCOUNT_ADDR]], align 4 // CHECK-NEXT: br label [[OMP_LOOP_PREHEADER:%.*]] // CHECK: omp_loop.preheader: -// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[TMP4]], i64 128) ] -// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[TMP5]], i64 64) ] -// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[ARRAYDECAY]], i64 16) ] // CHECK-NEXT: br label [[OMP_LOOP_HEADER:%.*]] // CHECK: omp_loop.header: // CHECK-NEXT: [[OMP_LOOP_IV:%.*]] = phi i32 [ 0, [[OMP_LOOP_PREHEADER]] ], [ [[OMP_LOOP_NEXT:%.*]], [[OMP_LOOP_INC:%.*]] ] diff --git a/clang/test/ParserOpenACC/parse-clauses.c b/clang/test/ParserOpenACC/parse-clauses.c index 8a404a5a1987..73a09697710f 100644 --- a/clang/test/ParserOpenACC/parse-clauses.c +++ b/clang/test/ParserOpenACC/parse-clauses.c @@ -343,23 +343,16 @@ struct HasMembersArray { void SelfUpdate() { struct Members s; - // expected-error@+2{{expected '('}} - // expected-warning@+1{{OpenACC construct 'update' not yet implemented, pragma ignored}} + // expected-error@+1{{expected '('}} #pragma acc update self for(int i = 0; i < 5;++i) {} - // expected-error@+6{{use of undeclared identifier 'zero'}} - // expected-error@+5{{expected ','}} - // expected-error@+4{{expected expression}} - // expected-warning@+3{{OpenACC clause 'self' not yet implemented, clause ignored}} - // expected-warning@+2{{OpenACC clause 'if_present' not yet implemented, clause ignored}} - // expected-warning@+1{{OpenACC construct 'update' not yet implemented, pragma ignored}} + // expected-error@+3{{use of undeclared identifier 'zero'}} + // expected-error@+2{{expected ','}} + // expected-error@+1{{expected expression}} #pragma acc update self(zero : s.array[s.value : 5], s.value), if_present for(int i = 0; i < 5;++i) {} - // expected-warning@+3{{OpenACC clause 'self' not yet implemented, clause ignored}} - // expected-warning@+2{{OpenACC clause 'if_present' not yet implemented, clause ignored}} - // expected-warning@+1{{OpenACC construct 'update' not yet implemented, pragma ignored}} #pragma acc update self(s.array[s.value : 5], s.value), if_present for(int i = 0; i < 5;++i) {} } @@ -821,28 +814,24 @@ void IntExprParsing() { #pragma acc init device_num(returns_int()) // expected-error@+2{{expected '('}} - // expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} #pragma acc set default_async // expected-error@+2{{expected expression}} - // expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} #pragma acc set default_async() // expected-error@+2{{use of undeclared identifier 'invalid'}} - // expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} #pragma acc set default_async(invalid) // expected-error@+3{{expected ')'}} // expected-note@+2{{to match this '('}} - // expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} #pragma acc set default_async(5, 4) - // expected-warning@+2{{OpenACC clause 'default_async' not yet implemented, clause ignored}} - // expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} #pragma acc set default_async(5) - // expected-warning@+2{{OpenACC clause 'default_async' not yet implemented, clause ignored}} - // expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} #pragma acc set default_async(returns_int()) diff --git a/clang/test/ParserOpenACC/parse-constructs.c b/clang/test/ParserOpenACC/parse-constructs.c index 878c38e8bedc..9948e33ac94d 100644 --- a/clang/test/ParserOpenACC/parse-constructs.c +++ b/clang/test/ParserOpenACC/parse-constructs.c @@ -148,11 +148,10 @@ void func() { #pragma acc shutdown clause list for(;;){} // expected-error@+2{{invalid OpenACC clause 'clause'}} - // expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} #pragma acc set clause list for(;;){} - // expected-error@+2{{invalid OpenACC clause 'clause'}} - // expected-warning@+1{{OpenACC construct 'update' not yet implemented, pragma ignored}} + // expected-error@+1{{invalid OpenACC clause 'clause'}} #pragma acc update clause list for(;;){} } diff --git a/clang/test/Preprocessor/macho-embedded-predefines.c b/clang/test/Preprocessor/macho-embedded-predefines.c index 74f29199218c..a7e5777a89a9 100644 --- a/clang/test/Preprocessor/macho-embedded-predefines.c +++ b/clang/test/Preprocessor/macho-embedded-predefines.c @@ -3,18 +3,18 @@ // CHECK-7M: #define __APPLE_CC__ // CHECK-7M: #define __APPLE__ // CHECK-7M: #define __ARM_ARCH_7M__ -// CHECK-7M-NOT: #define __MACH__ +// CHECK-7M: #define __MACH__ // RUN: %clang_cc1 -E -dM -triple thumbv7em-apple-unknown-macho -target-cpu cortex-m4 %s | FileCheck %s -check-prefix CHECK-7EM // CHECK-7EM: #define __APPLE_CC__ // CHECK-7EM: #define __APPLE__ // CHECK-7EM: #define __ARM_ARCH_7EM__ -// CHECK-7EM-NOT: #define __MACH__ +// CHECK-7EM: #define __MACH__ // RUN: %clang_cc1 -E -dM -triple thumbv6m-apple-unknown-macho -target-cpu cortex-m0 %s | FileCheck %s -check-prefix CHECK-6M // CHECK-6M: #define __APPLE_CC__ // CHECK-6M: #define __APPLE__ // CHECK-6M: #define __ARM_ARCH_6M__ -// CHECK-6M-NOT: #define __MACH__ +// CHECK-6M: #define __MACH__ diff --git a/clang/test/Preprocessor/riscv-target-features.c b/clang/test/Preprocessor/riscv-target-features.c index e376821a5517..c21977113527 100644 --- a/clang/test/Preprocessor/riscv-target-features.c +++ b/clang/test/Preprocessor/riscv-target-features.c @@ -182,6 +182,8 @@ // Experimental extensions +// CHECK-NOT: __riscv_sdext{{.*$}} +// CHECK-NOT: __riscv_sdtrig{{.*$}} // CHECK-NOT: __riscv_smctr{{.*$}} // CHECK-NOT: __riscv_smmpm{{.*$}} // CHECK-NOT: __riscv_smnpm{{.*$}} @@ -1796,6 +1798,22 @@ // CHECK-SUPM-EXT: __riscv_supm 1000000{{$}} // RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_sdext1p0 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SDEXT-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_sdext1p0 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SDEXT-EXT %s +// CHECK-SDEXT-EXT: __riscv_sdext 1000000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ +// RUN: -march=rv32i_sdtrig1p0 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SDTRIG-EXT %s +// RUN: %clang --target=riscv64 -menable-experimental-extensions \ +// RUN: -march=rv64i_sdtrig1p0 -E -dM %s \ +// RUN: -o - | FileCheck --check-prefix=CHECK-SDTRIG-EXT %s +// CHECK-SDTRIG-EXT: __riscv_sdtrig 1000000{{$}} + +// RUN: %clang --target=riscv32 -menable-experimental-extensions \ // RUN: -march=rv32i_smctr1p0 -E -dM %s \ // RUN: -o - | FileCheck --check-prefix=CHECK-SMCTR-EXT %s // RUN: %clang --target=riscv64 -menable-experimental-extensions \ diff --git a/clang/test/Sema/varargs.c b/clang/test/Sema/varargs.c index 2cb7270f604a..bec41dda65d5 100644 --- a/clang/test/Sema/varargs.c +++ b/clang/test/Sema/varargs.c @@ -75,6 +75,11 @@ void f9(__builtin_va_list args) (void)__builtin_va_arg(args, enum E); // Don't warn here in C (void)__builtin_va_arg(args, short); // expected-warning {{second argument to 'va_arg' is of promotable type 'short'}} (void)__builtin_va_arg(args, char); // expected-warning {{second argument to 'va_arg' is of promotable type 'char'}} + // Don't crash on some undefined behaviors. + int n; + (void)__builtin_va_arg(args, int[10]); // expected-warning{{second argument to 'va_arg' is of array type 'int[10]'}} + (void)__builtin_va_arg(args, int[++n]); // expected-warning{{second argument to 'va_arg' is of array type 'int[++n]'}} + (void)__builtin_va_arg(args, int[n][n]); // expected-warning{{second argument to 'va_arg' is of array type 'int[n][n]'}} } void f10(int a, ...) { diff --git a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp index 0674135aac48..48061439941f 100644 --- a/clang/test/SemaCXX/cxx2c-fold-exprs.cpp +++ b/clang/test/SemaCXX/cxx2c-fold-exprs.cpp @@ -305,3 +305,82 @@ static_assert(__is_same_as(_Three_way_comparison_result_with_tuple_like<tuple<in static_assert(__is_same_as(_Three_way_comparison_result_with_tuple_like<tuple<int>, 0>::type, long)); } + +namespace GH88866 { + +template <typename...Ts> struct index_by; + +template <typename T, typename Indices> +concept InitFunc = true; + +namespace ExpandsBoth { + +template <typename Indices, InitFunc<Indices> auto... init> +struct LazyLitMatrix; // expected-note {{here}} + +template < + typename...Indices, + InitFunc<index_by<Indices>> auto... init +> +struct LazyLitMatrix<index_by<Indices...>, init...> { +}; + +// FIXME: Explain why we didn't pick up the partial specialization - pack sizes don't match. +template struct LazyLitMatrix<index_by<int, char>, 42>; +// expected-error@-1 {{instantiation of undefined template}} +template struct LazyLitMatrix<index_by<int, char>, 42, 43>; + +} + +namespace ExpandsRespectively { + +template <typename Indices, InitFunc<Indices> auto... init> +struct LazyLitMatrix; + +template < + typename...Indices, + InitFunc<index_by<Indices...>> auto... init +> +struct LazyLitMatrix<index_by<Indices...>, init...> { +}; + +template struct LazyLitMatrix<index_by<int, char>, 42>; +template struct LazyLitMatrix<index_by<int, char>, 42, 43>; + +} + +namespace TypeParameter { + +template <typename Indices, InitFunc<Indices>... init> +struct LazyLitMatrix; // expected-note {{here}} + +template < + typename...Indices, + InitFunc<index_by<Indices>>... init +> +struct LazyLitMatrix<index_by<Indices...>, init...> { +}; + +// FIXME: Explain why we didn't pick up the partial specialization - pack sizes don't match. +template struct LazyLitMatrix<index_by<int, char>, float>; +// expected-error@-1 {{instantiation of undefined template}} +template struct LazyLitMatrix<index_by<int, char>, unsigned, float>; + +} + +namespace Invalid { + +template <typename Indices, InitFunc<Indices>... init> +struct LazyLitMatrix; + +template < + typename...Indices, + InitFunc<index_by<Indices>> init + // expected-error@-1 {{unexpanded parameter pack 'Indices'}} +> +struct LazyLitMatrix<index_by<Indices...>, init> { +}; + +} + +} diff --git a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp index cb679a6c3ad8..58b642d2735b 100644 --- a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp +++ b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp @@ -305,3 +305,19 @@ template <class... Args> struct mdispatch_ { mdispatch_<int, int> d; } // namespace GH116105 + +namespace GH121242 { + // Non-dependent type pack access + template <int...x> + int y = x...[0]; + + struct X {}; + + template <X...x> + X z = x...[0]; + + void foo() { + (void)y<0>; + (void)z<X{}>; + } +} // namespace GH121242 diff --git a/clang/test/SemaCXX/type-traits.cpp b/clang/test/SemaCXX/type-traits.cpp index 91ef7786f11b..1b9e2ba6ff16 100644 --- a/clang/test/SemaCXX/type-traits.cpp +++ b/clang/test/SemaCXX/type-traits.cpp @@ -5031,3 +5031,18 @@ void remove_all_extents() { using SomeArray = int[1][2]; static_assert(__is_same(remove_all_extents_t<const SomeArray>, const int)); } + +namespace GH121278 { +// https://cplusplus.github.io/LWG/lwg-active.html#3929 +#if __cplusplus >= 202002L +template <typename B, typename D> +concept C = __is_base_of(B, D); +// expected-error@-1 {{incomplete type 'GH121278::S' used in type trait expression}} +// expected-note@-2 {{while substituting template arguments into constraint expression here}} + +struct T; +struct S; +bool b = C<T, S>; +// expected-note@-1 {{while checking the satisfaction of concept 'C<GH121278::T, GH121278::S>' requested here}} +#endif +} diff --git a/clang/test/SemaCXX/warn-unused-result.cpp b/clang/test/SemaCXX/warn-unused-result.cpp index 682c500dc1d9..5105f347db8b 100644 --- a/clang/test/SemaCXX/warn-unused-result.cpp +++ b/clang/test/SemaCXX/warn-unused-result.cpp @@ -355,3 +355,12 @@ void use2() { (void)G{"Hello"}; } } // namespace nodiscard_specialization + +namespace GH117975 { +// Test for a regression for ICE in CallExpr::getUnusedResultAttr +int f() { return 0; } +void id_print_name() { + (int) // expected-warning {{expression result unused}} + ((int(*)())f)(); +} +} // namespace GH117975 diff --git a/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c b/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c index f37c1d7e7292..9a98f5e1659b 100644 --- a/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c +++ b/clang/test/SemaOpenACC/combined-construct-auto_seq_independent-clauses.c @@ -137,7 +137,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop auto device_num(1) for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop auto default_async(1) for(unsigned i = 0; i < 5; ++i); #pragma acc parallel loop auto device_type(*) @@ -254,7 +254,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop device_num(1) auto for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop default_async(1) auto for(unsigned i = 0; i < 5; ++i); #pragma acc parallel loop device_type(*) auto @@ -372,7 +372,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop independent device_num(1) for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop independent default_async(1) for(unsigned i = 0; i < 5; ++i); #pragma acc parallel loop independent device_type(*) @@ -489,7 +489,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop device_num(1) independent for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop default_async(1) independent for(unsigned i = 0; i < 5; ++i); #pragma acc parallel loop device_type(*) independent @@ -615,7 +615,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop seq device_num(1) for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop seq default_async(1) for(unsigned i = 0; i < 5; ++i); #pragma acc parallel loop seq device_type(*) @@ -738,7 +738,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop device_num(1) seq for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'parallel loop' directive}} #pragma acc parallel loop default_async(1) seq for(unsigned i = 0; i < 5; ++i); #pragma acc parallel loop device_type(*) seq diff --git a/clang/test/SemaOpenACC/combined-construct-device_type-clause.c b/clang/test/SemaOpenACC/combined-construct-device_type-clause.c index 50612c2a4685..8072ae7de4ff 100644 --- a/clang/test/SemaOpenACC/combined-construct-device_type-clause.c +++ b/clang/test/SemaOpenACC/combined-construct-device_type-clause.c @@ -193,8 +193,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'serial loop' directive}} #pragma acc serial loop device_type(*) device_num(1) for(int i = 0; i < 5; ++i); - // expected-error@+2{{OpenACC clause 'default_async' may not follow a 'device_type' clause in a 'serial loop' construct}} - // expected-note@+1{{previous clause is here}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'serial loop' directive}} #pragma acc serial loop device_type(*) default_async(1) for(int i = 0; i < 5; ++i); #pragma acc parallel loop device_type(*) async diff --git a/clang/test/SemaOpenACC/combined-construct-self-ast.cpp b/clang/test/SemaOpenACC/combined-construct-self-ast.cpp index 3a6ba3ca6aea..e504ea7f5a07 100644 --- a/clang/test/SemaOpenACC/combined-construct-self-ast.cpp +++ b/clang/test/SemaOpenACC/combined-construct-self-ast.cpp @@ -20,6 +20,7 @@ void TemplFunc() { for (unsigned i = 0; i < 5; ++i); // CHECK-NEXT: OpenACCCombinedConstruct{{.*}}serial loop // CHECK-NEXT: self clause + // CHECK-NEXT: <<<NULL>> // CHECK-NEXT: ForStmt // CHECK: NullStmt @@ -65,6 +66,7 @@ void TemplFunc() { // // CHECK-NEXT: OpenACCCombinedConstruct{{.*}}serial loop // CHECK-NEXT: self clause + // CHECK-NEXT: <<<NULL>> // CHECK-NEXT: ForStmt // CHECK: NullStmt diff --git a/clang/test/SemaOpenACC/compute-construct-clause-ast.cpp b/clang/test/SemaOpenACC/compute-construct-clause-ast.cpp index 69f65f4083ae..58c12b828439 100644 --- a/clang/test/SemaOpenACC/compute-construct-clause-ast.cpp +++ b/clang/test/SemaOpenACC/compute-construct-clause-ast.cpp @@ -197,6 +197,7 @@ void TemplFunc() { while(true); // CHECK-NEXT: OpenACCComputeConstruct{{.*}}serial // CHECK-NEXT: self clause + // CHECK-NEXT: <<<NULL>> // CHECK-NEXT: WhileStmt // CHECK-NEXT: CXXBoolLiteralExpr // CHECK-NEXT: NullStmt @@ -393,6 +394,7 @@ void TemplFunc() { // CHECK-NEXT: OpenACCComputeConstruct{{.*}}serial // CHECK-NEXT: self clause + // CHECK-NEXT: <<<NULL>> // CHECK-NEXT: WhileStmt // CHECK-NEXT: CXXBoolLiteralExpr // CHECK-NEXT: NullStmt diff --git a/clang/test/SemaOpenACC/compute-construct-device_type-clause.c b/clang/test/SemaOpenACC/compute-construct-device_type-clause.c index bbad68c425f3..33f433ce4c51 100644 --- a/clang/test/SemaOpenACC/compute-construct-device_type-clause.c +++ b/clang/test/SemaOpenACC/compute-construct-device_type-clause.c @@ -198,8 +198,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'kernels' directive}} #pragma acc kernels device_type(*) device_num(1) while(1); - // expected-error@+2{{OpenACC clause 'default_async' may not follow a 'device_type' clause in a 'kernels' construct}} - // expected-note@+1{{previous clause is here}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'kernels' directive}} #pragma acc kernels device_type(*) default_async(1) while(1); #pragma acc kernels device_type(*) async diff --git a/clang/test/SemaOpenACC/loop-construct-auto_seq_independent-clauses.c b/clang/test/SemaOpenACC/loop-construct-auto_seq_independent-clauses.c index d75d6abb99f6..d9a4c61a81c7 100644 --- a/clang/test/SemaOpenACC/loop-construct-auto_seq_independent-clauses.c +++ b/clang/test/SemaOpenACC/loop-construct-auto_seq_independent-clauses.c @@ -152,7 +152,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'loop' directive}} #pragma acc loop auto device_num(1) for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'loop' directive}} #pragma acc loop auto default_async(1) for(unsigned i = 0; i < 5; ++i); #pragma acc loop auto device_type(*) @@ -286,7 +286,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'loop' directive}} #pragma acc loop device_num(1) auto for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'loop' directive}} #pragma acc loop default_async(1) auto for(unsigned i = 0; i < 5; ++i); #pragma acc loop device_type(*) auto @@ -421,7 +421,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'loop' directive}} #pragma acc loop independent device_num(1) for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'loop' directive}} #pragma acc loop independent default_async(1) for(unsigned i = 0; i < 5; ++i); #pragma acc loop independent device_type(*) @@ -555,7 +555,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'loop' directive}} #pragma acc loop device_num(1) independent for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'loop' directive}} #pragma acc loop default_async(1) independent for(unsigned i = 0; i < 5; ++i); #pragma acc loop device_type(*) independent @@ -698,7 +698,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'loop' directive}} #pragma acc loop seq device_num(1) for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'loop' directive}} #pragma acc loop seq default_async(1) for(unsigned i = 0; i < 5; ++i); #pragma acc loop seq device_type(*) @@ -838,7 +838,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'loop' directive}} #pragma acc loop device_num(1) seq for(unsigned i = 0; i < 5; ++i); - // expected-warning@+1{{OpenACC clause 'default_async' not yet implemented}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'loop' directive}} #pragma acc loop default_async(1) seq for(unsigned i = 0; i < 5; ++i); #pragma acc loop device_type(*) seq diff --git a/clang/test/SemaOpenACC/loop-construct-device_type-clause.c b/clang/test/SemaOpenACC/loop-construct-device_type-clause.c index bf2a2499c343..f16f17f5d681 100644 --- a/clang/test/SemaOpenACC/loop-construct-device_type-clause.c +++ b/clang/test/SemaOpenACC/loop-construct-device_type-clause.c @@ -173,8 +173,7 @@ void uses() { // expected-error@+1{{OpenACC 'device_num' clause is not valid on 'loop' directive}} #pragma acc loop device_type(*) device_num(1) for(int i = 0; i < 5; ++i); - // expected-error@+2{{OpenACC clause 'default_async' may not follow a 'device_type' clause in a 'loop' construct}} - // expected-note@+1{{previous clause is here}} + // expected-error@+1{{OpenACC 'default_async' clause is not valid on 'loop' directive}} #pragma acc loop device_type(*) default_async(1) for(int i = 0; i < 5; ++i); // expected-error@+1{{OpenACC 'async' clause is not valid on 'loop' directive}} diff --git a/clang/test/SemaOpenACC/set-construct-ast.cpp b/clang/test/SemaOpenACC/set-construct-ast.cpp new file mode 100644 index 000000000000..c5eed944ada7 --- /dev/null +++ b/clang/test/SemaOpenACC/set-construct-ast.cpp @@ -0,0 +1,98 @@ +// 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 + +int some_int(); +long some_long(); +void NormalFunc() { + // CHECK-LABEL: NormalFunc + // CHECK-NEXT: CompoundStmt + +#pragma acc set default_async(some_int()) device_num(some_long()) device_type(DT) if (some_int() < some_long()) + // CHECK-NEXT: OpenACCSetConstruct{{.*}}set + // CHECK-NEXT: default_async clause + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' + // CHECK-NEXT: device_num clause + // CHECK-NEXT: CallExpr{{.*}} 'long' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_long' 'long ()' + // CHECK-NEXT: device_type(DT) + // CHECK-NEXT: if clause + // CHECK-NEXT: BinaryOperator{{.*}}'bool' '<' + // CHECK-NEXT: ImplicitCastExpr{{.*}}'long' + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' + // CHECK-NEXT: CallExpr{{.*}} 'long' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_long' 'long ()' +} + +template<typename T> +void TemplFunc(T t) { + // CHECK-LABEL: FunctionTemplateDecl {{.*}}TemplFunc + // CHECK-NEXT: TemplateTypeParmDecl + // CHECK-NEXT: FunctionDecl{{.*}}TemplFunc + // CHECK-NEXT: ParmVarDecl{{.*}} t 'T' + // CHECK-NEXT: CompoundStmt + +#pragma acc set default_async(T::value) device_num(t) device_type(DT) if (T::value < t) + // CHECK-NEXT: OpenACCSetConstruct{{.*}}set + // CHECK-NEXT: default_async clause + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}} '<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' + // CHECK-NEXT: device_num clause + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'T' + // CHECK-NEXT: device_type(DT) + // CHECK-NEXT: if clause + // CHECK-NEXT: BinaryOperator{{.*}}'<dependent type>' '<' + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}} '<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'T' + + // Instantiation: + // CHECK-NEXT: FunctionDecl{{.*}} TemplFunc 'void (SomeStruct)' implicit_instantiation + // CHECK-NEXT: TemplateArgument type 'SomeStruct' + // CHECK-NEXT: RecordType{{.*}} 'SomeStruct' + // CHECK-NEXT: CXXRecord{{.*}} 'SomeStruct' + // CHECK-NEXT: ParmVarDecl{{.*}} t 'SomeStruct' + // CHECK-NEXT: CompoundStmt + + // CHECK-NEXT: OpenACCSetConstruct{{.*}}set + // CHECK-NEXT: default_async clause + // CHECK-NEXT: ImplicitCastExpr {{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + // CHECK-NEXT: device_num clause + // CHECK-NEXT: ImplicitCastExpr {{.*}}'unsigned int' + // CHECK-NEXT: CXXMemberCallExpr{{.*}}'unsigned int' + // CHECK-NEXT: MemberExpr{{.*}}.operator unsigned int + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'SomeStruct' + // CHECK-NEXT: device_type(DT) + // CHECK-NEXT: if clause + // CHECK-NEXT: BinaryOperator{{.*}}'bool' '<' + // CHECK-NEXT: ImplicitCastExpr {{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + // CHECK-NEXT: ImplicitCastExpr {{.*}}'unsigned int' + // CHECK-NEXT: CXXMemberCallExpr{{.*}}'unsigned int' + // CHECK-NEXT: MemberExpr{{.*}}.operator unsigned int + // CHECk-NEXT: DeclRefExpr{{.*}}'t' 'SomeStruct' +} + +struct SomeStruct{ + static constexpr unsigned value = 5; + operator unsigned(); +}; + +void use() { + TemplFunc(SomeStruct{}); +} +#endif diff --git a/clang/test/SemaOpenACC/set-construct.cpp b/clang/test/SemaOpenACC/set-construct.cpp new file mode 100644 index 000000000000..23816dbab291 --- /dev/null +++ b/clang/test/SemaOpenACC/set-construct.cpp @@ -0,0 +1,69 @@ +// RUN: %clang_cc1 %s -fopenacc -verify + +struct NotConvertible{} NC; +short getS(); +int getI(); + +struct AmbiguousConvert{ + operator int(); // #AMBIG_INT + operator short(); // #AMBIG_SHORT + operator float(); +} Ambiguous; + +struct ExplicitConvertOnly { + explicit operator int() const; // #EXPL_CONV +} Explicit; + +void uses() { +#pragma acc set default_async(getI()) +#pragma acc set device_num(getI()) +#pragma acc set device_type(getI) +#pragma acc set device_type(getI) if (getI() < getS()) + + // expected-error@+1{{value of type 'struct NotConvertible' is not contextually convertible to 'bool'}} +#pragma acc set if (NC) device_type(I) + + // expected-error@+2{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} + // expected-error@+1{{OpenACC clause 'device_num' requires expression of integer type ('struct NotConvertible' invalid)}} +#pragma acc set device_num(NC) + // expected-error@+4{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} + // expected-error@+3{{multiple conversions from expression type 'struct AmbiguousConvert' to an integral type}} + // expected-note@#AMBIG_INT{{conversion to integral type 'int'}} + // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}} +#pragma acc set device_num(Ambiguous) + // expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}} + // expected-note@#EXPL_CONV{{conversion to integral type 'int'}} +#pragma acc set device_num(Explicit) + + // expected-error@+2{{OpenACC clause 'default_async' requires expression of integer type ('struct NotConvertible' invalid)}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} +#pragma acc set default_async(NC) + // expected-error@+4{{multiple conversions from expression type 'struct AmbiguousConvert' to an integral type}} + // expected-note@#AMBIG_INT{{conversion to integral type 'int'}} + // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}} + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} +#pragma acc set default_async(Ambiguous) + // expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}} + // expected-note@#EXPL_CONV{{conversion to integral type 'int'}} +#pragma acc set default_async(Explicit) + + // expected-error@+1{{OpenACC 'set' construct must have at least one 'default_async', 'device_num', 'device_type' or 'if' clause}} +#pragma acc set + +#pragma acc set if (true) + + // expected-error@+2{{'default_async' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set default_async(getI()) default_async(getI()) + + // expected-error@+2{{'device_num' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set device_num(getI()) device_num(getI()) + + // expected-error@+2{{'device_type' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set device_type(I) device_type(I) + // expected-error@+2{{'if' clause cannot appear more than once on a 'set' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc set device_type(I) if(true) if (true) +} diff --git a/clang/test/SemaOpenACC/unimplemented-construct.c b/clang/test/SemaOpenACC/unimplemented-construct.c index 42737eb08d93..b22bfa5a69bb 100644 --- a/clang/test/SemaOpenACC/unimplemented-construct.c +++ b/clang/test/SemaOpenACC/unimplemented-construct.c @@ -4,8 +4,8 @@ #pragma acc routine struct S { -// expected-warning@+1{{OpenACC construct 'set' not yet implemented, pragma ignored}} -#pragma acc set +// expected-warning@+1{{OpenACC construct 'declare' not yet implemented, pragma ignored}} +#pragma acc declare int foo; }; diff --git a/clang/test/SemaOpenACC/update-construct-ast.cpp b/clang/test/SemaOpenACC/update-construct-ast.cpp new file mode 100644 index 000000000000..9048e8823f5f --- /dev/null +++ b/clang/test/SemaOpenACC/update-construct-ast.cpp @@ -0,0 +1,267 @@ +// 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 + +int some_int(); +long some_long(); + +int Global; +short GlobalArray[5]; + + +void NormalFunc() { + // CHECK-LABEL: NormalFunc + // CHECK-NEXT: CompoundStmt + +#pragma acc update if_present if (some_int() < some_long()) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: if_present clause + // CHECK-NEXT: if clause + // CHECK-NEXT: BinaryOperator{{.*}}'bool' '<' + // CHECK-NEXT: ImplicitCastExpr{{.*}}'long' + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' + // CHECK-NEXT: CallExpr{{.*}} 'long' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_long' 'long ()' + +#pragma acc update wait async device_type(A) dtype(B) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: async clause + // CHECK-NEXT: device_type(A) + // CHECK-NEXT: dtype(B) +#pragma acc update wait(some_int(), some_long()) async(some_int()) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' + // CHECK-NEXT: CallExpr{{.*}}'long' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_long' 'long ()' + // CHECK-NEXT: async clause + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' +#pragma acc update wait(queues:some_int(), some_long()) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' + // CHECK-NEXT: CallExpr{{.*}}'long' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_long' 'long ()' +#pragma acc update wait(devnum: some_int() :some_int(), some_long()) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' + // CHECK-NEXT: CallExpr{{.*}}'int' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_int' 'int ()' + // CHECK-NEXT: CallExpr{{.*}}'long' + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'some_long' 'long ()' + +#pragma acc update self(Global, GlobalArray, GlobalArray[0], GlobalArray[0:1]) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: self clause + // CHECK-NEXT: DeclRefExpr{{.*}}'Global' 'int' + // CHECK-NEXT: DeclRefExpr{{.*}}'GlobalArray' 'short[5]' + // CHECK-NEXT: ArraySubscriptExpr{{.*}} 'short' lvalue + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'GlobalArray' 'short[5]' + // CHECK-NEXT: IntegerLiteral{{.*}} 0 + // CHECK-NEXT: ArraySectionExpr + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}}'GlobalArray' 'short[5]' + // CHECK-NEXT: IntegerLiteral{{.*}} 0 + // CHECK-NEXT: IntegerLiteral{{.*}} 1 +} + +template<typename T> +void TemplFunc(T t) { + // CHECK-LABEL: FunctionTemplateDecl {{.*}}TemplFunc + // CHECK-NEXT: TemplateTypeParmDecl + // CHECK-NEXT: FunctionDecl{{.*}}TemplFunc + // CHECK-NEXT: ParmVarDecl{{.*}} t 'T' + // CHECK-NEXT: CompoundStmt + +#pragma acc update if_present if (T::value < t) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: if_present clause + // CHECK-NEXT: if clause + // CHECK-NEXT: BinaryOperator{{.*}}'<dependent type>' '<' + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}} '<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'T' + +#pragma acc update wait async device_type(T) dtype(U) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: async clause + // CHECK-NEXT: device_type(T) + // CHECK-NEXT: dtype(U) +#pragma acc update wait(T::value, t) async(T::value) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}}'<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' + // CHECK-NEXT: DeclRefExpr{{.*}} 't' 'T' + // CHECK-NEXT: async clause + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}}'<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' +#pragma acc update wait(queues:T::value, t) async(t) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}}'<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' + // CHECK-NEXT: DeclRefExpr{{.*}} 't' 'T' + // CHECK-NEXT: async clause + // CHECK-NEXT: DeclRefExpr{{.*}} 't' 'T' +#pragma acc update wait(devnum: T::value:t, T::value) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}}'<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' + // CHECK-NEXT: DeclRefExpr{{.*}} 't' 'T' + // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}}'<dependent type>' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'T' + + decltype(T::value) Local = 0, LocalArray[5] = {}; + // CHECK-NEXT: DeclStmt + // CHECK-NEXT: VarDecl + // CHECK-NEXT: IntegerLiteral + // CHECK-NEXT: VarDecl + // CHECK-NEXT: InitListExpr + +#pragma acc update self(Local, LocalArray, LocalArray[0], LocalArray[0:1]) + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: self clause + // CHECK-NEXT: DeclRefExpr{{.*}} 'Local' 'decltype(T::value)' + // CHECK-NEXT: DeclRefExpr{{.*}} 'LocalArray' 'decltype(T::value)[5]' + // CHECK-NEXT: ArraySubscriptExpr + // CHECK-NEXT: DeclRefExpr{{.*}} 'LocalArray' 'decltype(T::value)[5]' + // CHECK-NEXT: IntegerLiteral{{.*}}0 + // CHECK-NEXT: ArraySectionExpr + // CHECK-NEXT: DeclRefExpr{{.*}} 'LocalArray' 'decltype(T::value)[5]' + // CHECK-NEXT: IntegerLiteral{{.*}}0 + // CHECK-NEXT: IntegerLiteral{{.*}}1 + + // Instantiation: + // CHECK-NEXT: FunctionDecl{{.*}} TemplFunc 'void (SomeStruct)' implicit_instantiation + // CHECK-NEXT: TemplateArgument type 'SomeStruct' + // CHECK-NEXT: RecordType{{.*}} 'SomeStruct' + // CHECK-NEXT: CXXRecord{{.*}} 'SomeStruct' + // CHECK-NEXT: ParmVarDecl{{.*}} t 'SomeStruct' + // CHECK-NEXT: CompoundStmt + + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: if_present clause + // CHECK-NEXT: if clause + // CHECK-NEXT: BinaryOperator{{.*}}'bool' '<' + // CHECK-NEXT: ImplicitCastExpr {{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + // CHECK-NEXT: ImplicitCastExpr {{.*}}'unsigned int' + // CHECK-NEXT: CXXMemberCallExpr{{.*}}'unsigned int' + // CHECK-NEXT: MemberExpr{{.*}}.operator unsigned int + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'SomeStruct' + + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: async clause + // CHECK-NEXT: device_type(T) + // CHECK-NEXT: dtype(U) + + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: CXXMemberCallExpr{{.*}}'unsigned int' + // CHECK-NEXT: MemberExpr{{.*}}.operator unsigned int + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'SomeStruct' + // CHECK-NEXT: async clause + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: <<<NULL>>> + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: CXXMemberCallExpr{{.*}}'unsigned int' + // CHECK-NEXT: MemberExpr{{.*}}.operator unsigned int + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'SomeStruct' + // CHECK-NEXT: async clause + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: CXXMemberCallExpr{{.*}}'unsigned int' + // CHECK-NEXT: MemberExpr{{.*}}.operator unsigned int + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'SomeStruct' + + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: wait clause + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: CXXMemberCallExpr{{.*}}'unsigned int' + // CHECK-NEXT: MemberExpr{{.*}}.operator unsigned int + // CHECK-NEXT: DeclRefExpr{{.*}}'t' 'SomeStruct' + // CHECK-NEXT: ImplicitCastExpr{{.*}}'unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}}'value' 'const unsigned int' + // CHECK-NEXT: NestedNameSpecifier TypeSpec 'SomeStruct' + + // CHECK-NEXT: DeclStmt + // CHECK-NEXT: VarDecl + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: IntegerLiteral + // CHECK-NEXT: VarDecl + // CHECK-NEXT: InitListExpr + // CHECK-NEXT: array_filler + + // CHECK-NEXT: OpenACCUpdateConstruct{{.*}}update + // CHECK-NEXT: self clause + // CHECK-NEXT: DeclRefExpr{{.*}} 'Local' 'decltype(SomeStruct::value)':'const unsigned int' + // CHECK-NEXT: DeclRefExpr{{.*}} 'LocalArray' 'decltype(SomeStruct::value)[5]' + // CHECK-NEXT: ArraySubscriptExpr + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}} 'LocalArray' 'decltype(SomeStruct::value)[5]' + // CHECK-NEXT: IntegerLiteral{{.*}}0 + // CHECK-NEXT: ArraySectionExpr + // CHECK-NEXT: ImplicitCastExpr + // CHECK-NEXT: DeclRefExpr{{.*}} 'LocalArray' 'decltype(SomeStruct::value)[5]' + // CHECK-NEXT: IntegerLiteral{{.*}}0 + // CHECK-NEXT: IntegerLiteral{{.*}}1 +} + +struct SomeStruct{ + static constexpr unsigned value = 5; + operator unsigned(); +}; +void use() { + TemplFunc(SomeStruct{}); +} +#endif diff --git a/clang/test/SemaOpenACC/update-construct.cpp b/clang/test/SemaOpenACC/update-construct.cpp new file mode 100644 index 000000000000..2abd7a30eda8 --- /dev/null +++ b/clang/test/SemaOpenACC/update-construct.cpp @@ -0,0 +1,167 @@ +// RUN: %clang_cc1 %s -fopenacc -verify + +struct NotConvertible{} NC; +int getI(); +void uses() { + int Var; +#pragma acc update async self(Var) +#pragma acc update wait self(Var) +#pragma acc update self(Var) device_type(I) +#pragma acc update if(true) self(Var) +#pragma acc update if_present self(Var) +#pragma acc update self(Var) + // expected-warning@+1{{OpenACC clause 'host' not yet implemented}} +#pragma acc update host(Var) + // expected-warning@+1{{OpenACC clause 'device' not yet implemented}} +#pragma acc update device(Var) + + // expected-error@+2{{OpenACC clause 'if' may not follow a 'device_type' clause in a 'update' construct}} + // expected-note@+1{{previous clause is here}} +#pragma acc update self(Var) device_type(I) if(true) + // expected-error@+2{{OpenACC clause 'if_present' may not follow a 'device_type' clause in a 'update' construct}} + // expected-note@+1{{previous clause is here}} +#pragma acc update self(Var) device_type(I) if_present + // expected-error@+2{{OpenACC clause 'self' may not follow a 'device_type' clause in a 'update' construct}} + // expected-note@+1{{previous clause is here}} +#pragma acc update device_type(I) self(Var) + // expected-error@+2{{OpenACC clause 'host' may not follow a 'device_type' clause in a 'update' construct}} + // expected-note@+1{{previous clause is here}} +#pragma acc update device_type(I) host(Var) + // expected-error@+2{{OpenACC clause 'device' may not follow a 'device_type' clause in a 'update' construct}} + // expected-note@+1{{previous clause is here}} +#pragma acc update device_type(I) device(Var) + // These 2 are OK. +#pragma acc update self(Var) device_type(I) async +#pragma acc update self(Var) device_type(I) wait + // Unless otherwise specified, we assume 'device_type' can happen after itself. +#pragma acc update self(Var) device_type(I) device_type(I) + + // TODO: OpenACC: These should diagnose because there isn't at least 1 of + // 'self', 'host', or 'device'. +#pragma acc update async +#pragma acc update wait +#pragma acc update device_type(I) +#pragma acc update if(true) +#pragma acc update if_present + + // expected-error@+1{{value of type 'struct NotConvertible' is not contextually convertible to 'bool'}} +#pragma acc update if (NC) device_type(I) + + // expected-error@+2{{OpenACC 'if' clause cannot appear more than once on a 'update' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc update if(true) if (false) + + // TODO: OpenACC: There is restrictions on the contents of a 'varlist', so + // those should be checked here too. + + // Cannot be the body of an 'if', 'while', 'do', 'switch', or + // 'label'. + // expected-error@+3{{OpenACC 'update' construct may not appear in place of the statement following an if statement}} + if (true) + // expected-warning@+1{{OpenACC clause 'device' not yet implemented}} +#pragma acc update device(Var) + + // expected-error@+3{{OpenACC 'update' construct may not appear in place of the statement following a while statement}} + while (true) + // expected-warning@+1{{OpenACC clause 'device' not yet implemented}} +#pragma acc update device(Var) + + // expected-error@+3{{OpenACC 'update' construct may not appear in place of the statement following a do statement}} + do + // expected-warning@+1{{OpenACC clause 'device' not yet implemented}} +#pragma acc update device(Var) + while (true); + + // expected-error@+3{{OpenACC 'update' construct may not appear in place of the statement following a switch statement}} + switch(Var) + // expected-warning@+1{{OpenACC clause 'device' not yet implemented}} +#pragma acc update device(Var) + + // expected-error@+3{{OpenACC 'update' construct may not appear in place of the statement following a label statement}} + LABEL: + // expected-warning@+1{{OpenACC clause 'device' not yet implemented}} +#pragma acc update device(Var) + + // For loops are OK. + for (;;) + // expected-warning@+1{{OpenACC clause 'device' not yet implemented}} +#pragma acc update device(Var) + + // Checking for 'async', which requires an 'int' expression. +#pragma acc update async + +#pragma acc update async(getI()) + // expected-error@+2{{expected ')'}} + // expected-note@+1{{to match this '('}} +#pragma acc update async(getI(), getI()) + // expected-error@+2{{OpenACC 'async' clause cannot appear more than once on a 'update' directive}} + // expected-note@+1{{previous clause is here}} +#pragma acc update async(getI()) async(getI()) + // expected-error@+1{{OpenACC clause 'async' requires expression of integer type ('struct NotConvertible' invalid)}} +#pragma acc update async(NC) + + // Checking for 'wait', which has a complicated set arguments. +#pragma acc update wait +#pragma acc update wait() +#pragma acc update wait(getI(), getI()) +#pragma acc update wait(devnum: getI(): getI()) +#pragma acc update wait(devnum: getI(): queues: getI(), getI()) + // expected-error@+1{{OpenACC clause 'wait' requires expression of integer type ('struct NotConvertible' invalid)}} +#pragma acc update wait(devnum:NC : 5) + // expected-error@+1{{OpenACC clause 'wait' requires expression of integer type ('struct NotConvertible' invalid)}} +#pragma acc update wait(devnum:5 : NC) + + int arr[5]; + // expected-error@+3{{OpenACC clause 'wait' requires expression of integer type ('int[5]' invalid)}} + // expected-error@+2{{OpenACC clause 'wait' requires expression of integer type ('int[5]' invalid)}} + // expected-error@+1{{OpenACC clause 'wait' requires expression of integer type ('struct NotConvertible' invalid)}} +#pragma acc update wait(devnum:arr : queues: arr, NC, 5) +} + +struct SomeS { + int Array[5]; + int MemberOfComp; +}; + +template<typename I, typename T> +void varlist_restrictions_templ() { + I iArray[5]; + T Single; + T Array[5]; + + // Members of a subarray of struct or class type may not appear, but others + // are permitted to. +#pragma acc update self(iArray[0:1]) + +#pragma acc update self(Array[0:1]) + + // expected-error@+1{{OpenACC sub-array is not allowed here}} +#pragma acc update self(Array[0:1].MemberOfComp) +} + +void varlist_restrictions() { + varlist_restrictions_templ<int, SomeS>();// expected-note{{in instantiation of}} + int iArray[5]; + SomeS Single; + SomeS Array[5]; + + int LocalInt; + int *LocalPtr; + +#pragma acc update self(LocalInt, LocalPtr, Single) + +#pragma acc update self(Single.MemberOfComp) + +#pragma acc update self(Single.Array[0:1]) + + + // Members of a subarray of struct or class type may not appear, but others + // are permitted to. +#pragma acc update self(iArray[0:1]) + +#pragma acc update self(Array[0:1]) + + // expected-error@+1{{OpenACC sub-array is not allowed here}} +#pragma acc update self(Array[0:1].MemberOfComp) +} + diff --git a/clang/test/SemaSPIRV/BuiltIns/distance-errors.c b/clang/test/SemaSPIRV/BuiltIns/distance-errors.c new file mode 100644 index 000000000000..17ea25d50789 --- /dev/null +++ b/clang/test/SemaSPIRV/BuiltIns/distance-errors.c @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 %s -triple spirv-pc-vulkan-compute -verify + +typedef float float2 __attribute__((ext_vector_type(2))); + +float test_no_second_arg(float2 p0) { + return __builtin_spirv_distance(p0); + // expected-error@-1 {{too few arguments to function call, expected 2, have 1}} +} + +float test_too_many_arg(float2 p0) { + return __builtin_spirv_distance(p0, p0, p0); + // expected-error@-1 {{too many arguments to function call, expected 2, have 3}} +} + +float test_double_scalar_inputs(double p0, double p1) { + return __builtin_spirv_distance(p0, p1); + // expected-error@-1 {{passing 'double' to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(double)))) double' (vector of 2 'double' values)}} +} + +float test_int_scalar_inputs(int p0, int p1) { + return __builtin_spirv_distance(p0, p1); + // expected-error@-1 {{passing 'int' to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values)}} +} diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp index 312469313fc5..f335ca3bd22b 100644 --- a/clang/test/SemaTemplate/concepts.cpp +++ b/clang/test/SemaTemplate/concepts.cpp @@ -1165,3 +1165,15 @@ concept C = invalid; // expected-error {{use of undeclared identifier 'invalid'} bool val2 = C<int>; } // namespace GH109780 + +namespace GH121980 { + +template <class> +concept has_member_difference_type; // expected-error {{expected '='}} + +template <has_member_difference_type> struct incrementable_traits; // expected-note {{declared here}} + +template <has_member_difference_type Tp> +struct incrementable_traits<Tp>; // expected-error {{not more specialized than the primary}} + +} diff --git a/clang/test/VFS/external-names.c b/clang/test/VFS/external-names.c index 5b7c443b36e5..dd0b5eb50184 100644 --- a/clang/test/VFS/external-names.c +++ b/clang/test/VFS/external-names.c @@ -47,4 +47,4 @@ // RUN: %clang_cc1 -D REINCLUDE -I %t -ivfsoverlay %t.yaml -Eonly %s -MTfoo -dependency-file %t.dep // RUN: cat %t.dep | FileCheck --check-prefix=CHECK-DEP %s -// CHECK-DEP-NOT: Inputs +// CHECK-DEP: Inputs{{..?}}external-names.h diff --git a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp index 98be350b3937..e332528e24e2 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp +++ b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp @@ -1,5 +1,9 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --version 5 // Basic C++ test for update_cc_test_checks // RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64-apple-macho -emit-llvm -o - %s | FileCheck %s --check-prefix=MACHO +// RUN: %clang_cc1 -triple=x86_64-windows-msvc -emit-llvm -o - %s | FileCheck %s --check-prefix=MSVC +// RUN: %clang_cc1 -triple=x86_64-windows-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=MINGW class Foo { int x; @@ -13,6 +17,8 @@ public: inline int function_defined_out_of_line(int arg) const; }; +[[clang::noinline]] static int static_noinline_fn(int arg) { return arg; } + Foo::Foo(int x) : x(x) {} Foo::~Foo() {} int Foo::function_defined_out_of_line(int arg) const { return x - arg; } @@ -22,4 +28,5 @@ int main() { Foo f(1); f.function_defined_inline(2); f.function_defined_out_of_line(3); + return static_noinline_fn(0); } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected index c42dc07fa359..96370b4bec2d 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected @@ -1,6 +1,9 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --version 5 // Basic C++ test for update_cc_test_checks // RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple=x86_64-apple-macho -emit-llvm -o - %s | FileCheck %s --check-prefix=MACHO +// RUN: %clang_cc1 -triple=x86_64-windows-msvc -emit-llvm -o - %s | FileCheck %s --check-prefix=MSVC +// RUN: %clang_cc1 -triple=x86_64-windows-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=MINGW class Foo { int x; @@ -8,52 +11,109 @@ class Foo { public: explicit Foo(int x); ~Foo(); -// CHECK-LABEL: @_ZNK3Foo23function_defined_inlineEi( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 -// CHECK-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store ptr [[THIS:%.*]], ptr [[THIS_ADDR]], align 8 -// CHECK-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 -// CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 -// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 -// CHECK-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 -// CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[X]], align 4 -// CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]] -// CHECK-NEXT: ret i32 [[ADD]] -// inline int function_defined_inline(int arg) const { return arg + x; } inline int function_defined_out_of_line(int arg) const; }; -// CHECK-LABEL: @_ZN3FooC1Ei( -// CHECK-NEXT: entry: +[[clang::noinline]] static int static_noinline_fn(int arg) { return arg; } + +Foo::Foo(int x) : x(x) {} +Foo::~Foo() {} +int Foo::function_defined_out_of_line(int arg) const { return x - arg; } + +// Call the inline methods to ensure the LLVM IR is generated: +int main() { + Foo f(1); + f.function_defined_inline(2); + f.function_defined_out_of_line(3); + return static_noinline_fn(0); +} +// CHECK-LABEL: define dso_local void @_ZN3FooC2Ei( +// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[X:%.*]]) unnamed_addr #[[ATTR0:[0-9]+]] align 2 { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: store i32 [[X]], ptr [[X_ADDR]], align 4 +// CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: [[X2:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4 +// CHECK-NEXT: store i32 [[TMP0]], ptr [[X2]], align 4 +// CHECK-NEXT: ret void +// +// +// CHECK-LABEL: define dso_local void @_ZN3FooC1Ei( +// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[X:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store ptr [[THIS:%.*]], ptr [[THIS_ADDR]], align 8 -// CHECK-NEXT: store i32 [[X:%.*]], ptr [[X_ADDR]], align 4 +// CHECK-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: store i32 [[X]], ptr [[X_ADDR]], align 4 // CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4 // CHECK-NEXT: call void @_ZN3FooC2Ei(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]], i32 noundef [[TMP0]]) // CHECK-NEXT: ret void // -Foo::Foo(int x) : x(x) {} -// CHECK-LABEL: @_ZN3FooD1Ev( -// CHECK-NEXT: entry: +// +// CHECK-LABEL: define dso_local void @_ZN3FooD2Ev( +// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 -// CHECK-NEXT: store ptr [[THIS:%.*]], ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: ret void +// +// +// CHECK-LABEL: define dso_local void @_ZN3FooD1Ev( +// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// CHECK-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 // CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 // CHECK-NEXT: call void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]]) #[[ATTR2:[0-9]+]] // CHECK-NEXT: ret void // -Foo::~Foo() {} -// CHECK-LABEL: @_ZNK3Foo28function_defined_out_of_lineEi( -// CHECK-NEXT: entry: +// +// CHECK-LABEL: define dso_local noundef i32 @main( +// CHECK-SAME: ) #[[ATTR1:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 +// CHECK-NEXT: [[F:%.*]] = alloca [[CLASS_FOO:%.*]], align 4 +// CHECK-NEXT: store i32 0, ptr [[RETVAL]], align 4 +// CHECK-NEXT: call void @_ZN3FooC1Ei(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 1) +// CHECK-NEXT: [[CALL:%.*]] = call noundef i32 @_ZNK3Foo23function_defined_inlineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 2) +// CHECK-NEXT: [[CALL1:%.*]] = call noundef i32 @_ZNK3Foo28function_defined_out_of_lineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 3) +// CHECK-NEXT: [[CALL2:%.*]] = call noundef i32 @_ZL18static_noinline_fni(i32 noundef 0) +// CHECK-NEXT: store i32 [[CALL2]], ptr [[RETVAL]], align 4 +// CHECK-NEXT: call void @_ZN3FooD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[F]]) #[[ATTR2]] +// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[RETVAL]], align 4 +// CHECK-NEXT: ret i32 [[TMP0]] +// +// +// CHECK-LABEL: define linkonce_odr noundef i32 @_ZNK3Foo23function_defined_inlineEi( +// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0]] comdat align 2 { +// CHECK-NEXT: [[ENTRY:.*:]] // CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 // CHECK-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 -// CHECK-NEXT: store ptr [[THIS:%.*]], ptr [[THIS_ADDR]], align 8 -// CHECK-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// CHECK-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// CHECK-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[X]], align 4 +// CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]] +// CHECK-NEXT: ret i32 [[ADD]] +// +// +// CHECK-LABEL: define linkonce_odr noundef i32 @_ZNK3Foo28function_defined_out_of_lineEi( +// CHECK-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0]] comdat align 2 { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// CHECK-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// CHECK-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 // CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 // CHECK-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[X]], align 4 @@ -61,20 +121,230 @@ Foo::~Foo() {} // CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP0]], [[TMP1]] // CHECK-NEXT: ret i32 [[SUB]] // -int Foo::function_defined_out_of_line(int arg) const { return x - arg; } - -// Call the inline methods to ensure the LLVM IR is generated: -// CHECK-LABEL: @main( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[F:%.*]] = alloca [[CLASS_FOO:%.*]], align 4 -// CHECK-NEXT: call void @_ZN3FooC1Ei(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 1) -// CHECK-NEXT: [[CALL:%.*]] = call noundef i32 @_ZNK3Foo23function_defined_inlineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 2) -// CHECK-NEXT: [[CALL1:%.*]] = call noundef i32 @_ZNK3Foo28function_defined_out_of_lineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 3) -// CHECK-NEXT: call void @_ZN3FooD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[F]]) #[[ATTR2]] -// CHECK-NEXT: ret i32 0 // -int main() { - Foo f(1); - f.function_defined_inline(2); - f.function_defined_out_of_line(3); -} +// CHECK-LABEL: define internal noundef i32 @_ZL18static_noinline_fni( +// CHECK-SAME: i32 noundef [[ARG:%.*]]) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// CHECK-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// CHECK-NEXT: ret i32 [[TMP0]] +// +// +// MACHO-LABEL: define void @_ZN3FooC2Ei( +// MACHO-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[X:%.*]]) unnamed_addr #[[ATTR0:[0-9]+]] align 2 { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MACHO-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: store i32 [[X]], ptr [[X_ADDR]], align 4 +// MACHO-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: [[X2:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4 +// MACHO-NEXT: store i32 [[TMP0]], ptr [[X2]], align 4 +// MACHO-NEXT: ret void +// +// +// MACHO-LABEL: define void @_ZN3FooC1Ei( +// MACHO-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[X:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MACHO-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: store i32 [[X]], ptr [[X_ADDR]], align 4 +// MACHO-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4 +// MACHO-NEXT: call void @_ZN3FooC2Ei(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]], i32 noundef [[TMP0]]) +// MACHO-NEXT: ret void +// +// +// MACHO-LABEL: define void @_ZN3FooD2Ev( +// MACHO-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MACHO-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: ret void +// +// +// MACHO-LABEL: define void @_ZN3FooD1Ev( +// MACHO-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MACHO-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: call void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]]) #[[ATTR2:[0-9]+]] +// MACHO-NEXT: ret void +// +// +// MACHO-LABEL: define noundef i32 @main( +// MACHO-SAME: ) #[[ATTR1:[0-9]+]] { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 +// MACHO-NEXT: [[F:%.*]] = alloca [[CLASS_FOO:%.*]], align 4 +// MACHO-NEXT: store i32 0, ptr [[RETVAL]], align 4 +// MACHO-NEXT: call void @_ZN3FooC1Ei(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 1) +// MACHO-NEXT: [[CALL:%.*]] = call noundef i32 @_ZNK3Foo23function_defined_inlineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 2) +// MACHO-NEXT: [[CALL1:%.*]] = call noundef i32 @_ZNK3Foo28function_defined_out_of_lineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 3) +// MACHO-NEXT: [[CALL2:%.*]] = call noundef i32 @_ZL18static_noinline_fni(i32 noundef 0) +// MACHO-NEXT: store i32 [[CALL2]], ptr [[RETVAL]], align 4 +// MACHO-NEXT: call void @_ZN3FooD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[F]]) #[[ATTR2]] +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[RETVAL]], align 4 +// MACHO-NEXT: ret i32 [[TMP0]] +// +// +// MACHO-LABEL: define linkonce_odr noundef i32 @_ZNK3Foo23function_defined_inlineEi( +// MACHO-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0]] align 2 { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MACHO-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// MACHO-NEXT: [[TMP1:%.*]] = load i32, ptr [[X]], align 4 +// MACHO-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]] +// MACHO-NEXT: ret i32 [[ADD]] +// +// +// MACHO-LABEL: define linkonce_odr noundef i32 @_ZNK3Foo28function_defined_out_of_lineEi( +// MACHO-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0]] align 2 { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MACHO-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MACHO-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[X]], align 4 +// MACHO-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP0]], [[TMP1]] +// MACHO-NEXT: ret i32 [[SUB]] +// +// +// MACHO-LABEL: define internal noundef i32 @_ZL18static_noinline_fni( +// MACHO-SAME: i32 noundef [[ARG:%.*]]) #[[ATTR0]] { +// MACHO-NEXT: [[ENTRY:.*:]] +// MACHO-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: ret i32 [[TMP0]] +// +// +// MSVC-LABEL: define dso_local noundef i32 @main( +// MSVC-SAME: ) #[[ATTR1:[0-9]+]] { +// MSVC-NEXT: [[ENTRY:.*:]] +// MSVC-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 +// MSVC-NEXT: [[F:%.*]] = alloca [[CLASS_FOO:%.*]], align 4 +// MSVC-NEXT: store i32 0, ptr [[RETVAL]], align 4 +// MSVC-NEXT: [[CALL:%.*]] = call noundef ptr @"??0Foo@@QEAA@H@Z"(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 1) +// MSVC-NEXT: [[CALL1:%.*]] = call noundef i32 @"?function_defined_inline@Foo@@QEBAHH@Z"(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 2) +// MSVC-NEXT: [[CALL2:%.*]] = call noundef i32 @"?function_defined_out_of_line@Foo@@QEBAHH@Z"(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 3) +// MSVC-NEXT: [[CALL3:%.*]] = call noundef i32 @"?static_noinline_fn@@YAHH@Z"(i32 noundef 0) +// MSVC-NEXT: store i32 [[CALL3]], ptr [[RETVAL]], align 4 +// MSVC-NEXT: call void @"??1Foo@@QEAA@XZ"(ptr noundef nonnull align 4 dereferenceable(4) [[F]]) #[[ATTR2:[0-9]+]] +// MSVC-NEXT: [[TMP0:%.*]] = load i32, ptr [[RETVAL]], align 4 +// MSVC-NEXT: ret i32 [[TMP0]] +// +// +// MINGW-LABEL: define dso_local void @_ZN3FooC2Ei( +// MINGW-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[X:%.*]]) unnamed_addr #[[ATTR0:[0-9]+]] align 2 { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MINGW-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: store i32 [[X]], ptr [[X_ADDR]], align 4 +// MINGW-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: [[X2:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4 +// MINGW-NEXT: store i32 [[TMP0]], ptr [[X2]], align 4 +// MINGW-NEXT: ret void +// +// +// MINGW-LABEL: define dso_local void @_ZN3FooC1Ei( +// MINGW-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[X:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MINGW-NEXT: [[X_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: store i32 [[X]], ptr [[X_ADDR]], align 4 +// MINGW-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[X_ADDR]], align 4 +// MINGW-NEXT: call void @_ZN3FooC2Ei(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]], i32 noundef [[TMP0]]) +// MINGW-NEXT: ret void +// +// +// MINGW-LABEL: define dso_local void @_ZN3FooD2Ev( +// MINGW-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MINGW-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: ret void +// +// +// MINGW-LABEL: define dso_local void @_ZN3FooD1Ev( +// MINGW-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR0]] align 2 { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MINGW-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: call void @_ZN3FooD2Ev(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]]) #[[ATTR2:[0-9]+]] +// MINGW-NEXT: ret void +// +// +// MINGW-LABEL: define dso_local noundef i32 @main( +// MINGW-SAME: ) #[[ATTR1:[0-9]+]] { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 +// MINGW-NEXT: [[F:%.*]] = alloca [[CLASS_FOO:%.*]], align 4 +// MINGW-NEXT: store i32 0, ptr [[RETVAL]], align 4 +// MINGW-NEXT: call void @_ZN3FooC1Ei(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 1) +// MINGW-NEXT: [[CALL:%.*]] = call noundef i32 @_ZNK3Foo23function_defined_inlineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 2) +// MINGW-NEXT: [[CALL1:%.*]] = call noundef i32 @_ZNK3Foo28function_defined_out_of_lineEi(ptr noundef nonnull align 4 dereferenceable(4) [[F]], i32 noundef 3) +// MINGW-NEXT: [[CALL2:%.*]] = call noundef i32 @_ZL18static_noinline_fni(i32 noundef 0) +// MINGW-NEXT: store i32 [[CALL2]], ptr [[RETVAL]], align 4 +// MINGW-NEXT: call void @_ZN3FooD1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[F]]) #[[ATTR2]] +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[RETVAL]], align 4 +// MINGW-NEXT: ret i32 [[TMP0]] +// +// +// MINGW-LABEL: define linkonce_odr dso_local noundef i32 @_ZNK3Foo23function_defined_inlineEi( +// MINGW-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0]] comdat align 2 { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// MINGW-NEXT: [[TMP1:%.*]] = load i32, ptr [[X]], align 4 +// MINGW-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]] +// MINGW-NEXT: ret i32 [[ADD]] +// +// +// MINGW-LABEL: define linkonce_odr dso_local noundef i32 @_ZNK3Foo28function_defined_out_of_lineEi( +// MINGW-SAME: ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[ARG:%.*]]) #[[ATTR0]] comdat align 2 { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8 +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8 +// MINGW-NEXT: [[X:%.*]] = getelementptr inbounds nuw [[CLASS_FOO:%.*]], ptr [[THIS1]], i32 0, i32 0 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[X]], align 4 +// MINGW-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP0]], [[TMP1]] +// MINGW-NEXT: ret i32 [[SUB]] +// +// +// MINGW-LABEL: define internal noundef i32 @_ZL18static_noinline_fni( +// MINGW-SAME: i32 noundef [[ARG:%.*]]) #[[ATTR0]] { +// MINGW-NEXT: [[ENTRY:.*:]] +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store i32 [[ARG]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: ret i32 [[TMP0]] +// diff --git a/clang/test/utils/update_cc_test_checks/Inputs/c-symbol-mangling.c b/clang/test/utils/update_cc_test_checks/Inputs/c-symbol-mangling.c new file mode 100644 index 000000000000..018f99264006 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/Inputs/c-symbol-mangling.c @@ -0,0 +1,49 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +/// Check that we generate checks for functions even though the mangledName +/// property in the AST dump JSON does not match the LLVM IR name. +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=ELF +// RUN: %clang_cc1 -triple=x86_64-apple-macho -emit-llvm -o - %s | FileCheck %s --check-prefix=MACHO +// RUN: %clang_cc1 -triple=x86_64-windows-msvc -emit-llvm -o - %s | FileCheck %s --check-prefix=MSVC +// RUN: %clang_cc1 -triple=x86_64-windows-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=MINGW +// RUN: %clang_cc1 -triple=i686-unknown-win32 -emit-llvm -o - %s | FileCheck %s --check-prefix=WIN32 +// RUN: %clang_cc1 -triple thumbv7s-apple-darwin -target-abi apcs-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=THUMB-DARWIN + +// UTC_ARGS: --disable +// ELF: target datalayout = "e-m:e- +// MACHO: target datalayout = "e-m:o- +// MSVC: target datalayout = "e-m:w- +// MINGW: target datalayout = "e-m:w- +// WIN32: target datalayout = "e-m:x- +// THUMB-DARWIN: target datalayout = "e-m:o- +// UTC_ARGS: --enable + +#ifdef __arm__ +/// FIXME: UTC does not find this function, but can find all others. +typedef __attribute__((neon_vector_type(8))) __INT8_TYPE__ int8x8_t; +int8x8_t test_vaba_s8(int8x8_t a, int8x8_t b, int8x8_t c) { + return a + b + c; +} +#endif + +/// Check global variable mangling +[[gnu::used]] static int i1 = 1; +int i2 = 2; + +[[clang::noinline,gnu::used]] static int static_noinline_fn(int arg) { return arg; } + +[[gnu::visibility("hidden")]] int hidden_visibility(int arg) { return arg; } + +#ifdef __ELF__ +[[gnu::visibility("protected")]] int protected_visibility(int arg) { return arg; } +#endif + +[[gnu::visibility("default")]] int default_visibility(int arg) { return arg; } + +int no_visibility(int arg) { return arg; } + + +/// FIXME: the i386 @fastcall@12 is not being checked here +#ifdef _WIN32 +int __fastcall fastcall(int arg, long arg2, long arg3) { return arg; } +#endif + diff --git a/clang/test/utils/update_cc_test_checks/Inputs/c-symbol-mangling.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/c-symbol-mangling.c.expected new file mode 100644 index 000000000000..5d514f9d64c0 --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/Inputs/c-symbol-mangling.c.expected @@ -0,0 +1,246 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +/// Check that we generate checks for functions even though the mangledName +/// property in the AST dump JSON does not match the LLVM IR name. +// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=ELF +// RUN: %clang_cc1 -triple=x86_64-apple-macho -emit-llvm -o - %s | FileCheck %s --check-prefix=MACHO +// RUN: %clang_cc1 -triple=x86_64-windows-msvc -emit-llvm -o - %s | FileCheck %s --check-prefix=MSVC +// RUN: %clang_cc1 -triple=x86_64-windows-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=MINGW +// RUN: %clang_cc1 -triple=i686-unknown-win32 -emit-llvm -o - %s | FileCheck %s --check-prefix=WIN32 +// RUN: %clang_cc1 -triple thumbv7s-apple-darwin -target-abi apcs-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=THUMB-DARWIN + +// UTC_ARGS: --disable +// ELF: target datalayout = "e-m:e- +// MACHO: target datalayout = "e-m:o- +// MSVC: target datalayout = "e-m:w- +// MINGW: target datalayout = "e-m:w- +// WIN32: target datalayout = "e-m:x- +// THUMB-DARWIN: target datalayout = "e-m:o- +// UTC_ARGS: --enable + +#ifdef __arm__ +/// FIXME: UTC does not find this function, but can find all others. +typedef __attribute__((neon_vector_type(8))) __INT8_TYPE__ int8x8_t; +int8x8_t test_vaba_s8(int8x8_t a, int8x8_t b, int8x8_t c) { + return a + b + c; +} +#endif + +/// Check global variable mangling +[[gnu::used]] static int i1 = 1; +int i2 = 2; + +// ELF-LABEL: @static_noinline_fn( +// ELF-NEXT: entry: +// ELF-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// ELF-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: ret i32 [[TMP0]] +// +// MACHO-LABEL: @static_noinline_fn( +// MACHO-NEXT: entry: +// MACHO-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: ret i32 [[TMP0]] +// +// MSVC-LABEL: @static_noinline_fn( +// MSVC-NEXT: entry: +// MSVC-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MSVC-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: ret i32 [[TMP0]] +// +// MINGW-LABEL: @static_noinline_fn( +// MINGW-NEXT: entry: +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: ret i32 [[TMP0]] +// +// WIN32-LABEL: @static_noinline_fn( +// WIN32-NEXT: entry: +// WIN32-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// WIN32-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: ret i32 [[TMP0]] +// +// THUMB-DARWIN-LABEL: @static_noinline_fn( +// THUMB-DARWIN-NEXT: entry: +// THUMB-DARWIN-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// THUMB-DARWIN-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: ret i32 [[TMP0]] +// +[[clang::noinline,gnu::used]] static int static_noinline_fn(int arg) { return arg; } + +// ELF-LABEL: @hidden_visibility( +// ELF-NEXT: entry: +// ELF-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// ELF-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: ret i32 [[TMP0]] +// +// MACHO-LABEL: @hidden_visibility( +// MACHO-NEXT: entry: +// MACHO-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: ret i32 [[TMP0]] +// +// MSVC-LABEL: @hidden_visibility( +// MSVC-NEXT: entry: +// MSVC-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MSVC-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: ret i32 [[TMP0]] +// +// MINGW-LABEL: @hidden_visibility( +// MINGW-NEXT: entry: +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: ret i32 [[TMP0]] +// +// WIN32-LABEL: @hidden_visibility( +// WIN32-NEXT: entry: +// WIN32-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// WIN32-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: ret i32 [[TMP0]] +// +// THUMB-DARWIN-LABEL: @hidden_visibility( +// THUMB-DARWIN-NEXT: entry: +// THUMB-DARWIN-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// THUMB-DARWIN-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: ret i32 [[TMP0]] +// +[[gnu::visibility("hidden")]] int hidden_visibility(int arg) { return arg; } + +#ifdef __ELF__ +// ELF-LABEL: @protected_visibility( +// ELF-NEXT: entry: +// ELF-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// ELF-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: ret i32 [[TMP0]] +// +[[gnu::visibility("protected")]] int protected_visibility(int arg) { return arg; } +#endif + +// ELF-LABEL: @default_visibility( +// ELF-NEXT: entry: +// ELF-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// ELF-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: ret i32 [[TMP0]] +// +// MACHO-LABEL: @default_visibility( +// MACHO-NEXT: entry: +// MACHO-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: ret i32 [[TMP0]] +// +// MSVC-LABEL: @default_visibility( +// MSVC-NEXT: entry: +// MSVC-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MSVC-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: ret i32 [[TMP0]] +// +// MINGW-LABEL: @default_visibility( +// MINGW-NEXT: entry: +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: ret i32 [[TMP0]] +// +// WIN32-LABEL: @default_visibility( +// WIN32-NEXT: entry: +// WIN32-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// WIN32-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: ret i32 [[TMP0]] +// +// THUMB-DARWIN-LABEL: @default_visibility( +// THUMB-DARWIN-NEXT: entry: +// THUMB-DARWIN-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// THUMB-DARWIN-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: ret i32 [[TMP0]] +// +[[gnu::visibility("default")]] int default_visibility(int arg) { return arg; } + +// ELF-LABEL: @no_visibility( +// ELF-NEXT: entry: +// ELF-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// ELF-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// ELF-NEXT: ret i32 [[TMP0]] +// +// MACHO-LABEL: @no_visibility( +// MACHO-NEXT: entry: +// MACHO-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MACHO-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MACHO-NEXT: ret i32 [[TMP0]] +// +// MSVC-LABEL: @no_visibility( +// MSVC-NEXT: entry: +// MSVC-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MSVC-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: ret i32 [[TMP0]] +// +// MINGW-LABEL: @no_visibility( +// MINGW-NEXT: entry: +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: ret i32 [[TMP0]] +// +// WIN32-LABEL: @no_visibility( +// WIN32-NEXT: entry: +// WIN32-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// WIN32-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// WIN32-NEXT: ret i32 [[TMP0]] +// +// THUMB-DARWIN-LABEL: @no_visibility( +// THUMB-DARWIN-NEXT: entry: +// THUMB-DARWIN-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// THUMB-DARWIN-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// THUMB-DARWIN-NEXT: ret i32 [[TMP0]] +// +int no_visibility(int arg) { return arg; } + + +/// FIXME: the i386 @fastcall@12 is not being checked here +#ifdef _WIN32 +// MSVC-LABEL: @fastcall( +// MSVC-NEXT: entry: +// MSVC-NEXT: [[ARG3_ADDR:%.*]] = alloca i32, align 4 +// MSVC-NEXT: [[ARG2_ADDR:%.*]] = alloca i32, align 4 +// MSVC-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MSVC-NEXT: store i32 [[ARG3:%.*]], ptr [[ARG3_ADDR]], align 4 +// MSVC-NEXT: store i32 [[ARG2:%.*]], ptr [[ARG2_ADDR]], align 4 +// MSVC-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MSVC-NEXT: ret i32 [[TMP0]] +// +// MINGW-LABEL: @fastcall( +// MINGW-NEXT: entry: +// MINGW-NEXT: [[ARG_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: [[ARG2_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: [[ARG3_ADDR:%.*]] = alloca i32, align 4 +// MINGW-NEXT: store i32 [[ARG:%.*]], ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: store i32 [[ARG2:%.*]], ptr [[ARG2_ADDR]], align 4 +// MINGW-NEXT: store i32 [[ARG3:%.*]], ptr [[ARG3_ADDR]], align 4 +// MINGW-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARG_ADDR]], align 4 +// MINGW-NEXT: ret i32 [[TMP0]] +// +int __fastcall fastcall(int arg, long arg2, long arg3) { return arg; } +#endif + diff --git a/clang/test/utils/update_cc_test_checks/c-symbol-mangling.test b/clang/test/utils/update_cc_test_checks/c-symbol-mangling.test new file mode 100644 index 000000000000..35cff933932f --- /dev/null +++ b/clang/test/utils/update_cc_test_checks/c-symbol-mangling.test @@ -0,0 +1,8 @@ +## Test that we handle mangled C symbol names correctly in the update script + +# RUN: cp %S/Inputs/c-symbol-mangling.c %t-generated.c && %update_cc_test_checks %t-generated.c +# RUN: diff -u %S/Inputs/c-symbol-mangling.c.expected %t-generated.c + +## Check that re-running update_cc_test_checks doesn't change the output +# RUN: %update_cc_test_checks %t-generated.c +# RUN: diff -u %S/Inputs/c-symbol-mangling.c.expected %t-generated.c |
