churchyard / rpms / gcc

Forked from rpms/gcc 4 years ago
Clone
Blob Blame History Raw
2009-03-27  Jakub Jelinek  <jakub@redhat.com>

	* config/rs6000/rs6000-c.c (rs6000_macro_to_expand): If macro
	following vector keyword has expansion starting with pixel or bool
	keyword, expand vector to __vector and pixel or bool to __pixel or
	__bool.

	* gcc.target/powerpc/altivec-28.c: New test.

--- gcc/config/rs6000/rs6000-c.c.jj	2008-10-23 13:21:36.000000000 +0200
+++ gcc/config/rs6000/rs6000-c.c	2009-03-27 11:45:50.000000000 +0100
@@ -188,7 +188,19 @@ rs6000_macro_to_expand (cpp_reader *pfil
 		tok = cpp_peek_token (pfile, idx++);
 	      while (tok->type == CPP_PADDING);
 	      ident = altivec_categorize_keyword (tok);
-	      if (ident)
+	      if (ident == C_CPP_HASHNODE (__pixel_keyword))
+		{
+		  expand_this = C_CPP_HASHNODE (__vector_keyword);
+		  expand_bool_pixel = __pixel_keyword;
+		  rid_code = RID_MAX;
+		}
+	      else if (ident == C_CPP_HASHNODE (__bool_keyword))
+		{
+		  expand_this = C_CPP_HASHNODE (__vector_keyword);
+		  expand_bool_pixel = __bool_keyword;
+		  rid_code = RID_MAX;
+		}
+	      else if (ident)
 		rid_code = (enum rid)(ident->rid_code);
 	    }
 
--- gcc/testsuite/gcc.target/powerpc/altivec-28.c.jj	2009-03-27 11:47:23.000000000 +0100
+++ gcc/testsuite/gcc.target/powerpc/altivec-28.c	2009-03-27 11:50:15.000000000 +0100
@@ -0,0 +1,16 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec" } */
+
+#define B bool
+#define P pixel
+#define I int
+#define BI bool int
+#define PI pixel int
+
+vector B int i;
+vector P int j;
+vector B I k;
+vector P I l;
+vector BI m;
+vector PI n;