Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeGenOpenCL/spirv_target.cl @ 236:c4bab56944e8 llvm-original
LLVM 16
author | kono |
---|---|
date | Wed, 09 Nov 2022 17:45:10 +0900 |
parents | |
children | 1f2b6ac9f198 |
comparison
equal
deleted
inserted
replaced
232:70dce7da266c | 236:c4bab56944e8 |
---|---|
1 // RUN: %clang_cc1 -no-opaque-pointers %s -triple "spirv32-unknown-unknown" -verify -emit-llvm -o - | FileCheck %s -check-prefix=SPIRV32 | |
2 // RUN: %clang_cc1 -no-opaque-pointers %s -triple "spirv64-unknown-unknown" -verify -emit-llvm -o - | FileCheck %s -check-prefix=SPIRV64 | |
3 | |
4 // SPIRV32: target triple = "spirv32-unknown-unknown" | |
5 // SPIRV64: target triple = "spirv64-unknown-unknown" | |
6 | |
7 typedef struct { | |
8 char c; | |
9 void *v; | |
10 void *v2; | |
11 } my_st; | |
12 | |
13 kernel void foo(global long *arg) { | |
14 #if __SPIRV32__ == 1 | |
15 int res1[sizeof(my_st) == 12 ? 1 : -1]; // expected-no-diagnostics | |
16 int res2[sizeof(void *) == 4 ? 1 : -1]; // expected-no-diagnostics | |
17 int res3[sizeof(arg) == 4 ? 1 : -1]; // expected-no-diagnostics | |
18 #elif __SPIRV64__ == 1 | |
19 int res1[sizeof(my_st) == 24 ? 1 : -1]; // expected-no-diagnostics | |
20 int res2[sizeof(void *) == 8 ? 1 : -1]; // expected-no-diagnostics | |
21 int res3[sizeof(arg) == 8 ? 1 : -1]; // expected-no-diagnostics | |
22 #endif | |
23 my_st *tmp = 0; | |
24 | |
25 // SPIRV32: store i64 4, i64 addrspace(1)* | |
26 // SPIRV64: store i64 8, i64 addrspace(1)* | |
27 arg[0] = (long)(&tmp->v); | |
28 // SPIRV32: store i64 8, i64 addrspace(1)* | |
29 // SPIRV64: store i64 16, i64 addrspace(1)* | |
30 arg[1] = (long)(&tmp->v2); | |
31 } |