[cfe-dev] How do I specify a specific PowerPC CPU to clang?

Andy Gibbs andyg1001 at hotmail.co.uk
Mon Jul 2 06:09:31 PDT 2012


On Tuesday, June 19, 2012 2:09 AM, Hal Finkel wrote:
> Sean, Richard,
> 
> I added -mcpu support for PPC to trunk clang in r158334. Does this not
> work for you?
> 
> -Hal

Hal,

Thanks for adding this feature.

Please can I offer an improvement to it?  In your commit comments you stated "a few preprocessor defines for common CPU types have been added".  Attached is a patch that adds more.  I have tried to match the defines that gcc generates and the IBM compiler documentation, where the two agree and where I have been able to confirm by testing.  FWIW, I am porting code that requires the _ARCH_PPCGR and _ARCH_PWRx defines to compile correctly, hence my motive!

In addition to the defines you added, I have added ones for 60x and 74xx series, additionally defining _ARCH_PPCGR where applicable.  I also fleshed out the 970, pwr6 and pwr7 sets to include _ARCH_PWR{4-6}, _ARCH_PPCGR and _ARCH_PPCSQ as applicable (which are additionally defined by gcc for these architectures).

Cheers
Andy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc-defines.patch
Type: application/octet-stream
Size: 8749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120702/9698668e/attachment.obj>


More information about the cfe-dev mailing list