Debian Codegraph @

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/cross.ll

raw
1 ; RUN: llc -O0 -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}
3
4 ; Make sure SPIRV operation function calls for cross are lowered correctly.
5
6 ; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450"
7 ; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32
8 ; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16
9 ; CHECK-DAG: %[[#vec3_float_16:]] = OpTypeVector %[[#float_16]] 3
10 ; CHECK-DAG: %[[#vec3_float_32:]] = OpTypeVector %[[#float_32]] 3
11
12 define noundef <3 x half> @cross_half4(<3 x half> noundef %a, <3 x half> noundef %b) {
13 entry:
14 ; CHECK: %[[#]] = OpFunction %[[#vec3_float_16]] None %[[#]]
15 ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec3_float_16]]
16 ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#vec3_float_16]]
17 ; CHECK: %[[#]] = OpExtInst %[[#vec3_float_16]] %[[#op_ext_glsl]] Cross %[[#arg0]] %[[#arg1]]
18 %hlsl.cross = call <3 x half> @llvm.spv.cross.v3f16(<3 x half> %a, <3 x half> %b)
19 ret <3 x half> %hlsl.cross
20 }
21
22 define noundef <3 x float> @cross_float4(<3 x float> noundef %a, <3 x float> noundef %b) {
23 entry:
24 ; CHECK: %[[#]] = OpFunction %[[#vec3_float_32]] None %[[#]]
25 ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec3_float_32]]
26 ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#vec3_float_32]]
27 ; CHECK: %[[#]] = OpExtInst %[[#vec3_float_32]] %[[#op_ext_glsl]] Cross %[[#arg0]] %[[#arg1]]
28 %hlsl.cross = call <3 x float> @llvm.spv.cross.v3f32(<3 x float> %a, <3 x float> %b)
29 ret <3 x float> %hlsl.cross
30 }
31
32 declare <3 x half> @llvm.spv.cross.v3f16(<3 x half>, <3 x half>)
33 declare <3 x float> @llvm.spv.cross.v3f32(<3 x float>, <3 x float>)