[llvm] [AMDGPU] Replace `isInlinableLiteral16` with specific version (PR #81345)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 28 23:38:53 PST 2024
================
@@ -15374,16 +15374,28 @@ bool SITargetLowering::checkAsmConstraintVal(SDValue Op, StringRef Constraint,
llvm_unreachable("Invalid asm constraint");
}
-bool SITargetLowering::checkAsmConstraintValA(SDValue Op,
- uint64_t Val,
+bool SITargetLowering::checkAsmConstraintValA(SDValue Op, uint64_t Val,
unsigned MaxSize) const {
unsigned Size = std::min<unsigned>(Op.getScalarValueSizeInBits(), MaxSize);
bool HasInv2Pi = Subtarget->hasInv2PiInlineImm();
- if ((Size == 16 && AMDGPU::isInlinableLiteral16(Val, HasInv2Pi)) ||
- (Size == 32 && AMDGPU::isInlinableLiteral32(Val, HasInv2Pi)) ||
- (Size == 64 && AMDGPU::isInlinableLiteral64(Val, HasInv2Pi))) {
- return true;
+ if (Size == 16) {
+ MVT VT = Op.getSimpleValueType();
+ if (VT == MVT::i16 && AMDGPU::isInlinableLiteralI16(Val, HasInv2Pi))
+ return true;
+ if (VT == MVT::f16 && AMDGPU::isInlinableLiteralFP16(Val, HasInv2Pi))
+ return true;
+ if (VT == MVT::bf16 && AMDGPU::isInlinableLiteralBF16(Val, HasInv2Pi))
+ return true;
+ if (VT == MVT::v2i16 && AMDGPU::getInlineEncodingV2I16(Val).has_value())
+ return true;
+ if (VT == MVT::v2f16 && AMDGPU::getInlineEncodingV2F16(Val).has_value())
+ return true;
+ if (VT == MVT::v2bf16 && AMDGPU::getInlineEncodingV2BF16(Val).has_value())
+ return true;
----------------
arsenm wrote:
switch (VT.SimpleTy)
https://github.com/llvm/llvm-project/pull/81345
More information about the llvm-commits
mailing list