This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR/22085: AltiVec disabled if -fpreprocessed (take 2)



Actually looking over this patch, I don't see how it could work on ppc-darwin as
rs6000/darwin.h overrides REGISTER_TARGET_PRAGMAS.

Ahem, I must admit I don't have a clue either, but I swear at one time I had the test passing. :-(


This patch (bootstrapped/regtested powerpc-apple-darwin8.1.0) will do its job.

Paolo
2005-07-07  Paolo Bonzini  <bonzini@gnu.org>

	* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Do not
	initialize targetm.resolve_overloaded_builtin here.
	(altivec_expand_overloaded_builtin): Make it non-static.
	* config/rs6000/rs6000-protos.h
	(altivec_expand_overloaded_builtin): New prototype.
	* config/rs6000/rs6000.h (REGISTER_TARGET_PRAGMAS): Initialize
	targetm.resolve_overloaded_builtin here.
	* config/rs6000/darwin.h (REGISTER_TARGET_PRAGMAS): Likewise.

2005-07-07  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/altivec-pr22085.c: New.

Index: rs6000/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/darwin.h,v
retrieving revision 1.90
diff -p -u -u -r1.90 darwin.h
--- rs6000/darwin.h	8 Jul 2005 05:50:49 -0000	1.90
+++ rs6000/darwin.h	20 Jul 2005 07:33:14 -0000
@@ -383,7 +383,13 @@ do {									\
 #define BOOL_TYPE_SIZE (darwin_one_byte_bool ? CHAR_TYPE_SIZE : INT_TYPE_SIZE)
 
 #undef REGISTER_TARGET_PRAGMAS
-#define REGISTER_TARGET_PRAGMAS DARWIN_REGISTER_TARGET_PRAGMAS
+#define REGISTER_TARGET_PRAGMAS() \
+  do \
+    { \
+      DARWIN_REGISTER_TARGET_PRAGMAS(); \
+      targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \
+    } \
+  while (0)
 
 /* Just like config/darwin.h's REAL_LIBGCC_SPEC, but use -lgcc_s_ppc64 for
    -m64.  */
Index: rs6000/rs6000-c.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000-c.c,v
retrieving revision 1.22
diff -p -u -u -r1.22 rs6000-c.c
--- rs6000/rs6000-c.c	19 Jul 2005 20:19:14 -0000	1.22
+++ rs6000/rs6000-c.c	20 Jul 2005 07:33:14 -0000
@@ -38,8 +38,6 @@
 
 
 
-static tree altivec_resolve_overloaded_builtin (tree, tree);
-
 /* Handle the machine specific pragma longcall.  Its syntax is
 
    # pragma longcall ( TOGGLE )
@@ -143,8 +141,6 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi
   /* Let the compiled code know if 'f' class registers will not be available.  */
   if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
     builtin_define ("__NO_FPRS__");
-
-  targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin;
 }
 
 
Index: rs6000/rs6000-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000-protos.h,v
retrieving revision 1.104
diff -p -u -u -r1.104 rs6000-protos.h
--- rs6000/rs6000-protos.h	15 Jul 2005 01:44:38 -0000	1.104
+++ rs6000/rs6000-protos.h	20 Jul 2005 07:33:14 -0000
@@ -115,6 +115,7 @@ extern void function_arg_advance (CUMULA
 				  tree, int, int);
 extern int function_arg_boundary (enum machine_mode, tree);
 extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
+extern tree altivec_resolve_overloaded_builtin (tree, tree);
 extern rtx rs6000_function_value (tree, tree);
 extern rtx rs6000_libcall_value (enum machine_mode);
 extern rtx rs6000_va_arg (tree, tree);
Index: rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.378
diff -p -u -u -r1.378 rs6000.h
--- rs6000/rs6000.h	6 Jul 2005 09:16:51 -0000	1.378
+++ rs6000/rs6000.h	20 Jul 2005 07:33:15 -0000
@@ -339,6 +339,7 @@ extern enum rs6000_nop_insertion rs6000_
 /* Target pragma.  */
 #define REGISTER_TARGET_PRAGMAS() do {				\
   c_register_pragma (0, "longcall", rs6000_pragma_longcall);	\
+  targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \
 } while (0)
 
 /* Target #defines.  */
Index: testsuite/gcc.dg/altivec-pr22085.c
===================================================================
RCS file: altivec-pr22085.c
diff -N altivec-pr22085.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/altivec-pr22085.c	7 Jul 2005 11:37:06 -0000
@@ -0,0 +1,12 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-maltivec -fpreprocessed" } */
+
+/* Program to test AltiVec with -fpreprocessed.  */
+int foo(__attribute__((altivec(vector__))) float x,
+        __attribute__((altivec(vector__))) float y)
+{
+  if (__builtin_vec_vcmpeq_p (2, (x), (y)))
+    return 3245;
+  else
+    return 12;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]