re PR target/38554 (ICE when compiling pamfunc.c in netpbm with -O1 enabled)

PR target/38554
	* expmed.c (expand_shift): With SHIFT_COUNT_TRUNCATED, don't lift
	the subreg from a lowpart subreg if it is also casting the value.

testsuite/
	PR target/38554
	* gcc.c-torture/compile/pr38554.c: New test.

From-SVN: r143440
This commit is contained in:
Adam Nemet 2009-01-16 18:56:47 +00:00 committed by Adam Nemet
parent 1ceb2263cf
commit c1cb09ada0
4 changed files with 58 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-01-16 Adam Nemet <anemet@caviumnetworks.com>
PR target/38554
* expmed.c (expand_shift): With SHIFT_COUNT_TRUNCATED, don't lift
the subreg from a lowpart subreg if it is also casting the value.
2009-01-16 Sebastian Pop <sebastian.pop@amd.com>
Tobias Grosser <tobi.grosser@amd.com>

View File

@ -2136,7 +2136,8 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1)
% GET_MODE_BITSIZE (mode));
else if (GET_CODE (op1) == SUBREG
&& subreg_lowpart_p (op1))
&& subreg_lowpart_p (op1)
&& INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1))))
op1 = SUBREG_REG (op1);
}

View File

@ -1,3 +1,8 @@
2009-01-16 Adam Nemet <anemet@caviumnetworks.com>
PR target/38554
* gcc.c-torture/compile/pr38554.c: New test.
2009-01-16 Jason Merrill <jason@redhat.com>
PR c++/38579

View File

@ -0,0 +1,45 @@
typedef unsigned long sample;
struct pam
{
sample maxval;
};
typedef sample *tuple;
enum function
{
FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR,
FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT
};
struct cmdlineInfo
{
enum function function;
union
{
float divisor;
unsigned int shiftCount;
}
u;
};
applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam,
struct pam const outpam, tuple * const inputRow,
tuple * const outputRow)
{
float const oneOverDivisor = 1 / cmdline.u.divisor;
int col;
{
int plane;
{
sample const inSample = inputRow[col][plane];
sample outSample;
switch (cmdline.function)
{
case FN_DIVIDE:
outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5));
break;
case FN_SHIFTLEFT:
outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval;
}
outputRow[col][plane] =
((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample));
}
}
}