-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[AMDGPU] Rewrite getVOPSrc0ForVT
with !cond
#81956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-amdgpu Author: Shilei Tian (shiltian) ChangesFull diff: https://github.com/llvm/llvm-project/pull/81956.diff 1 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
index 4b7555de712c80..d9b9c85a0557c2 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
@@ -1488,37 +1488,25 @@ class getSDWADstForVT<ValueType VT> {
// instructions for the given VT.
class getVOPSrc0ForVT<ValueType VT, bit IsTrue16, bit IsFake16 = 1> {
RegisterOperand ret =
- !if(VT.isFP,
- !if(!eq(VT.Size, 64),
- VSrc_f64,
- !if(!or(!eq(VT.Value, f16.Value), !eq(VT.Value, bf16.Value)),
- !if(IsTrue16,
- !if(IsFake16, VSrcFake16_f16_Lo128, VSrcT_f16_Lo128),
- VSrc_f16
- ),
- !if(!or(!eq(VT.Value, v2f16.Value), !eq(VT.Value, v2bf16.Value)),
- VSrc_v2f16,
- !if(!or(!eq(VT.Value, v4f16.Value), !eq(VT.Value, v4bf16.Value)),
- AVSrc_64,
- VSrc_f32
- )
- )
- )
- ),
- !if(!eq(VT.Size, 64),
- VSrc_b64,
- !if(!eq(VT.Value, i16.Value),
- !if(IsTrue16,
- !if(IsFake16, VSrcFake16_b16_Lo128, VSrcT_b16_Lo128),
- VSrc_b16
- ),
- !if(!eq(VT.Value, v2i16.Value),
- VSrc_v2b16,
- VSrc_b32
- )
- )
- )
- );
+ !cond(!eq(VT, i64) : VSrc_b64,
+ !eq(VT, f64) : VSrc_f64,
+ !eq(VT, i32) : VSrc_b32,
+ !eq(VT, f32) : VSrc_f32,
+ !eq(VT, i16) : !if(IsTrue16,
+ !if(IsFake16, VSrcFake16_b16_Lo128, VSrcT_b16_Lo128),
+ VSrc_b16),
+ !eq(VT, f16) : !if(IsTrue16,
+ !if(IsFake16, VSrcFake16_f16_Lo128, VSrcT_f16_Lo128),
+ VSrc_f16),
+ !eq(VT, bf16) : !if(IsTrue16,
+ !if(IsFake16, VSrcFake16_f16_Lo128, VSrcT_f16_Lo128),
+ VSrc_f16),
+ !eq(VT, v2i16) : VSrc_v2b16,
+ !eq(VT, v2f16) : VSrc_v2f16,
+ !eq(VT, v2bf16) : VSrc_v2f16,
+ !eq(VT, v4f16) : AVSrc_64,
+ !eq(VT, v4bf16) : AVSrc_64,
+ 1 : VSrc_b32);
}
class getSOPSrcForVT<ValueType VT> {
|
!eq(VT, v4f16) : AVSrc_64, | ||
!eq(VT, v4bf16) : AVSrc_64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to common up all the pairs of cases that have the same result e.g.:
!eq(VT, v4f16) : AVSrc_64, | |
!eq(VT, v4bf16) : AVSrc_64, | |
!or(!eq(VT, v4f16), !eq(VT, v4bf16)) : AVSrc_64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, after #80056 is landed, the f16 and bf16 variants will not use same value.
OK.
No description provided.