aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@redhat.com>2002-08-19 18:18:12 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2002-08-19 18:18:12 +0000
commit71012d9720fc774abd9f586abf40bd5d5643a412 (patch)
tree90d5a658b60ca93c1db59343c9ba71bdd464f467
parent35fb4cf6116fa7b35673deccfde8b3eb099ea261 (diff)
downloadgcc-71012d9720fc774abd9f586abf40bd5d5643a412.zip
gcc-71012d9720fc774abd9f586abf40bd5d5643a412.tar.gz
gcc-71012d9720fc774abd9f586abf40bd5d5643a412.tar.bz2
machmode.h (SCALAR_INT_MODE_P): New macro to test for scaler integer mode (MODE_INT or MODE_PARTIAL_INT).
* machmode.h (SCALAR_INT_MODE_P): New macro to test for scaler integer mode (MODE_INT or MODE_PARTIAL_INT). * explow.c (trunc_int_for_mode): Abort when the mode is not a scaler integer mode. * combine.c (expand_compound_operation): Don't expand Vector or Complex modes into shifts. (expand_field_assignment): Don't do bitwise arithmatic and shifts on Vector or Complex modes. (simplify_comparison): Don't call trunc_int_for_mode for VOIDmode. * recog.c (general_operand): Likewise. (immediate_operand): Likewise. (nonmemory_operand): Likewise. Co-Authored-By: Steve Ellcey <sje@cup.hp.com> From-SVN: r56443
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/combine.c22
-rw-r--r--gcc/explow.c4
-rw-r--r--gcc/machmode.h5
-rw-r--r--gcc/recog.c3
5 files changed, 47 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8d3077e..de73f25 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2002-08-19 Geoffrey Keating <geoffk@redhat.com>
+ Steve Ellcey <sje@cup.hp.com>
+
+ * machmode.h (SCALAR_INT_MODE_P): New macro to test for
+ scaler integer mode (MODE_INT or MODE_PARTIAL_INT).
+ * explow.c (trunc_int_for_mode): Abort when the mode is not
+ a scaler integer mode.
+ * combine.c (expand_compound_operation): Don't expand Vector
+ or Complex modes into shifts.
+ (expand_field_assignment): Don't do bitwise arithmatic and
+ shifts on Vector or Complex modes.
+ (simplify_comparison): Don't call trunc_int_for_mode
+ for VOIDmode.
+ * recog.c (general_operand): Likewise.
+ (immediate_operand): Likewise.
+ (nonmemory_operand): Likewise.
+
2002-08-19 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (rs6000_emit_set_const): Inline
diff --git a/gcc/combine.c b/gcc/combine.c
index 236ac2e..4a2ae3c 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5634,6 +5634,12 @@ expand_compound_operation (x)
if (GET_MODE_SIZE (GET_MODE (XEXP (x, 0))) > UNITS_PER_WORD)
return x;
+ /* Reject MODEs that aren't scalar integers because turning vector
+ or complex modes into shifts causes problems. */
+
+ if (! SCALAR_INT_MODE_P (GET_MODE (XEXP (x, 0))))
+ return x;
+
len = GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)));
/* If the inner object has VOIDmode (the only way this can happen
is if it is an ASM_OPERANDS), we can't do anything since we don't
@@ -5655,6 +5661,12 @@ expand_compound_operation (x)
|| GET_MODE (XEXP (x, 0)) == VOIDmode)
return x;
+ /* Reject MODEs that aren't scalar integers because turning vector
+ or complex modes into shifts causes problems. */
+
+ if (! SCALAR_INT_MODE_P (GET_MODE (XEXP (x, 0))))
+ return x;
+
len = INTVAL (XEXP (x, 1));
pos = INTVAL (XEXP (x, 2));
@@ -5862,12 +5874,12 @@ expand_field_assignment (x)
compute_mode = GET_MODE (inner);
- /* Don't attempt bitwise arithmetic on non-integral modes. */
- if (! INTEGRAL_MODE_P (compute_mode))
+ /* Don't attempt bitwise arithmetic on non scalar integer modes. */
+ if (! SCALAR_INT_MODE_P (compute_mode))
{
enum machine_mode imode;
- /* Something is probably seriously wrong if this matches. */
+ /* Don't do anything for vector or complex integral types. */
if (! FLOAT_MODE_P (compute_mode))
break;
@@ -10177,7 +10189,9 @@ simplify_comparison (code, pop0, pop1)
/* Get the constant we are comparing against and turn off all bits
not on in our mode. */
- const_op = trunc_int_for_mode (INTVAL (op1), mode);
+ const_op = INTVAL (op1);
+ if (mode != VOIDmode)
+ const_op = trunc_int_for_mode (const_op, mode);
op1 = GEN_INT (const_op);
/* If we are comparing against a constant power of two and the value
diff --git a/gcc/explow.c b/gcc/explow.c
index f61d009..4cda365 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -49,6 +49,10 @@ trunc_int_for_mode (c, mode)
{
int width = GET_MODE_BITSIZE (mode);
+ /* You want to truncate to a _what_? */
+ if (! SCALAR_INT_MODE_P (mode))
+ abort ();
+
/* Canonicalize BImode to 0 and STORE_FLAG_VALUE. */
if (mode == BImode)
return c & 1 ? STORE_FLAG_VALUE : 0;
diff --git a/gcc/machmode.h b/gcc/machmode.h
index f581cd0..c0c8c35 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -75,6 +75,11 @@ extern const enum mode_class mode_class[NUM_MACHINE_MODES];
(GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \
|| GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)
+/* Nonzero if MODE is a scalar integral mode. */
+#define SCALAR_INT_MODE_P(MODE) \
+ (GET_MODE_CLASS (MODE) == MODE_INT \
+ || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT)
+
/* Get the size in bytes of an object of mode MODE. */
extern const unsigned char mode_size[NUM_MACHINE_MODES];
diff --git a/gcc/recog.c b/gcc/recog.c
index 6bb8670..a01abd5 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -954,6 +954,7 @@ general_operand (op, mode)
return 0;
if (GET_CODE (op) == CONST_INT
+ && mode != VOIDmode
&& trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op))
return 0;
@@ -1159,6 +1160,7 @@ immediate_operand (op, mode)
return 0;
if (GET_CODE (op) == CONST_INT
+ && mode != VOIDmode
&& trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op))
return 0;
@@ -1241,6 +1243,7 @@ nonmemory_operand (op, mode)
return 0;
if (GET_CODE (op) == CONST_INT
+ && mode != VOIDmode
&& trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op))
return 0;