brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · e41dea3 Raw
113 lines · cpp
1// RUN: %clang_cc1 -triple spir64 -fsycl-is-device -verify -fsyntax-only %s2// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsycl-is-device -fsyntax-only %s3 4typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));5typedef __float128 BIGTY;6 7template <class T>8class Z {9public:10  // expected-note@+1 {{'field' defined here}}11  T field;12  // expected-note@+1 2{{'field1' defined here}}13  __float128 field1;14  using BIGTYPE = __float128;15  // expected-note@+1 {{'bigfield' defined here}}16  BIGTYPE bigfield;17};18 19void host_ok(void) {20  __float128 A;21  int B = sizeof(__float128);22  Z<__float128> C;23  C.field1 = A;24}25 26long double ld_func(long double arg);27 28void usage() {29  // expected-note@+1 3{{'A' defined here}}30  __float128 A;31  Z<__float128> C;32  // expected-error@+3 2{{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}33  // expected-error@+2 {{'A' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}34  // expected-error@+1 {{'field1' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}35  C.field1 = A;36  // expected-error@+2 {{expression requires 128 bit size 'BIGTYPE' (aka '__float128') type support, but target 'spir64' does not support it}}37  // expected-error@+1 {{'bigfield' requires 128 bit size 'BIGTYPE' (aka '__float128') type support, but target 'spir64' does not support it}}38  C.bigfield += 1.0;39 40  // expected-error@+1 {{'A' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}41  auto foo1 = [=]() {42    __float128 AA;43    // expected-note@+2 {{'BB' defined here}}44    // expected-error@+1 {{'A' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}45    auto BB = A;46    // expected-error@+2 {{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}47    // expected-error@+1 {{'BB' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}48    BB += 1;49 50    float F1 = 0.1f;51    float F2 = 0.1f;52    // expected-error@+1 3{{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}53    float F3 = ((__float128)F1 * (__float128)F2) / 2.0f;54 55    // assume that long double is supported56    float F4 = ld_func(F3);57  };58 59  // expected-note@+1 {{called by 'usage'}}60  foo1();61}62 63template <typename t>64void foo2(){};65 66// expected-note@+3 {{'P' defined here}}67// expected-error@+2 {{'P' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}68// expected-note@+1 2{{'foo' defined here}}69__float128 foo(__float128 P) { return P; }70 71template <typename Name, typename Func>72__attribute__((sycl_kernel)) void kernel(Func kernelFunc) {73  // expected-note@+1 5{{called by 'kernel}}74  kernelFunc();75}76 77int main() {78  // expected-note@+1 {{'CapturedToDevice' defined here}}79  __float128 CapturedToDevice = 1;80  host_ok();81  kernel<class variables>([=]() {82    decltype(CapturedToDevice) D;83    // expected-error@+1 {{'CapturedToDevice' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}84    auto C = CapturedToDevice;85    Z<__float128> S;86    // expected-error@+2 {{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}87    // expected-error@+1 {{'field1' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}88    S.field1 += 1;89    // expected-error@+2 {{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}90    // expected-error@+1 {{'field' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}91    S.field = 1;92  });93 94  kernel<class functions>([=]() {95    // expected-note@+1 2{{called by 'operator()'}}96    usage();97    // expected-note@+1 {{'BBBB' defined here}}98    BIGTY BBBB;99    // expected-note@+3 {{called by 'operator()'}}100    // expected-error@+2 {{'BBBB' requires 128 bit size 'BIGTY' (aka '__float128') type support, but target 'spir64' does not support it}}101    // expected-error@+1 2{{'foo' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}102    auto A = foo(BBBB);103  });104 105  kernel<class ok>([=]() {106    Z<__float128> S;107    foo2<__float128>();108    auto A = sizeof(CapturedToDevice);109  });110 111  return 0;112}113