rs6000.c (print_operand): Revise code that unsafely relied on signed overflow behavior.

2012-05-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* config/rs6000/rs6000.c (print_operand): Revise code that unsafely
	relied on signed overflow behavior.

From-SVN: r187657
This commit is contained in:
Bill Schmidt 2012-05-18 16:01:17 +00:00 committed by William Schmidt
parent a4293fa661
commit 9c68125ebc
2 changed files with 10 additions and 23 deletions

View File

@ -1,3 +1,8 @@
2012-05-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* config/rs6000/rs6000.c (print_operand): Revise code that unsafely
relied on signed overflow behavior.
2012-05-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/53346

View File

@ -14679,7 +14679,6 @@ void
print_operand (FILE *file, rtx x, int code)
{
int i;
HOST_WIDE_INT val;
unsigned HOST_WIDE_INT uval;
switch (code)
@ -15120,34 +15119,17 @@ print_operand (FILE *file, rtx x, int code)
case 'W':
/* MB value for a PowerPC64 rldic operand. */
val = (GET_CODE (x) == CONST_INT
? INTVAL (x) : CONST_DOUBLE_HIGH (x));
if (val < 0)
i = -1;
else
for (i = 0; i < HOST_BITS_PER_WIDE_INT; i++)
if ((val <<= 1) < 0)
break;
i = clz_hwi (GET_CODE (x) == CONST_INT
? INTVAL (x) : CONST_DOUBLE_HIGH (x));
#if HOST_BITS_PER_WIDE_INT == 32
if (GET_CODE (x) == CONST_INT && i >= 0)
if (GET_CODE (x) == CONST_INT && i > 0)
i += 32; /* zero-extend high-part was all 0's */
else if (GET_CODE (x) == CONST_DOUBLE && i == 32)
{
val = CONST_DOUBLE_LOW (x);
gcc_assert (val);
if (val < 0)
--i;
else
for ( ; i < 64; i++)
if ((val <<= 1) < 0)
break;
}
i = clz_hwi (CONST_DOUBLE_LOW (x)) + 32;
#endif
fprintf (file, "%d", i + 1);
fprintf (file, "%d", i);
return;
case 'x':