This is the mail archive of the gcc@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]

e500 API compatability patch [ignore]


The e500 API specifies that the magic opaque types defined in <spe.h>
can be copied to and from other simd types of the same size without
casting.  They can also be passed to functions without casting.  And a
function accepting an opaque type, can accept any other same sized
simd type without a cast.  Also, opaque types cannot be initialized.

Yes, puke and complain all you want.... But I'm only including this
(a) for archival purposes (b) in case anyone needs full API
compatability in writing e500 code.

We really should come up with a place to put all these "never to be
included but mildly useful patches".  For instance, Jason had some
front end patches for AltiVec as well we colud put there.

Not ok in install?

2002-07-27  Aldy Hernandez  <aldyh@redhat.com>

	* c-typeck.c (convert_for_assignment): Allow interconversion of
	__ev64_opaque__ types.
	(really_start_incremental_init): Disallow initialization of opaque
	types.


Index: c-typeck.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/c-typeck.c,v
retrieving revision 1.237.2.1
diff -c -p -r1.237.2.1 c-typeck.c
*** c-typeck.c	2002/06/10 22:29:05	1.237.2.1
--- c-typeck.c	2002/07/27 08:18:12
*************** convert_for_assignment (type, rhs, errty
*** 4076,4081 ****
--- 4076,4098 ----
        rhs = build1 (NOP_EXPR, type, rhs);
        return rhs;
      }
+   /* branch-local */
+   /* __ev64_opaque__ types can interconvert without explicit casts.
+      Sick, disgusting, and you better like it.  */
+   else if (codel == VECTOR_TYPE && coder == VECTOR_TYPE
+ 	   && ((TYPE_NAME (type)
+ 		&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+ 		&& DECL_NAME (TYPE_NAME (type))
+ 		&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
+ 			    "__ev64_opaque__"))
+ 	       || (TYPE_NAME (TREE_TYPE (rhs))
+ 		   && TREE_CODE (TYPE_NAME (TREE_TYPE (rhs))) == TYPE_DECL
+ 		   && DECL_NAME (TYPE_NAME (TREE_TYPE (rhs)))
+ 		   && !strcmp (IDENTIFIER_POINTER
+ 			       (DECL_NAME (TYPE_NAME (TREE_TYPE (rhs)))),
+ 			       "__ev64_opaque__"))))
+     return convert (type, rhs);
+   /* end-branch-local */
    /* Arithmetic types all interconvert, and enum is treated like int.  */
    else if ((codel == INTEGER_TYPE || codel == REAL_TYPE 
  	    || codel == ENUMERAL_TYPE || codel == COMPLEX_TYPE
*************** really_start_incremental_init (type)
*** 5148,5153 ****
--- 5165,5179 ----
  
    if (type == 0)
      type = TREE_TYPE (constructor_decl);
+ 
+   /* branch-local */
+   if (TYPE_NAME (type)
+       && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
+       && DECL_NAME (TYPE_NAME (type))
+       && !strcmp (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
+ 		  "__ev64_opaque__"))
+     error ("__ev64_opaque__ types cannot be initialized");
+   /* end-branch-local */
  
    p->type = constructor_type;
    p->fields = constructor_fields;


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