* Segher Boessenkool: >> 0000000000000000 <__GI___getdents64>: >> 0: addis r2,r12,0 >> 0: R_PPC64_REL16_HA .TOC. >> 4: addi r2,r2,0 >> 4: R_PPC64_REL16_LO .TOC.+0x4 >> 8: li r0,202 >> c: sc >> 10: mfcr r0 > > You also get this mfcr if the error code isn't used currently, even. And > it uses mfcr always it seems, not mfocrf, or directly use the bit like in > a conditional branch insn or an isel or whatnot.
It's hard-coded in the glibc inline assembler fragment for system calls. I don't think the x/y constraints work in extended asm, despite being documented in the manual. If they did, we could output the condition register to a variable, say err, and then write err & (1 << 28) for the error check. GCC could then figure out that this actually checks the condition register and use it directly. Thanks, Florian