https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64833

--- Comment #16 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
(In reply to Kazumoto Kojima from comment #15)
> I'll look for another point to call shorten_branches
> which can fix the issue.

OK, I'm giving up on this and now testing the patch below.

diff --git a/config/sh/sh.md b/config/sh/sh.md
index 35113c0..5c8d306 100644
--- a/config/sh/sh.md
+++ b/config/sh/sh.md
@@ -11344,6 +11344,8 @@ label:
     LABEL_NUSES (operands[2])++;
 })

+;; This may be replaced with casesi_worker_2 in sh_reorg for PIC.
+;; The insn length is set to 8 for that case.
 (define_insn "casesi_worker_1"
   [(set (match_operand:SI 0 "register_operand" "=r,r")
        (unspec:SI [(reg:SI R0_REG)
@@ -11375,7 +11377,9 @@ label:
       gcc_unreachable ();
     }
 }
-  [(set_attr "length" "4")])
+  [(set_attr_alternative "length"
+     [(if_then_else (match_test "flag_pic") (const_int 8) (const_int 4))
+      (if_then_else (match_test "flag_pic") (const_int 8) (const_int 4))])])

 (define_insn "casesi_worker_2"
   [(set (match_operand:SI 0 "register_operand" "=r,r")

Reply via email to