1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple x86_64 < %s | FileCheck %s
4 ; To ensure unused floating point constant is correctly removed
5 define float @test(float %src, float* %p) {
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: movq $0, (%rdi)
9 ; CHECK-NEXT: xorps %xmm0, %xmm0
12 %a0 = getelementptr inbounds float, float* %p, i32 0
13 %a1 = getelementptr inbounds float, float* %p, i32 1
14 store float 0.000000e+00, float* %a0
15 store float 0.000000e+00, float* %a1
16 %zero = load float, float* %a0
17 %fmul1 = fmul fast float %zero, %src
18 %fadd1 = fadd fast float %fmul1, %zero
19 %fmul2 = fmul fast float %fadd1, 2.000000e+00
20 %fmul3 = fmul fast float %fmul2, %fmul2
21 %fmul4 = fmul fast float %fmul2, 2.000000e+00
22 %fadd2 = fadd fast float %fmul4, -3.000000e+00
23 %fmul5 = fmul fast float %fadd2, %fmul2
24 %fadd3 = fadd fast float %fmul2, %src
25 %fadd4 = fadd fast float %fadd3, %fmul5
26 %fmul6 = fmul fast float %fmul3, %fadd4
30 ; To ensure negated result will not be removed when NegX=NegY and
32 define float @test2(float %x, float %y) {
35 ; CHECK-NEXT: movaps %xmm1, %xmm0
36 ; CHECK-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
38 %add = fadd fast float %x, 750.0
39 %sub = fsub fast float %x, %add
40 %mul = fmul fast float %sub, %sub
41 %mul2 = fmul fast float %mul, %sub
42 %add2 = fadd fast float %mul2, 1.0
43 %add3 = fadd fast float %mul2, %add2
44 %mul3 = fmul fast float %y, %add3