blob: 192a12735800c65b409cb5539be9589f2c23f394 [file] [log] [blame]
NAKAMURA Takumid35a4ff2012-09-01 00:26:28 +00001; RUN: llc -march=x86-64 -mattr=-fma4 -mtriple=x86_64-apple-darwin -enable-unsafe-fp-math < %s | FileCheck %s
Owen Andersoncc61f872012-08-30 23:35:16 +00002
3; CHECK: test1
4define float @test1(float %a) {
Owen Andersond1545e32012-08-30 23:51:20 +00005; CHECK-NOT: addss
6; CHECK: mulss
7; CHECK-NOT: addss
Owen Andersoncc61f872012-08-30 23:35:16 +00008; CHECK: ret
9 %t1 = fadd float %a, %a
10 %r = fadd float %t1, %t1
11 ret float %r
12}
13
14; CHECK: test2
15define float @test2(float %a) {
Owen Andersond1545e32012-08-30 23:51:20 +000016; CHECK-NOT: addss
17; CHECK: mulss
18; CHECK-NOT: addss
Owen Andersoncc61f872012-08-30 23:35:16 +000019; CHECK: ret
20 %t1 = fmul float 4.0, %a
21 %t2 = fadd float %a, %a
22 %r = fadd float %t1, %t2
23 ret float %r
24}
25
26; CHECK: test3
27define float @test3(float %a) {
Owen Andersond1545e32012-08-30 23:51:20 +000028; CHECK-NOT: addss
29; CHECK: xorps
30; CHECK-NOT: addss
Owen Andersoncc61f872012-08-30 23:35:16 +000031; CHECK: ret
32 %t1 = fmul float 2.0, %a
33 %t2 = fadd float %a, %a
34 %r = fsub float %t1, %t2
35 ret float %r
36}
37
Owen Andersonb351c8d2012-11-01 02:00:53 +000038; CHECK: test4
39define float @test4(float %a) {
40; CHECK-NOT: fma
41; CHECK-NOT mul
42; CHECK-NOT: add
43; CHECK: ret
44 %t1 = fmul float %a, 0.0
45 %t2 = fadd float %a, %t1
46 ret float %t2
47}
48
49; CHECK: test5
50define float @test5(float %a) {
51; CHECK-NOT: add
52; CHECK: vxorps
53; CHECK: ret
54 %t1 = fsub float -0.0, %a
55 %t2 = fadd float %a, %t1
56 ret float %t2
57}