1 // REQUIRES: mips-registered-target
2 // RUN: %clang --target=mips64-unknown-linux -S -mmadd4 %s -o -| FileCheck %s -check-prefix=MADD4
3 // RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 %s -o -| FileCheck %s -check-prefix=NOMADD4
4 // RUN: %clang --target=mips64-unknown-linux -S -mmadd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=MADD4-NONAN
5 // RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=NOMADD4-NONAN
7 float madd_s (float f
, float g
, float h
)
15 float msub_s (float f
, float g
, float h
)
23 double madd_d (double f
, double g
, double h
)
31 double msub_d (double f
, double g
, double h
)
40 float nmadd_s (float f
, float g
, float h
)
42 // FIXME: Zero has been explicitly placed to force generation of a positive
43 // zero in IR until pattern used to match this instruction is changed to
44 // comply with negative zero as well.
45 return 0-((f
* g
) + h
);
47 // MADD4-NONAN: nmadd.s
48 // NOMADD4-NONAN: mul.s
49 // NOMADD4-NONAN: add.s
50 // NOMADD4-NONAN: sub.s
52 float nmsub_s (float f
, float g
, float h
)
54 // FIXME: Zero has been explicitly placed to force generation of a positive
55 // zero in IR until pattern used to match this instruction is changed to
56 // comply with negative zero as well.
57 return 0-((f
* g
) - h
);
59 // MADD4-NONAN: nmsub.s
60 // NOMADD4-NONAN: mul.s
61 // NOMADD4-NONAN: sub.s
62 // NOMADD4-NONAN: sub.s
64 double nmadd_d (double f
, double g
, double h
)
66 // FIXME: Zero has been explicitly placed to force generation of a positive
67 // zero in IR until pattern used to match this instruction is changed to
68 // comply with negative zero as well.
69 return 0-((f
* g
) + h
);
71 // MADD4-NONAN: nmadd.d
72 // NOMADD4-NONAN: mul.d
73 // NOMADD4-NONAN: add.d
74 // NOMADD4-NONAN: sub.d
76 double nmsub_d (double f
, double g
, double h
)
78 // FIXME: Zero has been explicitly placed to force generation of a positive
79 // zero in IR until pattern used to match this instruction is changed to
80 // comply with negative zero as well.
81 return 0-((f
* g
) - h
);
83 // MADD4-NONAN: nmsub.d
84 // NOMADD4-NONAN: mul.d
85 // NOMADD4-NONAN: sub.d
86 // NOMADD4-NONAN: sub.d