aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/v850
diff options
context:
space:
mode:
authorJeff Law <jeffreyalaw@gmail.com>2022-02-09 14:10:53 -0500
committerJeff Law <jeffreyalaw@gmail.com>2022-02-09 14:10:53 -0500
commiteefec38c992e3622a69de9667e91f0cafbff03cc (patch)
tree9e93d1e58a23d374a4f0a5e2e985d1aa233d5ece /gcc/config/v850
parentd3f3ec5a555dbf0e3329515b38f848b4760589b2 (diff)
downloadgcc-eefec38c992e3622a69de9667e91f0cafbff03cc.zip
gcc-eefec38c992e3622a69de9667e91f0cafbff03cc.tar.gz
gcc-eefec38c992e3622a69de9667e91f0cafbff03cc.tar.bz2
Avoid using predefined insn name for instruction with different semantics
This isn't technically a regression, but it only impacts the v850 target and fixes a long standing code correctness issue. As outlined in slightly more detail in the PR, the v850 is using the pattern name "fnmasf4" and "fnmssf4" to generate fnmaf.s and fnmsf.s instructions respectively. Unfortunately fnmasf4 is expected to produce (-a * b) + c and fnmssf4 (-a * b) - c. Those v850 instructions actually negate the entire result. The fix is trivial. Use a different pattern name so that the combiner can still generate those instructions, but prevent those instructions from being used to implement GCC's notion of what fnmas and fnmss should be. This fixes pr97040 as well as a handful of testsuite failures for the v3e5 multilib. gcc/ PR target/97040 * config/v850/v850.md (*v850_fnmasf4): Renamed from fnmasf4. (*v850_fnmssf4): Renamed from fnmssf4
Diffstat (limited to 'gcc/config/v850')
-rw-r--r--gcc/config/v850/v850.md9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/config/v850/v850.md b/gcc/config/v850/v850.md
index ed51157..6ca31e3 100644
--- a/gcc/config/v850/v850.md
+++ b/gcc/config/v850/v850.md
@@ -2601,7 +2601,12 @@
(set_attr "type" "fpu")])
;;; negative-multiply-add
-(define_insn "fnmasf4"
+;; Note the name on this and the following insn were previously fnmasf4
+;; and fnmssf4. Those names are known to the gimple->rtl expanders and
+;; must implement specific semantics (negating one of the inputs to the
+;; multiplication). The v850 instructions actually negate the entire
+;; result. Thus the names have been changed and hidden.
+(define_insn "*v850_fnmasf4"
[(set (match_operand:SF 0 "register_operand" "=r")
(neg:SF (fma:SF (match_operand:SF 1 "register_operand" "r")
(match_operand:SF 2 "register_operand" "r")
@@ -2612,7 +2617,7 @@
(set_attr "type" "fpu")])
;; negative-multiply-subtract
-(define_insn "fnmssf4"
+(define_insn "*v850_fnmssf4"
[(set (match_operand:SF 0 "register_operand" "=r")
(neg:SF (fma:SF (match_operand:SF 1 "register_operand" "r")
(match_operand:SF 2 "register_operand" "r")