https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106592
Bug ID: 106592 Summary: s390: Inefficient branchless conditionals for long long Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jens.seifert at de dot ibm.com Target Milestone: --- Created attachment 53443 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53443&action=edit source code long long gtRef(long long a, long long b) { return a > b; } Generates: cgr %r2,%r3 lghi %r1,0 lghi %r2,1 locgrnh %r2,%r1 Better sequence: cgr %r2,%r3 lghi %r2,0 alcgr %r2,%r2 long long leMaskRef(long long a, long long b) { return -(a <= b); } Generates: cgr %r2,%r3 lhi %r1,0 lhi %r2,1 locrnle %r2,%r1 sllg %r2,%r2,63 srag %r2,%r2,63 Better sequence: cgr %r2,%r3 slbgr %r2,%r2 long long gtMaskRef(long long a, long long b) { return -(a > b); } Generates: cgr %r2,%r3 lhi %r1,0 lhi %r2,1 locrnh %r2,%r1 sllg %r2,%r2,63 srag %r2,%r2,63 Better sequence: cgr %r2,%r3 lghi %r2,0 alcgr %r2,%r2 lcgr %r2,%r2