| 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 |
| 6 |
|
| 7 |
float madd_s (float f, float g, float h) |
| 8 |
{ |
| 9 |
return (f * g) + h; |
| 10 |
} |
| 11 |
// MADD4: madd.s |
| 12 |
// NOMADD4: mul.s |
| 13 |
// NOMADD4: add.s |
| 14 |
|
| 15 |
float msub_s (float f, float g, float h) |
| 16 |
{ |
| 17 |
return (f * g) - h; |
| 18 |
} |
| 19 |
// MADD4: msub.s |
| 20 |
// NOMADD4: mul.s |
| 21 |
// NOMADD4: sub.s |
| 22 |
|
| 23 |
double madd_d (double f, double g, double h) |
| 24 |
{ |
| 25 |
return (f * g) + h; |
| 26 |
} |
| 27 |
// MADD4: madd.d |
| 28 |
// NOMADD4: mul.d |
| 29 |
// NOMADD4: add.d |
| 30 |
|
| 31 |
double msub_d (double f, double g, double h) |
| 32 |
{ |
| 33 |
return (f * g) - h; |
| 34 |
} |
| 35 |
// MADD4: msub.d |
| 36 |
// NOMADD4: mul.d |
| 37 |
// NOMADD4: sub.d |
| 38 |
|
| 39 |
|
| 40 |
float nmadd_s (float f, float g, float h) |
| 41 |
{ |
| 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); |
| 46 |
} |
| 47 |
// MADD4-NONAN: nmadd.s |
| 48 |
// NOMADD4-NONAN: mul.s |
| 49 |
// NOMADD4-NONAN: add.s |
| 50 |
// NOMADD4-NONAN: sub.s |
| 51 |
|
| 52 |
float nmsub_s (float f, float g, float h) |
| 53 |
{ |
| 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); |
| 58 |
} |
| 59 |
// MADD4-NONAN: nmsub.s |
| 60 |
// NOMADD4-NONAN: mul.s |
| 61 |
// NOMADD4-NONAN: sub.s |
| 62 |
// NOMADD4-NONAN: sub.s |
| 63 |
|
| 64 |
double nmadd_d (double f, double g, double h) |
| 65 |
{ |
| 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); |
| 70 |
} |
| 71 |
// MADD4-NONAN: nmadd.d |
| 72 |
// NOMADD4-NONAN: mul.d |
| 73 |
// NOMADD4-NONAN: add.d |
| 74 |
// NOMADD4-NONAN: sub.d |
| 75 |
|
| 76 |
double nmsub_d (double f, double g, double h) |
| 77 |
{ |
| 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); |
| 82 |
} |
| 83 |
// MADD4-NONAN: nmsub.d |
| 84 |
// NOMADD4-NONAN: mul.d |
| 85 |
// NOMADD4-NONAN: sub.d |
| 86 |
// NOMADD4-NONAN: sub.d |
| 87 |
|