xref: /llvm-project/llvm/test/CodeGen/SPIRV/hlsl-intrinsics/log10.ll (revision cf3d6fded9eaf1372ccfde1d49dd91df6762d98c)
1; RUN: llc -O0 -verify-machineinstrs -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 %}
3
4; CHECK: %[[#extinst:]] = OpExtInstImport "GLSL.std.450"
5
6; CHECK: %[[#float:]] = OpTypeFloat 32
7; CHECK: %[[#v4float:]] = OpTypeVector %[[#float]] 4
8; CHECK: %[[#float_0_30103001:]] = OpConstant %[[#float]] 0.30103000998497009
9
10define void @main(float %f, <4 x float> %f4) {
11entry:
12; CHECK-DAG: %[[#f:]] = OpFunctionParameter %[[#float]]
13; CHECK-DAG: %[[#f4:]] = OpFunctionParameter %[[#v4float]]
14  %logf = alloca float, align 4
15  %logf4 = alloca <4 x float>, align 16
16
17
18; CHECK: %[[#log2:]] = OpExtInst %[[#float]] %[[#extinst]] Log2 %[[#f]]
19; CHECK: %[[#res:]] = OpFMul %[[#float]] %[[#log2]] %[[#float_0_30103001]]
20  %elt.log10 = call float @llvm.log10.f32(float %f)
21
22; CHECK: %[[#log2:]] = OpExtInst %[[#v4float]] %[[#extinst]] Log2 %[[#f4]]
23; CHECK: %[[#res:]] = OpVectorTimesScalar %[[#v4float]] %[[#log2]] %[[#float_0_30103001]]
24  %elt.log101 = call <4 x float> @llvm.log10.v4f32(<4 x float> %f4)
25
26  ret void
27}
28
29declare float @llvm.log10.f32(float)
30declare <4 x float> @llvm.log10.v4f32(<4 x float>)
31