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