[Bug target/101865] _ARCH_PWR8 is not defined when using -mcpu=power8

guihaoc at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 26 00:52:41 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101865

--- Comment #9 from HaoChen Gui <guihaoc at gcc dot gnu.org> ---
(In reply to Tulio Magno Quites Machado Filho from comment #7)
> (In reply to HaoChen Gui from comment #6)
> > Does _ARCH_PWR8 impact anything during the compiling?
> 
> I can answer this question from an user point of view. It's used in many
> projects to indicate if the target processor supports certain features, e.g.
> 
> #ifdef _ARCH_PWR8
> asm (...); /* Power8-specific code. */
> #else
> /* Generic implementation. */
> ...
> #endif

For this example, let's suppose that we set mcpu=power8 and mno-vsx in the
command line. Thus, _ARCH_PWR8 should be defined as mcpu=power8. But if the
Power8-specific codes contain VSX codes, could the asm be executed? I think we
just use the macro _ARCH_PWR8 here to guard which instructions are available.


More information about the Gcc-bugs mailing list