[llvm] [AMDGPU] Rewrite `getVOP3DPPSrcForVT` with `!cond` (PR #81889)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 15 09:52:19 PST 2024
https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/81889
`!cond` is much more clear than nested `!if`.
>From 936ccb90785e2375f129173fb79c128fbe8c8470 Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Thu, 15 Feb 2024 12:51:36 -0500
Subject: [PATCH] [AMDGPU] Rewrite `getVOP3DPPSrcForVT` with `!cond`
`!cond` is much more clear than nested `!if`.
---
llvm/lib/Target/AMDGPU/SIInstrInfo.td | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
index 2b47686f23c238..4b7555de712c80 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
@@ -1571,13 +1571,15 @@ class getVOP3SrcForVT<ValueType VT, bit IsTrue16 = 0> {
// Src2 of VOP3 DPP instructions cannot be a literal
class getVOP3DPPSrcForVT<ValueType VT> {
RegisterOperand ret =
- !if (!eq(VT.Value, i1.Value), SSrc_i1,
- !if (VT.isFP,
- !if (!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)), VCSrc_f16,
- !if (!or(!eq(VT.Value, v2f16.Value), !eq(VT.Value, v2bf16.Value)), VCSrc_v2f16, VCSrc_f32)),
- !if (!eq(VT.Value, i16.Value), VCSrc_b16,
- !if (!eq(VT.Value, v2i16.Value), VCSrc_v2b16,
- VCSrc_b32))));
+ !cond(!eq(VT, i1) : SSrc_i1,
+ !eq(VT, i16) : VCSrc_b16,
+ !eq(VT, f16) : VCSrc_f16,
+ !eq(VT, bf16) : VCSrc_f16,
+ !eq(VT, v2i16) : VCSrc_v2b16,
+ !eq(VT, v2f16) : VCSrc_v2f16,
+ !eq(VT, v2bf16) : VCSrc_v2f16,
+ !eq(VT, f32) : VCSrc_f32,
+ 1 : VCSrc_b32);
}
// Float or packed int
More information about the llvm-commits
mailing list