xref: /llvm-project/llvm/test/CodeGen/DirectX/log2.ll (revision 011b618644113996e2c0a8e57db40f89d20878e3)
1cdfd884bSS. Bharadwaj Yadavalli; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
25cf1e2e2SFarzon Lotfi
35cf1e2e2SFarzon Lotfi; Make sure dxil operation function calls for log2 are generated for float and half.
45cf1e2e2SFarzon Lotfi
55cf1e2e2SFarzon Lotfidefine noundef float @log2_float(float noundef %a) #0 {
65cf1e2e2SFarzon Lotfientry:
7*011b6186SFinn Plummer; CHECK:call float @dx.op.unary.f32(i32 23, float %{{.*}}) #[[#ATTR:]]
85cf1e2e2SFarzon Lotfi  %elt.log2 = call float @llvm.log2.f32(float %a)
95cf1e2e2SFarzon Lotfi  ret float %elt.log2
105cf1e2e2SFarzon Lotfi}
115cf1e2e2SFarzon Lotfi
125cf1e2e2SFarzon Lotfidefine noundef half @log2_half(half noundef %a) #0 {
135cf1e2e2SFarzon Lotfientry:
14*011b6186SFinn Plummer; CHECK:call half @dx.op.unary.f16(i32 23, half %{{.*}}) #[[#ATTR]]
155cf1e2e2SFarzon Lotfi  %elt.log2 = call half @llvm.log2.f16(half %a)
165cf1e2e2SFarzon Lotfi  ret half %elt.log2
175cf1e2e2SFarzon Lotfi}
185cf1e2e2SFarzon Lotfi
19*011b6186SFinn Plummer; CHECK: attributes #[[#ATTR]] = {{{.*}} memory(none) {{.*}}}
20*011b6186SFinn Plummer
215cf1e2e2SFarzon Lotfideclare half @llvm.log2.f16(half)
225cf1e2e2SFarzon Lotfideclare float @llvm.log2.f32(float)
23