From: Stefan Schulze Frielinghaus <[email protected]>

For big-endian targets offset 0 for a subreg with outer QI mode and
inner HI mode is invalid and leads to an ICE.  Fixed by utilizing
gen_lowpart_SUBREG which takes care of computing the correct offset
which is for this particular case 1 for big-endian targets and 0 for
little-endian targets.

gcc/ChangeLog:

        * final.cc (test_output_operand_modifier_operand): Replace
        gen_rtx_SUBREG by gen_lowpart_SUBREG.
---
 Bootstrap is restored on s390 and still successful on x86_64 as before.
 Probably counts as obvious, however, I've never touched selftests before
 and it seems to me that it is fine to call into gen_lowpart_SUBREG here.
 Ok for mainline?

 gcc/final.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/final.cc b/gcc/final.cc
index d20e0caa351..224f0835a26 100644
--- a/gcc/final.cc
+++ b/gcc/final.cc
@@ -4795,7 +4795,7 @@ static void
 test_output_operand_modifier_operand ()
 {
   rtx operands[] = { GEN_INT (10),
-                    gen_rtx_SUBREG (QImode, gen_rtx_REG (HImode, 0), 0) };
+                    gen_lowpart_SUBREG (QImode, gen_rtx_REG (HImode, 0)) };
   auto_vec<unsigned long, 2> opnums;
   opnums.safe_push (1);
   opnums.safe_push (0);
-- 
2.55.0

Reply via email to