Debian Codegraph @

llvm/test/CodeGen/SPIRV/transcoding/OpDot.ll

raw
1 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
5 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
6
7 ; CHECK-SPIRV-DAG: %[[#TyFloat:]] = OpTypeFloat 32
8 ; CHECK-SPIRV-DAG: %[[#TyHalf:]] = OpTypeFloat 16
9
10 ;; The OpDot operands must be vectors; check that translating dot with
11 ;; scalar arguments does not result in OpDot.
12 ; CHECK-SPIRV-LABEL: %[[#]] = OpFunction %[[#]] None %[[#]]
13 ; CHECK-SPIRV: %[[#]] = OpFMul %[[#]] %[[#]] %[[#]]
14 ; CHECK-SPIRV-NOT: %[[#]] = OpDot %[[#]] %[[#]] %[[#]]
15 ; CHECK-SPIRV: OpFunctionEnd
16
17 define spir_kernel void @testScalar(float %f, ptr addrspace(1) %out) {
18 entry:
19 %call = tail call spir_func float @_Z3dotff(float %f, float %f)
20 store float %call, ptr addrspace(1) %out
21 ret void
22 }
23
24 ;; The OpDot operands must be vectors; check that translating dot with
25 ;; vector arguments results in OpDot.
26 ; CHECK-SPIRV-LABEL: %[[#]] = OpFunction %[[#]] None %[[#]]
27 ; CHECK-SPIRV: %[[#]] = OpDot %[[#TyFloat]] %[[#]] %[[#]]
28 ; CHECK-SPIRV: %[[#]] = OpDot %[[#TyFloat]] %[[#]] %[[#]]
29 ; CHECK-SPIRV: %[[#]] = OpDot %[[#TyHalf]] %[[#]] %[[#]]
30 ; CHECK-SPIRV: OpFunctionEnd
31
32 define spir_kernel void @testVector(<2 x float> %f, <2 x half> %h, ptr addrspace(1) %out, ptr addrspace(1) %outh) {
33 entry:
34 %call = tail call spir_func float @_Z3dotDv2_fS_(<2 x float> %f, <2 x float> %f)
35 store float %call, ptr addrspace(1) %out
36 %call2 = tail call spir_func float @__spirv_Dot(<2 x float> %f, <2 x float> %f)
37 store float %call2, ptr addrspace(1) %out
38 %call3 = tail call spir_func half @_Z11__spirv_DotDv2_DF16_S_(<2 x half> %h, <2 x half> %h)
39 store half %call3, ptr addrspace(1) %outh
40 ret void
41 }
42
43 declare spir_func float @_Z3dotff(float, float)
44
45 declare spir_func float @_Z3dotDv2_fS_(<2 x float>, <2 x float>)
46 declare spir_func float @__spirv_Dot(<2 x float>, <2 x float>)
47 declare spir_func half @_Z11__spirv_DotDv2_DF16_S_(<2 x half>, <2 x half>)