https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116849
Bug ID: 116849
Summary: [SH] Redundant fp mode switch at function entry
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: olegendo at gcc dot gnu.org
Target Milestone: ---
The following example, when compiled as C (not as C++) on sh-elf with -O2
-m4-single
-----------
typedef _Complex float tuplef_t;
static inline tuplef_t make_tuplef(float first, float second)
{
return (tuplef_t){ first, second };
}
tuplef_t get_my_tuplef()
{
return make_tuplef(12.3f, 15.4f);
}
-----------
sts fpscr,r1
mov.l .L3,r2
mova .L4,r0
fmov.s @r0+,fr2
and r2,r1 // & ~(1<<19), i.e. clear FPSCR.PR bit,
lds r1,fpscr // i.e. switch to single-fp mode
fldi0 fr1
rts
fmov fr2,fr0
.L5:
.align 2
.L3:
.long -524289
.L4:
.long 1095027917
The inserted mode switch is redundant, as the mode is known to be in "single
precision mode" at function entry.