Skip to content

Commit 201a461

Browse files
authored
AArch64: Add baseline test for treating exp as known positive (#167603)
1 parent 4d772de commit 201a461

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

llvm/test/CodeGen/AArch64/frem-power2.ll

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,96 @@ entry:
8585
ret float %fmod
8686
}
8787

88+
define float @frem2_exp(float %x) #0 {
89+
; CHECK-SD-LABEL: frem2_exp:
90+
; CHECK-SD: // %bb.0: // %entry
91+
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
92+
; CHECK-SD-NEXT: bl expf
93+
; CHECK-SD-NEXT: fmov s1, #0.50000000
94+
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
95+
; CHECK-SD-NEXT: fmov s2, #-2.00000000
96+
; CHECK-SD-NEXT: fmul s1, s0, s1
97+
; CHECK-SD-NEXT: frintz s1, s1
98+
; CHECK-SD-NEXT: fmadd s1, s1, s2, s0
99+
; CHECK-SD-NEXT: mvni v2.4s, #128, lsl #24
100+
; CHECK-SD-NEXT: bit v0.16b, v1.16b, v2.16b
101+
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 killed $q0
102+
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
103+
; CHECK-SD-NEXT: ret
104+
;
105+
; CHECK-GI-LABEL: frem2_exp:
106+
; CHECK-GI: // %bb.0: // %entry
107+
; CHECK-GI-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
108+
; CHECK-GI-NEXT: bl expf
109+
; CHECK-GI-NEXT: fmov s1, #2.00000000
110+
; CHECK-GI-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
111+
; CHECK-GI-NEXT: b fmodf
112+
entry:
113+
%a = tail call float @llvm.exp.f32(float %x)
114+
%fmod = frem float %a, 2.0
115+
ret float %fmod
116+
}
117+
118+
define float @frem2_exp2(float %x) #0 {
119+
; CHECK-SD-LABEL: frem2_exp2:
120+
; CHECK-SD: // %bb.0: // %entry
121+
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
122+
; CHECK-SD-NEXT: bl exp2f
123+
; CHECK-SD-NEXT: fmov s1, #0.50000000
124+
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
125+
; CHECK-SD-NEXT: fmov s2, #-2.00000000
126+
; CHECK-SD-NEXT: fmul s1, s0, s1
127+
; CHECK-SD-NEXT: frintz s1, s1
128+
; CHECK-SD-NEXT: fmadd s1, s1, s2, s0
129+
; CHECK-SD-NEXT: mvni v2.4s, #128, lsl #24
130+
; CHECK-SD-NEXT: bit v0.16b, v1.16b, v2.16b
131+
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 killed $q0
132+
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
133+
; CHECK-SD-NEXT: ret
134+
;
135+
; CHECK-GI-LABEL: frem2_exp2:
136+
; CHECK-GI: // %bb.0: // %entry
137+
; CHECK-GI-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
138+
; CHECK-GI-NEXT: bl exp2f
139+
; CHECK-GI-NEXT: fmov s1, #2.00000000
140+
; CHECK-GI-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
141+
; CHECK-GI-NEXT: b fmodf
142+
entry:
143+
%a = tail call float @llvm.exp2.f32(float %x)
144+
%fmod = frem float %a, 2.0
145+
ret float %fmod
146+
}
147+
148+
define float @frem2_exp10(float %x) #0 {
149+
; CHECK-SD-LABEL: frem2_exp10:
150+
; CHECK-SD: // %bb.0: // %entry
151+
; CHECK-SD-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
152+
; CHECK-SD-NEXT: bl exp10f
153+
; CHECK-SD-NEXT: fmov s1, #0.50000000
154+
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 def $q0
155+
; CHECK-SD-NEXT: fmov s2, #-2.00000000
156+
; CHECK-SD-NEXT: fmul s1, s0, s1
157+
; CHECK-SD-NEXT: frintz s1, s1
158+
; CHECK-SD-NEXT: fmadd s1, s1, s2, s0
159+
; CHECK-SD-NEXT: mvni v2.4s, #128, lsl #24
160+
; CHECK-SD-NEXT: bit v0.16b, v1.16b, v2.16b
161+
; CHECK-SD-NEXT: // kill: def $s0 killed $s0 killed $q0
162+
; CHECK-SD-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
163+
; CHECK-SD-NEXT: ret
164+
;
165+
; CHECK-GI-LABEL: frem2_exp10:
166+
; CHECK-GI: // %bb.0: // %entry
167+
; CHECK-GI-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
168+
; CHECK-GI-NEXT: bl exp10f
169+
; CHECK-GI-NEXT: fmov s1, #2.00000000
170+
; CHECK-GI-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
171+
; CHECK-GI-NEXT: b fmodf
172+
entry:
173+
%a = tail call float @llvm.exp10.f32(float %x)
174+
%fmod = frem float %a, 2.0
175+
ret float %fmod
176+
}
177+
88178
define half @hrem2_nsz(half %x) {
89179
; CHECK-SD-LABEL: hrem2_nsz:
90180
; CHECK-SD: // %bb.0: // %entry
@@ -630,3 +720,5 @@ entry:
630720
%fmod = frem float -12.50, %y
631721
ret float %fmod
632722
}
723+
724+
attributes #0 = { nounwind }

0 commit comments

Comments
 (0)