brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · f9e92a7 Raw
32 lines · plain
1// RUN: %clang_cc1 %s -triple "spirv32-unknown-unknown" -fno-delete-null-pointer-checks -verify -emit-llvm -o - | FileCheck %s -check-prefix=SPIRV322// RUN: %clang_cc1 %s -triple "spirv64-unknown-unknown" -fno-delete-null-pointer-checks -verify -emit-llvm -o - | FileCheck %s -check-prefix=SPIRV643 4// SPIRV32: target triple = "spirv32-unknown-unknown"5// SPIRV64: target triple = "spirv64-unknown-unknown"6 7typedef struct {8  char c;9  void *v;10  void *v2;11} my_st;12 13kernel void foo(global long *arg) {14#if __SPIRV32__ == 115  int res1[sizeof(my_st)  == 12 ? 1 : -1]; // expected-no-diagnostics16  int res2[sizeof(void *) ==  4 ? 1 : -1]; // expected-no-diagnostics17  int res3[sizeof(arg)    ==  4 ? 1 : -1]; // expected-no-diagnostics18#elif __SPIRV64__ == 119  int res1[sizeof(my_st)  == 24 ? 1 : -1]; // expected-no-diagnostics20  int res2[sizeof(void *) ==  8 ? 1 : -1]; // expected-no-diagnostics21  int res3[sizeof(arg)    ==  8 ? 1 : -1]; // expected-no-diagnostics22#endif23  my_st *tmp = 0;24 25  // SPIRV32: store i64 4, ptr addrspace(1)26  // SPIRV64: store i64 8, ptr addrspace(1)27  arg[0] = (long)(&tmp->v);28  // SPIRV32: store i64 8, ptr addrspace(1)29  // SPIRV64: store i64 16, ptr addrspace(1)30  arg[1] = (long)(&tmp->v2);31}32