[compiler-rt] [AMDGPU] Change the representation of double literals in operands (PR #68740)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 03:58:51 PDT 2023
================
@@ -4309,7 +4312,18 @@ bool AMDGPUAsmParser::validateVOPLiteral(const MCInst &Inst,
continue;
if (MO.isImm() && !isInlineConstant(Inst, OpIdx)) {
- uint32_t Value = static_cast<uint32_t>(MO.getImm());
+ uint64_t Value = static_cast<uint64_t>(MO.getImm());
+ bool IsFP = AMDGPU::isSISrcFPOperand(Desc, OpIdx);
+ bool IsValid32Op = AMDGPU::isValid32BitLiteral(Value, IsFP);
+
+ if (!IsValid32Op && !isInt<32>(Value) && !isUInt<32>(Value)) {
+ Error(getLitLoc(Operands), "invalid operand for instruction");
+ return false;
+ }
+
+ if (IsFP && IsValid32Op)
+ Value = Hi_32(Value);
----------------
jayfoad wrote:
> I also do not like changing isValid32BitLiteral's argument to IsFP64 as it brings even more context than it is needed.
The problem with calling it `IsFP` is that if I write this:
```
bool IsFP = AMDGPU::isSISrcFPOperand(Desc, OpIdx);
if (!AMDGPU::isValid32BitLiteral(Value, IsFP))
Error(getLitLoc(Operands), "invalid operand for instruction");
```
then all 16-bit FP operands are rejected. (Maybe all 32-bit ones too, I didn't check.)
https://github.com/llvm/llvm-project/pull/68740
More information about the llvm-commits
mailing list