https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125385
Bug ID: 125385
Summary: Expand ((float)a) CMP ((float)b) to use the ranges
rather than the just type
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: easyhack, missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
int f0(int a, int b)
{
a &=0xff;
b &=0xff;
return (float) a < (float) b;
}
int f1(int a, int b)
{
unsigned char aa = a;
unsigned char bb = b;
return (float) aa < (float) bb;
}
```
Both of these should optimized to the same but currently does not since we only
look at the precission of the type of int rather than the range of a to see we
could fit it into a float.