Commit 0e510b3e by Adam Nemet Committed by Adam Nemet

expmed.c (store_bit_field_1): Properly truncate the paradoxical subreg of op0 to the original op0.

	* expmed.c (store_bit_field_1): Properly truncate the paradoxical
	subreg of op0 to the original op0.

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

From-SVN: r143288
parent 3f429b87
2009-01-11 Adam Nemet <anemet@caviumnetworks.com>
* expmed.c (store_bit_field_1): Properly truncate the paradoxical
subreg of op0 to the original op0.
2009-01-11 Laurent GUERBY <laurent@guerby.net>
* doc/sourcebuild.texi (Source Tree): Move up intl and fixinc.
......
......@@ -749,6 +749,16 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
if (pat)
{
emit_insn (pat);
/* If the mode of the insertion is wider than the mode of the
target register we created a paradoxical subreg for the
target. Truncate the paradoxical subreg of the target to
itself properly. */
if (!TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (op0)),
GET_MODE_BITSIZE (op_mode))
&& (REG_P (xop0)
|| GET_CODE (xop0) == SUBREG))
convert_move (op0, xop0, true);
return true;
}
delete_insns_since (last);
......
2009-01-11 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/ins-2.c: New test.
2009-01-11 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/38809
......
/* { dg-do compile } */
/* { dg-options "-O -meb isa_rev>=2 -mgp64" } */
/* { dg-final { scan-assembler-times "\tins\t|\tdins\t" 1 } } */
/* { dg-final { scan-assembler-times "\tsll\t|\tins\t" 1 } } */
/* When inserting something into the top bit of a 32-bit structure,
we must make sure that the register remains properly sign-extended.
There are two ways of doing this:
- use purely 32-bit bit manipulations (a single INS, matched twice here).
- use a 64-bit bit manipulation (DINS), and sign-extend the result. We
check for this extension using SLL. */
struct s
{
int a:3;
int b:29;
};
NOMIPS16 void
f (int a)
{
struct s s;
asm volatile ("" : "=r"(s));
s.a = a;
asm volatile ("" :: "r"(s));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment