[llvm] [X86] foldMemoryOperandCustom - attempt to load-fold with a VEXTRACTF128/I128 into a regular load (PR #137316)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 08:12:17 PDT 2025


================
@@ -1743,11 +1743,9 @@ define <8 x bfloat> @fptrunc_v8f64(<8 x double> %a) nounwind {
 ; AVXNC-NEXT:    # xmm0 = mem[1,0]
 ; AVXNC-NEXT:    callq __truncdfbf2 at PLT
 ; AVXNC-NEXT:    vmovapd %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
-; AVXNC-NEXT:    vmovupd {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
-; AVXNC-NEXT:    vextractf128 $1, %ymm0, %xmm0
+; AVXNC-NEXT:    vmovapd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 32-byte Reload
----------------
RKSimon wrote:

what these cases are doing is:
```
SPILL YMM
RELOAD YMM (only use of spill)
EXTRACT_SUBVECTOR YMM -> XMM (only use of YMM reload)
```
what would be better is forcing this to:
```
EXTRACT_SUBVECTOR YMM -> XMM (this could then fold into the spill store)
SPILL XMM
RELOAD XMM
```

https://github.com/llvm/llvm-project/pull/137316


More information about the llvm-commits mailing list