You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
define double @foo(double %x) {
%y = mul double %x, 5.000000e-01
ret double %y
}
llc -march=x86-64 currently produces a 32-bit constant pool entry and this code:
cvtss2sd .LCPI1_0(%rip), %xmm1
mulsd %xmm1, %xmm0
instead of just using a 64-bit constant pool entry with this:
mulsd .LCPI1_0(%rip), %xmm0
This is due to the code in ExpandConstantFP in LegalizeDAG.cpp. It notices that
x86-64 indeed has an instruction to load a 32-bit float from memory and convert
it into a 64-bit float in a register, however it doesn't notice that this isn't
beneficial because it prevents the load from being folded into the multiply.
The text was updated successfully, but these errors were encountered:
Ah, very interesting issue. I see two ways of tackling this:
legalizer could remain unmodified, and we could make the isel pass do something so that it matches
load+fpextend as a load. When this happened, the isel would have to make a new 64-bit CP entry.
We could disable this legalize xform for x86 and do isel as normal. We could then do the xform as
an xform after isel (at which point we will know if the load isn't folded). This could be done at sched
time.
#374 also seems less than ideal to me. It would require yet another specialized
post-isel pass.
I wonder if #1 can be done with a special isel patten that folds the load (only
from constantpool) and does the transform using a SDNodeXForm. Seems better than
adding the pass if that's possible.
Extended Description
For this test case:
define double @foo(double %x) {
%y = mul double %x, 5.000000e-01
ret double %y
}
llc -march=x86-64 currently produces a 32-bit constant pool entry and this code:
instead of just using a 64-bit constant pool entry with this:
This is due to the code in ExpandConstantFP in LegalizeDAG.cpp. It notices that
x86-64 indeed has an instruction to load a 32-bit float from memory and convert
it into a 64-bit float in a register, however it doesn't notice that this isn't
beneficial because it prevents the load from being folded into the multiply.
The text was updated successfully, but these errors were encountered: