This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR59471
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 7 Jan 2014 15:54:56 +0100 (CET)
- Subject: [PATCH] Fix PR59471
- Authentication-results: sourceware.org; auth=none
This fixes PR59471 by properly gimplifying
VIEW_CONVERT_EXPR<uint8x8_t>(BIT_FIELD_REF <VIEW_CONVERT_EXPR<vector(2)
long unsigned int>(x), 64, 0>)
to use separate stmts for the VIEW_CONVERT_EXPRs.
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
Richard.
2014-01-07 Richard Biener <rguenther@suse.de>
PR middle-end/59471
* gimplify.c (gimplify_expr): Gimplify register-register type
VIEW_CONVERT_EXPRs to separate stmts.
* gcc.dg/pr59471.c: New testcase.
Index: gcc/gimplify.c
===================================================================
*** gcc/gimplify.c (revision 206385)
--- gcc/gimplify.c (working copy)
*************** gimplify_expr (tree *expr_p, gimple_seq
*** 7373,7384 ****
TREE_TYPE (*expr_p));
break;
case ARRAY_REF:
case ARRAY_RANGE_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
case COMPONENT_REF:
- case VIEW_CONVERT_EXPR:
ret = gimplify_compound_lval (expr_p, pre_p, post_p,
fallback ? fallback : fb_rvalue);
break;
--- 7373,7394 ----
TREE_TYPE (*expr_p));
break;
+ case VIEW_CONVERT_EXPR:
+ if (is_gimple_reg_type (TREE_TYPE (*expr_p))
+ && is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0))))
+ {
+ ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
+ post_p, is_gimple_val, fb_rvalue);
+ recalculate_side_effects (*expr_p);
+ break;
+ }
+ /* Fallthru. */
+
case ARRAY_REF:
case ARRAY_RANGE_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
case COMPONENT_REF:
ret = gimplify_compound_lval (expr_p, pre_p, post_p,
fallback ? fallback : fb_rvalue);
break;
Index: gcc/testsuite/gcc.dg/pr59471.c
===================================================================
*** gcc/testsuite/gcc.dg/pr59471.c (revision 0)
--- gcc/testsuite/gcc.dg/pr59471.c (working copy)
***************
*** 0 ****
--- 1,16 ----
+ /* { dg-do compile } */
+
+ typedef unsigned char uint8x4_t
+ __attribute__ ((__vector_size__ (4)));
+
+ typedef unsigned short uint16x8_t
+ __attribute__ ((__vector_size__ (16)));
+
+ typedef unsigned int uint32x4_t
+ __attribute__ ((__vector_size__ (16)));
+
+ uint8x4_t
+ foo (uint16x8_t x)
+ {
+ return (uint8x4_t) ((uint32x4_t) x)[0];
+ }