https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94795
Bug ID: 94795 Summary: Failure to use fast sbb method on x86 for spreading any set bit to all bits Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- int isNonzero(int x) { if (x == 0) return 0x00000000; else return 0xFFFFFFFF; } On x86, this can be simplified to a `neg`+`sbb`. LLVM does this transformation, but GCC doesn't Comparison here : https://godbolt.org/z/QFz9to