combine.c (make_compound_operation): If force_to_mode re-expanded the compound use gen_lowpart instead to convert to...

* combine.c (make_compound_operation) <SUBREG>: If force_to_mode
	re-expanded the compound use gen_lowpart instead to convert to the
	desired mode.

testsuite/
	* gcc.target/mips/ext-2.c: New test.

From-SVN: r149781
This commit is contained in:
Adam Nemet 2009-07-18 21:55:40 +00:00 committed by Adam Nemet
parent f3ce108897
commit 827f407940
4 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2009-07-18 Adam Nemet <anemet@caviumnetworks.com>
* combine.c (make_compound_operation) <SUBREG>: If force_to_mode
re-expanded the compound use gen_lowpart instead to convert to the
desired mode.
2009-07-18 Adam Nemet <anemet@caviumnetworks.com>
* combine.c (try_widen_shift_mode): Add COUNT, OUTER_CODE and

View File

@ -7061,6 +7061,12 @@ make_compound_operation (rtx x, enum rtx_code in_code)
if (GET_CODE (newer) != SUBREG)
newer = make_compound_operation (newer, in_code);
/* force_to_mode can expand compounds. If it just re-expanded the
compound use gen_lowpart instead to convert to the desired
mode. */
if (rtx_equal_p (newer, x))
return gen_lowpart (GET_MODE (x), tem);
return newer;
}

View File

@ -1,3 +1,7 @@
2009-07-18 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/ext-2.c: New test.
2009-07-18 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/octeon-exts-7.c: New test.

View File

@ -0,0 +1,14 @@
/* Turn the truncate,zero_extend,lshiftrt sequence before the or into a
zero_extract. The truncate is due to TARGET_PROMOTE_PROTOTYPES, the
zero_extend to PROMOTE_MODE. */
/* { dg-do compile } */
/* { dg-options "-O isa_rev>=2 -mgp64" } */
/* { dg-final { scan-assembler "\tdext\t" } } */
/* { dg-final { scan-assembler-not "and" } } */
/* { dg-final { scan-assembler-not "srl" } } */
void
f (unsigned char x, unsigned char *r)
{
*r = 0x50 | (x >> 4);
}