OSDN Git Service

am 0d041145: am 19c6fbb3: Merge "Adds the ability to run the llvm test suite in-tree."
[android-x86/external-llvm.git] / test / CodeGen / Mips / fmadd1.ll
1 ; Check that madd.[ds], msub.[ds], nmadd.[ds], and nmsub.[ds] are supported
2 ; correctly.
3 ; The spec for nmadd.[ds], and nmsub.[ds] does not state that they obey the
4 ; the Has2008 and ABS2008 configuration bits which govern the conformance to
5 ; IEEE 754 (1985) and IEEE 754 (2008). These instructions are therefore only
6 ; available when -enable-no-nans-fp-math is given.
7
8 ; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -enable-no-nans-fp-math | FileCheck %s -check-prefix=32R2 -check-prefix=CHECK
9 ; RUN: llc < %s -march=mips64el -mcpu=mips64r2 -mattr=n64 -enable-no-nans-fp-math | FileCheck %s -check-prefix=64R2 -check-prefix=CHECK
10 ; RUN: llc < %s -march=mipsel -mcpu=mips32r2 | FileCheck %s -check-prefix=32R2NAN -check-prefix=CHECK
11 ; RUN: llc < %s -march=mips64el -mcpu=mips64r2 -mattr=n64 | FileCheck %s -check-prefix=64R2NAN -check-prefix=CHECK
12
13 define float @FOO0float(float %a, float %b, float %c) nounwind readnone {
14 entry:
15 ; CHECK-LABEL: FOO0float:
16 ; CHECK: madd.s 
17   %mul = fmul float %a, %b
18   %add = fadd float %mul, %c
19   %add1 = fadd float %add, 0.000000e+00
20   ret float %add1
21 }
22
23 define float @FOO1float(float %a, float %b, float %c) nounwind readnone {
24 entry:
25 ; CHECK-LABEL: FOO1float:
26 ; CHECK: msub.s 
27   %mul = fmul float %a, %b
28   %sub = fsub float %mul, %c
29   %add = fadd float %sub, 0.000000e+00
30   ret float %add
31 }
32
33 define float @FOO2float(float %a, float %b, float %c) nounwind readnone {
34 entry:
35 ; CHECK-LABEL: FOO2float:
36 ; 32R2: nmadd.s 
37 ; 64R2: nmadd.s 
38 ; 32R2NAN: madd.s 
39 ; 64R2NAN: madd.s 
40   %mul = fmul float %a, %b
41   %add = fadd float %mul, %c
42   %sub = fsub float 0.000000e+00, %add
43   ret float %sub
44 }
45
46 define float @FOO3float(float %a, float %b, float %c) nounwind readnone {
47 entry:
48 ; CHECK-LABEL: FOO3float:
49 ; 32R2: nmsub.s 
50 ; 64R2: nmsub.s 
51 ; 32R2NAN: msub.s 
52 ; 64R2NAN: msub.s 
53   %mul = fmul float %a, %b
54   %sub = fsub float %mul, %c
55   %sub1 = fsub float 0.000000e+00, %sub
56   ret float %sub1
57 }
58
59 define double @FOO10double(double %a, double %b, double %c) nounwind readnone {
60 entry:
61 ; CHECK-LABEL: FOO10double:
62 ; CHECK: madd.d
63   %mul = fmul double %a, %b
64   %add = fadd double %mul, %c
65   %add1 = fadd double %add, 0.000000e+00
66   ret double %add1
67 }
68
69 define double @FOO11double(double %a, double %b, double %c) nounwind readnone {
70 entry:
71 ; CHECK-LABEL: FOO11double:
72 ; CHECK: msub.d
73   %mul = fmul double %a, %b
74   %sub = fsub double %mul, %c
75   %add = fadd double %sub, 0.000000e+00
76   ret double %add
77 }
78
79 define double @FOO12double(double %a, double %b, double %c) nounwind readnone {
80 entry:
81 ; CHECK-LABEL: FOO12double:
82 ; 32R2: nmadd.d 
83 ; 64R2: nmadd.d 
84 ; 32R2NAN: madd.d 
85 ; 64R2NAN: madd.d 
86   %mul = fmul double %a, %b
87   %add = fadd double %mul, %c
88   %sub = fsub double 0.000000e+00, %add
89   ret double %sub
90 }
91
92 define double @FOO13double(double %a, double %b, double %c) nounwind readnone {
93 entry:
94 ; CHECK-LABEL: FOO13double:
95 ; 32R2: nmsub.d 
96 ; 64R2: nmsub.d 
97 ; 32R2NAN: msub.d 
98 ; 64R2NAN: msub.d 
99   %mul = fmul double %a, %b
100   %sub = fsub double %mul, %c
101   %sub1 = fsub double 0.000000e+00, %sub
102   ret double %sub1
103 }