How to issue POWERPC instructions or byte codes?

Jeffrey Walton noloader@gmail.com
Tue Mar 29 23:22:04 GMT 2022


Hi Everyone,

I need some help with the assembler. We are using cpu feature probes
to determine when Altivec, POWER7 and POWER8 are available. For POWER8
we perform a 64-bit add (64-bit add is POWER8 and above). The code
executes within a SIGILL handler.

For POWER8 we compile the source file with -mcpu=power8. GCC conflates
our use of POWER8 with its own ability to use POWER8. We use
-mcpu=power8 because we are forced to (otherwise a program will not
compile). Then, GCC thinks it can use POWER8. (This is the root
problem. The toolchain thinks it can use the same options we are
forced to use).

I need to switch to inline assembler and byte codes so I can drop
-mcpu=power8. ARM has .inst to issue instructions and byte codes. For
example, here is a ARMv7 probe:

       asm volatile (
    #if defined(__thumb__)
           ".inst.n 0xf241, 0x2034  \n\t"   // movw r0, 0x1234
           ".inst.n 0xf2c1, 0x2034  \n\t"   // movt r0, 0x1234
           "mov %0, r0              \n\t"   // mov [a], r0
    #else
           ".inst 0xe3010234  \n\t"   // movw r0, 0x1234
           ".inst 0xe3410234  \n\t"   // movt r0, 0x1234
           "mov %0, r0        \n\t"   // mov [a], r0
    #endif
           : "=r" (a) : : "r0");

My question is, what does POWERPC offer to issue instructions or byte code?


More information about the Binutils mailing list