[llvm-bugs] [Bug 51091] New: Failure to widen loads from wider dereferenceable pointers
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 14 09:43:58 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51091
Bug ID: 51091
Summary: Failure to widen loads from wider dereferenceable
pointers
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: a.bataev at hotmail.com, craig.topper at gmail.com,
lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, pengfei.wang at intel.com,
spatel+llvm at rotateright.com
If we have generated this:
define float @Dot01(float* dereferenceable(16) %a0, float* dereferenceable(16)
%a1) {
%bcx01 = bitcast float* %a0 to <2 x float>*
%bcy01 = bitcast float* %a1 to <2 x float>*
%x01 = load <2 x float>, <2 x float>* %bcx01, align 4
%y01 = load <2 x float>, <2 x float>* %bcy01, align 4
%mul01 = fmul <2 x float> %x01, %y01
%mul0 = extractelement <2 x float> %mul01, i32 0
%mul1 = extractelement <2 x float> %mul01, i32 1
%dot01 = fadd float %mul0, %mul1
ret float %dot01
}
llc -mcpu=znver2
Dot01:
vmovsd (%rdi), %xmm0 # xmm0 = mem[0],zero
vmovsd (%rsi), %xmm1 # xmm1 = mem[0],zero
vmulps %xmm1, %xmm0, %xmm0
vmovshdup %xmm0, %xmm1 # xmm1 = xmm0[1,1,3,3]
vaddss %xmm1, %xmm0, %xmm0
retq
As we know that the pointers at (%rdi) and (%rsi) are both dereferenceable
across the full 16 bytes - why can't we load full float4 loads, which would let
us fold at least one of the loads:
Dot01:
vmovups (%rdi), %xmm0
vmulps (%rsi), %xmm0, %xmm0
vmovshdup %xmm0, %xmm1 # xmm1 = xmm0[1,1,3,3]
vaddss %xmm1, %xmm0, %xmm0
retq
(I'm not sure if we can perform this generally in DAG or VectorCombine or
whether we should just handle it inside x86's EltsFromConsecutiveLoads or
something).
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210714/fa6399e4/attachment.html>
More information about the llvm-bugs
mailing list