[LLVMbugs] [Bug 7518] New: terrible codegen of <2 x float>
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jun 28 23:24:10 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7518
Summary: terrible codegen of <2 x float>
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
AssignedTo: unassignedbugs at nondot.org
ReportedBy: clattner at apple.com
CC: llvmbugs at cs.uiuc.edu
The X86 backend is generating awful code for 2x float. This is an important
type (which should use the low 8 bytes of an XMM register) because they x86-64
ABI can be most efficiently expressed with 2 x float for structs that contain
multiple floats. Something like "struct {float a,b,c,d;}" end up being passed
as two <2x float>. Anyway, this:
define void @_Z3barR6Floats(<2 x float> %Q, float *%P2) nounwind {
%a = extractelement <2 x float> %Q, i32 0
%b = extractelement <2 x float> %Q, i32 1
%c = fadd float %a, %b
store float %c, float* %P2
ret void
}
Compiles to:
__Z3barR6Floats: ## @_Z3barR6Floats
## BB#0:
movq %xmm0, -16(%rsp)
movq %xmm0, -8(%rsp)
movss -16(%rsp), %xmm0
addss -4(%rsp), %xmm0
movss %xmm0, (%rdi)
ret
But this (which is the same semantics):
define void @_Z3barR6Floats(<4 x float> %Q, float *%P2) nounwind {
%a = extractelement <4 x float> %Q, i32 0
%b = extractelement <4 x float> %Q, i32 1
%c = fadd float %a, %b
store float %c, float* %P2
ret void
}
compiles to:
__Z3barR6Floats: ## @_Z3barR6Floats
## BB#0:
pshufd $1, %xmm0, %xmm1
addss %xmm0, %xmm1
movss %xmm1, (%rdi)
ret
Hopefully this is a simple type legalizer issue?
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list