https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101617
Bug ID: 101617
Summary: a ? -1 : 1 -> (-(type)a) | 1
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
I noticed this while looking through a few bug reports but it deals with <=>
too.
Take:
int f(int i)
{
int t = i ? -1 : 0;
return t | 1;
}
int f1(int i)
{
return i ? -1 : 1;
}
------- CUT ------
These two should produce the same code generation.
Filing so I don't lose this while I am going through bug reports.