aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2012-05-18 16:01:17 +0000
committerWilliam Schmidt <wschmidt@gcc.gnu.org>2012-05-18 16:01:17 +0000
commit9c68125ebc6d04907b91c881dab574ccb08a3537 (patch)
tree9edfe411af0a9de0059465a303cd35023ad4c302 /gcc
parenta4293fa6610acbe4412370b586122fc40615eeb9 (diff)
downloadgcc-9c68125ebc6d04907b91c881dab574ccb08a3537.zip
gcc-9c68125ebc6d04907b91c881dab574ccb08a3537.tar.gz
gcc-9c68125ebc6d04907b91c881dab574ccb08a3537.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/rs6000/rs6000.c28
2 files changed, 10 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b0d92ae..95bf7f9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a03d24d..0896af3 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -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':