https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126607

            Bug ID: 126607
           Summary: ((float)unsigned_short) - FPCST where FPCST is a whole
                    number can be convert into (float)(unsigned_short -
                    CST)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
unsigned short f();

float g(unsigned short t)
{
  return 2768.0 - t;
}
```

This can be just:
```
float g1(unsigned short t)
{
  return (2768 - t);
}
```

this shows up in ffmpeg:
https://github.com/FFmpeg/FFmpeg/blob/a7e72069f15efbef1e25b25d35c4e0511b43262e/libavcodec/amrwbdec.c#L915-L917

Reply via email to