aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips/mips.c
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>2019-05-31 15:40:25 -0600
committerJeff Law <law@gcc.gnu.org>2019-05-31 15:40:25 -0600
commit29c1593246765176943b642021fb0be67d25be76 (patch)
tree51ca5ac9d299532157d03bd11e29a14df3d81e18 /gcc/config/mips/mips.c
parente7393c8936b9cfb1a28f7e16043c107490491ba4 (diff)
downloadgcc-29c1593246765176943b642021fb0be67d25be76.zip
gcc-29c1593246765176943b642021fb0be67d25be76.tar.gz
gcc-29c1593246765176943b642021fb0be67d25be76.tar.bz2
mips.c (mips_expand_builtin_insn): Swap the 1st and 3rd operands of the fmadd/fmsub/maddv builtin.
* config/mips/mips.c (mips_expand_builtin_insn): Swap the 1st and 3rd operands of the fmadd/fmsub/maddv builtin. * gcc.target/mips/msa-fmadd.c: New. From-SVN: r271826
Diffstat (limited to 'gcc/config/mips/mips.c')
-rw-r--r--gcc/config/mips/mips.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 6eafe3d..c6433dc 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -16867,6 +16867,19 @@ mips_expand_builtin_insn (enum insn_code icode, unsigned int nops,
std::swap (ops[1], ops[2]);
break;
+ case CODE_FOR_msa_maddv_b:
+ case CODE_FOR_msa_maddv_h:
+ case CODE_FOR_msa_maddv_w:
+ case CODE_FOR_msa_maddv_d:
+ case CODE_FOR_msa_fmadd_w:
+ case CODE_FOR_msa_fmadd_d:
+ case CODE_FOR_msa_fmsub_w:
+ case CODE_FOR_msa_fmsub_d:
+ /* fma(a, b, c) results into (a * b + c), however builtin_msa_fmadd expects
+ it to be (a + b * c). Swap the 1st and 3rd operands. */
+ std::swap (ops[1], ops[3]);
+ break;
+
case CODE_FOR_msa_slli_b:
case CODE_FOR_msa_slli_h:
case CODE_FOR_msa_slli_w: