[Bug middle-end/96175] New: Failure to optimize memory stores of double literals properly
gabravier at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 12 17:02:55 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96175
Bug ID: 96175
Summary: Failure to optimize memory stores of double literals
properly
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
void f(double *x)
{
*x = 1.0;
}
With -O3, LLVM generates this :
f(double*): # @f(double*)
movabs rax, 4607182418800017408
mov qword ptr [rdi], rax
ret
GCC generates this :
f(double*):
mov rax, QWORD PTR .LC0[rip]
mov QWORD PTR [rdi], rax
ret
.LC0:
.long 0
.long 1072693248
This also occurs on every other architecture I tested (arm and powerpc64le,
though only with GCC 9). GCC is weirdly insistent on having a literal stored in
const data instead of just having it in the code, which seems inefficient.
More information about the Gcc-bugs
mailing list