1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOEXT
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s --spirv-ext=+SPV_INTEL_arbitrary_precision_integers -o - | FileCheck %s --check-prefixes=CHECK,CHECK-EXT
6 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOEXT
7 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
9 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s --spirv-ext=+SPV_INTEL_arbitrary_precision_integers -o - | FileCheck %s --check-prefixes=CHECK,CHECK-EXT
11 ; CHECK-DAG: OpName %[[#Struct:]] "struct"
12 ; CHECK-DAG: OpName %[[#Arg:]] "arg"
13 ; CHECK-DAG: OpName %[[#QArg:]] "qarg"
14 ; CHECK-DAG: OpName %[[#R:]] "r"
15 ; CHECK-DAG: OpName %[[#Q:]] "q"
16 ; CHECK-DAG: OpName %[[#Tr:]] "tr"
17 ; CHECK-DAG: OpName %[[#Tq:]] "tq"
18 ; CHECK-DAG: %[[#Struct]] = OpTypeStruct %[[#]] %[[#]] %[[#]]
19 ; CHECK-DAG: %[[#PtrStruct:]] = OpTypePointer CrossWorkgroup %[[#Struct]]
20 ; CHECK-EXT-DAG: %[[#Int40:]] = OpTypeInt 40 0
21 ; CHECK-EXT-DAG: %[[#Int50:]] = OpTypeInt 50 0
22 ; CHECK-NOEXT-DAG: %[[#Int40:]] = OpTypeInt 64 0
23 ; CHECK-DAG: %[[#PtrInt40:]] = OpTypePointer CrossWorkgroup %[[#Int40]]
27 ; CHECK-EXT: %[[#Tr]] = OpUConvert %[[#Int40]] %[[#R]]
28 ; CHECK-EXT: %[[#Store:]] = OpInBoundsPtrAccessChain %[[#PtrStruct]] %[[#Arg]] %[[#]]
29 ; CHECK-EXT: %[[#StoreAsInt40:]] = OpBitcast %[[#PtrInt40]] %[[#Store]]
30 ; CHECK-EXT: OpStore %[[#StoreAsInt40]] %[[#Tr]]
32 ; CHECK-NOEXT: %[[#Store:]] = OpInBoundsPtrAccessChain %[[#PtrStruct]] %[[#Arg]] %[[#]]
33 ; CHECK-NOEXT: %[[#StoreAsInt40:]] = OpBitcast %[[#PtrInt40]] %[[#Store]]
34 ; CHECK-NOEXT: OpStore %[[#StoreAsInt40]] %[[#R]]
38 ; CHECK-EXT: %[[#Tq]] = OpUConvert %[[#Int40]] %[[#Q]]
39 ; CHECK-EXT: OpStore %[[#QArg]] %[[#Tq]]
41 ; CHECK-NOEXT: OpStore %[[#QArg]] %[[#Q]]
43 %struct = type <{ i32, i8, [3 x i8] }>
45 define spir_kernel void @foo(ptr addrspace(1) %arg, i64 %r) {
46 %tr = trunc i64 %r to i40
47 %addr = getelementptr inbounds %struct, ptr addrspace(1) %arg, i64 0
48 store i40 %tr, ptr addrspace(1) %addr
52 define spir_kernel void @bar(ptr addrspace(1) %qarg, i50 %q) {
53 %tq = trunc i50 %q to i40
54 store i40 %tq, ptr addrspace(1) %qarg