[Bug target/70465] [5/6 Regression] Poor code for x87 asm
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 21 15:03:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70465
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #16 from Uroš Bizjak <ubizjak at gmail dot com> ---
Looking at some other PR, I have noticed that following testcase:
--cut here--
extern float global_data[1024];
static long double MIN (long double a, long double b) { return a < b ? a : b; }
static long double MAX (long double a, long double b) { return a > b ? a : b; }
float bar (void)
{
long double delta = (global_data[0]);
return (MIN (MAX (delta, 0.0l), 1.0l));
}
--cut here--
compiles with -Ofast -mfpmath=387 to:
bar:
flds global_data(%rip)
fldz
fxch %st(1)
The above shows that we can also consider x87 constants and float-extend from
memory when avoiding fxchs:
__.297r.stack:
(insn:TI 6 13 37 2 (set (reg:XF 8 st)
(float_extend:XF (mem/c:SF (symbol_ref:DI ("global_data") [flags 0x40]
<var_decl 0x2ac721f3ae10 global_data>) [1 global_data+0 S4 A32])))
"pr79593.c":12 153 {*extendsfxf2_i387}
(nil))
(insn:TI 37 6 46 2 (set (reg:XF 8 st)
(const_double:XF 0.0 [0x0.0p+0])) "pr79593.c":8 123 {*movxf_internal}
(expr_list:REG_EQUAL (const_double:XF 0.0 [0x0.0p+0])
(nil)))
(insn 46 37 11 2 (parallel [
(set (reg:XF 9 st(1))
(reg:XF 8 st))
(set (reg:XF 8 st)
(reg:XF 9 st(1)))
]) "pr79593.c":8 -1
(nil))
More information about the Gcc-bugs
mailing list