https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95737
--- Comment #4 from wschmidt at linux dot ibm.com --- On 6/19/20 12:43 PM, jens.seifert at de dot ibm.com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95737 > > Jens Seifert <jens.seifert at de dot ibm.com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|RESOLVED |UNCONFIRMED > Resolution|DUPLICATE |--- > > --- Comment #3 from Jens Seifert <jens.seifert at de dot ibm.com> --- > This is different as the extsw also happens if the result gets used e.g. > followed by a andc, which is my case. I obviously oversimplified the sample. > It > has nothing to do with function result and ABI requirements. gcc assume that > the result of -(a < b) implemented by subfc, subfe is signed 32-bit. But the > result is already 64-bit. > > unsigned long long branchlesconditional(unsigned long long a, unsigned long > long b, unsigned long long c) > { > unsigned long long mask = -(a < b); > return c &~ mask; > } > > results in > > _Z20branchlesconditionalyyy: > .LFB1: > .cfi_startproc > subfc 4,4,3 > subfe 3,3,3 > not 3,3 > extsw 3,3 > and 3,3,5 > blr > > expected > subfc > subfe > andc > Thanks for verifying, Jens!