xref: /llvm-project/llvm/test/CodeGen/DirectX/log2.ll (revision 011b618644113996e2c0a8e57db40f89d20878e3)
1; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
2
3; Make sure dxil operation function calls for log2 are generated for float and half.
4
5define noundef float @log2_float(float noundef %a) #0 {
6entry:
7; CHECK:call float @dx.op.unary.f32(i32 23, float %{{.*}}) #[[#ATTR:]]
8  %elt.log2 = call float @llvm.log2.f32(float %a)
9  ret float %elt.log2
10}
11
12define noundef half @log2_half(half noundef %a) #0 {
13entry:
14; CHECK:call half @dx.op.unary.f16(i32 23, half %{{.*}}) #[[#ATTR]]
15  %elt.log2 = call half @llvm.log2.f16(half %a)
16  ret half %elt.log2
17}
18
19; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
20
21declare half @llvm.log2.f16(half)
22declare float @llvm.log2.f32(float)
23