1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=avx -enable-unsafe-fp-math < %s | FileCheck %s
3
4define float @test1(float %a) {
5; CHECK-LABEL: test1:
6; CHECK:       # BB#0:
7; CHECK-NEXT:    vmulss {{.*}}(%rip), %xmm0, %xmm0
8; CHECK-NEXT:    retq
9  %t1 = fadd float %a, %a
10  %r = fadd float %t1, %t1
11  ret float %r
12}
13
14define float @test2(float %a) {
15; CHECK-LABEL: test2:
16; CHECK:       # BB#0:
17; CHECK-NEXT:    vmulss {{.*}}(%rip), %xmm0, %xmm0
18; CHECK-NEXT:    retq
19  %t1 = fmul float 4.0, %a
20  %t2 = fadd float %a, %a
21  %r = fadd float %t1, %t2
22  ret float %r
23}
24
25define float @test3(float %a) {
26; CHECK-LABEL: test3:
27; CHECK:       # BB#0:
28; CHECK-NEXT:    vmulss {{.*}}(%rip), %xmm0, %xmm0
29; CHECK-NEXT:    retq
30  %t1 = fmul float %a, 4.0
31  %t2 = fadd float %a, %a
32  %r = fadd float %t1, %t2
33  ret float %r
34}
35
36define float @test4(float %a) {
37; CHECK-LABEL: test4:
38; CHECK:       # BB#0:
39; CHECK-NEXT:    vmulss {{.*}}(%rip), %xmm0, %xmm0
40; CHECK-NEXT:    retq
41  %t1 = fadd float %a, %a
42  %t2 = fmul float 4.0, %a
43  %r = fadd float %t1, %t2
44  ret float %r
45}
46
47define float @test5(float %a) {
48; CHECK-LABEL: test5:
49; CHECK:       # BB#0:
50; CHECK-NEXT:    vmulss {{.*}}(%rip), %xmm0, %xmm0
51; CHECK-NEXT:    retq
52  %t1 = fadd float %a, %a
53  %t2 = fmul float %a, 4.0
54  %r = fadd float %t1, %t2
55  ret float %r
56}
57
58define float @test6(float %a) {
59; CHECK-LABEL: test6:
60; CHECK:       # BB#0:
61; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
62; CHECK-NEXT:    retq
63  %t1 = fmul float 2.0, %a
64  %t2 = fadd float %a, %a
65  %r = fsub float %t1, %t2
66  ret float %r
67}
68
69define float @test7(float %a) {
70; CHECK-LABEL: test7:
71; CHECK:       # BB#0:
72; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
73; CHECK-NEXT:    retq
74  %t1 = fmul float %a, 2.0
75  %t2 = fadd float %a, %a
76  %r = fsub float %t1, %t2
77  ret float %r
78}
79
80define float @test8(float %a) {
81; CHECK-LABEL: test8:
82; CHECK:       # BB#0:
83; CHECK-NEXT:    retq
84  %t1 = fmul float %a, 0.0
85  %t2 = fadd float %a, %t1
86  ret float %t2
87}
88
89define float @test9(float %a) {
90; CHECK-LABEL: test9:
91; CHECK:       # BB#0:
92; CHECK-NEXT:    retq
93  %t1 = fmul float 0.0, %a
94  %t2 = fadd float %t1, %a
95  ret float %t2
96}
97
98define float @test10(float %a) {
99; CHECK-LABEL: test10:
100; CHECK:       # BB#0:
101; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
102; CHECK-NEXT:    retq
103  %t1 = fsub float -0.0, %a
104  %t2 = fadd float %a, %t1
105  ret float %t2
106}
107
108define float @test11(float %a) {
109; CHECK-LABEL: test11:
110; CHECK:       # BB#0:
111; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
112; CHECK-NEXT:    retq
113  %t1 = fsub float -0.0, %a
114  %t2 = fadd float %a, %t1
115  ret float %t2
116}
117
118