[llvm] [AArch64][ISel] Use vector register for scalar CLMUL (PR #183282)
Matthew Devereau via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 03:18:23 PST 2026
================
@@ -8062,6 +8057,38 @@ SDValue AArch64TargetLowering::LowerFMA(SDValue Op, SelectionDAG &DAG) const {
return convertFromScalableVector(DAG, VT, ScalableRes);
}
+static SDValue LowerCLMUL(SDValue Op, SelectionDAG &DAG) {
+ SDLoc DL(Op);
+ EVT VT = Op.getValueType();
+ EVT VecVT = EVT::getVectorVT(*DAG.getContext(), VT, 64 / VT.getSizeInBits());
+ EVT CLMULTy = VT == MVT::i8 ? MVT::v8i8 : MVT::v1i64;
+ EVT ExtractTy = VT == MVT::i64 ? MVT::i64 : MVT::i32;
+ EVT ExtractVecTy = VT == MVT::i64 ? MVT::v1i64 : MVT::v2i32;
+
+ SDValue Op0 = Op.getOperand(0);
+ SDValue Op1 = Op.getOperand(1);
+ if (Op0.getOpcode() == ISD::TRUNCATE)
+ Op0 = Op0.getOperand(0);
+ if (Op1.getOpcode() == ISD::TRUNCATE)
+ Op1 = Op1.getOperand(0);
----------------
MDevereau wrote:
The dag can look like
```llvm
t2: i32,ch = CopyFromReg t0, Register:i32 %0
t5: i16 = truncate t2
t4: i32,ch = CopyFromReg t0, Register:i32 %1
t6: i16 = truncate t4
t7: i16 = clmul t5, t6
```
This is just reaching through the truncate to get the register in the i8 and i16 cases.
https://github.com/llvm/llvm-project/pull/183282
More information about the llvm-commits
mailing list