Skip to content

[AMDGPU][NFC] Simplify assertions - #206126

Merged
piotrAMD merged 1 commit into
llvm:mainfrom
piotrAMD:assert_again
Jun 26, 2026
Merged

[AMDGPU][NFC] Simplify assertions#206126
piotrAMD merged 1 commit into
llvm:mainfrom
piotrAMD:assert_again

Conversation

@piotrAMD

Copy link
Copy Markdown
Contributor

Replace assertions that listed concrete types with generic ones that check that the type is a vector with an even number of elements.

Update splitUnary and splitBinary.

I already updated splitBinary and splitTernary in #203472, but splitBinary change was accidentally removed in #203607, so I am bringing it back in.

Replace assertions that listed concrete types with generic
ones that check that the type is a vector with an even number
of elements.

Update splitUnary and splitBinary.

I already updated splitBinary and splitTernary in llvm#203472, but
splitBinary change was accidentally removed in llvm#203607, so
I am bringing it back in.
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-backend-amdgpu

Author: Piotr Sobczak (piotrAMD)

Changes

Replace assertions that listed concrete types with generic ones that check that the type is a vector with an even number of elements.

Update splitUnary and splitBinary.

I already updated splitBinary and splitTernary in #203472, but splitBinary change was accidentally removed in #203607, so I am bringing it back in.


Full diff: https://github.com/llvm/llvm-project/pull/206126.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIISelLowering.cpp (+2-15)
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index a5b331b6e076f..3a80cfec33b23 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -7463,13 +7463,7 @@ SDValue SITargetLowering::splitUnaryVectorOp(SDValue Op,
                                              SelectionDAG &DAG) const {
   unsigned Opc = Op.getOpcode();
   EVT VT = Op.getValueType();
-  assert(VT == MVT::v4i16 || VT == MVT::v4f16 || VT == MVT::v4bf16 ||
-         VT == MVT::v4f32 || VT == MVT::v8i16 || VT == MVT::v8f16 ||
-         VT == MVT::v8bf16 || VT == MVT::v16i16 || VT == MVT::v16f16 ||
-         VT == MVT::v16bf16 || VT == MVT::v8f32 || VT == MVT::v16f32 ||
-         VT == MVT::v32f32 || VT == MVT::v32i16 || VT == MVT::v32f16 ||
-         VT == MVT::v32bf16 || VT == MVT::v4f64 || VT == MVT::v8f64 ||
-         VT == MVT::v16f64 || VT == MVT::v32f64);
+  assert(VT.isVector() && VT.getVectorElementCount().isKnownEven());
 
   auto [Lo, Hi] = DAG.SplitVectorOperand(Op.getNode(), 0);
   auto [LoVT, HiVT] = DAG.GetSplitDestVTs(VT);
@@ -7509,14 +7503,7 @@ SDValue SITargetLowering::splitBinaryVectorOp(SDValue Op,
                                               SelectionDAG &DAG) const {
   unsigned Opc = Op.getOpcode();
   EVT VT = Op.getValueType();
-  assert(VT == MVT::v4i16 || VT == MVT::v4f16 || VT == MVT::v4bf16 ||
-         VT == MVT::v4f32 || VT == MVT::v8i16 || VT == MVT::v8f16 ||
-         VT == MVT::v8bf16 || VT == MVT::v16i16 || VT == MVT::v16f16 ||
-         VT == MVT::v16bf16 || VT == MVT::v8f32 || VT == MVT::v16f32 ||
-         VT == MVT::v32f32 || VT == MVT::v32i16 || VT == MVT::v32f16 ||
-         VT == MVT::v32bf16 || VT == MVT::v4f64 || VT == MVT::v8f64 ||
-         VT == MVT::v16f64 || VT == MVT::v32f64 || VT == MVT::v4i64 ||
-         VT == MVT::v8i64 || VT == MVT::v16i64 || VT == MVT::v32i64);
+  assert(VT.isVector() && VT.getVectorElementCount().isKnownEven());
 
   auto [Lo0, Hi0] = DAG.SplitVectorOperand(Op.getNode(), 0);
   auto [Lo1, Hi1] = DAG.SplitVectorOperand(Op.getNode(), 1);

@piotrAMD
piotrAMD merged commit fd917a0 into llvm:main Jun 26, 2026
13 checks passed
LouisLu060211 pushed a commit to LouisLu060211/llvm-project that referenced this pull request Jun 30, 2026
Replace assertions that listed concrete types with generic ones that
check that the type is a vector with an even number of elements.

Update splitUnary and splitBinary.

I already updated splitBinary and splitTernary in llvm#203472, but
splitBinary change was accidentally removed in llvm#203607, so I am bringing
it back in.
maarcosrmz pushed a commit to maarcosrmz/llvm-project that referenced this pull request Jul 1, 2026
Replace assertions that listed concrete types with generic ones that
check that the type is a vector with an even number of elements.

Update splitUnary and splitBinary.

I already updated splitBinary and splitTernary in llvm#203472, but
splitBinary change was accidentally removed in llvm#203607, so I am bringing
it back in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants