Hello, This is the same patch I posted in the PR. It seems to fix the issue. Tested on rev 192200 with make -k check RUNTESTFLAGS="--target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
and no new failures. OK? Cheers, Oleg gcc/ChangeLog: PR target/52480 * config/sh/sh.md (extv, extzv): Check that operands[3] is zero, regardless of the endianness. testsuite/ChangeLog: PR target/52480 * gcc.target/sh/sh4a-bitmovua.c: Compact skip-if list. Add runtime tests.
Index: gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c =================================================================== --- gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c (revision 192200) +++ gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c (working copy) @@ -1,7 +1,7 @@ /* Verify that we generate movua to load unaligned 32-bit values on SH4A. */ -/* { dg-do compile { target "sh*-*-*" } } */ -/* { dg-options "-O" } */ -/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" "-m4a-single-only" "-m4a-nofpu" } } */ +/* { dg-do run { target "sh*-*-*" } } */ +/* { dg-options "-O1 -save-temps -fno-inline" } */ +/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a*" } } */ /* { dg-final { scan-assembler-times "movua.l" 6 } } */ /* Aligned. */ @@ -64,4 +64,28 @@ return y4.d; } +#include <assert.h> +int +main (void) +{ + x1.d = 0x12345678; + assert (f1 () == 0x12345678); + + x2.d = 0x12345678; + assert (f2 () == 0x12345678); + + x3.d = 0x12345678; + assert (f3 () == 0x12345678); + + y_1.d = 0x12345678; + assert (g1 () == 0x12345678); + + y2.d = 0x12345678; + assert (g2 () == 0x12345678); + + y3.d = 0x12345678; + assert (g3 () == 0x12345678); + + return 0; +} Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 192200) +++ gcc/config/sh/sh.md (working copy) @@ -12706,7 +12706,7 @@ } if (TARGET_SH4A_ARCH && INTVAL (operands[2]) == 32 - && INTVAL (operands[3]) == -24 * (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN) + && INTVAL (operands[3]) == 0 && MEM_P (operands[1]) && MEM_ALIGN (operands[1]) < 32) { rtx src = adjust_address (operands[1], BLKmode, 0); @@ -12738,7 +12738,7 @@ } if (TARGET_SH4A_ARCH && INTVAL (operands[2]) == 32 - && INTVAL (operands[3]) == -24 * (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN) + && INTVAL (operands[3]) == 0 && MEM_P (operands[1]) && MEM_ALIGN (operands[1]) < 32) { rtx src = adjust_address (operands[1], BLKmode, 0);