https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125594
Bug ID: 125594
Summary: Missed optimization of a * bool <-> bool ? a : 0
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: kaelfandrew at gmail dot com
Target Milestone: ---
Created attachment 64620
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64620&action=edit
C code
https://godbolt.org/z/bqqMa5Toq
With flags -O3, some targets like loongarch64 can benefit from f1 and f2 to g1
and g2 respectively on optimization. Other targets like BPF seem better to
optimize g1 and g2 to f1 and f2 respectively since g1/g2 use more registers
than f1/f2 and has if condition.