Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/OpenCL.std/printf.spvasm

raw
1 ; REQUIRES: spirv-as
2 ; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
3 ; RUN: spirv-val %t.spv
4 ; RUN: llvm-spirv %t.spv -r -emit-opaque-pointers --spirv-target-env=SPV-IR -o %t.rev.bc
5 ; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SPV-IR
6 ; RUN: llvm-spirv %t.rev.bc -o - -spirv-text | FileCheck %s --check-prefix=CHECK-SPV-BACK
7 ; RUN: llvm-spirv %t.spv -r -emit-opaque-pointers --spirv-target-env=CL2.0 -o - | llvm-dis | FileCheck %s --check-prefixes=CHECK,CHECK-CL20
8
9 ; CHECK-LABEL: spir_kernel void @test
10
11 ; CHECK-SPV-IR: call spir_func i32 @_Z18__spirv_ocl_printfPU3AS2c(ptr addrspace(2) {{.*}})
12 ; CHECK-SPV-IR: call spir_func i32 @_Z18__spirv_ocl_printfPU3AS2ci(ptr addrspace(2) {{.*}}, i32 1)
13
14 ; CHECK-SPV-IR: declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS2c(ptr addrspace(2))
15 ; CHECK-SPV-IR: declare spir_func i32 @_Z18__spirv_ocl_printfPU3AS2ci(ptr addrspace(2), i32)
16
17 ; CHECK-CL20: call spir_func i32 (ptr addrspace(2), ...) @printf(ptr addrspace(2) {{.*}})
18 ; CHECK-CL20: call spir_func i32 (ptr addrspace(2), ...) @printf(ptr addrspace(2) {{.*}}, i32 1)
19
20 ; CHECK-CL20: declare spir_func i32 @printf(ptr addrspace(2), ...)
21
22 ; CHECK-SPV-BACK: ExtInstImport [[Set:[0-9]+]] "OpenCL.std"
23 ; CHECK-SPV-BACK-DAG: TypeInt [[Int8:[0-9]+]] 8
24 ; CHECK-SPV-BACK-DAG: TypeInt [[Int32:[0-9]+]] 32
25 ; CHECK-SPV-BACK: Constant [[Int32]] [[One:[0-9]+]] 1{{[[:space:]]}}
26 ; CHECK-SPV-BACK: TypePointer [[Int8PtrTy:[0-9]+]] 0 [[Int8]]{{[[:space:]]}}
27 ; CHECK-SPV-BACK: InBoundsPtrAccessChain [[Int8PtrTy]] [[Int8Ptr:[0-9]+]]
28 ; CHECK-SPV-BACK: ExtInst [[Int32]] {{[0-9]+}} [[Set]] printf [[Int8Ptr]]
29 ; CHECK-SPV-BACK: InBoundsPtrAccessChain [[Int8PtrTy]] [[Int8Ptr2:[0-9]+]]
30 ; CHECK-SPV-BACK: ExtInst [[Int32]] {{[0-9]+}} [[Set]] printf [[Int8Ptr2]] [[One]]
31
32 OpCapability Addresses
33 OpCapability Kernel
34 OpCapability Int8
35 %1 = OpExtInstImport "OpenCL.std"
36 OpMemoryModel Physical32 OpenCL
37 OpEntryPoint Kernel %26 "test"
38 %35 = OpString "kernel_arg_type.test."
39 OpSource OpenCL_C 200000
40 OpDecorate %_str Constant
41 OpDecorate %_str_1 Constant
42 OpDecorate %_str Alignment 1
43 OpDecorate %_str_1 Alignment 1
44 %uchar = OpTypeInt 8 0
45 %uint = OpTypeInt 32 0
46 %uchar_84 = OpConstant %uchar 84
47 %uchar_101 = OpConstant %uchar 101
48 %uchar_115 = OpConstant %uchar 115
49 %uchar_116 = OpConstant %uchar 116
50 %uchar_10 = OpConstant %uchar 10
51 %uchar_0 = OpConstant %uchar 0
52 %uint_6 = OpConstant %uint 6
53 %uchar_58 = OpConstant %uchar 58
54 %uchar_32 = OpConstant %uchar 32
55 %uchar_37 = OpConstant %uchar 37
56 %uchar_100 = OpConstant %uchar 100
57 %uint_10 = OpConstant %uint 10
58 %uint_0 = OpConstant %uint 0
59 %uint_1 = OpConstant %uint 1
60 %_arr_uchar_uint_6 = OpTypeArray %uchar %uint_6
61 %_ptr_UniformConstant__arr_uchar_uint_6 = OpTypePointer UniformConstant %_arr_uchar_uint_6
62 %_arr_uchar_uint_10 = OpTypeArray %uchar %uint_10
63 %_ptr_UniformConstant__arr_uchar_uint_10 = OpTypePointer UniformConstant %_arr_uchar_uint_10
64 %void = OpTypeVoid
65 %25 = OpTypeFunction %void
66 %_ptr_UniformConstant_uchar = OpTypePointer UniformConstant %uchar
67 %12 = OpConstantComposite %_arr_uchar_uint_6 %uchar_84 %uchar_101 %uchar_115 %uchar_116 %uchar_10 %uchar_0
68 %_str = OpVariable %_ptr_UniformConstant__arr_uchar_uint_6 UniformConstant %12
69 %21 = OpConstantComposite %_arr_uchar_uint_10 %uchar_84 %uchar_101 %uchar_115 %uchar_116 %uchar_58 %uchar_32 %uchar_37 %uchar_100 %uchar_10 %uchar_0
70 %_str_1 = OpVariable %_ptr_UniformConstant__arr_uchar_uint_10 UniformConstant %21
71 %26 = OpFunction %void None %25
72 %entry = OpLabel
73 %30 = OpInBoundsPtrAccessChain %_ptr_UniformConstant_uchar %_str %uint_0 %uint_0
74 %call = OpExtInst %uint %1 printf %30
75 %32 = OpInBoundsPtrAccessChain %_ptr_UniformConstant_uchar %_str_1 %uint_0 %uint_0
76 %call1 = OpExtInst %uint %1 printf %32 %uint_1
77 OpReturn
78 OpFunctionEnd