[C PATCH] Handle VCE in c_fully_fold_internal (PR c/47809)

Jakub Jelinek jakub@redhat.com
Sat Feb 19 20:47:00 GMT 2011


Hi!

convert generates a VCE for vector casts, therefore IMHO
c_fully_fold_internal should handle it similarly to NOP_EXPR/CONVERT_EXPR
as an unary expression, otherwise C_MAYBE_CONST_EXPR may leak into
gimplification.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2011-02-19  Jakub Jelinek  <jakub@redhat.com>

	PR c/47809
	* c-common.c (c_fully_fold_internal): Handle VIEW_CONVERT_EXPR.

	* gcc.target/i386/pr47809.c: New test.

--- gcc/c-family/c-common.c.jj	2011-02-15 15:28:17.000000000 +0100
+++ gcc/c-family/c-common.c	2011-02-19 18:23:32.000000000 +0100
@@ -1213,6 +1213,7 @@ c_fully_fold_internal (tree expr, bool i
     case FIX_TRUNC_EXPR:
     case FLOAT_EXPR:
     CASE_CONVERT:
+    case VIEW_CONVERT_EXPR:
     case NON_LVALUE_EXPR:
     case NEGATE_EXPR:
     case BIT_NOT_EXPR:
--- gcc/testsuite/gcc.target/i386/pr47809.c.jj	2011-02-19 18:27:43.000000000 +0100
+++ gcc/testsuite/gcc.target/i386/pr47809.c	2011-02-19 18:26:22.000000000 +0100
@@ -0,0 +1,13 @@
+/* PR c/47809 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+#include <emmintrin.h>
+double bar (double, double);
+
+__m128d
+foo (__m128d x)
+{
+  x *= (__m128d) { bar (1.0, 1.0), 0.0 };
+  return (__m128d) ((__m128i) x ^ (__m128i) { 0, 0});
+}

	Jakub



More information about the Gcc-patches mailing list