[llvm] [LLVM][AArch64] Improve big endian code generation for SVE BITCASTs. (PR #104769)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 10:51:52 PDT 2024
================
@@ -28877,7 +28885,20 @@ SDValue AArch64TargetLowering::getSVESafeBitCast(EVT VT, SDValue Op,
if (InVT != PackedInVT)
Op = DAG.getNode(AArch64ISD::REINTERPRET_CAST, DL, PackedInVT, Op);
- Op = DAG.getNode(ISD::BITCAST, DL, PackedVT, Op);
+ if (Subtarget->isLittleEndian() ||
+ PackedVT.getScalarSizeInBits() == PackedInVT.getScalarSizeInBits())
+ Op = DAG.getNode(ISD::BITCAST, DL, PackedVT, Op);
+ else {
+ EVT PackedVTAsInt = PackedVT.changeTypeToInteger();
+ EVT PackedInVTAsInt = PackedInVT.changeTypeToInteger();
+
+ // Simulate the effect of casting through memory.
+ Op = DAG.getNode(ISD::BITCAST, DL, PackedInVTAsInt, Op);
+ Op = DAG.getNode(ISD::BSWAP, DL, PackedInVTAsInt, Op);
----------------
paulwalker-arm wrote:
For context https://github.com/llvm/llvm-project/pull/104820/commits/245d3c6491fdcacd29dbaf632741072e48865803 contains the fixes I'm referring to above. You'll see this still affects some of the big endian bitcast tests but it's more contained (albeit I've not verified the changes are all correct yet). That PR is still a work in progress.
https://github.com/llvm/llvm-project/pull/104769
More information about the llvm-commits
mailing list