Adam added octeon-exts-7.c in: http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00406.html
to test that a sign_extract, truncate, sign_extend sequence got folded into a single sign_extract on targets where truncation is a sign-extension operation. The patches that I'm about to post defeat the test on EABI64 targets (for which the structure is passed by reference) because they allow the load and extraction to be done in 32 bits rather than 64. I only noticed because little-endian targets would then use SRA rather than EXTS to get the bitfield. I've applied the patch below to force a 64-bit operation to be used. I checked the dumps to make sure that we still had the sign_extract, truncate, sign_extend sequence before combine and that combine managed to fold it. Tested on mipsisa64-elf. Richard gcc/testsuite/ * gcc.target/mips/octeon-exts-7.c (bar): Make sure the extraction of b requires a 64-bit operation followed by a truncation. Index: gcc/testsuite/gcc.target/mips/octeon-exts-7.c =================================================================== --- gcc/testsuite/gcc.target/mips/octeon-exts-7.c 2012-08-27 17:31:22.000000000 +0100 +++ gcc/testsuite/gcc.target/mips/octeon-exts-7.c 2012-11-03 09:11:01.535370627 +0000 @@ -8,7 +8,8 @@ struct bar { long long a:18; - long long b:14; + long long b:24; + long long c:22; }; NOMIPS16 int