xref: /llvm-project/llvm/test/CodeGen/DirectX/log-vec.ll (revision 381156c130553179fe3499403cf530deb73f1a3f)
15cf1e2e2SFarzon Lotfi; RUN: opt -S  -dxil-intrinsic-expansion  < %s | FileCheck %s
25cf1e2e2SFarzon Lotfi
35cf1e2e2SFarzon Lotfi; Make sure dxil operation function calls for log are generated for float and half.
45cf1e2e2SFarzon Lotfi
55cf1e2e2SFarzon Lotfi; CHECK-LABEL: log_float4
65cf1e2e2SFarzon Lotfi; CHECK: call <4 x float> @llvm.log2.v4f32(<4 x float>  %{{.*}})
7*381156c1STex Riddell; CHECK: fmul <4 x float> splat (float 0x3FE62E4300000000),  %{{.*}}
85cf1e2e2SFarzon Lotfidefine noundef <4 x float> @log_float4(<4 x float> noundef %p0) {
95cf1e2e2SFarzon Lotfientry:
105cf1e2e2SFarzon Lotfi  %p0.addr = alloca <4 x float>, align 16
115cf1e2e2SFarzon Lotfi  store <4 x float> %p0, ptr %p0.addr, align 16
125cf1e2e2SFarzon Lotfi  %0 = load <4 x float>, ptr %p0.addr, align 16
135cf1e2e2SFarzon Lotfi  %elt.log = call <4 x float> @llvm.log.v4f32(<4 x float> %0)
145cf1e2e2SFarzon Lotfi  ret <4 x float> %elt.log
155cf1e2e2SFarzon Lotfi}
165cf1e2e2SFarzon Lotfi
175cf1e2e2SFarzon Lotfi; CHECK-LABEL: log10_float4
185cf1e2e2SFarzon Lotfi; CHECK: call <4 x float> @llvm.log2.v4f32(<4 x float>  %{{.*}})
19*381156c1STex Riddell; CHECK: fmul <4 x float> splat (float 0x3FD3441340000000),  %{{.*}}
205cf1e2e2SFarzon Lotfidefine noundef <4 x float> @log10_float4(<4 x float> noundef %p0) {
215cf1e2e2SFarzon Lotfientry:
225cf1e2e2SFarzon Lotfi  %p0.addr = alloca <4 x float>, align 16
235cf1e2e2SFarzon Lotfi  store <4 x float> %p0, ptr %p0.addr, align 16
245cf1e2e2SFarzon Lotfi  %0 = load <4 x float>, ptr %p0.addr, align 16
255cf1e2e2SFarzon Lotfi  %elt.log10 = call <4 x float> @llvm.log10.v4f32(<4 x float> %0)
265cf1e2e2SFarzon Lotfi  ret <4 x float> %elt.log10
275cf1e2e2SFarzon Lotfi}
285cf1e2e2SFarzon Lotfi
295cf1e2e2SFarzon Lotfideclare <4 x float> @llvm.log.v4f32(<4 x float>)
305cf1e2e2SFarzon Lotfideclare <4 x float> @llvm.log10.v4f32(<4 x float>)
31