https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126265
Bug ID: 126265
Summary: If a and b in (CST, CST + 1), then .SPACESHIP (a, b,
-1) is a - b
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kaelfandrew at gmail dot com
Target Milestone: ---
Created attachment 65045
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65045&action=edit
C code
https://godbolt.org/z/83v1zqE6s
With -O3:
.SPACESHIP (a_7(D), b_8(D), -1)
should optimize to a - b if a and b in (CST, CST + 1).
This is similar to pr126227 cmp_int_asc_branchless ().