aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2016-06-24 12:46:19 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2016-06-24 12:46:19 +0000
commit68a8632380e3606aeea2eb11921461e24926dddc (patch)
tree96126f7d5aca829faff5c28e8579d83f5f0a0341 /gcc
parentdfee28703668e4aa85de36e4f4bd0cac7a04146d (diff)
downloadgcc-68a8632380e3606aeea2eb11921461e24926dddc.zip
gcc-68a8632380e3606aeea2eb11921461e24926dddc.tar.gz
gcc-68a8632380e3606aeea2eb11921461e24926dddc.tar.bz2
[ARM][1/4] Replace uses of int_log2 by exact_log2
* config/arm/arm.c (int_log2): Delete definition and prototype. (shift_op): Use exact_log2 instead of int_log2. (vfp3_const_double_for_fract_bits): Likewise. From-SVN: r237757
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/arm/arm.c26
2 files changed, 13 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fdc4898..2c55cb3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/arm/arm.c (int_log2): Delete definition and prototype.
+ (shift_op): Use exact_log2 instead of int_log2.
+ (vfp3_const_double_for_fract_bits): Likewise.
+
2016-06-24 Jakub Jelinek <jakub@redhat.com>
* internal-fn.c (expand_arith_set_overflow): New function.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index a7dda1f..f609554 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -104,7 +104,6 @@ static void arm_print_operand_address (FILE *, machine_mode, rtx);
static bool arm_print_operand_punct_valid_p (unsigned char code);
static const char *fp_const_from_val (REAL_VALUE_TYPE *);
static arm_cc get_arm_condition_code (rtx);
-static HOST_WIDE_INT int_log2 (HOST_WIDE_INT);
static const char *output_multi_immediate (rtx *, const char *, const char *,
int, HOST_WIDE_INT);
static const char *shift_op (rtx, HOST_WIDE_INT *);
@@ -19094,7 +19093,8 @@ shift_op (rtx op, HOST_WIDE_INT *amountp)
return NULL;
}
- *amountp = int_log2 (*amountp);
+ *amountp = exact_log2 (*amountp);
+ gcc_assert (IN_RANGE (*amountp, 0, 31));
return ARM_LSL_NAME;
default:
@@ -19126,22 +19126,6 @@ shift_op (rtx op, HOST_WIDE_INT *amountp)
return mnem;
}
-/* Obtain the shift from the POWER of two. */
-
-static HOST_WIDE_INT
-int_log2 (HOST_WIDE_INT power)
-{
- HOST_WIDE_INT shift = 0;
-
- while ((((HOST_WIDE_INT) 1 << shift) & power) == 0)
- {
- gcc_assert (shift <= 31);
- shift++;
- }
-
- return shift;
-}
-
/* Output a .ascii pseudo-op, keeping track of lengths. This is
because /bin/as is horribly restrictive. The judgement about
whether or not each character is 'printable' (and can be output as
@@ -27931,7 +27915,11 @@ vfp3_const_double_for_fract_bits (rtx operand)
HOST_WIDE_INT value = real_to_integer (&r0);
value = value & 0xffffffff;
if ((value != 0) && ( (value & (value - 1)) == 0))
- return int_log2 (value);
+ {
+ int ret = exact_log2 (value);
+ gcc_assert (IN_RANGE (ret, 0, 31));
+ return ret;
+ }
}
}
return 0;