[PATCH] Intrinsics for PowerPC

Ziemowit Laski zlaski@apple.com
Tue Dec 23 02:43:00 GMT 2003


On 22 Dec 2003, at 17.24, Syd Polk wrote:

> The Metrowerks CodeWarrior compiler provides a set of builtin 
> functions that map down to single instructions so that developers can 
> issue one or two instructions without having to resort to inline 
> assembler. Here at Apple, we have emulated that functionality by 
> providing a combination of macros and inline functions that map to 
> CodeWarrior's functions.
>
> Our implementation has some problems, however. Because many of these 
> instructions require immediate operands (not register loads), they 
> have to be implemented using macros; however, at least one of our 
> customers has macros on top of the intrinsic function which cause it 
> to fail compilation if the intrinsic is a macro. Also, by making them 
> builtins, we might later be able to do instruction scheduling with 
> them.
>
> This patch is mainly to set up the structure for these intrinsics in 
> gcc. It only has one simple one, __eieio; later, it will be expanded 
> to the full set plus some others that have been asked for by 
> developers.
>
> Bootstrapped on Darwin; OK to check in?

Generally looks OK, but I have a couple of comments, recently having 
gone thru the rs6000.c baptism of fire myself:

1) Instead of creating a new .md file, perhaps you can add 'eieio' to 
rs6000.md?  (I'm a bit surprised it is not there already, actually...)  
For most of the remaining intrinsics, I would expect/hope that the 
corresponding instructions are already in rs6000.md.

2) To define the function signature for 'eieio', you may want to use 
what's done elsewhere in the code:

   tree void_ftype_void
     = build_function_type (void_type_node, void_list_node);

as I'm not sure if 'build_function_type_list' will do what you want...

Aside from that (and Andrew's scheduler comments which went over my 
head :-) ), I see no reason why these can't be checked in after a 
bootstrap, but where? :-) :-)  If you find out, please let me know, and 
maybe I'll check in my AltiVec work there as well...

--Zem



More information about the Gcc-patches mailing list