[PATCH] Fix nested vector shift ICE (PR middle-end/26379)
Jakub Jelinek
jakub@redhat.com
Mon Feb 20 11:38:00 GMT 2006
Hi!
The following testcase ICEs on x86_64-linux (both -m32 and -m64).
The problem is that the nested shift optimization (in this case
((m >> 2) << 8)) in combine.c doesn't handle vector shifts
and ICEs when trying to optimize V4HImode shift 0x3fffffffffffffff << 8
(the mask itself is wrong, it would need to be vector { 0x3fff, 0x3fff,
0x3fff, 0x3fff }). The following patch simply disables the optimization
for vector shifts, which is a safe thing to do for 4.0/4.1. For
trunk I'm not sure if we want this as well or rewrite the optimization
to handle vector shift as well.
This is a 4.0/4.1/4.2 regression.
Ok to commit to 4.0/4.1 (to 4.1 probably after 4.1 is released)? Is it
ok also for trunk followed by another patch to handle the optimization
later on?
2006-02-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/26379
* combine.c (simplify_shift_const_1): Disable nested shifts
optimization for vector shifts.
* gcc.target/i386/mmx-7.c: New test.
--- gcc/combine.c.jj 2006-02-16 08:22:59.000000000 +0100
+++ gcc/combine.c 2006-02-20 12:23:27.000000000 +0100
@@ -8737,7 +8737,8 @@ simplify_shift_const_1 (enum rtx_code co
&& INTVAL (XEXP (varop, 1)) >= 0
&& INTVAL (XEXP (varop, 1)) < GET_MODE_BITSIZE (GET_MODE (varop))
&& GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT
- && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
+ && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
+ && !VECTOR_MODE_P (result_mode))
{
enum rtx_code first_code = GET_CODE (varop);
unsigned int first_count = INTVAL (XEXP (varop, 1));
--- gcc/testsuite/gcc.target/i386/mmx-7.c.jj 2006-02-20 12:26:28.000000000 +0100
+++ gcc/testsuite/gcc.target/i386/mmx-7.c 2006-02-20 12:25:32.000000000 +0100
@@ -0,0 +1,18 @@
+/* PR middle-end/26379 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mmmx" } */
+
+#include <mmintrin.h>
+
+void
+foo (__m64 *p)
+{
+ __m64 m;
+
+ m = p[0];
+ m = _mm_srli_pi16(m, 2);
+ m = _mm_slli_pi16(m, 8);
+
+ p[0] = m;
+ _mm_empty();
+}
Jakub
More information about the Gcc-patches
mailing list