diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-19 07:02:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-19 07:02:30 +0000 |
commit | de51d671486b6ac9a2ad9ee5fcfdb1a23cc59238 (patch) | |
tree | 17ff629bd1f00b82d8dbb66a022e2f59e218c3c2 /test | |
parent | 8746d127c04f5bbaf6c6e88cef8606ca5a6a54e9 (diff) |
Notes
Diffstat (limited to 'test')
85 files changed, 2977 insertions, 179 deletions
diff --git a/test/Analysis/localization-aggressive.m b/test/Analysis/localization-aggressive.m index 346cf3ef22e2..ea5e0b152945 100644 --- a/test/Analysis/localization-aggressive.m +++ b/test/Analysis/localization-aggressive.m @@ -61,8 +61,16 @@ int random(); NSString *CFNumberFormatterCreateStringWithNumber(float x); + (NSString *)forceLocalized:(NSString *)str __attribute__((annotate("returns_localized_nsstring"))); ++ (NSString *)takesLocalizedString: + (NSString *)__attribute__((annotate("takes_localized_nsstring")))str; @end +NSString * +takesLocalizedString(NSString *str + __attribute__((annotate("takes_localized_nsstring")))) { + return str; +} + // Test cases begin here @implementation LocalizationTestSuite @@ -75,6 +83,8 @@ NSString *ForceLocalized(NSString *str) { return str; } return str; } ++ (NSString *) takesLocalizedString:(NSString *)str { return str; } + // An ObjC method that returns a localized string + (NSString *)unLocalizedStringMethod { return @"UnlocalizedString"; @@ -269,4 +279,13 @@ NSString *ForceLocalized(NSString *str) { return str; } NSString *string2 = POSSIBLE_FALSE_POSITIVE(@"Hello", @"Hello"); // no-warning } +- (void)testTakesLocalizedString { + NSString *localized = NSLocalizedString(@"Hello", @"World"); + NSString *alsoLocalized = [LocalizationTestSuite takesLocalizedString:localized]; // no-warning + NSString *stillLocalized = [LocalizationTestSuite takesLocalizedString:alsoLocalized]; // no-warning + takesLocalizedString(stillLocalized); // no-warning + + [LocalizationTestSuite takesLocalizedString:@"not localized"]; // expected-warning {{User-facing text should use localized string macro}} + takesLocalizedString(@"not localized"); // expected-warning {{User-facing text should use localized string macro}} +} @end diff --git a/test/Analysis/retain-release-inline.m b/test/Analysis/retain-release-inline.m index 0cde2c1cf5af..388c55f6be23 100644 --- a/test/Analysis/retain-release-inline.m +++ b/test/Analysis/retain-release-inline.m @@ -12,7 +12,7 @@ // // It includes the basic definitions for the test cases below. //===----------------------------------------------------------------------===// - +#define NULL 0 typedef unsigned int __darwin_natural_t; typedef unsigned long uintptr_t; typedef unsigned int uint32_t; @@ -267,6 +267,10 @@ typedef NSUInteger NSStringEncoding; extern CFStringRef CFStringCreateWithCStringNoCopy(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocator); +typedef struct { + int ref; +} isl_basic_map; + //===----------------------------------------------------------------------===// // Test cases. //===----------------------------------------------------------------------===// @@ -285,6 +289,7 @@ void test() { foo(s); bar(s); } + void test_neg() { NSString *s = [[NSString alloc] init]; // no-warning foo(s); @@ -294,6 +299,55 @@ void test_neg() { bar(s); } +__attribute__((cf_returns_retained)) isl_basic_map *isl_basic_map_cow(__attribute__((cf_consumed)) isl_basic_map *bmap); +void free(void *); + +// As 'isl_basic_map_free' is annotated with 'rc_ownership_trusted_implementation', RetainCountChecker trusts its +// implementation and doesn't analyze its body. If the annotation 'rc_ownership_trusted_implementation' is removed, +// a leak warning is raised by RetainCountChecker as the analyzer is unable to detect a decrement in the reference +// count of 'bmap' along the path in 'isl_basic_map_free' assuming the predicate of the second 'if' branch to be +// true or assuming both the predicates in the function to be false. +__attribute__((annotate("rc_ownership_trusted_implementation"))) isl_basic_map *isl_basic_map_free(__attribute__((cf_consumed)) isl_basic_map *bmap) { + if (!bmap) + return NULL; + + if (--bmap->ref > 0) + return NULL; + + free(bmap); + return NULL; +} + +// As 'isl_basic_map_copy' is annotated with 'rc_ownership_trusted_implementation', RetainCountChecker trusts its +// implementation and doesn't analyze its body. If that annotation is removed, a 'use-after-release' warning might +// be raised by RetainCountChecker as the pointer which is passed as an argument to this function and the pointer +// which is returned from the function point to the same memory location. +__attribute__((annotate("rc_ownership_trusted_implementation"))) __attribute__((cf_returns_retained)) isl_basic_map *isl_basic_map_copy(isl_basic_map *bmap) { + if (!bmap) + return NULL; + + bmap->ref++; + return bmap; +} + +void test_use_after_release_with_trusted_implementation_annotate_attribute(__attribute__((cf_consumed)) isl_basic_map *bmap) { + // After this call, 'bmap' has a +1 reference count. + bmap = isl_basic_map_cow(bmap); + // After the call to 'isl_basic_map_copy', 'bmap' has a +1 reference count. + isl_basic_map *temp = isl_basic_map_cow(isl_basic_map_copy(bmap)); + // After this call, 'bmap' has a +0 reference count. + isl_basic_map *temp2 = isl_basic_map_cow(bmap); // no-warning + isl_basic_map_free(temp2); + isl_basic_map_free(temp); +} + +void test_leak_with_trusted_implementation_annotate_attribute(__attribute__((cf_consumed)) isl_basic_map *bmap) { + // After this call, 'bmap' has a +1 reference count. + bmap = isl_basic_map_cow(bmap); // no-warning + // After this call, 'bmap' has a +0 reference count. + isl_basic_map_free(bmap); +} + //===----------------------------------------------------------------------===// // Test returning retained and not-retained values. //===----------------------------------------------------------------------===// diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index 39a3baa8960c..29af194a3d67 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -1447,7 +1447,7 @@ typedef NSString* MyStringTy; + (void) consume2:(id) CF_CONSUMED x; @end -static int ownership_attribute_doesnt_go_here NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to functions and methods}} +static int ownership_attribute_doesnt_go_here NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' only applies to function types; type here is 'int'}} void test_attr_1(TestOwnershipAttr *X) { NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}} diff --git a/test/CodeGen/aarch64-type-sizes.c b/test/CodeGen/aarch64-type-sizes.c index ce8b51fc4085..195e8968ecb1 100644 --- a/test/CodeGen/aarch64-type-sizes.c +++ b/test/CodeGen/aarch64-type-sizes.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple aarch64_be-none-linux-gnu -emit-llvm -w -o - %s | FileCheck --check-prefix=CHECK %s +// RUN: %clang_cc1 -triple aarch64_be-none-linux-gnu -emit-llvm -w -o - %s | FileCheck %s // char by definition has size 1 // CHECK: target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" diff --git a/test/CodeGen/aarch64-varargs-ms.c b/test/CodeGen/aarch64-varargs-ms.c new file mode 100644 index 000000000000..f3ff9603c9c2 --- /dev/null +++ b/test/CodeGen/aarch64-varargs-ms.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple arm64-windows-msvc -emit-llvm -o - %s | FileCheck %s + +#include <stdarg.h> + +int simple_int(va_list ap) { +// CHECK-LABEL: define i32 @simple_int + return va_arg(ap, int); +// CHECK: [[ADDR:%[a-z_0-9]+]] = bitcast i8* %argp.cur to i32* +// CHECK: [[RESULT:%[a-z_0-9]+]] = load i32, i32* [[ADDR]] +// CHECK: ret i32 [[RESULT]] +} diff --git a/test/CodeGen/builtins-hexagon.c b/test/CodeGen/builtins-hexagon.c index e2eda2afafd5..f9f5d495d02a 100644 --- a/test/CodeGen/builtins-hexagon.c +++ b/test/CodeGen/builtins-hexagon.c @@ -2962,4 +2962,16 @@ void foo() { // CHECK: @llvm.hexagon.V6.vzh.128B __builtin_HEXAGON_V6_vzh(v16); // CHECK: @llvm.hexagon.V6.vzh + __builtin_HEXAGON_Y2_dccleana(0); + // CHECK: @llvm.hexagon.Y2.dccleana + __builtin_HEXAGON_Y2_dccleaninva(0); + // CHECK: @llvm.hexagon.Y2.dccleaninva + __builtin_HEXAGON_Y2_dcinva(0); + // CHECK: @llvm.hexagon.Y2.dcinva + __builtin_HEXAGON_Y2_dczeroa(0); + // CHECK: @llvm.hexagon.Y2.dczeroa + __builtin_HEXAGON_Y4_l2fetch(0, 0); + // CHECK: @llvm.hexagon.Y4.l2fetch + __builtin_HEXAGON_Y5_l2fetch(0, 0); + // CHECK: @llvm.hexagon.Y5.l2fetch } diff --git a/test/CodeGen/builtins-systemz-vector2-error.c b/test/CodeGen/builtins-systemz-vector2-error.c new file mode 100644 index 000000000000..ceebaf8cc72f --- /dev/null +++ b/test/CodeGen/builtins-systemz-vector2-error.c @@ -0,0 +1,61 @@ +// REQUIRES: systemz-registered-target +// RUN: %clang_cc1 -target-cpu z14 -triple s390x-unknown-unknown \ +// RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s + +typedef __attribute__((vector_size(16))) signed char vec_schar; +typedef __attribute__((vector_size(16))) signed short vec_sshort; +typedef __attribute__((vector_size(16))) signed int vec_sint; +typedef __attribute__((vector_size(16))) signed long long vec_slong; +typedef __attribute__((vector_size(16))) unsigned char vec_uchar; +typedef __attribute__((vector_size(16))) unsigned short vec_ushort; +typedef __attribute__((vector_size(16))) unsigned int vec_uint; +typedef __attribute__((vector_size(16))) unsigned long long vec_ulong; +typedef __attribute__((vector_size(16))) double vec_double; +typedef __attribute__((vector_size(16))) float vec_float; + +volatile vec_schar vsc; +volatile vec_sshort vss; +volatile vec_sint vsi; +volatile vec_slong vsl; +volatile vec_uchar vuc; +volatile vec_ushort vus; +volatile vec_uint vui; +volatile vec_ulong vul; +volatile vec_double vd; +volatile vec_float vf; + +volatile unsigned int len; +int cc; + +void test_integer(void) { + __builtin_s390_vmslg(vul, vul, vuc, -1); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vmslg(vul, vul, vuc, 16); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vmslg(vul, vul, vuc, len); // expected-error {{must be a constant integer}} +} + +void test_float(void) { + __builtin_s390_vfmaxdb(vd, vd, -1); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfmaxdb(vd, vd, 16); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfmaxdb(vd, vd, len); // expected-error {{must be a constant integer}} + __builtin_s390_vfmindb(vd, vd, -1); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfmindb(vd, vd, 16); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfmindb(vd, vd, len); // expected-error {{must be a constant integer}} + + __builtin_s390_vftcisb(vf, -1, &cc); // expected-error {{argument should be a value from 0 to 4095}} + __builtin_s390_vftcisb(vf, 4096, &cc); // expected-error {{argument should be a value from 0 to 4095}} + __builtin_s390_vftcisb(vf, len, &cc); // expected-error {{must be a constant integer}} + + __builtin_s390_vfisb(vf, -1, 0); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfisb(vf, 16, 0); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfisb(vf, len, 0); // expected-error {{must be a constant integer}} + __builtin_s390_vfisb(vf, 0, -1); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfisb(vf, 0, 16); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfisb(vf, 0, len); // expected-error {{must be a constant integer}} + + __builtin_s390_vfmaxsb(vf, vf, -1); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfmaxsb(vf, vf, 16); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfmaxsb(vf, vf, len); // expected-error {{must be a constant integer}} + __builtin_s390_vfminsb(vf, vf, -1); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfminsb(vf, vf, 16); // expected-error {{argument should be a value from 0 to 15}} + __builtin_s390_vfminsb(vf, vf, len); // expected-error {{must be a constant integer}} +} diff --git a/test/CodeGen/builtins-systemz-vector2.c b/test/CodeGen/builtins-systemz-vector2.c new file mode 100644 index 000000000000..8f0b8aee8c2d --- /dev/null +++ b/test/CodeGen/builtins-systemz-vector2.c @@ -0,0 +1,136 @@ +// REQUIRES: systemz-registered-target +// RUN: %clang_cc1 -target-cpu z14 -triple s390x-ibm-linux -fno-lax-vector-conversions \ +// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s + +typedef __attribute__((vector_size(16))) signed char vec_schar; +typedef __attribute__((vector_size(16))) signed short vec_sshort; +typedef __attribute__((vector_size(16))) signed int vec_sint; +typedef __attribute__((vector_size(16))) signed long long vec_slong; +typedef __attribute__((vector_size(16))) unsigned char vec_uchar; +typedef __attribute__((vector_size(16))) unsigned short vec_ushort; +typedef __attribute__((vector_size(16))) unsigned int vec_uint; +typedef __attribute__((vector_size(16))) unsigned long long vec_ulong; +typedef __attribute__((vector_size(16))) double vec_double; +typedef __attribute__((vector_size(16))) float vec_float; + +volatile vec_schar vsc; +volatile vec_sshort vss; +volatile vec_sint vsi; +volatile vec_slong vsl; +volatile vec_uchar vuc; +volatile vec_ushort vus; +volatile vec_uint vui; +volatile vec_ulong vul; +volatile vec_double vd; +volatile vec_float vf; + +volatile unsigned int len; +const void * volatile cptr; +void * volatile ptr; +int cc; + +void test_core(void) { + vul = __builtin_s390_vbperm(vuc, vuc); + // CHECK: call <2 x i64> @llvm.s390.vbperm(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + + vsc = __builtin_s390_vlrl(len, cptr); + // CHECK: call <16 x i8> @llvm.s390.vlrl(i32 %{{.*}}, i8* %{{.*}}) + + __builtin_s390_vstrl(vsc, len, ptr); + // CHECK: call void @llvm.s390.vstrl(<16 x i8> %{{.*}}, i32 %{{.*}}, i8* %{{.*}}) +} + +void test_integer(void) { + vuc = __builtin_s390_vmslg(vul, vul, vuc, 0); + // CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vuc = __builtin_s390_vmslg(vul, vul, vuc, 15); + // CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 15) +} + +void test_float(void) { + vd = __builtin_s390_vfmaxdb(vd, vd, 4); + // CHECK: call <2 x double> @llvm.maxnum.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + vd = __builtin_s390_vfmaxdb(vd, vd, 0); + // CHECK: call <2 x double> @llvm.s390.vfmaxdb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0) + vd = __builtin_s390_vfmaxdb(vd, vd, 15); + // CHECK: call <2 x double> @llvm.s390.vfmaxdb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 15) + + vd = __builtin_s390_vfmindb(vd, vd, 4); + // CHECK: call <2 x double> @llvm.minnum.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + vd = __builtin_s390_vfmindb(vd, vd, 0); + // CHECK: call <2 x double> @llvm.s390.vfmindb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0) + vd = __builtin_s390_vfmindb(vd, vd, 15); + // CHECK: call <2 x double> @llvm.s390.vfmindb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 15) + + vd = __builtin_s390_vfnmadb(vd, vd, vd); + // CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) + // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + vd = __builtin_s390_vfnmsdb(vd, vd, vd); + // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) + // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + + vsi = __builtin_s390_vfcesbs(vf, vf, &cc); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfcesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + vsi = __builtin_s390_vfchsbs(vf, vf, &cc); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + vsi = __builtin_s390_vfchesbs(vf, vf, &cc); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + + vsi = __builtin_s390_vftcisb(vf, 0, &cc); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 0) + vsi = __builtin_s390_vftcisb(vf, 4095, &cc); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 4095) + + vf = __builtin_s390_vfmaxsb(vf, vf, 4); + // CHECK: call <4 x float> @llvm.maxnum.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + vf = __builtin_s390_vfmaxsb(vf, vf, 0); + // CHECK: call <4 x float> @llvm.s390.vfmaxsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0) + vf = __builtin_s390_vfmaxsb(vf, vf, 15); + // CHECK: call <4 x float> @llvm.s390.vfmaxsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 15) + + vf = __builtin_s390_vfminsb(vf, vf, 4); + // CHECK: call <4 x float> @llvm.minnum.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + vf = __builtin_s390_vfminsb(vf, vf, 0); + // CHECK: call <4 x float> @llvm.s390.vfminsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0) + vf = __builtin_s390_vfminsb(vf, vf, 15); + // CHECK: call <4 x float> @llvm.s390.vfminsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 15) + + vf = __builtin_s390_vfsqsb(vf); + // CHECK: call <4 x float> @llvm.sqrt.v4f32(<4 x float> %{{.*}}) + + vf = __builtin_s390_vfmasb(vf, vf, vf); + // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) + vf = __builtin_s390_vfmssb(vf, vf, vf); + // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) + vf = __builtin_s390_vfnmasb(vf, vf, vf); + // CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) + // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + vf = __builtin_s390_vfnmssb(vf, vf, vf); + // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) + // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + + vf = __builtin_s390_vflpsb(vf); + // CHECK: call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}}) + vf = __builtin_s390_vflnsb(vf); + // CHECK: [[ABS:%[^ ]+]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}}) + // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[ABS]] + + vf = __builtin_s390_vfisb(vf, 0, 0); + // CHECK: call <4 x float> @llvm.rint.v4f32(<4 x float> %{{.*}}) + vf = __builtin_s390_vfisb(vf, 4, 0); + // CHECK: call <4 x float> @llvm.nearbyint.v4f32(<4 x float> %{{.*}}) + vf = __builtin_s390_vfisb(vf, 4, 1); + // CHECK: call <4 x float> @llvm.round.v4f32(<4 x float> %{{.*}}) + vf = __builtin_s390_vfisb(vf, 4, 5); + // CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}}) + vf = __builtin_s390_vfisb(vf, 4, 6); + // CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{.*}}) + vf = __builtin_s390_vfisb(vf, 4, 7); + // CHECK: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{.*}}) + vf = __builtin_s390_vfisb(vf, 4, 4); + // CHECK: call <4 x float> @llvm.s390.vfisb(<4 x float> %{{.*}}, i32 4, i32 4) +} + diff --git a/test/CodeGen/builtins-systemz-zvector-error.c b/test/CodeGen/builtins-systemz-zvector-error.c index b28e8d9bc1fc..8d5aaabfbac3 100644 --- a/test/CodeGen/builtins-systemz-zvector-error.c +++ b/test/CodeGen/builtins-systemz-zvector-error.c @@ -446,43 +446,43 @@ void test_integer(void) { // expected-note@vecintrin.h:* 1 {{must be a constant integer}} vsc = vec_sld(vsc, vsc, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} + // expected-note@vecintrin.h:* 12 {{candidate function not viable}} // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} vsc = vec_sld(vsc, vsc, -1); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} + // expected-note@vecintrin.h:* 12 {{candidate function not viable}} // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} vsc = vec_sld(vsc, vsc, 16); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} + // expected-note@vecintrin.h:* 12 {{candidate function not viable}} // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} vuc = vec_sld(vuc, vuc, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} - // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + // expected-note@vecintrin.h:* 11 {{candidate function not viable}} + // expected-note@vecintrin.h:* 2 {{must be a constant integer from 0 to 15}} vuc = vec_sld(vuc, vuc, -1); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} - // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + // expected-note@vecintrin.h:* 11 {{candidate function not viable}} + // expected-note@vecintrin.h:* 2 {{must be a constant integer from 0 to 15}} vuc = vec_sld(vuc, vuc, 16); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} - // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + // expected-note@vecintrin.h:* 11 {{candidate function not viable}} + // expected-note@vecintrin.h:* 2 {{must be a constant integer from 0 to 15}} vss = vec_sld(vss, vss, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} + // expected-note@vecintrin.h:* 12 {{candidate function not viable}} // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} vus = vec_sld(vus, vus, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} - // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + // expected-note@vecintrin.h:* 11 {{candidate function not viable}} + // expected-note@vecintrin.h:* 2 {{must be a constant integer from 0 to 15}} vsi = vec_sld(vsi, vsi, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} + // expected-note@vecintrin.h:* 12 {{candidate function not viable}} // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} vui = vec_sld(vui, vui, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} - // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + // expected-note@vecintrin.h:* 11 {{candidate function not viable}} + // expected-note@vecintrin.h:* 2 {{must be a constant integer from 0 to 15}} vsl = vec_sld(vsl, vsl, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} + // expected-note@vecintrin.h:* 12 {{candidate function not viable}} // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} vul = vec_sld(vul, vul, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} - // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + // expected-note@vecintrin.h:* 11 {{candidate function not viable}} + // expected-note@vecintrin.h:* 2 {{must be a constant integer from 0 to 15}} vd = vec_sld(vd, vd, idx); // expected-error {{no matching function}} - // expected-note@vecintrin.h:* 8 {{candidate function not viable}} + // expected-note@vecintrin.h:* 12 {{candidate function not viable}} // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} vsc = vec_sldw(vsc, vsc, idx); // expected-error {{no matching function}} diff --git a/test/CodeGen/builtins-systemz-zvector.c b/test/CodeGen/builtins-systemz-zvector.c index 6d554af44e93..a8adbd717ea1 100644 --- a/test/CodeGen/builtins-systemz-zvector.c +++ b/test/CodeGen/builtins-systemz-zvector.c @@ -294,6 +294,16 @@ void test_core(void) { vec_scatter_element(vd, vul, ptrd, 0); vec_scatter_element(vd, vul, ptrd, 1); + vsc = vec_xl(idx, cptrsc); + vuc = vec_xl(idx, cptruc); + vss = vec_xl(idx, cptrss); + vus = vec_xl(idx, cptrus); + vsi = vec_xl(idx, cptrsi); + vui = vec_xl(idx, cptrui); + vsl = vec_xl(idx, cptrsl); + vul = vec_xl(idx, cptrul); + vd = vec_xl(idx, cptrd); + vsc = vec_xld2(idx, cptrsc); vuc = vec_xld2(idx, cptruc); vss = vec_xld2(idx, cptrss); @@ -311,6 +321,16 @@ void test_core(void) { vsi = vec_xlw4(idx, cptrsi); vui = vec_xlw4(idx, cptrui); + vec_xst(vsc, idx, ptrsc); + vec_xst(vuc, idx, ptruc); + vec_xst(vss, idx, ptrss); + vec_xst(vus, idx, ptrus); + vec_xst(vsi, idx, ptrsi); + vec_xst(vui, idx, ptrui); + vec_xst(vsl, idx, ptrsl); + vec_xst(vul, idx, ptrul); + vec_xst(vd, idx, ptrd); + vec_xstd2(vsc, idx, ptrsc); vec_xstd2(vuc, idx, ptruc); vec_xstd2(vss, idx, ptrss); @@ -1841,6 +1861,10 @@ void test_integer(void) { // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vuc = vec_sld(vuc, vuc, 15); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) + vbc = vec_sld(vbc, vbc, 0); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vbc = vec_sld(vbc, vbc, 15); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) vss = vec_sld(vss, vss, 0); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vss = vec_sld(vss, vss, 15); @@ -1849,6 +1873,10 @@ void test_integer(void) { // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vus = vec_sld(vus, vus, 15); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) + vbs = vec_sld(vbs, vbs, 0); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vbs = vec_sld(vbs, vbs, 15); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) vsi = vec_sld(vsi, vsi, 0); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vsi = vec_sld(vsi, vsi, 15); @@ -1857,6 +1885,10 @@ void test_integer(void) { // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vui = vec_sld(vui, vui, 15); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) + vbi = vec_sld(vbi, vbi, 0); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vbi = vec_sld(vbi, vbi, 15); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) vsl = vec_sld(vsl, vsl, 0); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vsl = vec_sld(vsl, vsl, 15); @@ -1865,6 +1897,10 @@ void test_integer(void) { // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vul = vec_sld(vul, vul, 15); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) + vbl = vec_sld(vbl, vbl, 0); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vbl = vec_sld(vbl, vbl, 15); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) vd = vec_sld(vd, vd, 0); // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) vd = vec_sld(vd, vd, 15); @@ -2943,6 +2979,16 @@ void test_float(void) { // CHECK: [[VAL:%[^ ]+]] = fmul <2 x double> %{{.*}}, <double 0x41E0000000000000, double 0x41E0000000000000> // CHECK: fptoui <2 x double> [[VAL]] to <2 x i64> + vd = vec_double(vsl); + // CHECK: sitofp <2 x i64> %{{.*}} to <2 x double> + vd = vec_double(vul); + // CHECK: uitofp <2 x i64> %{{.*}} to <2 x double> + + vsl = vec_signed(vd); + // CHECK: fptosi <2 x double> %{{.*}} to <2 x i64> + vul = vec_unsigned(vd); + // CHECK: fptoui <2 x double> %{{.*}} to <2 x i64> + vd = vec_roundp(vd); // CHECK: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{.*}}) vd = vec_ceil(vd); @@ -2957,6 +3003,8 @@ void test_float(void) { // CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) vd = vec_roundc(vd); // CHECK: call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %{{.*}}) + vd = vec_rint(vd); + // CHECK: call <2 x double> @llvm.rint.v2f64(<2 x double> %{{.*}}) vd = vec_round(vd); // CHECK: call <2 x double> @llvm.s390.vfidb(<2 x double> %{{.*}}, i32 4, i32 4) @@ -2964,4 +3012,44 @@ void test_float(void) { // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 0) vbl = vec_fp_test_data_class(vd, 4095, &cc); // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 4095) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_ZERO_P, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 2048) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_ZERO_N, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 1024) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_ZERO, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 3072) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_NORMAL_P, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 512) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_NORMAL_N, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 256) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_NORMAL, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 768) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_SUBNORMAL_P, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 128) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_SUBNORMAL_N, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 64) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_SUBNORMAL, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 192) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_INFINITY_P, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 32) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_INFINITY_N, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 16) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_INFINITY, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 48) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_QNAN_P, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 8) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_QNAN_N, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 4) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_QNAN, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 12) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_SNAN_P, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 2) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_SNAN_N, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 1) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_SNAN, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 3) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_NAN, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 15) + vbl = vec_fp_test_data_class(vd, __VEC_CLASS_FP_NOT_NORMAL, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 3327) } diff --git a/test/CodeGen/builtins-systemz-zvector2-error.c b/test/CodeGen/builtins-systemz-zvector2-error.c new file mode 100644 index 000000000000..823d6374dc0e --- /dev/null +++ b/test/CodeGen/builtins-systemz-zvector2-error.c @@ -0,0 +1,153 @@ +// REQUIRES: systemz-registered-target +// RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \ +// RUN: -fzvector -fno-lax-vector-conversions \ +// RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s + +#include <vecintrin.h> + +volatile vector signed char vsc; +volatile vector signed short vss; +volatile vector signed int vsi; +volatile vector signed long long vsl; +volatile vector unsigned char vuc; +volatile vector unsigned short vus; +volatile vector unsigned int vui; +volatile vector unsigned long long vul; +volatile vector bool char vbc; +volatile vector bool short vbs; +volatile vector bool int vbi; +volatile vector bool long long vbl; +volatile vector float vf; +volatile vector double vd; + +volatile signed char sc; +volatile signed short ss; +volatile signed int si; +volatile signed long long sl; +volatile unsigned char uc; +volatile unsigned short us; +volatile unsigned int ui; +volatile unsigned long long ul; +volatile float f; +volatile double d; + +const void * volatile cptr; +const signed char * volatile cptrsc; +const signed short * volatile cptrss; +const signed int * volatile cptrsi; +const signed long long * volatile cptrsl; +const unsigned char * volatile cptruc; +const unsigned short * volatile cptrus; +const unsigned int * volatile cptrui; +const unsigned long long * volatile cptrul; +const float * volatile cptrf; +const double * volatile cptrd; + +void * volatile ptr; +signed char * volatile ptrsc; +signed short * volatile ptrss; +signed int * volatile ptrsi; +signed long long * volatile ptrsl; +unsigned char * volatile ptruc; +unsigned short * volatile ptrus; +unsigned int * volatile ptrui; +unsigned long long * volatile ptrul; +float * volatile ptrf; +double * volatile ptrd; + +volatile unsigned int len; +volatile int idx; +int cc; + +void test_core(void) { + vf = vec_gather_element(vf, vui, cptrf, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vf = vec_gather_element(vf, vui, cptrf, -1); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vf = vec_gather_element(vf, vui, cptrf, 4); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vd = vec_gather_element(vd, vul, cptrd, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + vd = vec_gather_element(vd, vul, cptrd, -1); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + vd = vec_gather_element(vd, vul, cptrd, 2); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + + vec_scatter_element(vf, vui, ptrf, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vec_scatter_element(vf, vui, ptrf, -1); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vec_scatter_element(vf, vui, ptrf, 4); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vec_scatter_element(vd, vul, ptrd, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + vec_scatter_element(vd, vul, ptrd, -1); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + vec_scatter_element(vd, vul, ptrd, 2); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 7 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + + vf = vec_splat(vf, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vf = vec_splat(vf, -1); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vf = vec_splat(vf, 4); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}} + vd = vec_splat(vd, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + vd = vec_splat(vd, -1); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} + vd = vec_splat(vd, 2); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}} +} + +void test_integer(void) { + vf = vec_sld(vf, vf, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + vd = vec_sld(vd, vd, idx); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 13 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}} + + vuc = vec_msum_u128(vul, vul, vuc, idx); // expected-error {{must be a constant integer}} + vuc = vec_msum_u128(vul, vul, vuc, -1); // expected-error {{should be a value from 0 to 15}} + vuc = vec_msum_u128(vul, vul, vuc, 16); // expected-error {{should be a value from 0 to 15}} +} + +void test_float(void) { + vbi = vec_fp_test_data_class(vf, idx, &cc); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 1 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}} + vbi = vec_fp_test_data_class(vf, -1, &cc); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 1 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}} + vbi = vec_fp_test_data_class(vf, 4096, &cc); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 1 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}} + vbl = vec_fp_test_data_class(vd, idx, &cc); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 1 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}} + vbl = vec_fp_test_data_class(vd, -1, &cc); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 1 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}} + vbl = vec_fp_test_data_class(vd, 4096, &cc); // expected-error {{no matching function}} + // expected-note@vecintrin.h:* 1 {{candidate function not viable}} + // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}} +} diff --git a/test/CodeGen/builtins-systemz-zvector2.c b/test/CodeGen/builtins-systemz-zvector2.c new file mode 100644 index 000000000000..d9607b3a8788 --- /dev/null +++ b/test/CodeGen/builtins-systemz-zvector2.c @@ -0,0 +1,545 @@ +// REQUIRES: systemz-registered-target +// RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \ +// RUN: -O -fzvector -fno-lax-vector-conversions \ +// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s + +#include <vecintrin.h> + +volatile vector signed char vsc; +volatile vector signed short vss; +volatile vector signed int vsi; +volatile vector signed long long vsl; +volatile vector unsigned char vuc; +volatile vector unsigned short vus; +volatile vector unsigned int vui; +volatile vector unsigned long long vul; +volatile vector bool char vbc; +volatile vector bool short vbs; +volatile vector bool int vbi; +volatile vector bool long long vbl; +volatile vector float vf; +volatile vector double vd; + +volatile signed char sc; +volatile signed short ss; +volatile signed int si; +volatile signed long long sl; +volatile unsigned char uc; +volatile unsigned short us; +volatile unsigned int ui; +volatile unsigned long long ul; +volatile float f; +volatile double d; + +const void * volatile cptr; +const signed char * volatile cptrsc; +const signed short * volatile cptrss; +const signed int * volatile cptrsi; +const signed long long * volatile cptrsl; +const unsigned char * volatile cptruc; +const unsigned short * volatile cptrus; +const unsigned int * volatile cptrui; +const unsigned long long * volatile cptrul; +const float * volatile cptrf; +const double * volatile cptrd; + +void * volatile ptr; +signed char * volatile ptrsc; +signed short * volatile ptrss; +signed int * volatile ptrsi; +signed long long * volatile ptrsl; +unsigned char * volatile ptruc; +unsigned short * volatile ptrus; +unsigned int * volatile ptrui; +unsigned long long * volatile ptrul; +float * volatile ptrf; +double * volatile ptrd; + +volatile unsigned int len; +volatile int idx; +int cc; + +void test_core(void) { + f = vec_extract(vf, idx); + // CHECK: extractelement <4 x float> %{{.*}}, i32 %{{.*}} + d = vec_extract(vd, idx); + // CHECK: extractelement <2 x double> %{{.*}}, i32 %{{.*}} + + vf = vec_insert(d, vf, idx); + // CHECK: insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 %{{.*}} + vd = vec_insert(f, vd, idx); + // CHECK: insertelement <2 x double> %{{.*}}, double %{{.*}}, i32 %{{.*}} + + vf = vec_promote(f, idx); + // CHECK: insertelement <4 x float> undef, float %{{.*}}, i32 %{{.*}} + vd = vec_promote(d, idx); + // CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}} + + vf = vec_insert_and_zero(cptrf); + // CHECK: insertelement <4 x float> <float undef, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, float %{{.*}}, i32 0 + vd = vec_insert_and_zero(cptrd); + // CHECK: insertelement <2 x double> <double undef, double 0.000000e+00>, double %{{.*}}, i32 0 + + vf = vec_perm(vf, vf, vuc); + // CHECK: call <16 x i8> @llvm.s390.vperm(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vd = vec_perm(vd, vd, vuc); + // CHECK: call <16 x i8> @llvm.s390.vperm(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + + vul = vec_bperm_u128(vuc, vuc); + // CHECK: call <2 x i64> @llvm.s390.vbperm(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + + vf = vec_sel(vf, vf, vui); + vf = vec_sel(vf, vf, vbi); + vd = vec_sel(vd, vd, vul); + vd = vec_sel(vd, vd, vbl); + + vf = vec_gather_element(vf, vui, cptrf, 0); + vf = vec_gather_element(vf, vui, cptrf, 1); + vf = vec_gather_element(vf, vui, cptrf, 2); + vf = vec_gather_element(vf, vui, cptrf, 3); + vd = vec_gather_element(vd, vul, cptrd, 0); + vd = vec_gather_element(vd, vul, cptrd, 1); + + vec_scatter_element(vf, vui, ptrf, 0); + vec_scatter_element(vf, vui, ptrf, 1); + vec_scatter_element(vf, vui, ptrf, 2); + vec_scatter_element(vf, vui, ptrf, 3); + vec_scatter_element(vd, vul, ptrd, 0); + vec_scatter_element(vd, vul, ptrd, 1); + + vf = vec_xl(idx, cptrf); + vd = vec_xl(idx, cptrd); + + vec_xst(vf, idx, ptrf); + vec_xst(vd, idx, ptrd); + + vd = vec_load_bndry(cptrd, 64); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 0) + vf = vec_load_bndry(cptrf, 64); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 0) + vf = vec_load_bndry(cptrf, 128); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 1) + vf = vec_load_bndry(cptrf, 256); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 2) + vf = vec_load_bndry(cptrf, 512); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 3) + vf = vec_load_bndry(cptrf, 1024); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 4) + vf = vec_load_bndry(cptrf, 2048); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 5) + vf = vec_load_bndry(cptrf, 4096); + // CHECK: call <16 x i8> @llvm.s390.vlbb(i8* %{{.*}}, i32 6) + + vf = vec_load_len(cptrf, idx); + // CHECK: call <16 x i8> @llvm.s390.vll(i32 %{{.*}}, i8* %{{.*}}) + vd = vec_load_len(cptrd, idx); + // CHECK: call <16 x i8> @llvm.s390.vll(i32 %{{.*}}, i8* %{{.*}}) + + vec_store_len(vf, ptrf, idx); + // CHECK: call void @llvm.s390.vstl(<16 x i8> %{{.*}}, i32 %{{.*}}, i8* %{{.*}}) + vec_store_len(vd, ptrd, idx); + // CHECK: call void @llvm.s390.vstl(<16 x i8> %{{.*}}, i32 %{{.*}}, i8* %{{.*}}) + + vuc = vec_load_len_r(cptruc, idx); + // CHECK: call <16 x i8> @llvm.s390.vlrl(i32 %{{.*}}, i8* %{{.*}}) + + vec_store_len_r(vuc, ptruc, idx); + // CHECK: call void @llvm.s390.vstrl(<16 x i8> %{{.*}}, i32 %{{.*}}, i8* %{{.*}}) + + vf = vec_splat(vf, 0); + // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> undef, <4 x i32> zeroinitializer + vf = vec_splat(vf, 1); + // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1> + vd = vec_splat(vd, 0); + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> undef, <2 x i32> zeroinitializer + vd = vec_splat(vd, 1); + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> undef, <2 x i32> <i32 1, i32 1> + + vf = vec_splats(f); + // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> undef, <4 x i32> zeroinitializer + vd = vec_splats(d); + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> undef, <2 x i32> zeroinitializer + + vf = vec_mergeh(vf, vf); + // shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> <i32 0, i32 4, i32 1, i32 5> + vd = vec_mergeh(vd, vd); + // shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> <i32 0, i32 2> + + vf = vec_mergel(vf, vf); + // shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <i32 2, i32 6, i32 3, i32 7> + vd = vec_mergel(vd, vd); + // shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <i32 1, i32 3> +} + +void test_compare(void) { + vbi = vec_cmpeq(vf, vf); + // CHECK: fcmp oeq <4 x float> %{{.*}}, %{{.*}} + vbl = vec_cmpeq(vd, vd); + // CHECK: fcmp oeq <2 x double> %{{.*}}, %{{.*}} + + vbi = vec_cmpge(vf, vf); + // CHECK: fcmp oge <4 x float> %{{.*}}, %{{.*}} + vbl = vec_cmpge(vd, vd); + // CHECK: fcmp oge <2 x double> %{{.*}}, %{{.*}} + + vbi = vec_cmpgt(vf, vf); + // CHECK: fcmp ogt <4 x float> %{{.*}}, %{{.*}} + vbl = vec_cmpgt(vd, vd); + // CHECK: fcmp ogt <2 x double> %{{.*}}, %{{.*}} + + vbi = vec_cmple(vf, vf); + // CHECK: fcmp ole <4 x float> %{{.*}}, %{{.*}} + vbl = vec_cmple(vd, vd); + // CHECK: fcmp ole <2 x double> %{{.*}}, %{{.*}} + + vbi = vec_cmplt(vf, vf); + // CHECK: fcmp olt <4 x float> %{{.*}}, %{{.*}} + vbl = vec_cmplt(vd, vd); + // CHECK: fcmp olt <2 x double> %{{.*}}, %{{.*}} + + idx = vec_all_eq(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfcesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_eq(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfcedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_ne(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfcesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_ne(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfcedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_ge(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_ge(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_gt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_gt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_le(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_le(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_lt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_lt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_nge(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + idx = vec_all_nge(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_ngt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_ngt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_nle(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_nle(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_nlt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_all_nlt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_all_nan(vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 15) + idx = vec_all_nan(vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 15) + + idx = vec_all_numeric(vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 15) + idx = vec_all_numeric(vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 15) + + idx = vec_any_eq(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfcesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_eq(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfcedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_ne(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfcesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_ne(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfcedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_ge(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_ge(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_gt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_gt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_le(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_le(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_lt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_lt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_nge(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_nge(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_ngt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_ngt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_nle(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchesbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_nle(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchedbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_nlt(vf, vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vfchsbs(<4 x float> %{{.*}}, <4 x float> %{{.*}}) + idx = vec_any_nlt(vd, vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vfchdbs(<2 x double> %{{.*}}, <2 x double> %{{.*}}) + + idx = vec_any_nan(vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 15) + idx = vec_any_nan(vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 15) + + idx = vec_any_numeric(vf); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 15) + idx = vec_any_numeric(vd); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 15) +} + +void test_integer(void) { + vf = vec_andc(vf, vf); + vd = vec_andc(vd, vd); + + vf = vec_nor(vf, vf); + vd = vec_nor(vd, vd); + + vsc = vec_nand(vsc, vsc); + vuc = vec_nand(vuc, vuc); + vbc = vec_nand(vbc, vbc); + vss = vec_nand(vss, vss); + vus = vec_nand(vus, vus); + vbs = vec_nand(vbs, vbs); + vsi = vec_nand(vsi, vsi); + vui = vec_nand(vui, vui); + vbi = vec_nand(vbi, vbi); + vsl = vec_nand(vsl, vsl); + vul = vec_nand(vul, vul); + vbl = vec_nand(vbl, vbl); + vf = vec_nand(vf, vf); + vd = vec_nand(vd, vd); + + vsc = vec_orc(vsc, vsc); + vuc = vec_orc(vuc, vuc); + vbc = vec_orc(vbc, vbc); + vss = vec_orc(vss, vss); + vus = vec_orc(vus, vus); + vbs = vec_orc(vbs, vbs); + vsi = vec_orc(vsi, vsi); + vui = vec_orc(vui, vui); + vbi = vec_orc(vbi, vbi); + vsl = vec_orc(vsl, vsl); + vul = vec_orc(vul, vul); + vbl = vec_orc(vbl, vbl); + vf = vec_orc(vf, vf); + vd = vec_orc(vd, vd); + + vsc = vec_eqv(vsc, vsc); + vuc = vec_eqv(vuc, vuc); + vbc = vec_eqv(vbc, vbc); + vss = vec_eqv(vss, vss); + vus = vec_eqv(vus, vus); + vbs = vec_eqv(vbs, vbs); + vsi = vec_eqv(vsi, vsi); + vui = vec_eqv(vui, vui); + vbi = vec_eqv(vbi, vbi); + vsl = vec_eqv(vsl, vsl); + vul = vec_eqv(vul, vul); + vbl = vec_eqv(vbl, vbl); + vf = vec_eqv(vf, vf); + vd = vec_eqv(vd, vd); + + vf = vec_slb(vf, vsi); + // CHECK: call <16 x i8> @llvm.s390.vslb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vf = vec_slb(vf, vui); + // CHECK: call <16 x i8> @llvm.s390.vslb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vd = vec_slb(vd, vsl); + // CHECK: call <16 x i8> @llvm.s390.vslb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vd = vec_slb(vd, vul); + // CHECK: call <16 x i8> @llvm.s390.vslb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + + vf = vec_sld(vf, vf, 0); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vf = vec_sld(vf, vf, 15); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) + vd = vec_sld(vd, vd, 0); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vd = vec_sld(vd, vd, 15); + // CHECK: call <16 x i8> @llvm.s390.vsldb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}, i32 15) + + vf = vec_srab(vf, vsi); + // CHECK: call <16 x i8> @llvm.s390.vsrab(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vf = vec_srab(vf, vui); + // CHECK: call <16 x i8> @llvm.s390.vsrab(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vd = vec_srab(vd, vsl); + // CHECK: call <16 x i8> @llvm.s390.vsrab(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vd = vec_srab(vd, vul); + // CHECK: call <16 x i8> @llvm.s390.vsrab(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + + vf = vec_srb(vf, vsi); + // CHECK: call <16 x i8> @llvm.s390.vsrlb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vf = vec_srb(vf, vui); + // CHECK: call <16 x i8> @llvm.s390.vsrlb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vd = vec_srb(vd, vsl); + // CHECK: call <16 x i8> @llvm.s390.vsrlb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + vd = vec_srb(vd, vul); + // CHECK: call <16 x i8> @llvm.s390.vsrlb(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + + idx = vec_test_mask(vf, vui); + // CHECK: call i32 @llvm.s390.vtm(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + idx = vec_test_mask(vd, vul); + // CHECK: call i32 @llvm.s390.vtm(<16 x i8> %{{.*}}, <16 x i8> %{{.*}}) + + vuc = vec_msum_u128(vul, vul, vuc, 0); + // CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 0) + vuc = vec_msum_u128(vul, vul, vuc, 4); + // CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 4) + vuc = vec_msum_u128(vul, vul, vuc, 8); + // CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 8) + vuc = vec_msum_u128(vul, vul, vuc, 12); + // CHECK: call <16 x i8> @llvm.s390.vmslg(<2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <16 x i8> %{{.*}}, i32 12) +} + +void test_float(void) { + vf = vec_abs(vf); + // CHECK: call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}}) + vd = vec_abs(vd); + // CHECK: call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{.*}}) + + vf = vec_nabs(vf); + // CHECK: [[ABS:%[^ ]+]] = tail call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}}) + // CHECK-NEXT: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[ABS]] + vd = vec_nabs(vd); + // CHECK: [[ABS:%[^ ]+]] = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %{{.*}}) + // CHECK-NEXT: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[ABS]] + + vf = vec_max(vf, vf); + // CHECK: call <4 x float> @llvm.s390.vfmaxsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0) + vd = vec_max(vd, vd); + // CHECK: call <2 x double> @llvm.s390.vfmaxdb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0) + + vf = vec_min(vf, vf); + // CHECK: call <4 x float> @llvm.s390.vfminsb(<4 x float> %{{.*}}, <4 x float> %{{.*}}, i32 0) + vd = vec_min(vd, vd); + // CHECK: call <2 x double> @llvm.s390.vfmindb(<2 x double> %{{.*}}, <2 x double> %{{.*}}, i32 0) + + vf = vec_madd(vf, vf, vf); + // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) + vd = vec_madd(vd, vd, vd); + // CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) + + vf = vec_msub(vf, vf, vf); + // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) + vd = vec_msub(vd, vd, vd); + // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) + + vf = vec_nmadd(vf, vf, vf); + // CHECK: [[RES:%[^ ]+]] = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) + // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + vd = vec_nmadd(vd, vd, vd); + // CHECK: [[RES:%[^ ]+]] = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) + // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + + vf = vec_nmsub(vf, vf, vf); + // CHECK: [[NEG:%[^ ]+]] = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{.*}} + // CHECK: [[RES:%[^ ]+]] = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]]) + // CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[RES]] + vd = vec_nmsub(vd, vd, vd); + // CHECK: [[NEG:%[^ ]+]] = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{.*}} + // CHECK: [[RES:%[^ ]+]] = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]]) + // CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, [[RES]] + + vf = vec_sqrt(vf); + // CHECK: call <4 x float> @llvm.sqrt.v4f32(<4 x float> %{{.*}}) + vd = vec_sqrt(vd); + // CHECK: call <2 x double> @llvm.sqrt.v2f64(<2 x double> %{{.*}}) + + vd = vec_doublee(vf); + // CHECK: fpext <2 x float> %{{.*}} to <2 x double> + vf = vec_floate(vd); + // CHECK: fptrunc <2 x double> %{{.*}} to <2 x float> + + vd = vec_double(vsl); + // CHECK: sitofp <2 x i64> %{{.*}} to <2 x double> + vd = vec_double(vul); + // CHECK: uitofp <2 x i64> %{{.*}} to <2 x double> + + vsl = vec_signed(vd); + // CHECK: fptosi <2 x double> %{{.*}} to <2 x i64> + vul = vec_unsigned(vd); + // CHECK: fptoui <2 x double> %{{.*}} to <2 x i64> + + vf = vec_roundp(vf); + // CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{.*}}) + vf = vec_ceil(vf); + // CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{.*}}) + vd = vec_roundp(vd); + // CHECK: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{.*}}) + vd = vec_ceil(vd); + // CHECK: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{.*}}) + + vf = vec_roundm(vf); + // CHECK: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{.*}}) + vf = vec_floor(vf); + // CHECK: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{.*}}) + vd = vec_roundm(vd); + // CHECK: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{.*}}) + vd = vec_floor(vd); + // CHECK: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{.*}}) + + vf = vec_roundz(vf); + // CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}}) + vf = vec_trunc(vf); + // CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}}) + vd = vec_roundz(vd); + // CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) + vd = vec_trunc(vd); + // CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) + + vf = vec_roundc(vf); + // CHECK: call <4 x float> @llvm.nearbyint.v4f32(<4 x float> %{{.*}}) + vd = vec_roundc(vd); + // CHECK: call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %{{.*}}) + + vf = vec_rint(vf); + // CHECK: call <4 x float> @llvm.rint.v4f32(<4 x float> %{{.*}}) + vd = vec_rint(vd); + // CHECK: call <2 x double> @llvm.rint.v2f64(<2 x double> %{{.*}}) + + vf = vec_round(vf); + // CHECK: call <4 x float> @llvm.s390.vfisb(<4 x float> %{{.*}}, i32 4, i32 4) + vd = vec_round(vd); + // CHECK: call <2 x double> @llvm.s390.vfidb(<2 x double> %{{.*}}, i32 4, i32 4) + + vbi = vec_fp_test_data_class(vf, 0, &cc); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 0) + vbi = vec_fp_test_data_class(vf, 4095, &cc); + // CHECK: call { <4 x i32>, i32 } @llvm.s390.vftcisb(<4 x float> %{{.*}}, i32 4095) + vbl = vec_fp_test_data_class(vd, 0, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 0) + vbl = vec_fp_test_data_class(vd, 4095, &cc); + // CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 4095) +} diff --git a/test/CodeGen/coff-aarch64-type-sizes.c b/test/CodeGen/coff-aarch64-type-sizes.c new file mode 100644 index 000000000000..1d8a64520469 --- /dev/null +++ b/test/CodeGen/coff-aarch64-type-sizes.c @@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -triple aarch64-windows -emit-llvm -w -o - %s | FileCheck %s + +// CHECK: target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128" +// CHECK: target triple = "aarch64--windows-msvc" + +int check_short() { + return sizeof(short); +// CHECK: ret i32 2 +} + +int check_int() { + return sizeof(int); +// CHECK: ret i32 4 +} + +int check_long() { + return sizeof(long); +// CHECK: ret i32 4 +} + +int check_longlong() { + return sizeof(long long); +// CHECK: ret i32 8 +} + +int check_int128() { + return sizeof(__int128); +// CHECK: ret i32 16 +} + +int check_fp16() { + return sizeof(__fp16); +// CHECK: ret i32 2 +} + +int check_float() { + return sizeof(float); +// CHECK: ret i32 4 +} + +int check_double() { + return sizeof(double); +// CHECK: ret i32 8 +} + +int check_longdouble() { + return sizeof(long double); +// CHECK: ret i32 8 +} + +int check_floatComplex() { + return sizeof(float _Complex); +// CHECK: ret i32 8 +} + +int check_doubleComplex() { + return sizeof(double _Complex); +// CHECK: ret i32 16 +} + +int check_longdoubleComplex() { + return sizeof(long double _Complex); +// CHECK: ret i32 16 +} + +int check_bool() { + return sizeof(_Bool); +// CHECK: ret i32 1 +} + +int check_wchar() { + return sizeof(__WCHAR_TYPE__); +// CHECK: ret i32 2 +} + +int check_wchar_unsigned() { + return (__WCHAR_TYPE__)-1 > (__WCHAR_TYPE__)0; +// CHECK: ret i32 1 +} + +enum Small { + Item +}; + +int foo() { + return sizeof(enum Small); +// CHECK: ret i32 4 +} diff --git a/test/CodeGen/debug-info-imported-entity.cpp b/test/CodeGen/debug-info-imported-entity.cpp index c7935eda48c5..398536e581ae 100644 --- a/test/CodeGen/debug-info-imported-entity.cpp +++ b/test/CodeGen/debug-info-imported-entity.cpp @@ -5,5 +5,6 @@ using std::A; using ::A; // CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: [[Imports:![0-9]+]] // CHECK: [[Imports]] = !{[[ImportedEntity:![0-9]+]]} -// CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: [[STDA:![0-9]+]], line: 4) +// CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: [[STDA:![0-9]+]], file: [[FILE:![0-9]+]], line: 4) // CHECK: [[STDA]] = !DICompositeType(tag: DW_TAG_class_type, name: "A", +// CHECK: [[FILE]] = !DIFile(filename: {{.*}}debug-info-imported-entity.cpp diff --git a/test/CodeGen/ms_abi.c b/test/CodeGen/ms_abi.c index 97f66b29c517..407087e40916 100644 --- a/test/CodeGen/ms_abi.c +++ b/test/CodeGen/ms_abi.c @@ -15,20 +15,20 @@ void f3(void) { // FREEBSD-LABEL: define void @f3() // WIN64-LABEL: define void @f3() f1(); - // FREEBSD: call x86_64_win64cc void @f1() + // FREEBSD: call win64cc void @f1() // WIN64: call void @f1() f2(); // FREEBSD: call void @f2() // WIN64: call x86_64_sysvcc void @f2() } -// FREEBSD: declare x86_64_win64cc void @f1() +// FREEBSD: declare win64cc void @f1() // FREEBSD: declare void @f2() // WIN64: declare void @f1() // WIN64: declare x86_64_sysvcc void @f2() // Win64 ABI varargs void __attribute__((ms_abi)) f4(int a, ...) { - // FREEBSD-LABEL: define x86_64_win64cc void @f4 + // FREEBSD-LABEL: define win64cc void @f4 // WIN64-LABEL: define void @f4 __builtin_ms_va_list ap; __builtin_ms_va_start(ap, a); diff --git a/test/CodeGen/ms_abi_aarch64.c b/test/CodeGen/ms_abi_aarch64.c new file mode 100644 index 000000000000..4aa93f00859a --- /dev/null +++ b/test/CodeGen/ms_abi_aarch64.c @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm < %s | FileCheck -check-prefix=LINUX %s +// RUN: %clang_cc1 -triple aarch64-pc-win32 -emit-llvm < %s | FileCheck -check-prefix=WIN64 %s + +void __attribute__((ms_abi)) f1(void); +void f2(void); +void f3(void) { + // LINUX-LABEL: define void @f3() + // WIN64-LABEL: define void @f3() + f1(); + // LINUX: call win64cc void @f1() + // WIN64: call void @f1() + f2(); + // LINUX: call void @f2() + // WIN64: call void @f2() +} +// LINUX: declare win64cc void @f1() +// LINUX: declare void @f2() +// WIN64: declare void @f1() +// WIN64: declare void @f2() + +// Win64 ABI varargs +void __attribute__((ms_abi)) f4(int a, ...) { + // LINUX-LABEL: define win64cc void @f4 + // WIN64-LABEL: define void @f4 + __builtin_ms_va_list ap; + __builtin_ms_va_start(ap, a); + // LINUX: %[[AP:.*]] = alloca i8* + // LINUX: call void @llvm.va_start + // WIN64: %[[AP:.*]] = alloca i8* + // WIN64: call void @llvm.va_start + int b = __builtin_va_arg(ap, int); + // LINUX: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] + // LINUX-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 + // LINUX-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] + // LINUX-NEXT: bitcast i8* %[[AP_CUR]] to i32* + // WIN64: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] + // WIN64-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 + // WIN64-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] + // WIN64-NEXT: bitcast i8* %[[AP_CUR]] to i32* + __builtin_ms_va_list ap2; + __builtin_ms_va_copy(ap2, ap); + // LINUX: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]] + // LINUX-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]] + // WIN64: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]] + // WIN64-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]] + __builtin_ms_va_end(ap); + // LINUX: call void @llvm.va_end + // WIN64: call void @llvm.va_end +} + +// Let's verify that normal va_lists work right on Win64, too. +void f5(int a, ...) { + // WIN64-LABEL: define void @f5 + __builtin_va_list ap; + __builtin_va_start(ap, a); + // WIN64: %[[AP:.*]] = alloca i8* + // WIN64: call void @llvm.va_start + int b = __builtin_va_arg(ap, int); + // WIN64: %[[AP_CUR:.*]] = load i8*, i8** %[[AP]] + // WIN64-NEXT: %[[AP_NEXT:.*]] = getelementptr inbounds i8, i8* %[[AP_CUR]], i64 8 + // WIN64-NEXT: store i8* %[[AP_NEXT]], i8** %[[AP]] + // WIN64-NEXT: bitcast i8* %[[AP_CUR]] to i32* + __builtin_va_list ap2; + __builtin_va_copy(ap2, ap); + // WIN64: call void @llvm.va_copy + __builtin_va_end(ap); + // WIN64: call void @llvm.va_end +} diff --git a/test/CodeGen/systemz-abi-vector.c b/test/CodeGen/systemz-abi-vector.c index 455e3bbcced2..191c2321bb1d 100644 --- a/test/CodeGen/systemz-abi-vector.c +++ b/test/CodeGen/systemz-abi-vector.c @@ -6,6 +6,10 @@ // RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \ // RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s +// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 \ +// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s +// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch12 \ +// RUN: -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s // Vector types diff --git a/test/CodeGen/systemz-abi.c b/test/CodeGen/systemz-abi.c index 17fdb9e322c8..de5dce54b5f0 100644 --- a/test/CodeGen/systemz-abi.c +++ b/test/CodeGen/systemz-abi.c @@ -6,6 +6,10 @@ // RUN: -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \ // RUN: -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 \ +// RUN: -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch12 \ +// RUN: -emit-llvm -o - %s | FileCheck %s // Scalar types diff --git a/test/CodeGen/target-data.c b/test/CodeGen/target-data.c index 68ee8f02d2ee..851ce5831fa3 100644 --- a/test/CodeGen/target-data.c +++ b/test/CodeGen/target-data.c @@ -171,6 +171,10 @@ // RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR // RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch11 -o - -emit-llvm %s | \ // RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR +// RUN: %clang_cc1 -triple s390x-unknown -target-cpu z14 -o - -emit-llvm %s | \ +// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR +// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch12 -o - -emit-llvm %s | \ +// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR // SYSTEMZ-VECTOR: target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64" // RUN: %clang_cc1 -triple msp430-unknown -o - -emit-llvm %s | \ diff --git a/test/CodeGen/ubsan-pointer-overflow.m b/test/CodeGen/ubsan-pointer-overflow.m index da622355fdb4..977e2458384b 100644 --- a/test/CodeGen/ubsan-pointer-overflow.m +++ b/test/CodeGen/ubsan-pointer-overflow.m @@ -10,16 +10,20 @@ void unary_arith(char *p) { ++p; // CHECK: ptrtoint i8* {{.*}} to i64, !nosanitize - // CHECK-NEXT: add i64 {{.*}}, -1, !nosanitize - // CHECK: select i1 false{{.*}}, !nosanitize + // CHECK-NEXT: [[COMPGEP:%.*]] = add i64 {{.*}}, -1, !nosanitize + // CHECK: [[NEGVALID:%.*]] = icmp ule i64 [[COMPGEP]], {{.*}}, !nosanitize + // CHECK-NOT: select + // CHECK: br i1 [[NEGVALID]]{{.*}}, !nosanitize // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} --p; + // CHECK: icmp uge i64 // CHECK-NOT: select // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} p++; - // CHECK: select + // CHECK: icmp ule i64 + // CHECK-NOT: select // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} p--; } @@ -64,7 +68,8 @@ void binary_arith_unsigned(char *p, unsigned i) { // CHECK: [[OFFSET:%.*]] = sub i64 0, {{.*}} // CHECK-NEXT: getelementptr inbounds {{.*}} [[OFFSET]] - // CHECK: select + // CHECK: icmp ule i64 + // CHECK-NOT: select // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} p - i; } @@ -121,8 +126,10 @@ void pointer_array(int **arr, int k) { // CHECK-LABEL: define void @pointer_array_unsigned_indices void pointer_array_unsigned_indices(int **arr, unsigned k) { + // CHECK: icmp uge // CHECK-NOT: select // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} + // CHECK: icmp uge // CHECK-NOT: select // CHECK: call void @__ubsan_handle_pointer_overflow{{.*}} arr[k][k]; diff --git a/test/CodeGen/zvector2.c b/test/CodeGen/zvector2.c new file mode 100644 index 000000000000..909b3fd7650f --- /dev/null +++ b/test/CodeGen/zvector2.c @@ -0,0 +1,194 @@ +// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \ +// RUN: -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s + +volatile vector float ff, ff2; +volatile vector bool int bi; + +void test_assign (void) +{ +// CHECK-LABEL: test_assign +// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: store volatile <4 x float> [[VAL]], <4 x float>* @ff + ff = ff2; +} + +void test_pos (void) +{ +// CHECK-LABEL: test_pos +// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: store volatile <4 x float> [[VAL]], <4 x float>* @ff + ff = +ff2; +} + +void test_neg (void) +{ +// CHECK-LABEL: test_neg +// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, [[VAL]] + ff = -ff2; +} + +void test_preinc (void) +{ +// CHECK-LABEL: test_preinc +// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00> + ++ff2; +} + +void test_postinc (void) +{ +// CHECK-LABEL: test_postinc +// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00> + ff2++; +} + +void test_predec (void) +{ +// CHECK-LABEL: test_predec +// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00> + --ff2; +} + +void test_postdec (void) +{ +// CHECK-LABEL: test_postdec +// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00> + ff2--; +} + +void test_add (void) +{ +// CHECK-LABEL: test_add +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fadd <4 x float> [[VAL1]], [[VAL2]] + ff = ff + ff2; +} + +void test_add_assign (void) +{ +// CHECK-LABEL: test_add_assign +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: %{{.*}} = fadd <4 x float> [[VAL2]], [[VAL1]] + ff += ff2; +} + +void test_sub (void) +{ +// CHECK-LABEL: test_sub +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]] + ff = ff - ff2; +} + +void test_sub_assign (void) +{ +// CHECK-LABEL: test_sub_assign +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]] + ff -= ff2; +} + +void test_mul (void) +{ +// CHECK-LABEL: test_mul +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fmul <4 x float> [[VAL1]], [[VAL2]] + ff = ff * ff2; +} + +void test_mul_assign (void) +{ +// CHECK-LABEL: test_mul_assign +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: %{{.*}} = fmul <4 x float> [[VAL2]], [[VAL1]] + ff *= ff2; +} + +void test_div (void) +{ +// CHECK-LABEL: test_div +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]] + ff = ff / ff2; +} + +void test_div_assign (void) +{ +// CHECK-LABEL: test_div_assign +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]] + ff /= ff2; +} + +void test_cmpeq (void) +{ +// CHECK-LABEL: test_cmpeq +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[CMP:%[^ ]+]] = fcmp oeq <4 x float> [[VAL1]], [[VAL2]] +// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> + bi = ff == ff2; +} + +void test_cmpne (void) +{ +// CHECK-LABEL: test_cmpne +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[CMP:%[^ ]+]] = fcmp une <4 x float> [[VAL1]], [[VAL2]] +// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> + bi = ff != ff2; +} + +void test_cmpge (void) +{ +// CHECK-LABEL: test_cmpge +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[CMP:%[^ ]+]] = fcmp oge <4 x float> [[VAL1]], [[VAL2]] +// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> + bi = ff >= ff2; +} + +void test_cmpgt (void) +{ +// CHECK-LABEL: test_cmpgt +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[CMP:%[^ ]+]] = fcmp ogt <4 x float> [[VAL1]], [[VAL2]] +// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> + bi = ff > ff2; +} + +void test_cmple (void) +{ +// CHECK-LABEL: test_cmple +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[CMP:%[^ ]+]] = fcmp ole <4 x float> [[VAL1]], [[VAL2]] +// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> + bi = ff <= ff2; +} + +void test_cmplt (void) +{ +// CHECK-LABEL: test_cmplt +// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff +// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2 +// CHECK: [[CMP:%[^ ]+]] = fcmp olt <4 x float> [[VAL1]], [[VAL2]] +// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32> + bi = ff < ff2; +} + diff --git a/test/CodeGenCXX/amdgcn-automatic-variable.cpp b/test/CodeGenCXX/amdgcn-automatic-variable.cpp index a82275206c6d..9830a7845e5b 100644 --- a/test/CodeGenCXX/amdgcn-automatic-variable.cpp +++ b/test/CodeGenCXX/amdgcn-automatic-variable.cpp @@ -13,31 +13,32 @@ void func1(int *x) { // CHECK-LABEL: define void @_Z5func2v() void func2(void) { // CHECK: %lv1 = alloca i32, align 4, addrspace(5) + // CHECK: %[[r0:.*]] = addrspacecast i32 addrspace(5)* %lv1 to i32* // CHECK: %lv2 = alloca i32, align 4, addrspace(5) + // CHECK: %[[r1:.*]] = addrspacecast i32 addrspace(5)* %lv2 to i32* // CHECK: %la = alloca [100 x i32], align 4, addrspace(5) + // CHECK: %[[r2:.*]] = addrspacecast [100 x i32] addrspace(5)* %la to [100 x i32]* // CHECK: %lp1 = alloca i32*, align 8, addrspace(5) + // CHECK: %[[r3:.*]] = addrspacecast i32* addrspace(5)* %lp1 to i32** // CHECK: %lp2 = alloca i32*, align 8, addrspace(5) + // CHECK: %[[r4:.*]] = addrspacecast i32* addrspace(5)* %lp2 to i32** // CHECK: %lvc = alloca i32, align 4, addrspace(5) + // CHECK: %[[r5:.*]] = addrspacecast i32 addrspace(5)* %lvc to i32* - // CHECK: %[[r0:.*]] = addrspacecast i32 addrspace(5)* %lv1 to i32* // CHECK: store i32 1, i32* %[[r0]] int lv1; lv1 = 1; - // CHECK: %[[r1:.*]] = addrspacecast i32 addrspace(5)* %lv2 to i32* // CHECK: store i32 2, i32* %[[r1]] int lv2 = 2; - // CHECK: %[[r2:.*]] = addrspacecast [100 x i32] addrspace(5)* %la to [100 x i32]* // CHECK: %[[arrayidx:.*]] = getelementptr inbounds [100 x i32], [100 x i32]* %[[r2]], i64 0, i64 0 // CHECK: store i32 3, i32* %[[arrayidx]], align 4 int la[100]; la[0] = 3; - // CHECK: %[[r3:.*]] = addrspacecast i32* addrspace(5)* %lp1 to i32** // CHECK: store i32* %[[r0]], i32** %[[r3]], align 8 int *lp1 = &lv1; - // CHECK: %[[r4:.*]] = addrspacecast i32* addrspace(5)* %lp2 to i32** // CHECK: %[[arraydecay:.*]] = getelementptr inbounds [100 x i32], [100 x i32]* %[[r2]], i32 0, i32 0 // CHECK: store i32* %[[arraydecay]], i32** %[[r4]], align 8 int *lp2 = la; @@ -45,7 +46,6 @@ void func2(void) { // CHECK: call void @_Z5func1Pi(i32* %[[r0]]) func1(&lv1); - // CHECK: %[[r5:.*]] = addrspacecast i32 addrspace(5)* %lvc to i32* // CHECK: store i32 4, i32* %[[r5]] // CHECK: store i32 4, i32* %[[r0]] const int lvc = 4; @@ -81,4 +81,25 @@ void func4(int x) { func1(&x); } +// CHECK-LABEL: define void @_Z5func5v +void func5() { + return; + int x = 0; +} + +// CHECK-LABEL: define void @_Z5func6v +void func6() { + return; + int x; +} + +// CHECK-LABEL: define void @_Z5func7v +extern void use(int *); +void func7() { + goto later; + int x; +later: + use(&x); +} + // CHECK-NOT: !opencl.ocl.version diff --git a/test/CodeGenCXX/debug-info-anon-namespace.cpp b/test/CodeGenCXX/debug-info-anon-namespace.cpp index 79298deaf8b1..3f4ef2a38360 100644 --- a/test/CodeGenCXX/debug-info-anon-namespace.cpp +++ b/test/CodeGenCXX/debug-info-anon-namespace.cpp @@ -21,7 +21,7 @@ int *b2 = &a2; // PS4: [[NS:![0-9]+]] = !DINamespace // PS4: [[CU:![0-9]+]] = distinct !DICompileUnit // PS4: [[NS2:![0-9]+]] = !DINamespace -// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CU]], entity: [[NS]]) -// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[NS]], entity: [[NS2]], line: {{[0-9]+}}) +// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CU]], entity: [[NS]], file: {{![0-9]+}}) +// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[NS]], entity: [[NS2]], file: {{![0-9]+}}, line: {{[0-9]+}}) // NON-PS4-NOT: !DIImportedEntity diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp index 95857e339085..296c99efc8eb 100644 --- a/test/CodeGenCXX/debug-info-namespace.cpp +++ b/test/CodeGenCXX/debug-info-namespace.cpp @@ -81,17 +81,17 @@ void C::c() {} // CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-SAME: imports: [[MODULES:![0-9]*]] // CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], [[M4:![0-9]+]], [[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], [[M8:![0-9]+]], [[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], [[M12:![0-9]+]], [[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], [[M16:![0-9]+]], [[M17:![0-9]+]] -// CHECK: [[M1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CTXT]], entity: [[NS]], line: 15) +// CHECK: [[M1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CTXT]], entity: [[NS]], file: [[FOOCPP]], line: 15) // CHECK: [[M2]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CU]], entity: [[CTXT]], -// CHECK: [[M3]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "E", scope: [[CU]], entity: [[CTXT]], line: 19) -// CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[LEX2:![0-9]+]], entity: [[NS]], line: 23) +// CHECK: [[M3]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "E", scope: [[CU]], entity: [[CTXT]], file: [[FOOCPP]], line: 19) +// CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[LEX2:![0-9]+]], entity: [[NS]], file: [[FOOCPP]], line: 23) // CHECK: [[LEX2]] = distinct !DILexicalBlock(scope: [[LEX1:![0-9]+]], file: [[FOOCPP]], // CHECK: [[LEX1]] = distinct !DILexicalBlock(scope: [[FUNC:![0-9]+]], file: [[FOOCPP]], // CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func",{{.*}} isDefinition: true // CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[FUNC]], entity: [[CTXT:![0-9]+]], -// CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FOO:![0-9]+]], line: 27) +// CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FOO:![0-9]+]], file: [[FOOCPP]], line: 27) // CHECK: [[FOO]] = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", // CHECK-SAME: line: 5 // CHECK-SAME: DIFlagFwdDecl diff --git a/test/CodeGenCXX/implicit-exception-spec.cpp b/test/CodeGenCXX/implicit-exception-spec.cpp index cf363bd685ad..e1a969ab277f 100644 --- a/test/CodeGenCXX/implicit-exception-spec.cpp +++ b/test/CodeGenCXX/implicit-exception-spec.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -std=c++11 -o - -fcxx-exceptions -fexceptions | FileCheck -check-prefix=CHECK %s +// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -std=c++11 -o - -fcxx-exceptions -fexceptions | FileCheck %s struct A { A(); diff --git a/test/CodeGenObjC/arc-property.m b/test/CodeGenObjC/arc-property.m index b8dc18e872bf..edc4d1e85383 100644 --- a/test/CodeGenObjC/arc-property.m +++ b/test/CodeGenObjC/arc-property.m @@ -131,4 +131,24 @@ void test3(Test3 *t) { - (void) setCopyMachine: (id) x {} @end +// rdar://31579994 +// When synthesizing a property that's declared in multiple protocols, ensure +// that the setter is emitted if any of these declarations is readwrite. +@protocol ABC +@property (copy, nonatomic, readonly) Test3 *someId; +@end +@protocol ABC__Mutable <ABC> +@property (copy, nonatomic, readwrite) Test3 *someId; +@end + +@interface ABC_Class <ABC, ABC__Mutable> +@end + +@implementation ABC_Class +@synthesize someId = _someId; +// CHECK: define internal %{{.*}}* @"\01-[ABC_Class someId]" +// CHECK: define internal void @"\01-[ABC_Class setSomeId:]"( +@end + + // CHECK: attributes [[NUW]] = { nounwind } diff --git a/test/CodeGenObjC/attr-callconv.m b/test/CodeGenObjC/attr-callconv.m index b0a41f74381d..8cf8d2bd71f7 100644 --- a/test/CodeGenObjC/attr-callconv.m +++ b/test/CodeGenObjC/attr-callconv.m @@ -9,5 +9,5 @@ // CHECK: define{{.*}}x86_stdcallcc{{.*}}Test test - (void)test2 __attribute__((ms_abi)) {} - // CHECK: define{{.*}}x86_64_win64cc{{.*}}Test test2 + // CHECK: define{{.*}}win64cc{{.*}}Test test2 @end diff --git a/test/CodeGenOpenCL/kernel-arg-info.cl b/test/CodeGenOpenCL/kernel-arg-info.cl index f1b2f45d7d97..463cc4451114 100644 --- a/test/CodeGenOpenCL/kernel-arg-info.cl +++ b/test/CodeGenOpenCL/kernel-arg-info.cl @@ -1,10 +1,24 @@ // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO -kernel void foo(__global int * restrict X, const int Y, - volatile int anotherArg, __constant float * restrict Z, - __global volatile int * V, __global const int * C) { - *X = Y + anotherArg; +kernel void foo(global int * globalintp, global int * restrict globalintrestrictp, + global const int * globalconstintp, + global const int * restrict globalconstintrestrictp, + constant int * constantintp, constant int * restrict constantintrestrictp, + global const volatile int * globalconstvolatileintp, + global const volatile int * restrict globalconstvolatileintrestrictp, + global volatile int * globalvolatileintp, + global volatile int * restrict globalvolatileintrestrictp, + local int * localintp, local int * restrict localintrestrictp, + local const int * localconstintp, + local const int * restrict localconstintrestrictp, + local const volatile int * localconstvolatileintp, + local const volatile int * restrict localconstvolatileintrestrictp, + local volatile int * localvolatileintp, + local volatile int * restrict localvolatileintrestrictp, + int X, const int constint, const volatile int constvolatileint, + volatile int volatileint) { + *globalintrestrictp = constint + volatileint; } // CHECK: define spir_kernel void @foo{{[^!]+}} // CHECK: !kernel_arg_addr_space ![[MD11:[0-9]+]] @@ -61,11 +75,15 @@ kernel void foo5(myImage img1, write_only image1d_t img2) { // CHECK-NOT: !kernel_arg_name // ARGINFO: !kernel_arg_name ![[MD54:[0-9]+]] -// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2, i32 1, i32 1} -// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none", !"none", !"none"} -// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*", !"int*", !"int*"} -// CHECK: ![[MD14]] = !{!"restrict", !"", !"", !"restrict const", !"volatile", !"const"} -// ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z", !"V", !"C"} +typedef char char16 __attribute__((ext_vector_type(16))); +__kernel void foo6(__global char16 arg[]) {} +// CHECK: !kernel_arg_type ![[MD61:[0-9]+]] + +// CHECK: ![[MD11]] = !{i32 1, i32 1, i32 1, i32 1, i32 2, i32 2, i32 1, i32 1, i32 1, i32 1, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 0, i32 0, i32 0, i32 0} +// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none", !"none"} +// CHECK: ![[MD13]] = !{!"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int*", !"int", !"int", !"int", !"int"} +// CHECK: ![[MD14]] = !{!"", !"restrict", !"const", !"restrict const", !"const", !"restrict const", !"const volatile", !"restrict const volatile", !"volatile", !"restrict volatile", !"", !"restrict", !"const", !"restrict const", !"const volatile", !"restrict const volatile", !"volatile", !"restrict volatile", !"", !"", !"", !""} +// ARGINFO: ![[MD15]] = !{!"globalintp", !"globalintrestrictp", !"globalconstintp", !"globalconstintrestrictp", !"constantintp", !"constantintrestrictp", !"globalconstvolatileintp", !"globalconstvolatileintrestrictp", !"globalvolatileintp", !"globalvolatileintrestrictp", !"localintp", !"localintrestrictp", !"localconstintp", !"localconstintrestrictp", !"localconstvolatileintp", !"localconstvolatileintrestrictp", !"localvolatileintp", !"localvolatileintrestrictp", !"X", !"constint", !"constvolatileint", !"volatileint"} // CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1} // CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", !"read_write"} // CHECK: ![[MD23]] = !{!"image1d_t", !"image2d_t", !"image2d_array_t", !"image1d_t"} @@ -86,4 +104,5 @@ kernel void foo5(myImage img1, write_only image1d_t img2) { // CHECK: ![[MD52]] = !{!"myImage", !"image1d_t"} // CHECK: ![[MD53]] = !{!"image1d_t", !"image1d_t"} // ARGINFO: ![[MD54]] = !{!"img1", !"img2"} +// CHECK: ![[MD61]] = !{!"char16*"} diff --git a/test/Driver/autocomplete.c b/test/Driver/autocomplete.c index e9e2e992bae9..dec48bfb3596 100644 --- a/test/Driver/autocomplete.c +++ b/test/Driver/autocomplete.c @@ -40,3 +40,7 @@ // MRELOCMODEL_CLANG-NOT: -mrelocation-model // RUN: %clang --autocomplete=#-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1 // MRELOCMODEL_CC1: -mrelocation-model +// RUN: %clang --autocomplete=-Wma | FileCheck %s -check-prefix=WARNING +// WARNING: -Wmacro-redefined -Wmain -Wmain-return-type -Wmalformed-warning-check -Wmany-braces-around-scalar-init -Wmax-unsigned-zero +// RUN: %clang --autocomplete=-Wnoinvalid-pp- | FileCheck %s -check-prefix=NOWARNING +// NOWARNING: -Wnoinvalid-pp-token diff --git a/test/Driver/constructors.c b/test/Driver/constructors.c index cd14ed736a28..39a199a3c6ae 100644 --- a/test/Driver/constructors.c +++ b/test/Driver/constructors.c @@ -74,3 +74,11 @@ // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target arm64-none-none-eabi \ // RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s +// +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target sparc-sun-solaris2.11 \ +// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s +// +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-pc-solaris2.11 \ +// RUN: | FileCheck --check-prefix=CHECK-INIT-ARRAY %s diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index c11a2df37f98..12c7ef6eb0b1 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -121,3 +121,15 @@ // RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOSSIM %s // CHECK-VERSION-WATCHOSSIM: "i386-apple-watchos2.0.0" + +// RUN: %clang -target x86_64-apple-ios11.0.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS-TARGET %s +// CHECK-VERSION-IOS-TARGET: "x86_64-apple-ios11.0.0" + +// RUN: %clang -target x86_64-apple-tvos11.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-TVOS-TARGET %s +// CHECK-VERSION-TVOS-TARGET: "x86_64-apple-tvos11.0.0" + +// RUN: %clang -target x86_64-apple-watchos4.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS-TARGET %s +// CHECK-VERSION-WATCHOS-TARGET: "x86_64-apple-watchos4.0.0" diff --git a/test/Driver/emulated-tls.cpp b/test/Driver/emulated-tls.cpp index a18c2e220bf8..38edc98ac889 100644 --- a/test/Driver/emulated-tls.cpp +++ b/test/Driver/emulated-tls.cpp @@ -1,5 +1,7 @@ -// Cygwin uses emutls. Clang should pass -femulated-tls to cc1 and cc1 should pass EmulatedTLS to LLVM CodeGen. +// Cygwin and OpenBSD use emutls. Clang should pass -femulated-tls to cc1 +// and cc1 should pass EmulatedTLS to LLVM CodeGen. // FIXME: Add more targets here to use emutls. // RUN: %clang -### -std=c++11 -target i686-pc-cygwin %s 2>&1 | FileCheck %s +// RUN: %clang -### -std=c++11 -target i686-pc-openbsd %s 2>&1 | FileCheck %s // CHECK: "-cc1" {{.*}}"-femulated-tls" diff --git a/test/Driver/fuchsia.c b/test/Driver/fuchsia.c index 64d31cc0d38c..405086f3f07e 100644 --- a/test/Driver/fuchsia.c +++ b/test/Driver/fuchsia.c @@ -5,6 +5,7 @@ // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" // CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu" +// CHECK: "-z" "rodynamic" // CHECK: "--sysroot=[[SYSROOT]]" // CHECK: "-pie" // CHECK: "--build-id" diff --git a/test/Driver/fuchsia.cpp b/test/Driver/fuchsia.cpp index 4c3f7d29acd8..20299c342688 100644 --- a/test/Driver/fuchsia.cpp +++ b/test/Driver/fuchsia.cpp @@ -7,6 +7,7 @@ // CHECK: "-internal-isystem" "{{.*[/\\]}}x86_64-fuchsia{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" // CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu" +// CHECK: "-z" "rodynamic" // CHECK: "--sysroot=[[SYSROOT]]" // CHECK: "-pie" // CHECK: "--build-id" diff --git a/test/Driver/lto-unit.c b/test/Driver/lto-unit.c index 8a800fa4dcd6..1f1a2861670e 100644 --- a/test/Driver/lto-unit.c +++ b/test/Driver/lto-unit.c @@ -2,6 +2,8 @@ // RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s // RUN: %clang -target x86_64-apple-darwin13.3.0 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s +// RUN: %clang -target x86_64-scei-ps4 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s +// RUN: %clang -target x86_64-scei-ps4 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s // UNIT: "-flto-unit" // NOUNIT-NOT: "-flto-unit" diff --git a/test/Driver/pic.c b/test/Driver/pic.c index 61d752094f6e..6b01c583b8b1 100644 --- a/test/Driver/pic.c +++ b/test/Driver/pic.c @@ -247,6 +247,9 @@ // On OpenBSD, -nopie needs to be passed through to the linker. // RUN: %clang %s -target i386-pc-openbsd -nopie -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD +// Try with the alias +// RUN: %clang %s -target i386-pc-openbsd -no-pie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD // // On Android PIC is enabled by default // RUN: %clang -c %s -target i686-linux-android -### 2>&1 \ diff --git a/test/Driver/std.cpp b/test/Driver/std.cpp index aceda017a4e1..52b42ab9bd4f 100644 --- a/test/Driver/std.cpp +++ b/test/Driver/std.cpp @@ -9,6 +9,9 @@ // RUN: not %clang -std=gnu++1y %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX1Y %s // RUN: not %clang -std=c++1z %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX1Z %s // RUN: not %clang -std=gnu++1z %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX1Z %s +// RUN: not %clang -std=c++2a %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX2A %s +// RUN: not %clang -std=gnu++2a %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX2A %s + void f(int n) { typeof(n)(); @@ -38,3 +41,10 @@ void f(int n) { // GNUXX1Z-NOT: undeclared identifier 'typeof' // GNUXX1Z-NOT: undeclared identifier 'decltype' + +// CXX2A: undeclared identifier 'typeof' +// CXX2A-NOT: undeclared identifier 'decltype' + +// GNUXX2A-NOT: undeclared identifier 'typeof' +// GNUXX2A-NOT: undeclared identifier 'decltype' + diff --git a/test/Driver/systemz-march.c b/test/Driver/systemz-march.c index a5df1f482d1e..2fe7f89d8512 100644 --- a/test/Driver/systemz-march.c +++ b/test/Driver/systemz-march.c @@ -9,6 +9,8 @@ // RUN: %clang -target s390x -### -S -emit-llvm -march=arch10 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH10 %s // RUN: %clang -target s390x -### -S -emit-llvm -march=z13 %s 2>&1 | FileCheck --check-prefix=CHECK-Z13 %s // RUN: %clang -target s390x -### -S -emit-llvm -march=arch11 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH11 %s +// RUN: %clang -target s390x -### -S -emit-llvm -march=z14 %s 2>&1 | FileCheck --check-prefix=CHECK-Z14 %s +// RUN: %clang -target s390x -### -S -emit-llvm -march=arch12 %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH12 %s // CHECK-Z9: error: unknown target CPU 'z9' // CHECK-Z10: "-target-cpu" "z10" @@ -19,5 +21,7 @@ // CHECK-ARCH10: "-target-cpu" "arch10" // CHECK-Z13: "-target-cpu" "z13" // CHECK-ARCH11: "-target-cpu" "arch11" +// CHECK-Z14: "-target-cpu" "z14" +// CHECK-ARCH12: "-target-cpu" "arch12" int x; diff --git a/test/Driver/unknown-std.cpp b/test/Driver/unknown-std.cpp index 4f7a5e64a6ed..195a671edadf 100644 --- a/test/Driver/unknown-std.cpp +++ b/test/Driver/unknown-std.cpp @@ -15,6 +15,8 @@ // CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard // CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard // CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard +// CHECK-NEXT: note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard +// CHECK-NEXT: note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard // CUDA-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard // Make sure that no other output is present. diff --git a/test/FixIt/format.m b/test/FixIt/format.m index 7af2cfdaf71a..c3cf2b1f3c56 100644 --- a/test/FixIt/format.m +++ b/test/FixIt/format.m @@ -229,6 +229,19 @@ void testSignedness(long i, unsigned long u) { // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:14}:"%+ld" } +void testSizeTypes() { + printf("%zu", 0.f); // expected-warning-re{{format specifies type 'size_t' (aka '{{.+}}') but the argument has type 'float'}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:14}:"%f" + + printf("%zd", 0.f); // expected-warning-re{{format specifies type 'ssize_t' (aka '{{.+}}') but the argument has type 'float'}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:14}:"%f" + + short x; + printf("%zn", &x); // expected-warning-re{{format specifies type 'ssize_t *' (aka '{{.+}}') but the argument has type 'short *'}} + // PrintfSpecifier::fixType doesn't handle %n, so a fix-it is not emitted, + // see the comment in PrintfSpecifier::fixType in PrintfFormatString.cpp. +} + void testEnum() { typedef enum { ImplicitA = 1, diff --git a/test/Index/Core/index-source.m b/test/Index/Core/index-source.m index c911973a70d6..1333cafd7575 100644 --- a/test/Index/Core/index-source.m +++ b/test/Index/Core/index-source.m @@ -438,3 +438,28 @@ void testImplicitProperties(ImplicitProperties *c) { // CHECK: [[@LINE-1]]:22 | class-method/ObjC | classImplicit | c:objc(cs)ImplicitProperties(cm)classImplicit | +[ImplicitProperties classImplicit] | Ref,Call,RelCall,RelCont | rel: 1 // CHECK-NEXT: RelCall,RelCont | testImplicitProperties | c:@F@testImplicitProperties } + +@interface EmptySelectors + +- (int):(int)_; // CHECK: [[@LINE]]:8 | instance-method/ObjC | : | c:objc(cs)EmptySelectors(im): | -[EmptySelectors :] +- (void)test: (int)x :(int)y; // CHECK: [[@LINE]]:9 | instance-method/ObjC | test:: | c:objc(cs)EmptySelectors(im)test:: | -[EmptySelectors test::] +- (void):(int)_ :(int)m:(int)z; // CHECK: [[@LINE]]:9 | instance-method/ObjC | ::: | c:objc(cs)EmptySelectors(im)::: | -[EmptySelectors :::] + +@end + +@implementation EmptySelectors + +- (int):(int)_ { // CHECK: [[@LINE]]:8 | instance-method/ObjC | : | c:objc(cs)EmptySelectors(im): | -[EmptySelectors :] + [self :2]; // CHECK: [[@LINE]]:9 | instance-method/ObjC | : | c:objc(cs)EmptySelectors(im): | -[EmptySelectors :] + return 0; +} + +- (void)test: (int)x :(int)y { // CHECK: [[@LINE]]:9 | instance-method/ObjC | test:: | c:objc(cs)EmptySelectors(im)test:: | -[EmptySelectors test::] +} + +- (void) :(int)_ :(int)m :(int)z { // CHECK: [[@LINE]]:10 | instance-method/ObjC | ::: | c:objc(cs)EmptySelectors(im)::: | -[EmptySelectors :::] + [self test:0:1]; // CHECK: [[@LINE]]:9 | instance-method/ObjC | test:: | c:objc(cs)EmptySelectors(im)test:: | -[EmptySelectors test::] + [self: 0: 1: 2]; // CHECK: [[@LINE]]:8 | instance-method/ObjC | ::: | c:objc(cs)EmptySelectors(im)::: | -[EmptySelectors :::] +} + +@end diff --git a/test/Index/Core/no-templated-canonical-decl.cpp b/test/Index/Core/no-templated-canonical-decl.cpp new file mode 100644 index 000000000000..5434e9cb6515 --- /dev/null +++ b/test/Index/Core/no-templated-canonical-decl.cpp @@ -0,0 +1,4 @@ +// RUN: c-index-test core -print-source-symbols -include-locals -- %s | FileCheck %s + +template <template <typename> class A> class B { typedef A<int> A_int; }; +// CHECK: [[@LINE-1]]:46 | class(Gen)/C++ | B | c:@ST>1#t>1#T@B | <no-cgname> | Def | rel: 0 diff --git a/test/Index/complete-available.m b/test/Index/complete-available.m index 8267dbdddc5c..6c0a2622be03 100644 --- a/test/Index/complete-available.m +++ b/test/Index/complete-available.m @@ -8,8 +8,8 @@ void atAvailable() { } } -// RUN: c-index-test -code-completion-at=%s:4:18 %s | FileCheck -check-prefix=CHECK %s -// RUN: c-index-test -code-completion-at=%s:7:27 %s | FileCheck -check-prefix=CHECK %s +// RUN: c-index-test -code-completion-at=%s:4:18 %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:7:27 %s | FileCheck %s // CHECK: {TypedText iOS} (40) // CHECK: {TypedText iOSApplicationExtension} (40) // CHECK: {TypedText macOS} (40) diff --git a/test/Misc/ast-dump-decl.c b/test/Misc/ast-dump-decl.c index 313c808c4ac8..71b98c9443cf 100644 --- a/test/Misc/ast-dump-decl.c +++ b/test/Misc/ast-dump-decl.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -check-prefix CHECK-TU -strict-whitespace %s // RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodule-name=X -triple x86_64-unknown-unknown -fmodule-map-file=%S/Inputs/module.modulemap -ast-dump -ast-dump-filter Test %s -DMODULES | FileCheck -check-prefix CHECK -check-prefix CHECK-MODULES -strict-whitespace %s diff --git a/test/Misc/ast-dump-decl.cpp b/test/Misc/ast-dump-decl.cpp index 7370f46c5b32..a48261d367d9 100644 --- a/test/Misc/ast-dump-decl.cpp +++ b/test/Misc/ast-dump-decl.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s class testEnumDecl { enum class TestEnumDeclScoped; diff --git a/test/Modules/DebugInfoTransitiveImport.m b/test/Modules/DebugInfoTransitiveImport.m index 034a909333cd..08dfecfb7899 100644 --- a/test/Modules/DebugInfoTransitiveImport.m +++ b/test/Modules/DebugInfoTransitiveImport.m @@ -12,9 +12,9 @@ // Definition of left: // CHECK: !DICompileUnit({{.*}}dwoId: -// CHECK: !DIFile({{.*}}diamond_left +// CHECK: ![[LEFT:[0-9]+]] = !DIFile({{.*}}diamond_left.h // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, -// CHECK-SAME: entity: ![[MODULE:.*]], line: 3) +// CHECK-SAME: entity: ![[MODULE:.*]], file: ![[LEFT]], line: 3) // CHECK: ![[MODULE]] = !DIModule(scope: null, name: "diamond_top" // Skeleton for top: diff --git a/test/Modules/ExtDebugInfo.cpp b/test/Modules/ExtDebugInfo.cpp index fd3bb940751f..ed9d1e859d83 100644 --- a/test/Modules/ExtDebugInfo.cpp +++ b/test/Modules/ExtDebugInfo.cpp @@ -71,6 +71,8 @@ void foo() { anon.i = GlobalStruct.i = GlobalUnion.i = GlobalEnum; } +// CHECK: ![[CPP:.*]] = !DIFile(filename: {{.*}}ExtDebugInfo.cpp" + // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum", // CHECK-SAME: scope: ![[NS:[0-9]+]], // CHECK-SAME: flags: DIFlagFwdDecl, @@ -201,7 +203,7 @@ void foo() { // CHECK-SAME: name: "InAnonymousNamespace", {{.*}}DIFlagFwdDecl) -// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !{{[0-9]+}}, entity: ![[STRUCT]], line: 27) +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !{{[0-9]+}}, entity: ![[STRUCT]], file: ![[CPP]], line: 27) // CHECK: !DICompileUnit( // CHECK-SAME: splitDebugFilename: diff --git a/test/Modules/Inputs/DebugObjCImport.h b/test/Modules/Inputs/DebugObjCImport.h new file mode 100644 index 000000000000..b5ef366fca1f --- /dev/null +++ b/test/Modules/Inputs/DebugObjCImport.h @@ -0,0 +1,2 @@ +@import Empty; +struct DebugObjCImport {}; diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index c0fe6c557f22..4cb3e8a02804 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -347,6 +347,12 @@ module DebugObjC { header "DebugObjC.h" } +module DebugObjCImport { + module SubModule { + header "DebugObjCImport.h" + } +} + module ImportNameInDir { header "ImportNameInDir.h" export * diff --git a/test/Modules/ModuleDebugInfo.m b/test/Modules/ModuleDebugInfo.m index d1a0e8d5e80a..9289abe08080 100644 --- a/test/Modules/ModuleDebugInfo.m +++ b/test/Modules/ModuleDebugInfo.m @@ -23,8 +23,10 @@ @import DebugObjC; #endif -// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC -// CHECK-SAME: isOptimized: false, +// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC, file: ![[FILE:[0-9]+]], +// CHECK-SAME: isOptimized: false + +// CHECK: ![[FILE]] = !DIFile(filename: "{{DebugObjC|.*DebugObjC.h}}" // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, // CHECK-SAME: scope: ![[MODULE:[0-9]+]], diff --git a/test/Modules/debug-info-moduleimport-in-module.m b/test/Modules/debug-info-moduleimport-in-module.m new file mode 100644 index 000000000000..cde46115d288 --- /dev/null +++ b/test/Modules/debug-info-moduleimport-in-module.m @@ -0,0 +1,21 @@ +// Test that an @import inside a module is not represented in the debug info. + +// REQUIRES: asserts + +// RUN: rm -rf %t +// RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \ +// RUN: -fimplicit-module-maps -fmodules-cache-path=%t %s \ +// RUN: -debugger-tuning=lldb -I %S/Inputs -emit-llvm -o %t.ll \ +// RUN: -mllvm -debug-only=pchcontainer &>%t-mod.ll +// RUN: cat %t-mod.ll | FileCheck %s + +@import DebugObjCImport.SubModule; + +// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC +// CHECK: DW_TAG_structure_type, name: "DebugObjCImport" +// CHECK: ![[HEADER:.*]] = !DIFile(filename: {{.*}}DebugObjCImport.h" +// CHECK: ![[SUBMOD:.*]] = !DIModule({{.*}}name: "SubModule" +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, +// CHECK-SAME: scope: ![[SUBMOD]], entity: ![[EMPTY:[0-9]+]], +// CHECK-SAME: file: ![[HEADER]], line: 1) +// CHECK: ![[EMPTY]] = !DIModule(scope: null, name: "Empty" diff --git a/test/Modules/debug-info-moduleimport.m b/test/Modules/debug-info-moduleimport.m index bf60690be40b..16820baebe68 100644 --- a/test/Modules/debug-info-moduleimport.m +++ b/test/Modules/debug-info-moduleimport.m @@ -10,12 +10,13 @@ // CHECK: ![[CU:.*]] = distinct !DICompileUnit @import DebugObjC; // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[CU]], -// CHECK-SAME: entity: ![[MODULE:.*]], line: [[@LINE-2]]) +// CHECK-SAME: entity: ![[MODULE:.*]], file: ![[F:[0-9]+]], +// CHECK-SAME: line: [[@LINE-3]]) // CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC", // CHECK-SAME: configMacros: "\22-DGREETING=Hello World\22 \22-UNDEBUG\22", // CHECK-SAME: includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs", // CHECK-SAME: isysroot: "/tmp/..") - +// CHECK: ![[F]] = !DIFile(filename: {{.*}}debug-info-moduleimport.m // RUN: %clang_cc1 -debug-info-kind=limited -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - \ diff --git a/test/Modules/odr_hash.cpp b/test/Modules/odr_hash.cpp index ee45ae529961..68a988dc8e78 100644 --- a/test/Modules/odr_hash.cpp +++ b/test/Modules/odr_hash.cpp @@ -517,8 +517,91 @@ S14 s14; // expected-error@second.h:* {{'Method::S14' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [3]'}} // expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [2]'}} #endif + +#if defined(FIRST) +struct S15 { + int A() { return 0; } +}; +#elif defined(SECOND) +struct S15 { + long A() { return 0; } +}; +#else +S15 s15; +// expected-error@first.h:* {{'Method::S15::A' from module 'FirstModule' is not present in definition of 'Method::S15' in module 'SecondModule'}} +// expected-note@second.h:* {{declaration of 'A' does not match}} +#endif } // namespace Method +namespace Constructor { +#if defined(FIRST) +struct S1 { + S1() {} + void foo() {} +}; +#elif defined(SECOND) +struct S1 { + void foo() {} + S1() {} +}; +#else +S1 s1; +// expected-error@second.h:* {{'Constructor::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'foo'}} +// expected-note@first.h:* {{but in 'FirstModule' found constructor}} +#endif + +#if defined(FIRST) +struct S2 { + S2(int) {} + S2(int, int) {} +}; +#elif defined(SECOND) +struct S2 { + S2(int, int) {} + S2(int) {} +}; +#else +S2* s2; +// expected-error@second.h:* {{'Constructor::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found constructor that has 2 parameters}} +// expected-note@first.h:* {{but in 'FirstModule' found constructor that has 1 parameter}} +#endif +} // namespace Constructor + +namespace Destructor { +#if defined(FIRST) +struct S1 { + ~S1() {} + S1() {} +}; +#elif defined(SECOND) +struct S1 { + S1() {} + ~S1() {} +}; +#else +S1 s1; +// expected-error@second.h:* {{'Destructor::S1' has different definitions in different modules; first difference is definition in module 'SecondModule' found constructor}} +// expected-note@first.h:* {{but in 'FirstModule' found destructor}} +#endif + +#if defined(FIRST) +struct S2 { + virtual ~S2() {} + void foo() {} +}; +#elif defined(SECOND) +struct S2 { + ~S2() {} + virtual void foo() {} +}; +#else +S2 s2; +// expected-error@second.h:* {{'Destructor::S2' has different definitions in different modules; first difference is definition in module 'SecondModule' found destructor is not virtual}} +// expected-note@first.h:* {{but in 'FirstModule' found destructor is virtual}} +#endif + +} // namespace Destructor + // Naive parsing of AST can lead to cycles in processing. Ensure // self-references don't trigger an endless cycles of AST node processing. namespace SelfReference { diff --git a/test/OpenMP/distribute_parallel_for_if_codegen.cpp b/test/OpenMP/distribute_parallel_for_if_codegen.cpp index e6cd7215f585..9ee909e0139c 100644 --- a/test/OpenMP/distribute_parallel_for_if_codegen.cpp +++ b/test/OpenMP/distribute_parallel_for_if_codegen.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/for_reduction_codegen.cpp b/test/OpenMP/for_reduction_codegen.cpp index 274546b06547..d5afae990bf4 100644 --- a/test/OpenMP/for_reduction_codegen.cpp +++ b/test/OpenMP/for_reduction_codegen.cpp @@ -497,15 +497,12 @@ int main() { // CHECK: [[RED_LIST:%.+]] = alloca [4 x i8*], // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], +// CHECK: store i{{[0-9]+}}* %{{.+}}, i{{[0-9]+}}** +// CHECK: store i{{[0-9]+}}* %{{.+}}, i{{[0-9]+}}** [[ARR_ADDR:%.+]], +// CHECK: [[ARR:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[ARR_ADDR]], -// CHECK: [[IDX1:%.+]] = mul nsw i64 1, %{{.+}} -// CHECK: [[LB1:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] -// CHECK: [[LB1_0:%.+]] = getelementptr inbounds i32, i32* [[LB1]], i64 0 -// CHECK: [[IDX1:%.+]] = mul nsw i64 1, %{{.+}} -// CHECK: [[UB1:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] -// CHECK: [[UB1_UP:%.+]] = getelementptr inbounds i32, i32* [[UB1]], i64 % -// CHECK: [[UB_CAST:%.+]] = ptrtoint i32* [[UB1_UP]] to i64 -// CHECK: [[LB_CAST:%.+]] = ptrtoint i32* [[LB1_0]] to i64 +// CHECK: [[UB_CAST:%.+]] = ptrtoint i32* [[UB1_UP:%.+]] to i64 +// CHECK: [[LB_CAST:%.+]] = ptrtoint i32* [[LB1_0:%.+]] to i64 // CHECK: [[DIFF:%.+]] = sub i64 [[UB_CAST]], [[LB_CAST]] // CHECK: [[SIZE_1:%.+]] = sdiv exact i64 [[DIFF]], ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i64) // CHECK: [[ARR_SIZE:%.+]] = add nuw i64 [[SIZE_1]], 1 @@ -704,7 +701,7 @@ int main() { // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], -// CHECK: [[ARR_SIZE:%.+]] = mul nuw i64 %{{.+}}, 4 +// CHECK: [[ARR_SIZE:%.+]] = udiv exact i64 // CHECK: call i8* @llvm.stacksave() // CHECK: [[ARR_PRIV:%.+]] = alloca i32, i64 [[ARR_SIZE]], @@ -718,7 +715,6 @@ int main() { // CHECK: br i1 [[DONE]], // Check initialization of private copy. -// CHECK: [[LHS_BEGIN:%.+]] = bitcast [10 x [4 x [[S_FLOAT_TY]]]]* %{{.+}} to [[S_FLOAT_TY]]* // CHECK: [[BEGIN:%.+]] = getelementptr inbounds [10 x [4 x [[S_FLOAT_TY]]]], [10 x [4 x [[S_FLOAT_TY]]]]* [[ARRS_PRIV]], i32 0, i32 0, i32 0 // CHECK: [[END:%.+]] = getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* [[BEGIN]], i64 40 // CHECK: [[ISEMPTY:%.+]] = icmp eq [[S_FLOAT_TY]]* [[BEGIN]], [[END]] @@ -727,6 +723,7 @@ int main() { // CHECK: call void @_ZN1SIfEC1Ev([[S_FLOAT_TY]]* % // CHECK: [[DONE:%.+]] = icmp eq [[S_FLOAT_TY]]* %{{.+}}, [[END]] // CHECK: br i1 [[DONE]], +// CHECK: [[LHS_BEGIN:%.+]] = bitcast [10 x [4 x [[S_FLOAT_TY]]]]* %{{.+}} to [[S_FLOAT_TY]]* // CHECK: [[ARRS_PRIV_BEGIN:%.+]] = bitcast [10 x [4 x [[S_FLOAT_TY]]]]* [[ARRS_PRIV]] to [[S_FLOAT_TY]]* // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]] @@ -895,23 +892,15 @@ int main() { // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], // CHECK: [[VAR2_ORIG:%.+]] = load [[S_FLOAT_TY]]***, [[S_FLOAT_TY]]**** [[VAR2_ORIG_ADDR]], -// CHECK: load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], -// CHECK: getelementptr inbounds [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** %{{.+}}, i64 0 -// CHECK: load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** % -// CHECK: [[LOW:%.+]] = getelementptr inbounds [[S_FLOAT_TY]], [[S_FLOAT_TY]]* %{{.+}}, i64 1 -// CHECK: load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], -// CHECK: getelementptr inbounds [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** %{{.+}}, i64 4 -// CHECK: load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** % -// CHECK: getelementptr inbounds [[S_FLOAT_TY]], [[S_FLOAT_TY]]* %{{.+}}, i64 6 -// CHECK: [[LD:%.+]] = load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], -// CHECK: [[ORIG_START:%.+]] = load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** [[LD]], // CHECK: [[LAST:%.+]] = ptrtoint [[S_FLOAT_TY]]* %{{.+}} to i64 -// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 +// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW:%.+]] to i64 // CHECK: [[BYTE_DIF:%.+]] = sub i64 [[LAST]], [[FIRST]] // CHECK: [[DIF:%.+]] = sdiv exact i64 [[BYTE_DIF]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) // CHECK: [[SIZE:%.+]] = add nuw i64 [[DIF]], 1 // CHECK: call i8* @llvm.stacksave() // CHECK: [[VAR2_PRIV:%.+]] = alloca [[S_FLOAT_TY]], i64 [[SIZE]], +// CHECK: [[LD:%.+]] = load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], +// CHECK: [[ORIG_START:%.+]] = load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** [[LD]], // CHECK: [[START:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[ORIG_START]] to i64 // CHECK: [[LOW_BOUND:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[OFFSET_BYTES:%.+]] = sub i64 [[START]], [[LOW_BOUND]] @@ -932,8 +921,6 @@ int main() { // CHECK: [[VVAR2_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VVAR2_ORIG_ADDR]], // CHECK: [[LOW:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]], i64 0, i64 0 -// CHECK: getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]], i64 0, i64 4 -// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[LAST:%.+]] = ptrtoint [[S_FLOAT_TY]]* %{{.+}} to i64 // CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[BYTE_DIF:%.+]] = sub i64 [[LAST]], [[FIRST]] @@ -941,6 +928,7 @@ int main() { // CHECK: [[SIZE:%.+]] = add nuw i64 [[DIF]], 1 // CHECK: call i8* @llvm.stacksave() // CHECK: [[VVAR2_PRIV:%.+]] = alloca [[S_FLOAT_TY]], i64 [[SIZE]], +// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[START:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[ORIG_START]] to i64 // CHECK: [[LOW_BOUND:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[OFFSET_BYTES:%.+]] = sub i64 [[START]], [[LOW_BOUND]] @@ -960,19 +948,15 @@ int main() { // CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], // CHECK: store [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR:%.+]], -// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: [[LOW:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], i64 0, i64 1 -// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], i64 0, i64 2 -// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[LAST:%.+]] = ptrtoint [[S_FLOAT_TY]]* %{{.+}} to i64 -// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 +// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW:%.+]] to i64 // CHECK: [[BYTE_DIF:%.+]] = sub i64 [[LAST]], [[FIRST]] // CHECK: [[DIF:%.+]] = sdiv exact i64 [[BYTE_DIF]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) // CHECK: [[SIZE:%.+]] = add nuw i64 [[DIF]], 1 // CHECK: call i8* @llvm.stacksave() // CHECK: [[VAR3_PRIV:%.+]] = alloca [[S_FLOAT_TY]], i64 [[SIZE]], +// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], +// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[START:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[ORIG_START]] to i64 // CHECK: [[LOW_BOUND:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[OFFSET_BYTES:%.+]] = sub i64 [[START]], [[LOW_BOUND]] @@ -997,11 +981,11 @@ int main() { // CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], // CHECK: store [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR:%.+]], // CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VAR3_PRIV]], i32 0, i32 0 // CHECK: getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* %{{.+}}, i64 2 // CHECK: store [2 x [[S_FLOAT_TY]]]* [[VAR3_PRIV]], [2 x [[S_FLOAT_TY]]]** % +// CHECK: bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: ret void diff --git a/test/OpenMP/for_reduction_codegen_UDR.cpp b/test/OpenMP/for_reduction_codegen_UDR.cpp index 699e06dda85a..95b04f44d468 100644 --- a/test/OpenMP/for_reduction_codegen_UDR.cpp +++ b/test/OpenMP/for_reduction_codegen_UDR.cpp @@ -306,15 +306,12 @@ int main() { // CHECK: [[RED_LIST:%.+]] = alloca [4 x i8*], // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], +// CHECK: store i{{[0-9]+}}* %{{.+}}, i{{[0-9]+}}** +// CHECK: store i{{[0-9]+}}* %{{.+}}, i{{[0-9]+}}** [[ARR_ADDR:%.+]], +// CHECK: [[ARR:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[ARR_ADDR]], -// CHECK: [[IDX1:%.+]] = mul nsw i64 1, %{{.+}} -// CHECK: [[LB1:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] -// CHECK: [[LB1_0:%.+]] = getelementptr inbounds i32, i32* [[LB1]], i64 0 -// CHECK: [[IDX1:%.+]] = mul nsw i64 1, %{{.+}} -// CHECK: [[UB1:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] -// CHECK: [[UB1_UP:%.+]] = getelementptr inbounds i32, i32* [[UB1]], i64 % -// CHECK: [[UB_CAST:%.+]] = ptrtoint i32* [[UB1_UP]] to i64 -// CHECK: [[LB_CAST:%.+]] = ptrtoint i32* [[LB1_0]] to i64 +// CHECK: [[UB_CAST:%.+]] = ptrtoint i32* [[UB1_UP:%.+]] to i64 +// CHECK: [[LB_CAST:%.+]] = ptrtoint i32* [[LB1_0:%.+]] to i64 // CHECK: [[DIFF:%.+]] = sub i64 [[UB_CAST]], [[LB_CAST]] // CHECK: [[SIZE_1:%.+]] = sdiv exact i64 [[DIFF]], ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i64) // CHECK: [[ARR_SIZE:%.+]] = add nuw i64 [[SIZE_1]], 1 @@ -508,7 +505,7 @@ int main() { // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], -// CHECK: [[ARR_SIZE:%.+]] = mul nuw i64 %{{.+}}, 4 +// CHECK: [[ARR_SIZE:%.+]] = udiv exact i64 // CHECK: call i8* @llvm.stacksave() // CHECK: [[ARR_PRIV:%.+]] = alloca i32, i64 [[ARR_SIZE]], @@ -522,8 +519,8 @@ int main() { // CHECK: br i1 [[DONE]], // Check initialization of private copy. -// CHECK: [[LHS_BEGIN:%.+]] = bitcast [10 x [4 x [[S_FLOAT_TY]]]]* %{{.+}} to [[S_FLOAT_TY]]* // CHECK: [[BEGIN:%.+]] = getelementptr inbounds [10 x [4 x [[S_FLOAT_TY]]]], [10 x [4 x [[S_FLOAT_TY]]]]* [[ARRS_PRIV]], i32 0, i32 0, i32 0 +// CHECK: [[LHS_BEGIN:%.+]] = bitcast [10 x [4 x [[S_FLOAT_TY]]]]* %{{.+}} to [[S_FLOAT_TY]]* // CHECK: [[END:%.+]] = getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* [[BEGIN]], i64 40 // CHECK: [[ISEMPTY:%.+]] = icmp eq [[S_FLOAT_TY]]* [[BEGIN]], [[END]] // CHECK: br i1 [[ISEMPTY]], @@ -531,6 +528,7 @@ int main() { // CHECK: call void @_Z4initR6BaseS1RKS_(% // CHECK: [[DONE:%.+]] = icmp eq [[S_FLOAT_TY]]* %{{.+}}, [[END]] // CHECK: br i1 [[DONE]], +// CHECK: [[LHS_BEGIN:%.+]] = bitcast [10 x [4 x [[S_FLOAT_TY]]]]* %{{.+}} to [[S_FLOAT_TY]]* // CHECK: [[ARRS_PRIV_BEGIN:%.+]] = bitcast [10 x [4 x [[S_FLOAT_TY]]]]* [[ARRS_PRIV]] to [[S_FLOAT_TY]]* // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]] @@ -695,23 +693,15 @@ int main() { // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], // CHECK: [[VAR2_ORIG:%.+]] = load [[S_FLOAT_TY]]***, [[S_FLOAT_TY]]**** [[VAR2_ORIG_ADDR]], -// CHECK: load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], -// CHECK: getelementptr inbounds [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** %{{.+}}, i64 0 -// CHECK: load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** % -// CHECK: [[LOW:%.+]] = getelementptr inbounds [[S_FLOAT_TY]], [[S_FLOAT_TY]]* %{{.+}}, i64 1 -// CHECK: load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], -// CHECK: getelementptr inbounds [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** %{{.+}}, i64 4 -// CHECK: load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** % -// CHECK: getelementptr inbounds [[S_FLOAT_TY]], [[S_FLOAT_TY]]* %{{.+}}, i64 6 -// CHECK: [[LD:%.+]] = load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], -// CHECK: [[ORIG_START:%.+]] = load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** [[LD]], // CHECK: [[LAST:%.+]] = ptrtoint [[S_FLOAT_TY]]* %{{.+}} to i64 -// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 +// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW:%.+]] to i64 // CHECK: [[BYTE_DIF:%.+]] = sub i64 [[LAST]], [[FIRST]] // CHECK: [[DIF:%.+]] = sdiv exact i64 [[BYTE_DIF]], ptrtoint ([[S_FLOAT_TY]]* getelementptr ([[S_FLOAT_TY]], [[S_FLOAT_TY]]* null, i32 1) to i64) // CHECK: [[SIZE:%.+]] = add nuw i64 [[DIF]], 1 // CHECK: call i8* @llvm.stacksave() // CHECK: [[VAR2_PRIV:%.+]] = alloca [[S_FLOAT_TY]], i64 [[SIZE]], +// CHECK: [[LD:%.+]] = load [[S_FLOAT_TY]]**, [[S_FLOAT_TY]]*** [[VAR2_ORIG]], +// CHECK: [[ORIG_START:%.+]] = load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** [[LD]], // CHECK: [[START:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[ORIG_START]] to i64 // CHECK: [[LOW_BOUND:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[OFFSET_BYTES:%.+]] = sub i64 [[START]], [[LOW_BOUND]] @@ -732,8 +722,6 @@ int main() { // CHECK: [[VVAR2_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VVAR2_ORIG_ADDR]], // CHECK: [[LOW:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]], i64 0, i64 0 -// CHECK: getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]], i64 0, i64 4 -// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[LAST:%.+]] = ptrtoint [[S_FLOAT_TY]]* %{{.+}} to i64 // CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[BYTE_DIF:%.+]] = sub i64 [[LAST]], [[FIRST]] @@ -741,6 +729,7 @@ int main() { // CHECK: [[SIZE:%.+]] = add nuw i64 [[DIF]], 1 // CHECK: call i8* @llvm.stacksave() // CHECK: [[VVAR2_PRIV:%.+]] = alloca [[S_FLOAT_TY]], i64 [[SIZE]], +// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VVAR2_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[START:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[ORIG_START]] to i64 // CHECK: [[LOW_BOUND:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[OFFSET_BYTES:%.+]] = sub i64 [[START]], [[LOW_BOUND]] @@ -760,19 +749,15 @@ int main() { // CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], // CHECK: store [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR:%.+]], -// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: [[LOW:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], i64 0, i64 1 -// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], i64 0, i64 2 -// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[LAST:%.+]] = ptrtoint [[S_FLOAT_TY]]* %{{.+}} to i64 -// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 +// CHECK: [[FIRST:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW:%.+]] to i64 // CHECK: [[BYTE_DIF:%.+]] = sub i64 [[LAST]], [[FIRST]] // CHECK: [[DIF:%.+]] = sdiv exact i64 [[BYTE_DIF]], ptrtoint ([[S_FLOAT_TY]]* getelementptr ([[S_FLOAT_TY]], [[S_FLOAT_TY]]* null, i32 1) to i64) // CHECK: [[SIZE:%.+]] = add nuw i64 [[DIF]], 1 // CHECK: call i8* @llvm.stacksave() // CHECK: [[VAR3_PRIV:%.+]] = alloca [[S_FLOAT_TY]], i64 [[SIZE]], +// CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], +// CHECK: [[ORIG_START:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: [[START:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[ORIG_START]] to i64 // CHECK: [[LOW_BOUND:%.+]] = ptrtoint [[S_FLOAT_TY]]* [[LOW]] to i64 // CHECK: [[OFFSET_BYTES:%.+]] = sub i64 [[START]], [[LOW_BOUND]] @@ -797,8 +782,8 @@ int main() { // CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], // CHECK: store [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR:%.+]], // CHECK: [[VAR3_ORIG:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], -// CHECK: bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[VAR3_PRIV]], i32 0, i32 0 +// CHECK: bitcast [2 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* %{{.+}}, i64 2 // CHECK: store [2 x [[S_FLOAT_TY]]]* [[VAR3_PRIV]], [2 x [[S_FLOAT_TY]]]** % diff --git a/test/OpenMP/parallel_if_codegen.cpp b/test/OpenMP/parallel_if_codegen.cpp index af154c0e36dd..87dcf1dde943 100644 --- a/test/OpenMP/parallel_if_codegen.cpp +++ b/test/OpenMP/parallel_if_codegen.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/taskgroup_ast_print.cpp b/test/OpenMP/taskgroup_ast_print.cpp index 683141e686ec..4292eedfb56e 100644 --- a/test/OpenMP/taskgroup_ast_print.cpp +++ b/test/OpenMP/taskgroup_ast_print.cpp @@ -8,6 +8,62 @@ void foo() {} +struct S1 { + S1(): a(0) {} + S1(int v) : a(v) {} + int a; + typedef int type; + S1& operator +(const S1&); + S1& operator *(const S1&); + S1& operator &&(const S1&); + S1& operator ^(const S1&); +}; + +template <typename T> +class S7 : public T { +protected: + T a; + T b[100]; + S7() : a(0) {} + +public: + S7(typename T::type v) : a(v) { +#pragma omp taskgroup task_reduction(+ : a) task_reduction(*: b[:]) + for (int k = 0; k < a.a; ++k) + ++this->a.a; + } + S7 &operator=(S7 &s) { +#pragma omp taskgroup task_reduction(&& : this->a) task_reduction(^: b[s.a.a]) + for (int k = 0; k < s.a.a; ++k) + ++s.a.a; + return *this; + } +}; + +// CHECK: #pragma omp taskgroup task_reduction(+: this->a) task_reduction(*: this->b[:]) +// CHECK: #pragma omp taskgroup task_reduction(&&: this->a) task_reduction(^: this->b[s.a.a]) +// CHECK: #pragma omp taskgroup task_reduction(+: this->a) task_reduction(*: this->b[:]) + +class S8 : public S7<S1> { + S8() {} + +public: + S8(int v) : S7<S1>(v){ +#pragma omp taskgroup task_reduction(^ : S7 < S1 > ::a) task_reduction(+ : S7 < S1 > ::b[ : S7 < S1 > ::a.a]) + for (int k = 0; k < a.a; ++k) + ++this->a.a; + } + S8 &operator=(S8 &s) { +#pragma omp taskgroup task_reduction(* : this->a) task_reduction(&&:this->b[a.a:]) + for (int k = 0; k < s.a.a; ++k) + ++s.a.a; + return *this; + } +}; + +// CHECK: #pragma omp taskgroup task_reduction(^: this->S7<S1>::a) task_reduction(+: this->S7<S1>::b[:this->S7<S1>::a.a]) +// CHECK: #pragma omp taskgroup task_reduction(*: this->a) task_reduction(&&: this->b[this->a.a:]) + int main (int argc, char **argv) { int b = argc, c, d, e, f, g; static int a; @@ -18,9 +74,9 @@ int main (int argc, char **argv) { // CHECK-NEXT: a = 2; // CHECK-NEXT: ++a; ++a; -#pragma omp taskgroup +#pragma omp taskgroup task_reduction(min: a) foo(); -// CHECK-NEXT: #pragma omp taskgroup +// CHECK-NEXT: #pragma omp taskgroup task_reduction(min: a) // CHECK-NEXT: foo(); // CHECK-NEXT: return 0; return 0; diff --git a/test/OpenMP/taskgroup_messages.cpp b/test/OpenMP/taskgroup_messages.cpp index e893da4be3fa..23820734a551 100644 --- a/test/OpenMP/taskgroup_messages.cpp +++ b/test/OpenMP/taskgroup_messages.cpp @@ -63,5 +63,7 @@ int foo() { foo(); } +#pragma omp taskgroup init // expected-warning {{extra tokens at the end of '#pragma omp taskgroup' are ignored}} + ; return 0; } diff --git a/test/OpenMP/taskgroup_task_reduction_messages.cpp b/test/OpenMP/taskgroup_task_reduction_messages.cpp new file mode 100644 index 000000000000..9c8177b0bd43 --- /dev/null +++ b/test/OpenMP/taskgroup_task_reduction_messages.cpp @@ -0,0 +1,258 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 150 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 -ferror-limit 150 -o - %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 150 -o - %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +void foobar(int &ref) { +#pragma omp taskgroup task_reduction(+:ref) + foo(); +} + +struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}} +extern S1 a; +class S2 { + mutable int a; + S2 &operator+(const S2 &arg) { return (*this); } // expected-note 3 {{implicitly declared private here}} + +public: + S2() : a(0) {} + S2(S2 &s2) : a(s2.a) {} + static float S2s; // expected-note 2 {{static data member is predetermined as shared}} + static const float S2sc; +}; +const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}} +S2 b; // expected-note 3 {{'b' defined here}} +const S2 ba[5]; // expected-note 2 {{'ba' defined here}} +class S3 { + int a; + +public: + int b; + S3() : a(0) {} + S3(const S3 &s3) : a(s3.a) {} + S3 operator+(const S3 &arg1) { return arg1; } +}; +int operator+(const S3 &arg1, const S3 &arg2) { return 5; } +S3 c; // expected-note 3 {{'c' defined here}} +const S3 ca[5]; // expected-note 2 {{'ca' defined here}} +extern const int f; // expected-note 4 {{'f' declared here}} +class S4 { + int a; + S4(); // expected-note {{implicitly declared private here}} + S4(const S4 &s4); + S4 &operator+(const S4 &arg) { return (*this); } + +public: + S4(int v) : a(v) {} +}; +S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; } +class S5 { + int a; + S5() : a(0) {} // expected-note {{implicitly declared private here}} + S5(const S5 &s5) : a(s5.a) {} + S5 &operator+(const S5 &arg); + +public: + S5(int v) : a(v) {} +}; +class S6 { // expected-note 3 {{candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const S6' for 1st argument}} +#if __cplusplus >= 201103L // C++11 or later +// expected-note@-2 3 {{candidate function (the implicit move assignment operator) not viable}} +#endif + int a; + +public: + S6() : a(6) {} + operator int() { return 6; } +} o; + +S3 h, k; +#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} + +template <class T> // expected-note {{declared here}} +T tmain(T argc) { + const T d = T(); // expected-note 4 {{'d' defined here}} + const T da[5] = {T()}; // expected-note 2 {{'da' defined here}} + T qa[5] = {T()}; + T i; + T &j = i; // expected-note 2 {{'j' defined here}} + S3 &p = k; // expected-note 2 {{'p' defined here}} + const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}} + T &q = qa[(int)i]; + T fl; +#pragma omp taskgroup task_reduction // expected-error {{expected '(' after 'task_reduction'}} + foo(); +#pragma omp taskgroup task_reduction + // expected-error {{expected '(' after 'task_reduction'}} expected-warning {{extra tokens at the end of '#pragma omp taskgroup' are ignored}} + foo(); +#pragma omp taskgroup task_reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp taskgroup task_reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp taskgroup task_reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} + foo(); +#pragma omp taskgroup task_reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} + foo(); +#pragma omp taskgroup task_reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} + foo(); +#pragma omp taskgroup task_reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}} + foo(); +#pragma omp taskgroup task_reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{invalid operands to binary expression ('float' and 'float')}} + foo(); +#pragma omp taskgroup task_reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name, array element or array section}} + foo(); +#pragma omp taskgroup task_reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} + foo(); +#pragma omp taskgroup task_reduction(&& : argc) + foo(); +#pragma omp taskgroup task_reduction(^ : T) // expected-error {{'T' does not refer to a value}} + foo(); +#pragma omp taskgroup task_reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 3 {{const-qualified list item cannot be reduction}} expected-error 2 {{'operator+' is a private member of 'S2'}} + foo(); +#pragma omp taskgroup task_reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 4 {{arguments of OpenMP clause 'task_reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} + foo(); +#pragma omp taskgroup task_reduction(+ : ba) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(* : ca) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(- : da) // expected-error {{const-qualified list item cannot be reduction}} expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} + foo(); +#pragma omp taskgroup task_reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(+ : o) // expected-error 2 {{no viable overloaded '='}} + foo(); +#pragma omp parallel private(k) +#pragma omp taskgroup task_reduction(+ : p), task_reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'task_reduction' must reference the same object in all threads}} + foo(); +#pragma omp taskgroup task_reduction(+ : p), task_reduction(+ : p) // expected-error 2 {{variable can appear only once in OpenMP 'task_reduction' clause}} expected-note 2 {{previously referenced here}} + foo(); +#pragma omp taskgroup task_reduction(+ : r) // expected-error 2 {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp parallel shared(i) +#pragma omp parallel reduction(min : i) +#pragma omp taskgroup task_reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'task_reduction' must reference the same object in all threads}} + foo(); +#pragma omp parallel +#pragma omp for private(fl) + for (int i = 0; i < 10; ++i) +#pragma omp taskgroup task_reduction(+ : fl) + foo(); +#pragma omp parallel +#pragma omp for reduction(- : fl) + for (int i = 0; i < 10; ++i) +#pragma omp taskgroup task_reduction(+ : fl) + foo(); + + return T(); +} + +namespace A { +double x; +#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} +} +namespace B { +using A::x; +} + +int main(int argc, char **argv) { + const int d = 5; // expected-note 2 {{'d' defined here}} + const int da[5] = {0}; // expected-note {{'da' defined here}} + int qa[5] = {0}; + S4 e(4); + S5 g(5); + int i; + int &j = i; // expected-note {{'j' defined here}} + S3 &p = k; // expected-note 2 {{'p' defined here}} + const int &r = da[i]; // expected-note {{'r' defined here}} + int &q = qa[i]; + float fl; +#pragma omp taskgroup task_reduction // expected-error {{expected '(' after 'task_reduction'}} + foo(); +#pragma omp taskgroup task_reduction + // expected-error {{expected '(' after 'task_reduction'}} expected-warning {{extra tokens at the end of '#pragma omp taskgroup' are ignored}} + foo(); +#pragma omp taskgroup task_reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp taskgroup task_reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp taskgroup task_reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} + foo(); +#pragma omp taskgroup task_reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} + foo(); +#pragma omp taskgroup task_reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} + foo(); +#pragma omp taskgroup task_reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} + foo(); +#pragma omp taskgroup task_reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp taskgroup task_reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}} + foo(); +#pragma omp taskgroup task_reduction(~ : argc) // expected-error {{expected unqualified-id}} + foo(); +#pragma omp taskgroup task_reduction(&& : argc) + foo(); +#pragma omp taskgroup task_reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} + foo(); +#pragma omp taskgroup task_reduction(+ : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{const-qualified list item cannot be reduction}} expected-error {{'operator+' is a private member of 'S2'}} + foo(); +#pragma omp taskgroup task_reduction(min : a, b, c, d, f) // expected-error {{a reduction list item with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'task_reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(max : h.b) // expected-error {{expected variable name, array element or array section}} + foo(); +#pragma omp taskgroup task_reduction(+ : ba) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(* : ca) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(- : da) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}} + foo(); +#pragma omp taskgroup task_reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(& : e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{nvalid operands to binary expression ('S4' and 'S4')}} expected-error {{calling a private constructor of class 'S5'}} expected-error {{invalid operands to binary expression ('S5' and 'S5')}} + foo(); +#pragma omp taskgroup task_reduction(+ : h, k, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be reduction}} + foo(); +#pragma omp taskgroup task_reduction(+ : o) // expected-error {{no viable overloaded '='}} + foo(); +#pragma omp parallel private(k) +#pragma omp taskgroup task_reduction(+ : p), task_reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'task_reduction' must reference the same object in all threads}} + foo(); +#pragma omp taskgroup task_reduction(+ : p), task_reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'task_reduction' clause}} expected-note {{previously referenced here}} + foo(); +#pragma omp taskgroup task_reduction(+ : r) // expected-error {{const-qualified list item cannot be reduction}} + foo(); +#pragma omp parallel shared(i) +#pragma omp parallel reduction(min : i) +#pragma omp taskgroup task_reduction(max : j) // expected-error {{argument of OpenMP clause 'task_reduction' must reference the same object in all threads}} + foo(); +#pragma omp parallel +#pragma omp for private(fl) + for (int i = 0; i < 10; ++i) +#pragma omp taskgroup task_reduction(+ : fl) + foo(); +#pragma omp parallel +#pragma omp for reduction(- : fl) + for (int i = 0; i < 10; ++i) +#pragma omp taskgroup task_reduction(+ : fl) + foo(); + static int m; +#pragma omp taskgroup task_reduction(+ : m) // OK + m++; + + return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}} +} diff --git a/test/OpenMP/taskloop_codegen.cpp b/test/OpenMP/taskloop_codegen.cpp index b1b45455802a..8de52023f33d 100644 --- a/test/OpenMP/taskloop_codegen.cpp +++ b/test/OpenMP/taskloop_codegen.cpp @@ -9,7 +9,7 @@ int main(int argc, char **argv) { // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%ident_t* [[DEFLOC:@.+]]) // CHECK: call void @__kmpc_taskgroup(%ident_t* [[DEFLOC]], i32 [[GTID]]) -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 33, i64 72, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK1:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 33, i64 80, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK1:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[DOWN:%.+]] = getelementptr inbounds [[TD_TY:%.+]], [[TD_TY]]* [[TASK_DATA]], i32 0, i32 5 @@ -24,7 +24,7 @@ int main(int argc, char **argv) { #pragma omp taskloop priority(argc) for (int i = 0; i < 10; ++i) ; -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 72, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK2:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 80, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[DOWN:%.+]] = getelementptr inbounds [[TD_TY:%.+]], [[TD_TY]]* [[TASK_DATA]], i32 0, i32 5 @@ -40,7 +40,7 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) ; // CHECK: call void @__kmpc_taskgroup(%ident_t* [[DEFLOC]], i32 [[GTID]]) -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 72, i64 24, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK3:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 80, i64 24, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK3:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[IF:%.+]] = icmp ne i32 %{{.+}}, 0 @@ -144,7 +144,7 @@ struct S { int a; S(int c) { // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%ident_t* [[DEFLOC:@.+]]) -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 72, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK4:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 80, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK4:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[DOWN:%.+]] = getelementptr inbounds [[TD_TY:%.+]], [[TD_TY]]* [[TASK_DATA]], i32 0, i32 5 diff --git a/test/OpenMP/taskloop_firstprivate_codegen.cpp b/test/OpenMP/taskloop_firstprivate_codegen.cpp index f4358db99b8c..6e8453050987 100644 --- a/test/OpenMP/taskloop_firstprivate_codegen.cpp +++ b/test/OpenMP/taskloop_firstprivate_codegen.cpp @@ -23,7 +23,7 @@ struct S { volatile double g; -// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32 } +// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32, i8* } // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double } // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [2 x [[S_DOUBLE_TY]]], [[S_DOUBLE_TY]], i32, [2 x i32] // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type {{.*}}{ [2 x i32]*, i32, {{.*}}[2 x [[S_DOUBLE_TY]]]*, [[S_DOUBLE_TY]]*, i{{[0-9]+}} @@ -57,7 +57,7 @@ int main() { // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[PRIVATES]], i{{.+}} 0, i{{.+}} 0 // LAMBDA: [[G_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 0 @@ -101,7 +101,7 @@ int main() { // BLOCKS: call void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[PRIVATES]], i{{.+}} 0, i{{.+}} 0 // BLOCKS: [[G_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 0 @@ -190,7 +190,7 @@ int main() { // [[KMP_TASK_T]] task_data; // [[KMP_TASK_MAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 112, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 120, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_MAIN_TY]]* // Fill kmp_task_t->shareds by copying from original capture argument. diff --git a/test/OpenMP/taskloop_lastprivate_codegen.cpp b/test/OpenMP/taskloop_lastprivate_codegen.cpp index e689feba20ac..837977eb57c0 100644 --- a/test/OpenMP/taskloop_lastprivate_codegen.cpp +++ b/test/OpenMP/taskloop_lastprivate_codegen.cpp @@ -23,7 +23,7 @@ struct S { volatile double g; -// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32 } +// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32, i8* } // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double } // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [2 x [[S_DOUBLE_TY]]], [[S_DOUBLE_TY]], i32, [2 x i32] // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { [2 x i32]*, i32*, [2 x [[S_DOUBLE_TY]]]*, [[S_DOUBLE_TY]]*, i{{[0-9]+}}* } @@ -57,7 +57,7 @@ int main() { // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // LAMBDA: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_MAIN_TY:%[^*]+]]*, [[KMP_TASK_MAIN_TY]]*, i32)* [[MAIN_DUP:@.+]] to i8*)) @@ -98,7 +98,7 @@ int main() { // BLOCKS: call void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // BLOCKS: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_MAIN_TY:%[^*]+]]*, [[KMP_TASK_MAIN_TY]]*, i32)* [[MAIN_DUP:@.+]] to i8*)) // BLOCKS: ret @@ -182,7 +182,7 @@ int main() { // [[KMP_TASK_T]] task_data; // [[KMP_TASK_MAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 112, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 120, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_MAIN_TY]]* // Fill kmp_task_t->shareds by copying from original capture argument. diff --git a/test/OpenMP/taskloop_private_codegen.cpp b/test/OpenMP/taskloop_private_codegen.cpp index dad9a17767fc..6ca7c402a12b 100644 --- a/test/OpenMP/taskloop_private_codegen.cpp +++ b/test/OpenMP/taskloop_private_codegen.cpp @@ -23,7 +23,7 @@ struct S { volatile double g; -// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32 } +// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32, i8* } // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double } // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { i8 } // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [2 x [[S_DOUBLE_TY]]], [[S_DOUBLE_TY]], i32, [2 x i32] @@ -55,7 +55,7 @@ int main() { // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // LAMBDA: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) // LAMBDA: ret @@ -91,7 +91,7 @@ int main() { // BLOCKS: call void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // BLOCKS: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) // BLOCKS: ret @@ -157,7 +157,7 @@ int main() { // [[KMP_TASK_T_TY]] task_data; // [[KMP_TASK_MAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 112, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 120, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_MAIN_TY]]* // CHECK: [[TASK:%.+]] = getelementptr inbounds [[KMP_TASK_MAIN_TY]], [[KMP_TASK_MAIN_TY]]* [[RES_KMP_TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 diff --git a/test/OpenMP/taskloop_reduction_codegen.cpp b/test/OpenMP/taskloop_reduction_codegen.cpp new file mode 100644 index 000000000000..af071ae8bd4e --- /dev/null +++ b/test/OpenMP/taskloop_reduction_codegen.cpp @@ -0,0 +1,197 @@ +// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu | FileCheck %s +// expected-no-diagnostics + +struct S { + float a; + S() : a(0.0f) {} + ~S() {} +}; + +#pragma omp declare reduction(+:S:omp_out.a += omp_in.a) initializer(omp_priv = omp_orig) + +float g; + +int a; +#pragma omp threadprivate(a) +int main (int argc, char *argv[]) +{ +int i, n; +float a[100], b[100], sum, e[argc + 100]; +S c[100]; +float &d = g; + +/* Some initializations */ +n = 100; +for (i=0; i < n; i++) + a[i] = b[i] = i * 1.0; +sum = 0.0; + +#pragma omp taskloop reduction(+:sum, c[:n], d, e) + for (i=0; i < n; i++) { + sum = sum + (a[i] * b[i]); + c[i].a = i*i; + d += i*i; + e[i] = i; + } + +} + +// CHECK-LABEL: @main( +// CHECK: [[RETVAL:%.*]] = alloca i32, +// CHECK: [[ARGC_ADDR:%.*]] = alloca i32, +// CHECK: [[ARGV_ADDR:%.*]] = alloca i8**, +// CHECK: [[I:%.*]] = alloca i32, +// CHECK: [[N:%.*]] = alloca i32, +// CHECK: [[A:%.*]] = alloca [100 x float], +// CHECK: [[B:%.*]] = alloca [100 x float], +// CHECK: [[SUM:%.*]] = alloca float, +// CHECK: [[SAVED_STACK:%.*]] = alloca i8*, +// CHECK: [[C:%.*]] = alloca [100 x %struct.S], +// CHECK: [[D:%.*]] = alloca float*, +// CHECK: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]], +// CHECK: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(%ident_t* +// CHECK: [[DOTRD_INPUT_:%.*]] = alloca [4 x %struct.kmp_task_red_input_t], +// CHECK: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, +// CHECK: [[DOTCAPTURE_EXPR_9:%.*]] = alloca i32, +// CHECK: store i32 0, i32* [[RETVAL]], +// CHECK: store i32 [[ARGC:%.*]], i32* [[ARGC_ADDR]], +// CHECK: store i8** [[ARGV:%.*]], i8*** [[ARGV_ADDR]], +// CHECK: [[TMP1:%.*]] = load i32, i32* [[ARGC_ADDR]], +// CHECK: [[ADD:%.*]] = add nsw i32 [[TMP1]], 100 +// CHECK: [[TMP2:%.*]] = zext i32 [[ADD]] to i64 +// CHECK: [[VLA:%.+]] = alloca float, i64 % + +// CHECK: call void @__kmpc_taskgroup(%ident_t* +// CHECK-DAG: [[TMP21:%.*]] = bitcast float* [[SUM]] to i8* +// CHECK-DAG: store i8* [[TMP21]], i8** [[TMP20:%[^,]+]], +// CHECK-DAG: [[TMP20]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T:%.+]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP22:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 1 +// CHECK-DAG: store i64 4, i64* [[TMP22]], +// CHECK-DAG: [[TMP23:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT1:@.+]] to i8*), i8** [[TMP23]], +// CHECK-DAG: [[TMP24:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 3 +// CHECK-DAG: store i8* null, i8** [[TMP24]], +// CHECK-DAG: [[TMP25:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB1:@.+]] to i8*), i8** [[TMP25]], +// CHECK-DAG: [[TMP26:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 5 +// CHECK-DAG: [[TMP27:%.*]] = bitcast i32* [[TMP26]] to i8* +// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* [[TMP27]], i8 0, i64 4, i32 8, i1 false) +// CHECK-DAG: [[ARRAYIDX5:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C]], i64 0, i64 0 +// CHECK-DAG: [[LB_ADD_LEN:%.*]] = add nsw i64 -1, % +// CHECK-DAG: [[ARRAYIDX6:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C]], i64 0, i64 [[LB_ADD_LEN]] +// CHECK-DAG: [[TMP31:%.*]] = bitcast %struct.S* [[ARRAYIDX5]] to i8* +// CHECK-DAG: store i8* [[TMP31]], i8** [[TMP28:%[^,]+]], +// CHECK-DAG: [[TMP28]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP32:%.*]] = ptrtoint %struct.S* [[ARRAYIDX6]] to i64 +// CHECK-DAG: [[TMP33:%.*]] = ptrtoint %struct.S* [[ARRAYIDX5]] to i64 +// CHECK-DAG: [[TMP34:%.*]] = sub i64 [[TMP32]], [[TMP33]] +// CHECK-DAG: [[TMP35:%.*]] = sdiv exact i64 [[TMP34]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) +// CHECK-DAG: [[TMP36:%.*]] = add nuw i64 [[TMP35]], 1 +// CHECK-DAG: [[TMP37:%.*]] = mul nuw i64 [[TMP36]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) +// CHECK-DAG: store i64 [[TMP37]], i64* [[TMP38:%[^,]+]], +// CHECK-DAG: [[TMP38]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 1 +// CHECK-DAG: [[TMP39:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT2:@.+]] to i8*), i8** [[TMP39]], +// CHECK-DAG: [[TMP40:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 3 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_FINI2:@.+]] to i8*), i8** [[TMP40]], +// CHECK-DAG: [[TMP41:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB2:@.+]] to i8*), i8** [[TMP41]], +// CHECK-DAG: [[TMP42:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 5 +// CHECK-DAG: store i32 1, i32* [[TMP42]], +// CHECK-DAG: [[TMP44:%.*]] = load float*, float** [[D]], +// CHECK-DAG: [[TMP45:%.*]] = bitcast float* [[TMP44]] to i8* +// CHECK-DAG: store i8* [[TMP45]], i8** [[TMP43:%[^,]+]], +// CHECK-DAG: [[TMP43]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP46:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 1 +// CHECK-DAG: store i64 4, i64* [[TMP46]], +// CHECK-DAG: [[TMP47:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT3:@.+]] to i8*), i8** [[TMP47]], +// CHECK-DAG: [[TMP48:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 3 +// CHECK-DAG: store i8* null, i8** [[TMP48]], +// CHECK-DAG: [[TMP49:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB3:@.+]] to i8*), i8** [[TMP49]], +// CHECK-DAG: [[TMP50:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 5 +// CHECK-DAG: [[TMP51:%.*]] = bitcast i32* [[TMP50]] to i8* +// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* [[TMP51]], i8 0, i64 4, i32 8, i1 false) +// CHECK-DAG: [[TMP53:%.*]] = bitcast float* [[VLA]] to i8* +// CHECK-DAG: store i8* [[TMP53]], i8** [[TMP52:%[^,]+]], +// CHECK-DAG: [[TMP52]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP54:%.*]] = mul nuw i64 [[TMP2]], 4 +// CHECK-DAG: [[TMP55:%.*]] = udiv exact i64 [[TMP54]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) +// CHECK-DAG: store i64 [[TMP54]], i64* [[TMP56:%[^,]+]], +// CHECK-DAG: [[TMP56]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 1 +// CHECK-DAG: [[TMP57:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT4:@.+]] to i8*), i8** [[TMP57]], +// CHECK-DAG: [[TMP58:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 3 +// CHECK-DAG: store i8* null, i8** [[TMP58]], +// CHECK-DAG: [[TMP59:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB4:@.+]] to i8*), i8** [[TMP59]], +// CHECK-DAG: [[TMP60:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 5 +// CHECK-DAG: store i32 1, i32* [[TMP60]], +// CHECK-DAG: [[DOTRD_INPUT_GEP_]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK-DAG: [[DOTRD_INPUT_GEP_4]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK-DAG: [[DOTRD_INPUT_GEP_7]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK-DAG: [[DOTRD_INPUT_GEP_8]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK: [[TMP61:%.*]] = bitcast [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]] to i8* +// CHECK: [[TMP62:%.*]] = call i8* @__kmpc_task_reduction_init(i32 [[TMP0]], i32 4, i8* [[TMP61]]) +// CHECK: [[TMP63:%.*]] = load i32, i32* [[N]], +// CHECK: store i32 [[TMP63]], i32* [[DOTCAPTURE_EXPR_]], +// CHECK: [[TMP64:%.*]] = load i32, i32* [[DOTCAPTURE_EXPR_]], +// CHECK: [[SUB:%.*]] = sub nsw i32 [[TMP64]], 0 +// CHECK: [[SUB10:%.*]] = sub nsw i32 [[SUB]], 1 +// CHECK: [[ADD11:%.*]] = add nsw i32 [[SUB10]], 1 +// CHECK: [[DIV:%.*]] = sdiv i32 [[ADD11]], 1 +// CHECK: [[SUB12:%.*]] = sub nsw i32 [[DIV]], 1 +// CHECK: store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]], +// CHECK: [[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%ident_t* %{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 72, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @{{.+}} to i32 (i32, i8*)*)) +// CHECK: call void @__kmpc_taskloop(%ident_t* %{{.+}}, i32 [[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) +// CHECK: call void @__kmpc_end_taskgroup(%ident_t* + +// CHECK: ret i32 + +// CHECK: define internal void [[RED_INIT1]](i8*) +// CHECK: store float 0.000000e+00, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB1]](i8*, i8*) +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_INIT2]](i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64( +// CHECK: ret void + +// CHECK: define internal void [[RED_FINI2]](i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: call void @ +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB2]](i8*, i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_INIT3]](i8*) +// CHECK: store float 0.000000e+00, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB3]](i8*, i8*) +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_INIT4]](i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: store float 0.000000e+00, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB4]](i8*, i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + diff --git a/test/OpenMP/taskloop_simd_codegen.cpp b/test/OpenMP/taskloop_simd_codegen.cpp index 48c6f479e9fa..f787689688e3 100644 --- a/test/OpenMP/taskloop_simd_codegen.cpp +++ b/test/OpenMP/taskloop_simd_codegen.cpp @@ -9,7 +9,7 @@ int main(int argc, char **argv) { // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%ident_t* [[DEFLOC:@.+]]) // CHECK: call void @__kmpc_taskgroup(%ident_t* [[DEFLOC]], i32 [[GTID]]) -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 33, i64 72, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK1:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 33, i64 80, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK1:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[DOWN:%.+]] = getelementptr inbounds [[TD_TY:%.+]], [[TD_TY]]* [[TASK_DATA]], i32 0, i32 5 @@ -24,7 +24,7 @@ int main(int argc, char **argv) { #pragma omp taskloop simd priority(argc) for (int i = 0; i < 10; ++i) ; -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 72, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK2:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 80, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[DOWN:%.+]] = getelementptr inbounds [[TD_TY:%.+]], [[TD_TY]]* [[TASK_DATA]], i32 0, i32 5 @@ -40,7 +40,7 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) ; // CHECK: call void @__kmpc_taskgroup(%ident_t* [[DEFLOC]], i32 [[GTID]]) -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 72, i64 24, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK3:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 80, i64 24, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK3:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[IF:%.+]] = icmp ne i32 %{{.+}}, 0 @@ -146,7 +146,7 @@ struct S { int a; S(int c) { // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%ident_t* [[DEFLOC:@.+]]) -// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 72, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK4:@.+]] to i32 (i32, i8*)*)) +// CHECK: [[TASKV:%.+]] = call i8* @__kmpc_omp_task_alloc(%ident_t* [[DEFLOC]], i32 [[GTID]], i32 1, i64 80, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[TDP_TY:%.+]]*)* [[TASK4:@.+]] to i32 (i32, i8*)*)) // CHECK: [[TASK:%.+]] = bitcast i8* [[TASKV]] to [[TDP_TY]]* // CHECK: [[TASK_DATA:%.+]] = getelementptr inbounds [[TDP_TY]], [[TDP_TY]]* [[TASK]], i32 0, i32 0 // CHECK: [[DOWN:%.+]] = getelementptr inbounds [[TD_TY:%.+]], [[TD_TY]]* [[TASK_DATA]], i32 0, i32 5 diff --git a/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp b/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp index 230ef980e64d..9e268d8a1739 100644 --- a/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp +++ b/test/OpenMP/taskloop_simd_firstprivate_codegen.cpp @@ -23,7 +23,7 @@ struct S { volatile double g; -// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32 } +// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32, i8* } // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double } // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [2 x [[S_DOUBLE_TY]]], [[S_DOUBLE_TY]], i32, [2 x i32] // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type {{.*}}{ [2 x i32]*, i32, {{.*}}[2 x [[S_DOUBLE_TY]]]*, [[S_DOUBLE_TY]]*, i{{[0-9]+}} @@ -57,7 +57,7 @@ int main() { // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[PRIVATES]], i{{.+}} 0, i{{.+}} 0 // LAMBDA: [[G_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 0 @@ -101,7 +101,7 @@ int main() { // BLOCKS: call void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[PRIVATES]], i{{.+}} 0, i{{.+}} 0 // BLOCKS: [[G_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 0 @@ -190,7 +190,7 @@ int main() { // [[KMP_TASK_T]] task_data; // [[KMP_TASK_MAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 112, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 120, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_MAIN_TY]]* // Fill kmp_task_t->shareds by copying from original capture argument. diff --git a/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp b/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp index 41f04f9bdb3c..8d5ebb216808 100644 --- a/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp +++ b/test/OpenMP/taskloop_simd_lastprivate_codegen.cpp @@ -23,7 +23,7 @@ struct S { volatile double g; -// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32 } +// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32, i8* } // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double } // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [2 x [[S_DOUBLE_TY]]], [[S_DOUBLE_TY]], i32, [2 x i32] // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { [2 x i32]*, i32*, [2 x [[S_DOUBLE_TY]]]*, [[S_DOUBLE_TY]]*, i{{[0-9]+}}* } @@ -57,7 +57,7 @@ int main() { // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // LAMBDA: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_MAIN_TY:%[^*]+]]*, [[KMP_TASK_MAIN_TY]]*, i32)* [[MAIN_DUP:@.+]] to i8*)) @@ -98,7 +98,7 @@ int main() { // BLOCKS: call void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // BLOCKS: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* bitcast (void ([[KMP_TASK_MAIN_TY:%[^*]+]]*, [[KMP_TASK_MAIN_TY]]*, i32)* [[MAIN_DUP:@.+]] to i8*)) // BLOCKS: ret @@ -182,7 +182,7 @@ int main() { // [[KMP_TASK_T]] task_data; // [[KMP_TASK_MAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 112, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 120, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_MAIN_TY]]* // Fill kmp_task_t->shareds by copying from original capture argument. diff --git a/test/OpenMP/taskloop_simd_private_codegen.cpp b/test/OpenMP/taskloop_simd_private_codegen.cpp index 493137ade65f..3833b5ea9fb3 100644 --- a/test/OpenMP/taskloop_simd_private_codegen.cpp +++ b/test/OpenMP/taskloop_simd_private_codegen.cpp @@ -23,7 +23,7 @@ struct S { volatile double g; -// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32 } +// CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, %union{{.+}}, %union{{.+}}, i64, i64, i64, i32, i8* } // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double } // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { i8 } // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [2 x [[S_DOUBLE_TY]]], [[S_DOUBLE_TY]], i32, [2 x i32] @@ -55,7 +55,7 @@ int main() { // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // LAMBDA: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) // LAMBDA: ret @@ -91,7 +91,7 @@ int main() { // BLOCKS: call void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 88, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 96, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // BLOCKS: call void @__kmpc_taskloop(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) // BLOCKS: ret @@ -157,7 +157,7 @@ int main() { // [[KMP_TASK_T_TY]] task_data; // [[KMP_TASK_MAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 112, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 9, i64 120, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_MAIN_TY]]* // CHECK: [[TASK:%.+]] = getelementptr inbounds [[KMP_TASK_MAIN_TY]], [[KMP_TASK_MAIN_TY]]* [[RES_KMP_TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 diff --git a/test/OpenMP/taskloop_simd_reduction_codegen.cpp b/test/OpenMP/taskloop_simd_reduction_codegen.cpp new file mode 100644 index 000000000000..b96c8d50a3ff --- /dev/null +++ b/test/OpenMP/taskloop_simd_reduction_codegen.cpp @@ -0,0 +1,197 @@ +// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu | FileCheck %s +// expected-no-diagnostics + +struct S { + float a; + S() : a(0.0f) {} + ~S() {} +}; + +#pragma omp declare reduction(+:S:omp_out.a += omp_in.a) initializer(omp_priv = omp_orig) + +float g; + +int a; +#pragma omp threadprivate(a) +int main (int argc, char *argv[]) +{ +int i, n; +float a[100], b[100], sum, e[argc + 100]; +S c[100]; +float &d = g; + +/* Some initializations */ +n = 100; +for (i=0; i < n; i++) + a[i] = b[i] = i * 1.0; +sum = 0.0; + +#pragma omp taskloop simd reduction(+:sum, c[:n], d, e) + for (i=0; i < n; i++) { + sum = sum + (a[i] * b[i]); + c[i].a = i*i; + d += i*i; + e[i] = i; + } + +} + +// CHECK-LABEL: @main( +// CHECK: [[RETVAL:%.*]] = alloca i32, +// CHECK: [[ARGC_ADDR:%.*]] = alloca i32, +// CHECK: [[ARGV_ADDR:%.*]] = alloca i8**, +// CHECK: [[I:%.*]] = alloca i32, +// CHECK: [[N:%.*]] = alloca i32, +// CHECK: [[A:%.*]] = alloca [100 x float], +// CHECK: [[B:%.*]] = alloca [100 x float], +// CHECK: [[SUM:%.*]] = alloca float, +// CHECK: [[SAVED_STACK:%.*]] = alloca i8*, +// CHECK: [[C:%.*]] = alloca [100 x %struct.S], +// CHECK: [[D:%.*]] = alloca float*, +// CHECK: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]], +// CHECK: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(%ident_t* +// CHECK: [[DOTRD_INPUT_:%.*]] = alloca [4 x %struct.kmp_task_red_input_t], +// CHECK: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, +// CHECK: [[DOTCAPTURE_EXPR_9:%.*]] = alloca i32, +// CHECK: store i32 0, i32* [[RETVAL]], +// CHECK: store i32 [[ARGC:%.*]], i32* [[ARGC_ADDR]], +// CHECK: store i8** [[ARGV:%.*]], i8*** [[ARGV_ADDR]], +// CHECK: [[TMP1:%.*]] = load i32, i32* [[ARGC_ADDR]], +// CHECK: [[ADD:%.*]] = add nsw i32 [[TMP1]], 100 +// CHECK: [[TMP2:%.*]] = zext i32 [[ADD]] to i64 +// CHECK: [[VLA:%.+]] = alloca float, i64 % + +// CHECK: call void @__kmpc_taskgroup(%ident_t* +// CHECK-DAG: [[TMP21:%.*]] = bitcast float* [[SUM]] to i8* +// CHECK-DAG: store i8* [[TMP21]], i8** [[TMP20:%[^,]+]], +// CHECK-DAG: [[TMP20]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T:%.+]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP22:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 1 +// CHECK-DAG: store i64 4, i64* [[TMP22]], +// CHECK-DAG: [[TMP23:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT1:@.+]] to i8*), i8** [[TMP23]], +// CHECK-DAG: [[TMP24:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 3 +// CHECK-DAG: store i8* null, i8** [[TMP24]], +// CHECK-DAG: [[TMP25:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB1:@.+]] to i8*), i8** [[TMP25]], +// CHECK-DAG: [[TMP26:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 5 +// CHECK-DAG: [[TMP27:%.*]] = bitcast i32* [[TMP26]] to i8* +// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* [[TMP27]], i8 0, i64 4, i32 8, i1 false) +// CHECK-DAG: [[ARRAYIDX5:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C]], i64 0, i64 0 +// CHECK-DAG: [[LB_ADD_LEN:%.*]] = add nsw i64 -1, % +// CHECK-DAG: [[ARRAYIDX6:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C]], i64 0, i64 [[LB_ADD_LEN]] +// CHECK-DAG: [[TMP31:%.*]] = bitcast %struct.S* [[ARRAYIDX5]] to i8* +// CHECK-DAG: store i8* [[TMP31]], i8** [[TMP28:%[^,]+]], +// CHECK-DAG: [[TMP28]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP32:%.*]] = ptrtoint %struct.S* [[ARRAYIDX6]] to i64 +// CHECK-DAG: [[TMP33:%.*]] = ptrtoint %struct.S* [[ARRAYIDX5]] to i64 +// CHECK-DAG: [[TMP34:%.*]] = sub i64 [[TMP32]], [[TMP33]] +// CHECK-DAG: [[TMP35:%.*]] = sdiv exact i64 [[TMP34]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) +// CHECK-DAG: [[TMP36:%.*]] = add nuw i64 [[TMP35]], 1 +// CHECK-DAG: [[TMP37:%.*]] = mul nuw i64 [[TMP36]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) +// CHECK-DAG: store i64 [[TMP37]], i64* [[TMP38:%[^,]+]], +// CHECK-DAG: [[TMP38]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 1 +// CHECK-DAG: [[TMP39:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT2:@.+]] to i8*), i8** [[TMP39]], +// CHECK-DAG: [[TMP40:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 3 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_FINI2:@.+]] to i8*), i8** [[TMP40]], +// CHECK-DAG: [[TMP41:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB2:@.+]] to i8*), i8** [[TMP41]], +// CHECK-DAG: [[TMP42:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 5 +// CHECK-DAG: store i32 1, i32* [[TMP42]], +// CHECK-DAG: [[TMP44:%.*]] = load float*, float** [[D]], +// CHECK-DAG: [[TMP45:%.*]] = bitcast float* [[TMP44]] to i8* +// CHECK-DAG: store i8* [[TMP45]], i8** [[TMP43:%[^,]+]], +// CHECK-DAG: [[TMP43]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP46:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 1 +// CHECK-DAG: store i64 4, i64* [[TMP46]], +// CHECK-DAG: [[TMP47:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT3:@.+]] to i8*), i8** [[TMP47]], +// CHECK-DAG: [[TMP48:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 3 +// CHECK-DAG: store i8* null, i8** [[TMP48]], +// CHECK-DAG: [[TMP49:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB3:@.+]] to i8*), i8** [[TMP49]], +// CHECK-DAG: [[TMP50:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 5 +// CHECK-DAG: [[TMP51:%.*]] = bitcast i32* [[TMP50]] to i8* +// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* [[TMP51]], i8 0, i64 4, i32 8, i1 false) +// CHECK-DAG: [[TMP53:%.*]] = bitcast float* [[VLA]] to i8* +// CHECK-DAG: store i8* [[TMP53]], i8** [[TMP52:%[^,]+]], +// CHECK-DAG: [[TMP52]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8:%.+]], i32 0, i32 0 +// CHECK-DAG: [[TMP54:%.*]] = mul nuw i64 [[TMP2]], 4 +// CHECK-DAG: [[TMP55:%.*]] = udiv exact i64 [[TMP54]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64) +// CHECK-DAG: store i64 [[TMP54]], i64* [[TMP56:%[^,]+]], +// CHECK-DAG: [[TMP56]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 1 +// CHECK-DAG: [[TMP57:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 2 +// CHECK-DAG: store i8* bitcast (void (i8*)* [[RED_INIT4:@.+]] to i8*), i8** [[TMP57]], +// CHECK-DAG: [[TMP58:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 3 +// CHECK-DAG: store i8* null, i8** [[TMP58]], +// CHECK-DAG: [[TMP59:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 4 +// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* [[RED_COMB4:@.+]] to i8*), i8** [[TMP59]], +// CHECK-DAG: [[TMP60:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 5 +// CHECK-DAG: store i32 1, i32* [[TMP60]], +// CHECK-DAG: [[DOTRD_INPUT_GEP_]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK-DAG: [[DOTRD_INPUT_GEP_4]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK-DAG: [[DOTRD_INPUT_GEP_7]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK-DAG: [[DOTRD_INPUT_GEP_8]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64 +// CHECK: [[TMP61:%.*]] = bitcast [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]] to i8* +// CHECK: [[TMP62:%.*]] = call i8* @__kmpc_task_reduction_init(i32 [[TMP0]], i32 4, i8* [[TMP61]]) +// CHECK: [[TMP63:%.*]] = load i32, i32* [[N]], +// CHECK: store i32 [[TMP63]], i32* [[DOTCAPTURE_EXPR_]], +// CHECK: [[TMP64:%.*]] = load i32, i32* [[DOTCAPTURE_EXPR_]], +// CHECK: [[SUB:%.*]] = sub nsw i32 [[TMP64]], 0 +// CHECK: [[SUB10:%.*]] = sub nsw i32 [[SUB]], 1 +// CHECK: [[ADD11:%.*]] = add nsw i32 [[SUB10]], 1 +// CHECK: [[DIV:%.*]] = sdiv i32 [[ADD11]], 1 +// CHECK: [[SUB12:%.*]] = sub nsw i32 [[DIV]], 1 +// CHECK: store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]], +// CHECK: [[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%ident_t* %{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 72, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @{{.+}} to i32 (i32, i8*)*)) +// CHECK: call void @__kmpc_taskloop(%ident_t* %{{.+}}, i32 [[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) +// CHECK: call void @__kmpc_end_taskgroup(%ident_t* + +// CHECK: ret i32 + +// CHECK: define internal void [[RED_INIT1]](i8*) +// CHECK: store float 0.000000e+00, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB1]](i8*, i8*) +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_INIT2]](i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64( +// CHECK: ret void + +// CHECK: define internal void [[RED_FINI2]](i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: call void @ +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB2]](i8*, i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_INIT3]](i8*) +// CHECK: store float 0.000000e+00, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB3]](i8*, i8*) +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_INIT4]](i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: store float 0.000000e+00, float* % +// CHECK: ret void + +// CHECK: define internal void [[RED_COMB4]](i8*, i8*) +// CHECK: call i8* @__kmpc_threadprivate_cached( +// CHECK: fadd float % +// CHECK: store float %{{.+}}, float* % +// CHECK: ret void + diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp index 74f4bb3268de..c796eded1f0d 100644 --- a/test/Parser/MicrosoftExtensions.cpp +++ b/test/Parser/MicrosoftExtensions.cpp @@ -261,9 +261,7 @@ int __identifier(else} = __identifier(for); // expected-error {{missing ')' afte #define identifier_weird(x) __identifier(x int k = identifier_weird(if)); // expected-error {{use of undeclared identifier 'if'}} -// This is a bit weird, but the alternative tokens aren't keywords, and this -// behavior matches MSVC. FIXME: Consider supporting this anyway. -extern int __identifier(and) r; // expected-error {{cannot convert '&&' token to an identifier}} +extern int __identifier(and); void f() { __identifier(() // expected-error {{cannot convert '(' token to an identifier}} diff --git a/test/Preprocessor/aarch64-target-features.c b/test/Preprocessor/aarch64-target-features.c index 721246aff3a7..836d29866efe 100644 --- a/test/Preprocessor/aarch64-target-features.c +++ b/test/Preprocessor/aarch64-target-features.c @@ -37,6 +37,7 @@ // CHECK-NOT: __ARM_PCS_VFP 1 // CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1 // CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2 +// CHECK-NOT: __ARM_FEATURE_SVE // RUN: %clang -target aarch64_be-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-BIGENDIAN // CHECK-BIGENDIAN: __ARM_BIG_ENDIAN 1 @@ -84,6 +85,10 @@ // CHECK-GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" // RUN: %clang -target aarch64 -mtune=cyclone -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MTUNE-CYCLONE %s + +// RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+sve -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE %s +// CHECK-SVE: __ARM_FEATURE_SVE 1 + // ================== Check whether -mtune accepts mixed-case features. // RUN: %clang -target aarch64 -mtune=CYCLONE -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MTUNE-CYCLONE %s // CHECK-MTUNE-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+zcm" "-target-feature" "+zcz" diff --git a/test/Preprocessor/cxx_oper_keyword.cpp b/test/Preprocessor/cxx_oper_keyword.cpp index 89a094d073ca..a66e8904973f 100644 --- a/test/Preprocessor/cxx_oper_keyword.cpp +++ b/test/Preprocessor/cxx_oper_keyword.cpp @@ -29,3 +29,15 @@ #ifdef and #warning and is defined #endif + +#ifdef OPERATOR_NAMES +//expected-error@+2 {{invalid token at start of a preprocessor expression}} +#endif +#if or +#endif + +#ifdef OPERATOR_NAMES +//expected-error@+2 {{invalid token at start of a preprocessor expression}} +#endif +#if and_eq +#endif diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 0ee7edecb3c4..5a77d06d2403 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -9,6 +9,15 @@ // BLOCKS:#define __block __attribute__((__blocks__(byref))) // // +// RUN: %clang_cc1 -x c++ -std=c++2a -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix CXX2A %s +// +// CXX2A:#define __GNUG__ {{.*}} +// CXX2A:#define __GXX_EXPERIMENTAL_CXX0X__ 1 +// CXX2A:#define __GXX_RTTI 1 +// CXX2A:#define __GXX_WEAK__ 1 +// CXX2A:#define __cplusplus 201707L +// CXX2A:#define __private_extern__ extern +// // RUN: %clang_cc1 -x c++ -std=c++1z -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix CXX1Z %s // // CXX1Z:#define __GNUG__ {{.*}} @@ -110,6 +119,13 @@ // RUN: %clang_cc1 -ffreestanding -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix FREESTANDING %s // FREESTANDING:#define __STDC_HOSTED__ 0 // +// RUN: %clang_cc1 -x c++ -std=gnu++2a -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GXX2A %s +// +// GXX2A:#define __GNUG__ {{.*}} +// GXX2A:#define __GXX_WEAK__ 1 +// GXX2A:#define __cplusplus 201707L +// GXX2A:#define __private_extern__ extern +// // // RUN: %clang_cc1 -x c++ -std=gnu++1z -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GXX1Z %s // diff --git a/test/Preprocessor/predefined-arch-macros.c b/test/Preprocessor/predefined-arch-macros.c index da4c5d03574b..8976f9e8fb27 100644 --- a/test/Preprocessor/predefined-arch-macros.c +++ b/test/Preprocessor/predefined-arch-macros.c @@ -2237,6 +2237,25 @@ // CHECK_SYSTEMZ_ARCH11: #define __s390x__ 1 // CHECK_SYSTEMZ_ARCH11: #define __zarch__ 1 // +// RUN: %clang -march=arch12 -E -dM %s -o - 2>&1 \ +// RUN: -target s390x-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_ARCH12 +// RUN: %clang -march=z14 -E -dM %s -o - 2>&1 \ +// RUN: -target s390x-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_ARCH12 +// +// CHECK_SYSTEMZ_ARCH12: #define __ARCH__ 12 +// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +// CHECK_SYSTEMZ_ARCH12: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +// CHECK_SYSTEMZ_ARCH12: #define __HTM__ 1 +// CHECK_SYSTEMZ_ARCH12: #define __LONG_DOUBLE_128__ 1 +// CHECK_SYSTEMZ_ARCH12: #define __VX__ 1 +// CHECK_SYSTEMZ_ARCH12: #define __s390__ 1 +// CHECK_SYSTEMZ_ARCH12: #define __s390x__ 1 +// CHECK_SYSTEMZ_ARCH12: #define __zarch__ 1 +// // RUN: %clang -mhtm -E -dM %s -o - 2>&1 \ // RUN: -target s390x-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_HTM @@ -2256,7 +2275,7 @@ // RUN: -target s390x-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SYSTEMZ_ZVECTOR // -// CHECK_SYSTEMZ_ZVECTOR: #define __VEC__ 10301 +// CHECK_SYSTEMZ_ZVECTOR: #define __VEC__ 10302 // Begin amdgcn tests ---------------- // diff --git a/test/Sema/tls.c b/test/Sema/tls.c index a3fdc8ea5132..6d10363305ff 100644 --- a/test/Sema/tls.c +++ b/test/Sema/tls.c @@ -12,9 +12,9 @@ // RUN: %clang_cc1 -triple x86_64-pc-win32 -fsyntax-only %s // RUN: %clang_cc1 -triple i386-pc-win32 -fsyntax-only %s -// OpenBSD does not suppport TLS. -// RUN: not %clang_cc1 -triple x86_64-pc-openbsd -fsyntax-only %s -// RUN: not %clang_cc1 -triple i386-pc-openbsd -fsyntax-only %s +// OpenBSD suppports TLS. +// RUN: %clang_cc1 -triple x86_64-pc-openbsd -fsyntax-only %s +// RUN: %clang_cc1 -triple i386-pc-openbsd -fsyntax-only %s // Haiku does not suppport TLS. // RUN: not %clang_cc1 -triple i586-pc-haiku -fsyntax-only %s diff --git a/test/Sema/varargs-aarch64.c b/test/Sema/varargs-aarch64.c new file mode 100644 index 000000000000..145c82105610 --- /dev/null +++ b/test/Sema/varargs-aarch64.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -triple aarch64-linux-gnu + +void f1(int a, ...) { + __builtin_ms_va_list ap; + __builtin_ms_va_start(ap, a); // expected-error {{'__builtin_ms_va_start' used in System V ABI function}} +} + +void __attribute__((ms_abi)) f2(int a, ...) { + __builtin_va_list ap; + __builtin_va_start(ap, a); // expected-error {{'va_start' used in Win64 ABI function}} +} diff --git a/test/Sema/varargs-x86-32.c b/test/Sema/varargs-x86-32.c index 6f57022ffcbf..0359e65892f0 100644 --- a/test/Sema/varargs-x86-32.c +++ b/test/Sema/varargs-x86-32.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -triple i386-apple-darwin9 void foo(int a, ...) { - __builtin_ms_va_start((void *)0, a); // expected-error {{this builtin is only available on x86-64 targets}} + __builtin_ms_va_start((void *)0, a); // expected-error {{this builtin is only available on x86-64 and aarch64 targets}} } diff --git a/test/Sema/zvector2.c b/test/Sema/zvector2.c new file mode 100644 index 000000000000..0adc0315f0b8 --- /dev/null +++ b/test/Sema/zvector2.c @@ -0,0 +1,211 @@ +// RUN: %clang_cc1 -triple s390x-linux-gnu -fzvector -target-cpu z14 \ +// RUN: -fno-lax-vector-conversions -W -Wall -Wconversion \ +// RUN: -Werror -fsyntax-only -verify %s + +vector signed char sc, sc2; +vector unsigned char uc, uc2; +vector bool char bc, bc2; + +vector signed short ss, ss2; +vector unsigned short us, us2; +vector bool short bs, bs2; + +vector signed int si, si2; +vector unsigned int ui, ui2; +vector bool int bi, bi2; + +vector signed long long sl, sl2; +vector unsigned long long ul, ul2; +vector bool long long bl, bl2; + +vector double fd, fd2; + +vector float ff, ff2; + +void foo(void) +{ + // ------------------------------------------------------------------------- + // Test assignment. + // ------------------------------------------------------------------------- + + ff = ff2; + + sc = ff2; // expected-error {{incompatible type}} + ff = sc2; // expected-error {{incompatible type}} + + uc = ff2; // expected-error {{incompatible type}} + ff = uc2; // expected-error {{incompatible type}} + + bc = ff2; // expected-error {{incompatible type}} + ff = bc2; // expected-error {{incompatible type}} + + fd = ff2; // expected-error {{incompatible type}} + ff = fd2; // expected-error {{incompatible type}} + + // ------------------------------------------------------------------------- + // Test casts to same element width. + // ------------------------------------------------------------------------- + + ui = (vector unsigned int)ff2; + ff = (vector float)si2; + + // ------------------------------------------------------------------------- + // Test casts to different element width. + // ------------------------------------------------------------------------- + + uc = (vector unsigned char)ff2; + us = (vector unsigned short)ff2; + ul = (vector unsigned long long)ff2; + + ff = (vector float)sc2; + ff = (vector float)ss2; + ff = (vector float)sl2; + + // ------------------------------------------------------------------------- + // Test unary operators. + // ------------------------------------------------------------------------- + + ++ff2; + ff++; + + --ff2; + ff--; + + ff = +ff2; + + ff = -ff2; + + ff = ~ff2; // expected-error {{invalid argument}} + + // ------------------------------------------------------------------------- + // Test binary arithmetic operators. + // ------------------------------------------------------------------------- + + ff = ff + ff2; + ff = ff + ui2; // expected-error {{cannot convert}} + ff = si + ff2; // expected-error {{cannot convert}} + ff = fd + ff2; // expected-error {{cannot convert}} + ff += ff2; + ff += fd2; // expected-error {{cannot convert}} + sc += ff2; // expected-error {{cannot convert}} + + ff = ff - ff2; + ff = ff - ui2; // expected-error {{cannot convert}} + ff = si - ff2; // expected-error {{cannot convert}} + ff = fd - ff2; // expected-error {{cannot convert}} + ff -= ff2; + ff -= fd2; // expected-error {{cannot convert}} + sc -= ff2; // expected-error {{cannot convert}} + + ff = ff * ff2; + ff = ff * ui2; // expected-error {{cannot convert}} + ff = si * ff2; // expected-error {{cannot convert}} + ff = fd * ff2; // expected-error {{cannot convert}} + ff *= ff2; + ff *= fd2; // expected-error {{cannot convert}} + sc *= ff2; // expected-error {{cannot convert}} + + ff = ff / ff2; + ff = ff / ui2; // expected-error {{cannot convert}} + ff = si / ff2; // expected-error {{cannot convert}} + ff = fd / ff2; // expected-error {{cannot convert}} + ff /= ff2; + ff /= fd2; // expected-error {{cannot convert}} + sc /= ff2; // expected-error {{cannot convert}} + + ff = ff % ff2; // expected-error {{invalid operands}} + ff = ff % ui2; // expected-error {{invalid operands}} + ff = si % ff2; // expected-error {{invalid operands}} + ff = fd % ff2; // expected-error {{invalid operands}} + ff %= ff2; // expected-error {{invalid operands}} + ff %= fd2; // expected-error {{invalid operands}} + sc %= ff2; // expected-error {{invalid operands}} + + // ------------------------------------------------------------------------- + // Test bitwise binary operators. + // ------------------------------------------------------------------------- + + ff = ff & ff2; // expected-error {{invalid operands}} + ff = bi & ff2; // expected-error {{invalid operands}} + ff = fd & ff2; // expected-error {{invalid operands}} + ff = ff & bi2; // expected-error {{invalid operands}} + ff = ff & si2; // expected-error {{invalid operands}} + ff = ff & ui2; // expected-error {{invalid operands}} + sc &= ff2; // expected-error {{invalid operands}} + ff &= bc2; // expected-error {{invalid operands}} + ff &= fd2; // expected-error {{invalid operands}} + + ff = ff | ff2; // expected-error {{invalid operands}} + ff = bi | ff2; // expected-error {{invalid operands}} + ff = fd | ff2; // expected-error {{invalid operands}} + ff = ff | bi2; // expected-error {{invalid operands}} + ff = ff | si2; // expected-error {{invalid operands}} + ff = ff | ui2; // expected-error {{invalid operands}} + sc |= ff2; // expected-error {{invalid operands}} + ff |= bc2; // expected-error {{invalid operands}} + ff |= fd2; // expected-error {{invalid operands}} + + ff = ff ^ ff2; // expected-error {{invalid operands}} + ff = bi ^ ff2; // expected-error {{invalid operands}} + ff = fd ^ ff2; // expected-error {{invalid operands}} + ff = ff ^ bi2; // expected-error {{invalid operands}} + ff = ff ^ si2; // expected-error {{invalid operands}} + ff = ff ^ ui2; // expected-error {{invalid operands}} + sc ^= ff2; // expected-error {{invalid operands}} + ff ^= bc2; // expected-error {{invalid operands}} + ff ^= fd2; // expected-error {{invalid operands}} + + // ------------------------------------------------------------------------- + // Test shift operators. + // ------------------------------------------------------------------------- + + ff = ff << ff2; // expected-error {{integer is required}} + ff = ff << fd2; // expected-error {{integer is required}} + ff = ff << ui2; // expected-error {{integer is required}} + ff = sl << ff2; // expected-error {{integer is required}} + sc <<= ff2; // expected-error {{integer is required}} + ff <<= ff2; // expected-error {{integer is required}} + fd <<= ff2; // expected-error {{integer is required}} + + ff = ff >> ff2; // expected-error {{integer is required}} + ff = ff >> fd2; // expected-error {{integer is required}} + ff = ff >> ui2; // expected-error {{integer is required}} + ff = sl >> ff2; // expected-error {{integer is required}} + sc >>= ff2; // expected-error {{integer is required}} + ff >>= ff2; // expected-error {{integer is required}} + fd >>= ff2; // expected-error {{integer is required}} + + // ------------------------------------------------------------------------- + // Test comparison operators. + // ------------------------------------------------------------------------- + + (void)(ff == ff2); + (void)(ff == fd2); // expected-error {{cannot convert}} + (void)(ff == ui2); // expected-error {{cannot convert}} + (void)(ui == ff2); // expected-error {{cannot convert}} + + (void)(ff != ff2); + (void)(ff != fd2); // expected-error {{cannot convert}} + (void)(ff != ui2); // expected-error {{cannot convert}} + (void)(ui != ff2); // expected-error {{cannot convert}} + + (void)(ff <= ff2); + (void)(ff <= fd2); // expected-error {{cannot convert}} + (void)(ff <= ui2); // expected-error {{cannot convert}} + (void)(ui <= ff2); // expected-error {{cannot convert}} + + (void)(ff >= ff2); + (void)(ff >= fd2); // expected-error {{cannot convert}} + (void)(ff >= ui2); // expected-error {{cannot convert}} + (void)(ui >= ff2); // expected-error {{cannot convert}} + + (void)(ff < ff2); + (void)(ff < fd2); // expected-error {{cannot convert}} + (void)(ff < ui2); // expected-error {{cannot convert}} + (void)(ui < ff2); // expected-error {{cannot convert}} + + (void)(ff > ff2); + (void)(ff > fd2); // expected-error {{cannot convert}} + (void)(ff > ui2); // expected-error {{cannot convert}} + (void)(ui > ff2); // expected-error {{cannot convert}} +} diff --git a/test/SemaCXX/attr-x86-no_caller_saved_registers.cpp b/test/SemaCXX/attr-x86-no_caller_saved_registers.cpp index 48ccdec251af..ec69e986144f 100644 --- a/test/SemaCXX/attr-x86-no_caller_saved_registers.cpp +++ b/test/SemaCXX/attr-x86-no_caller_saved_registers.cpp @@ -24,7 +24,7 @@ void foo6(){} // expected-note {{previous declaration is here}} void __attribute__((no_caller_saved_registers)) foo6(); // expected-error {{function declared with 'no_caller_saved_registers' attribute was previously declared without the 'no_caller_saved_registers' attribute}} int main(int argc, char **argv) { - void (*fp)(int *) = foo; // expected-error {{cannot initialize a variable of type 'void (*)(int *)' with an lvalue of type 'void (int *)__attribute__((no_caller_saved_registers))'}} + void (*fp)(int *) = foo; // expected-error {{cannot initialize a variable of type 'void (*)(int *)' with an lvalue of type 'void (int *) __attribute__((no_caller_saved_registers))'}} a::foo(&argc); foo3 func = foo2; func(&argc); diff --git a/test/SemaCXX/cxx1z-noexcept-function-type.cpp b/test/SemaCXX/cxx1z-noexcept-function-type.cpp index 524ea8e53c10..6578eb89b0ba 100644 --- a/test/SemaCXX/cxx1z-noexcept-function-type.cpp +++ b/test/SemaCXX/cxx1z-noexcept-function-type.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions %s // RUN: %clang_cc1 -std=c++1z -verify -fexceptions -fcxx-exceptions %s -Wno-dynamic-exception-spec // RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions -Wno-c++1z-compat-mangling -DNO_COMPAT_MANGLING %s +// RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions -Wno-noexcept-type -DNO_COMPAT_MANGLING %s #if __cplusplus > 201402L diff --git a/test/SemaObjC/arc-property-decl-attrs.m b/test/SemaObjC/arc-property-decl-attrs.m index 6c96ba481c4a..ee48d310edc0 100644 --- a/test/SemaObjC/arc-property-decl-attrs.m +++ b/test/SemaObjC/arc-property-decl-attrs.m @@ -121,3 +121,107 @@ __attribute__((objc_root_class)) @implementation I2 @synthesize prop; @end + +// rdar://31579994 +// Verify that the all of the property declarations in inherited protocols are +// compatible when synthesing a property from a protocol. + +@protocol CopyVsAssign1 +@property (copy, nonatomic, readonly) id prop; // expected-error {{property with attribute 'copy' was selected for synthesis}} +@end +@protocol CopyVsAssign2 +@property (assign, nonatomic, readonly) id prop; // expected-note {{it could also be property without attribute 'copy' declared here}} +@end + +@interface CopyVsAssign: Foo <CopyVsAssign1, CopyVsAssign2> +@end +@implementation CopyVsAssign +@synthesize prop; // expected-note {{property synthesized here}} +@end + +@protocol RetainVsNonRetain1 +@property (readonly) id prop; // expected-error {{property without attribute 'retain (or strong)' was selected for synthesis}} +@end +@protocol RetainVsNonRetain2 +@property (retain, readonly) id prop; // expected-note {{it could also be property with attribute 'retain (or strong)' declared here}} +@end + +@interface RetainVsNonRetain: Foo <RetainVsNonRetain1, RetainVsNonRetain2> +@end +@implementation RetainVsNonRetain +@synthesize prop; // expected-note {{property synthesized here}} +@end + +@protocol AtomicVsNonatomic1 +@property (copy, nonatomic, readonly) id prop; // expected-error {{property without attribute 'atomic' was selected for synthesis}} +@end +@protocol AtomicVsNonatomic2 +@property (copy, atomic, readonly) id prop; // expected-note {{it could also be property with attribute 'atomic' declared here}} +@end + +@interface AtomicVsNonAtomic: Foo <AtomicVsNonatomic1, AtomicVsNonatomic2> +@end +@implementation AtomicVsNonAtomic +@synthesize prop; // expected-note {{property synthesized here}} +@end + +@protocol Getter1 +@property (copy, readonly) id prop; // expected-error {{property with getter 'prop' was selected for synthesis}} +@end +@protocol Getter2 +@property (copy, getter=x, readonly) id prop; // expected-note {{it could also be property with getter 'x' declared here}} +@end + +@interface GetterVsGetter: Foo <Getter1, Getter2> +@end +@implementation GetterVsGetter +@synthesize prop; // expected-note {{property synthesized here}} +@end + +@protocol Setter1 +@property (copy, readonly) id prop; +@end +@protocol Setter2 +@property (copy, setter=setp:, readwrite) id prop; // expected-error {{property with setter 'setp:' was selected for synthesis}} +@end +@protocol Setter3 +@property (copy, readwrite) id prop; // expected-note {{it could also be property with setter 'setProp:' declared here}} +@end + +@interface SetterVsSetter: Foo <Setter1, Setter2, Setter3> +@end +@implementation SetterVsSetter +@synthesize prop; // expected-note {{property synthesized here}} +@end + +@protocol TypeVsAttribute1 +@property (assign, atomic, readonly) int prop; // expected-error {{property of type 'int' was selected for synthesis}} +@end +@protocol TypeVsAttribute2 +@property (assign, atomic, readonly) id prop; // expected-note {{it could also be property of type 'id' declared here}} +@end +@protocol TypeVsAttribute3 +@property (copy, readonly) id prop; // expected-note {{it could also be property with attribute 'copy' declared here}} +@end + +@interface TypeVsAttribute: Foo <TypeVsAttribute1, TypeVsAttribute2, TypeVsAttribute3> +@end +@implementation TypeVsAttribute +@synthesize prop; // expected-note {{property synthesized here}} +@end + +@protocol TypeVsSetter1 +@property (assign, nonatomic, readonly) int prop; // expected-note {{it could also be property of type 'int' declared here}} +@end +@protocol TypeVsSetter2 +@property (assign, nonatomic, readonly) id prop; // ok +@end +@protocol TypeVsSetter3 +@property (assign, nonatomic, readwrite) id prop; // expected-error {{property of type 'id' was selected for synthesis}} +@end + +@interface TypeVsSetter: Foo <TypeVsSetter1, TypeVsSetter2, TypeVsSetter3> +@end +@implementation TypeVsSetter +@synthesize prop; // expected-note {{property synthesized here}} +@end diff --git a/test/SemaObjC/attr-ns_returns_retained.m b/test/SemaObjC/attr-ns_returns_retained.m new file mode 100644 index 000000000000..83397a6556cc --- /dev/null +++ b/test/SemaObjC/attr-ns_returns_retained.m @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -verify %s + +// rdar://20130079 + +#if __has_feature(objc_arc) +__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)(); // expected-note {{previous definition is here}} +id (^invalidBlockRedecl)(); //expected-error {{redefinition of 'invalidBlockRedecl' with a different type: 'id (^__strong)()' vs 'id ((^__strong))() __attribute__((ns_returns_retained))'}} +#else +__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)(); +id (^invalidBlockRedecl)(); +#endif + +typedef __attribute__((ns_returns_retained)) id (^blockType)(); + +typedef __attribute__((ns_returns_retained)) int (^invalidBlockType)(); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}} + +__attribute__((ns_returns_retained)) int functionDecl(); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}} diff --git a/test/SemaObjC/property-ambiguous-synthesis.m b/test/SemaObjC/property-ambiguous-synthesis.m index 98f59450744c..5c652fa472e7 100644 --- a/test/SemaObjC/property-ambiguous-synthesis.m +++ b/test/SemaObjC/property-ambiguous-synthesis.m @@ -2,7 +2,7 @@ // rdar://13075400 @protocol FooAsID -@property (copy) id foo; // expected-note 2 {{it could also be property of type 'id' declared here}} \\ +@property (assign) id foo; // expected-note 2 {{it could also be property of type 'id' declared here}} \\ // expected-warning {{property of type 'id' was selected for synthesis}} @end diff --git a/test/SemaObjC/warn-deprecated-implementations.m b/test/SemaObjC/warn-deprecated-implementations.m index df2557b9cd52..440b2886f01d 100644 --- a/test/SemaObjC/warn-deprecated-implementations.m +++ b/test/SemaObjC/warn-deprecated-implementations.m @@ -1,9 +1,11 @@ -// RUN: %clang_cc1 -fsyntax-only -Wdeprecated-implementations -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -triple=x86_64-apple-macos10.10 -fsyntax-only -Wdeprecated-implementations -verify -Wno-objc-root-class %s // rdar://8973810 // rdar://12717705 @protocol P - (void) D __attribute__((deprecated)); // expected-note {{method 'D' declared here}} + +- (void) unavailable __attribute__((__unavailable__)); // expected-note {{method 'unavailable' declared here}} @end @interface A <P> @@ -16,8 +18,10 @@ @implementation A + (void)F { } // No warning, implementing its own deprecated method -- (void) D {} // expected-warning {{Implementing deprecated method}} +- (void) D {} // expected-warning {{implementing deprecated method}} - (void) E {} // No warning, implementing deprecated method in its class extension. + +- (void) unavailable { } // expected-warning {{implementing unavailable metho}} @end @interface A(CAT) @@ -32,10 +36,10 @@ __attribute__((deprecated)) // expected-note {{'CL' has been explicitly marked d @interface CL // expected-note 2 {{class declared here}} @end -@implementation CL // expected-warning {{Implementing deprecated class}} +@implementation CL // expected-warning {{implementing deprecated class}} @end -@implementation CL (SomeCategory) // expected-warning {{Implementing deprecated category}} +@implementation CL (SomeCategory) // expected-warning {{implementing deprecated category}} @end @interface CL_SUB : CL // expected-warning {{'CL' is deprecated}} @@ -43,13 +47,16 @@ __attribute__((deprecated)) // expected-note {{'CL' has been explicitly marked d @interface BASE - (void) B __attribute__((deprecated)); // expected-note {{method 'B' declared here}} + ++ (void) unavailable __attribute__((availability(macos, unavailable))); // expected-note {{method 'unavailable' declared here}} @end @interface SUB : BASE @end @implementation SUB -- (void) B {} // expected-warning {{Implementing deprecated method}} +- (void) B {} // expected-warning {{implementing deprecated method}} ++ (void) unavailable { } // expected-warning {{implementing unavailable method}} @end @interface Test @@ -69,5 +76,5 @@ __attribute__((deprecated)) @interface Test(DeprecatedCategory) // expected-note {{category declared here}} @end -@implementation Test(DeprecatedCategory) // expected-warning {{Implementing deprecated category}} +@implementation Test(DeprecatedCategory) // expected-warning {{implementing deprecated category}} @end |