[llvm] [AMDGPU][SDAG] Legalise v2i32 or/xor/and instructions to make use of 64-bit wide instructions (PR #140694)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 24 04:37:35 PDT 2025


================
@@ -13180,13 +13245,42 @@ SDValue SITargetLowering::performXorCombine(SDNode *N,
   if (SDValue RV = reassociateScalarOps(N, DCI.DAG))
     return RV;
 
+  SelectionDAG &DAG = DCI.DAG;
+  EVT VT = N->getValueType(0);
   SDValue LHS = N->getOperand(0);
   SDValue RHS = N->getOperand(1);
 
+  // Fold the fneg of a vselect into the v2 vselect operands.
+  // xor (vselect c, a, b), 0x80000000 ->
+  //   bitcast (vselect c, (fneg (bitcast a)), (fneg (bitcast b)))
+  if (VT == MVT::v2i32 && LHS.getNumOperands() > 1) {
----------------
arsenm wrote:

I'm not sure why you're considering VSELECT and not just SELECT. We don't have legal VSELECT, and don't really care about it 

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


More information about the llvm-commits mailing list