This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR middle-end/37269: extract_bit_field_1 doesn't handle vector mode properly
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Joey Ye <joey dot ye at intel dot com>, Xuepeng Guo <xuepeng dot guo at intel dot com>
- Date: Thu, 28 Aug 2008 14:08:31 -0700
- Subject: PATCH: PR middle-end/37269: extract_bit_field_1 doesn't handle vector mode properly
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
extract_bit_field_1 may call gen_lowpart to generate a V8SImode rtx from
a V8QImode rtx. This isn't valid even when V8SImode is a valid mode.
This patch replaces gen_lowpart with gen_lowpart_if_possible. Tested
on Linux/ia32 and Linux/Intel64. OK for trunk?
Thanks.
H.J.
---
gcc/
2008-08-28 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/37269
* expmed.c (extract_bit_field_1): Call gen_lowpart_if_possible
instead of gen_lowpart on vector mode.
gcc/testsuite/
2008-08-28 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/37269
* gcc.target/i386/avx-4.c: New.
Index: gcc/testsuite/gcc.target/i386/avx-4.c
===================================================================
--- gcc/testsuite/gcc.target/i386/avx-4.c (revision 0)
+++ gcc/testsuite/gcc.target/i386/avx-4.c (revision 3820)
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+
+__attribute__ ((vector_size (8))) signed char v4, v5, v6;
+void
+two (void)
+{
+ v4 = v5 + v6;
+}
Index: gcc/testsuite/ChangeLog.internal
===================================================================
Index: gcc/expmed.c
===================================================================
--- gcc/expmed.c (revision 3819)
+++ gcc/expmed.c (revision 3820)
@@ -1200,9 +1200,14 @@ extract_bit_field_1 (rtx str_rtx, unsign
if (GET_MODE_NUNITS (new_mode) == nunits
&& GET_MODE_INNER (new_mode) == tmode
&& targetm.vector_mode_supported_p (new_mode))
- break;
- if (new_mode != VOIDmode)
- op0 = gen_lowpart (new_mode, op0);
+ {
+ rtx tmp = gen_lowpart_if_possible (new_mode, op0);
+ if (tmp)
+ {
+ op0 = tmp;
+ break;
+ }
+ }
}
/* Use vec_extract patterns for extracting parts of vectors whenever
Index: gcc/ChangeLog.internal
===================================================================