Skip to content

Commit bd92b86

Browse files
committed
add vector tests for log10 and log
1 parent 8665e4e commit bd92b86

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

llvm/test/CodeGen/DirectX/log-vec.ll

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
; RUN: opt -S -dxil-intrinsic-expansion < %s | FileCheck %s
2+
3+
; Make sure dxil operation function calls for log are generated for float and half.
4+
5+
; CHECK-LABEL: log_float4
6+
; CHECK: call <4 x float> @llvm.log2.v4f32(<4 x float> %{{.*}})
7+
; CHECK: fmul <4 x float> <float 0x3FE62E4300000000, float 0x3FE62E4300000000, float 0x3FE62E4300000000, float 0x3FE62E4300000000>, %{{.*}}
8+
define noundef <4 x float> @log_float4(<4 x float> noundef %p0) {
9+
entry:
10+
%p0.addr = alloca <4 x float>, align 16
11+
store <4 x float> %p0, ptr %p0.addr, align 16
12+
%0 = load <4 x float>, ptr %p0.addr, align 16
13+
%elt.log = call <4 x float> @llvm.log.v4f32(<4 x float> %0)
14+
ret <4 x float> %elt.log
15+
}
16+
17+
; CHECK-LABEL: log10_float4
18+
; CHECK: call <4 x float> @llvm.log2.v4f32(<4 x float> %{{.*}})
19+
; CHECK: fmul <4 x float> <float 0x3FD3441340000000, float 0x3FD3441340000000, float 0x3FD3441340000000, float 0x3FD3441340000000>, %{{.*}}
20+
define noundef <4 x float> @log10_float4(<4 x float> noundef %p0) {
21+
entry:
22+
%p0.addr = alloca <4 x float>, align 16
23+
store <4 x float> %p0, ptr %p0.addr, align 16
24+
%0 = load <4 x float>, ptr %p0.addr, align 16
25+
%elt.log10 = call <4 x float> @llvm.log10.v4f32(<4 x float> %0)
26+
ret <4 x float> %elt.log10
27+
}
28+
29+
declare <4 x float> @llvm.log.v4f32(<4 x float>)
30+
declare <4 x float> @llvm.log10.v4f32(<4 x float>)

0 commit comments

Comments
 (0)