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

--- Comment #9 from Segher Boessenkool <segher at gcc dot gnu.org> ---
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index dcccb03..11ab745 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10311,7 +10311,8 @@ (define_insn "*largetoc_low_aix<mode>"
 (define_insn_and_split "*tocref<mode>"
   [(set (match_operand:P 0 "gpc_reg_operand" "=b")
        (match_operand:P 1 "small_toc_ref" "R"))]
-   "TARGET_TOC"
+   "TARGET_TOC
+    && legitimate_constant_pool_address_p (operands[1], QImode, false)"
    "la %0,%a1"
    "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
   [(set (match_dup 0) (high:P (match_dup 1)))


This works on the testcase fine; regression testing now.

Reply via email to