[Bug target/82430] New: [4.9 Regression] Suboptimal code generated because of unnecessary "pxor xmm0, xmm0"
antoshkka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Oct 4 14:30:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82430
Bug ID: 82430
Summary: [4.9 Regression] Suboptimal code generated because of
unnecessary "pxor xmm0, xmm0"
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
Following code snippets
unsigned my_mul(unsigned a) {
return a * 1.5;
}
unsigned my_div(unsigned a) {
return a / 1.5;
}
Generate assemblies that have "pxor xmm0, xmm0" as a first instruction:
my_mul(unsigned int):
pxor xmm0, xmm0 <=== This is not necessary
mov edi, edi
cvtsi2sdq xmm0, rdi
mulsd xmm0, QWORD PTR .LC0[rip]
cvttsd2si rax, xmm0
ret
my_div(unsigned int):
pxor xmm0, xmm0 <=== This is not necessary
mov edi, edi
cvtsi2sdq xmm0, rdi
divsd xmm0, QWORD PTR .LC0[rip]
cvttsd2si rax, xmm0
ret
The regression was introduced with GCC 4.9. GCC-4.8 and previous versions were
generating assembly without pxor:
my_mul(unsigned int):
mov edi, edi
cvtsi2sd xmm0, rdi
mulsd xmm0, QWORD PTR .LC0[rip]
cvttsd2si rax, xmm0
ret
my_div(unsigned int):
mov edi, edi
cvtsi2sd xmm0, rdi
divsd xmm0, QWORD PTR .LC0[rip]
cvttsd2si rax, xmm0
ret
More information about the Gcc-bugs
mailing list