public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* e500 API compatability patch [ignore]
@ 2002-07-27 15:04 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2002-07-27 15:04 UTC (permalink / raw)
  To: gcc, gcc-patches

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-27  8:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-27 15:04 e500 API compatability patch [ignore] Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).