------- Comment #4 from suckfish at ihug dot co dot nz  2008-10-14 07:17 -------
Digging a bit, in combine.c, the ASHIFTRT case of force_to_mode() contains two
calls to simplify_shift_const().  Disabling those for vector modes fixes the
test case here (patch below).

But I suspect this is just the tip of the iceberg; there are probably many
other arithmetic simplifications here that will get incorrectly applied to
vector types, especially when sizeof(vector type) <= sizeof (HOST_WIDE_INT).

Do we need to audit the whole compiler for such things, or is there a sensible
place we can insert a don't-optimise-vector-types test with disabling too many
useful optimisations?

Thinking that the test-suite probably contains many more tests for 128 bit
vector types, would it be possible/worth-while to build a compiler & run the
test-suite with HOST_WIDE_INT being 128 bits?


diff --git a/gcc/combine.c b/gcc/combine.c
index 5821301..ad24d94 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -7635,7 +7635,8 @@
              nonzero >>= INTVAL (XEXP (x, 1));
            }

-         if ((mask & ~nonzero) == 0)
+         if ((mask & ~nonzero) == 0
+              && !VECTOR_MODE_P (mode) && !VECTOR_MODE_P (GET_MODE (x)))
            {
              x = simplify_shift_const (NULL_RTX, LSHIFTRT, GET_MODE (x),
                                        XEXP (x, 0), INTVAL (XEXP (x, 1)));
@@ -7643,7 +7644,8 @@
                return force_to_mode (x, mode, mask, next_select);
            }

-         else if ((i = exact_log2 (mask)) >= 0)
+         else if ((i = exact_log2 (mask)) >= 0
+                   && !VECTOR_MODE_P (mode) && !VECTOR_MODE_P (GET_MODE (x)))
            {
              x = simplify_shift_const
                  (NULL_RTX, LSHIFTRT, GET_MODE (x), XEXP (x, 0),


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37809

Reply via email to