1 ; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; CHECK: %[[#extinst:]] = OpExtInstImport "GLSL.std.450"
6 ; CHECK: %[[#float:]] = OpTypeFloat 32
7 ; CHECK: %[[#v4float:]] = OpTypeVector %[[#float]] 4
8 ; CHECK: %[[#float_0_30103001:]] = OpConstant %[[#float]] 0.30103000998497009
9 ; CHECK: %[[#_ptr_Function_v4float:]] = OpTypePointer Function %[[#v4float]]
10 ; CHECK: %[[#_ptr_Function_float:]] = OpTypePointer Function %[[#float]]
14 ; CHECK: %[[#f:]] = OpVariable %[[#_ptr_Function_float]] Function
15 ; CHECK: %[[#logf:]] = OpVariable %[[#_ptr_Function_float]] Function
16 ; CHECK: %[[#f4:]] = OpVariable %[[#_ptr_Function_v4float]] Function
17 ; CHECK: %[[#logf4:]] = OpVariable %[[#_ptr_Function_v4float]] Function
18 %f = alloca float, align 4
19 %logf = alloca float, align 4
20 %f4 = alloca <4 x float>, align 16
21 %logf4 = alloca <4 x float>, align 16
23 ; CHECK: %[[#load:]] = OpLoad %[[#float]] %[[#f]] Aligned 4
24 ; CHECK: %[[#log2:]] = OpExtInst %[[#float]] %[[#extinst]] Log2 %[[#load]]
25 ; CHECK: %[[#res:]] = OpFMul %[[#float]] %[[#log2]] %[[#float_0_30103001]]
26 ; CHECK: OpStore %[[#logf]] %[[#res]] Aligned 4
27 %0 = load float, ptr %f, align 4
28 %elt.log10 = call float @llvm.log10.f32(float %0)
29 store float %elt.log10, ptr %logf, align 4
31 ; CHECK: %[[#load:]] = OpLoad %[[#v4float]] %[[#f4]] Aligned 16
32 ; CHECK: %[[#log2:]] = OpExtInst %[[#v4float]] %[[#extinst]] Log2 %[[#load]]
33 ; CHECK: %[[#res:]] = OpVectorTimesScalar %[[#v4float]] %[[#log2]] %[[#float_0_30103001]]
34 ; CHECK: OpStore %[[#logf4]] %[[#res]] Aligned 16
35 %1 = load <4 x float>, ptr %f4, align 16
36 %elt.log101 = call <4 x float> @llvm.log10.v4f32(<4 x float> %1)
37 store <4 x float> %elt.log101, ptr %logf4, align 16
42 declare float @llvm.log10.f32(float)
43 declare <4 x float> @llvm.log10.v4f32(<4 x float>)