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]

[PATCH] Intrinsics for PowerPC


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?

gcc ChangeLog:

2003-12-22 Syd Polk <spolk@apple.com>

* config/rs6000/ppc_intrinsics.md: New file for PowerPC intrinsic functions.
* config/rs6000/rs6000.c (rs6000_expand_void_builtin): New function.
(rs6000_init_intrinsic_builtins): New function.
(rs6000_expand_builtin): Add no-operand built-ins.
(rs6000_init_builtins): Call rs6000_init_intrinsic_builtins().
* config/rs6000/rs6000.h: Define PPC_BUILTIN_EIEIO.
* config/rs6000/rs6000.md: Likewise.


testsuite ChangeLog:

2003-12-22 Syd Polk <spolk@apple.com>

* gcc.dg/ppc_intrinsics.c: Added.

Patch:

Attachment: intrinsics.patch
Description: Binary data




Here is the list of instructions that have intrinsics in CodeWarrior that I am planning on implementing.


eieio
isync
sync
lhbrx
lwbrx
sthbrx
stwbrx
cntlzw
rlwimi
rlwinm
rlwnm
dcba
dcbf
dcbst
dcbt
dcbtst
dcbz
setflm
fabs
fnabs
fctiw
fctiwz
fmadd
fmadds
fmsub
fmsubs
fmul
fmuls
fnmadd
fnmadds
fnmsub
fnmsubs
fres
frsp
frsqrte
frsqrtes
fsel
fsels
fsqrt
fsqrts
mulhw
mulhwu
stfiwx
icbi
mffs
mfspr
mtfsf
mtspr




Syd Polk Apple Computer Technology EPM, Mac OS X Development Tools +1 408 974-0577

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