|
| 1 | +; REQUIRES: spirv-as |
| 2 | +; RUN: spirv-as --target-env spv1.0 -o %t.spv %s |
| 3 | +; RUN: llvm-spirv %t.spv -r --spirv-target-env=SPV-IR -o - | llvm-dis | FileCheck %s --check-prefixes=CHECK,CHECK-SPV-IR |
| 4 | +; RUN: llvm-spirv %t.spv -r --spirv-target-env=CL2.0 -o - | llvm-dis | FileCheck %s --check-prefixes=CHECK,CHECK-CL20 |
| 5 | +; |
| 6 | +; CHECK-LABEL: spir_kernel void @test |
| 7 | +; CHECK-SPV-IR: call spir_func float @_Z16__spirv_ocl_acosf(float |
| 8 | +; CHECK-SPV-IR: call spir_func double @_Z16__spirv_ocl_acosd(double |
| 9 | +; CHECK-CL20: call spir_func float @_Z4acosf(float |
| 10 | +; CHECK-CL20: call spir_func double @_Z4acosd(double |
| 11 | +; CHECK-LABEL: spir_kernel void @test2 |
| 12 | +; CHECK-SPV-IR: call spir_func <4 x float> @_Z16__spirv_ocl_acosDv4_f(<4 x float> |
| 13 | +; CHECK-SPV-IR: call spir_func <4 x double> @_Z16__spirv_ocl_acosDv4_d(<4 x double> |
| 14 | +; CHECK-CL20: call spir_func <4 x float> @_Z4acosDv4_f(<4 x float> |
| 15 | +; CHECK-CL20: call spir_func <4 x double> @_Z4acosDv4_d(<4 x double> |
| 16 | + |
| 17 | + OpCapability Addresses |
| 18 | + OpCapability Kernel |
| 19 | + OpCapability Float64 |
| 20 | + %1 = OpExtInstImport "OpenCL.std" |
| 21 | + OpMemoryModel Physical32 OpenCL |
| 22 | + OpEntryPoint Kernel %8 "test" |
| 23 | + OpEntryPoint Kernel %21 "test2" |
| 24 | + %29 = OpString "kernel_arg_type.test.float,double,float*,double*," |
| 25 | + %30 = OpString "kernel_arg_type.test2.float4,double4,float4*,double4*," |
| 26 | + OpSource OpenCL_C 200000 |
| 27 | + OpName %arg1 "arg1" |
| 28 | + OpName %arg2 "arg2" |
| 29 | + OpName %output1 "output1" |
| 30 | + OpName %output2 "output2" |
| 31 | + OpName %entry "entry" |
| 32 | + OpName %call "call" |
| 33 | + OpName %call1 "call1" |
| 34 | + OpName %arg1_0 "arg1" |
| 35 | + OpName %arg2_0 "arg2" |
| 36 | + OpName %output1_0 "output1" |
| 37 | + OpName %output2_0 "output2" |
| 38 | + OpName %entry_0 "entry" |
| 39 | + OpName %call_0 "call" |
| 40 | + OpName %call1_0 "call1" |
| 41 | + OpDecorate %output1 FuncParamAttr NoCapture |
| 42 | + OpDecorate %output2 FuncParamAttr NoCapture |
| 43 | + OpDecorate %output1_0 FuncParamAttr NoCapture |
| 44 | + OpDecorate %output2_0 FuncParamAttr NoCapture |
| 45 | + %void = OpTypeVoid |
| 46 | + %float = OpTypeFloat 32 |
| 47 | + %double = OpTypeFloat 64 |
| 48 | +%_ptr_CrossWorkgroup_float = OpTypePointer CrossWorkgroup %float |
| 49 | +%_ptr_CrossWorkgroup_double = OpTypePointer CrossWorkgroup %double |
| 50 | + %7 = OpTypeFunction %void %float %double %_ptr_CrossWorkgroup_float %_ptr_CrossWorkgroup_double |
| 51 | + %v4float = OpTypeVector %float 4 |
| 52 | + %v4double = OpTypeVector %double 4 |
| 53 | +%_ptr_CrossWorkgroup_v4float = OpTypePointer CrossWorkgroup %v4float |
| 54 | +%_ptr_CrossWorkgroup_v4double = OpTypePointer CrossWorkgroup %v4double |
| 55 | + %20 = OpTypeFunction %void %v4float %v4double %_ptr_CrossWorkgroup_v4float %_ptr_CrossWorkgroup_v4double |
| 56 | + %8 = OpFunction %void None %7 |
| 57 | + %arg1 = OpFunctionParameter %float |
| 58 | + %arg2 = OpFunctionParameter %double |
| 59 | + %output1 = OpFunctionParameter %_ptr_CrossWorkgroup_float |
| 60 | + %output2 = OpFunctionParameter %_ptr_CrossWorkgroup_double |
| 61 | + %entry = OpLabel |
| 62 | + %call = OpExtInst %float %1 acos %arg1 |
| 63 | + OpStore %output1 %call Aligned 4 |
| 64 | + %call1 = OpExtInst %double %1 acos %arg2 |
| 65 | + OpStore %output2 %call1 Aligned 8 |
| 66 | + OpReturn |
| 67 | + OpFunctionEnd |
| 68 | + %21 = OpFunction %void None %20 |
| 69 | + %arg1_0 = OpFunctionParameter %v4float |
| 70 | + %arg2_0 = OpFunctionParameter %v4double |
| 71 | + %output1_0 = OpFunctionParameter %_ptr_CrossWorkgroup_v4float |
| 72 | + %output2_0 = OpFunctionParameter %_ptr_CrossWorkgroup_v4double |
| 73 | + %entry_0 = OpLabel |
| 74 | + %call_0 = OpExtInst %v4float %1 acos %arg1_0 |
| 75 | + OpStore %output1_0 %call_0 Aligned 16 |
| 76 | + %call1_0 = OpExtInst %v4double %1 acos %arg2_0 |
| 77 | + OpStore %output2_0 %call1_0 Aligned 32 |
| 78 | + OpReturn |
| 79 | + OpFunctionEnd |
0 commit comments