public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/personal-branch)] Disable brabc/brabs patterns as their length computation is horribly broken and leads to incorrect c
@ 2020-06-10  3:20 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-10  3:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6dda86084439af4f5315a5c3aaee732a610e3551

commit 6dda86084439af4f5315a5c3aaee732a610e3551
Author: Jeff Law <law@redhat.com>
Date:   Sat May 30 21:53:28 2020 -0600

    Disable brabc/brabs patterns as their length computation is horribly broken and leads to incorrect code generation.
    
            * config/h8300/jumpcall.md (brabs, brabc): Disable patterns.

Diff:
---
 gcc/config/h8300/jumpcall.md | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gcc/config/h8300/jumpcall.md b/gcc/config/h8300/jumpcall.md
index 7208fb6d86b..3917cf18920 100644
--- a/gcc/config/h8300/jumpcall.md
+++ b/gcc/config/h8300/jumpcall.md
@@ -77,6 +77,16 @@
  [(set_attr "type" "branch")
    (set_attr "cc" "none")])
 
+;; The brabc/brabs patterns have been disabled because their length computation
+;; is horribly broken.  When we call out to a function via a SYMBOL_REF we get
+;; bogus default and minimum lengths.  The trick used by the PA port seems to
+;; fix the minimum, but not the default length.  The broken lengths can lead
+;; to bogusly using a short jump when a long jump was needed and thus
+;; incorrect code.
+;;
+;; Given the restricted addressing modes for operand 1, we could probably just
+;; open-code the necessary length computation in the two affected patterns
+;; rather than using a function call.  I think that would fix this problem.
 (define_insn "*brabc"
   [(set (pc)
 	(if_then_else (eq (zero_extract (match_operand:QI 1 "bit_memory_operand" "WU")
@@ -85,7 +95,7 @@
 			  (const_int 0))
 		      (label_ref (match_operand 0 "" ""))
 		      (pc)))]
-  "TARGET_H8300SX"
+  "0 && TARGET_H8300SX"
 {
   switch (get_attr_length (insn)
 	  - h8300_insn_length_from_table (insn, operands))
@@ -110,7 +120,7 @@
 			  (const_int 0))
 		      (label_ref (match_operand 0 "" ""))
 		      (pc)))]
-  "TARGET_H8300SX"
+  "0 && TARGET_H8300SX"
 {
   switch (get_attr_length (insn)
 	  - h8300_insn_length_from_table (insn, operands))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-10  3:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10  3:20 [gcc(refs/users/guojiufu/heads/personal-branch)] Disable brabc/brabs patterns as their length computation is horribly broken and leads to incorrect c Jiu Fu Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).