[llvm] [DAG] Enable bitcast STLF for Constant/Undef (PR #172523)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 10 06:39:41 PST 2026
KennethHilmersson wrote:
This does not work for our out of tree big-endian target. Something like this is missing (for the current
code that only support offset=0):
```@@ -20874,8 +20874,17 @@ SDValue DAGCombiner::ForwardStoreValueToDirectLoad(LoadSDNode *LD) {
if (!TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, InterVT))
break;
+ // In case of big-endian the offset is normalized to zero, denoting
+ // the last bit. For big-endian we need to transform the extraction
+ // to the last sub-vector.
+ unsigned ExtIdx = 0;
+ if (DAG.getDataLayout().isBigEndian()) {
+ ExtIdx =
+ InterVT.getVectorNumElements() - LDMemType.getVectorNumElements();
+ }
+
Val = DAG.getExtractSubvector(SDLoc(LD), LDMemType,
- DAG.getBitcast(InterVT, Val), 0);
+ DAG.getBitcast(InterVT, Val), ExtIdx);
} else if (!STMemType.isVector() && !LDMemType.isVector() &&
STMemType.isInteger() && LDMemType.isInteger())
Val = DAG.getNode(ISD::TRUNCATE, SDLoc(LD), LDMemType, Val);```
https://github.com/llvm/llvm-project/pull/172523
More information about the llvm-commits
mailing list