]> granicus.if.org Git - llvm/commitdiff
[AMDGPU] Assembler: Fix parsing error with floating-point literals passed to integer...
authorSam Kolton <Sam.Kolton@amd.com>
Tue, 5 Jul 2016 14:01:11 +0000 (14:01 +0000)
committerSam Kolton <Sam.Kolton@amd.com>
Tue, 5 Jul 2016 14:01:11 +0000 (14:01 +0000)
Differential Revision: http://reviews.llvm.org/D21972

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274551 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
test/MC/AMDGPU/vop1.s
test/MC/AMDGPU/vop2.s

index 677e661c61317f29bc02d5ec286e6eafad5aa0c7..cc3e02bcadd385ea9bc16416bf72ddace0857b47 100644 (file)
@@ -1107,12 +1107,6 @@ AMDGPUAsmParser::parseRegOrImmWithIntInputMods(OperandVector &Operands) {
     return Res;
   }
 
-  AMDGPUOperand &Op = static_cast<AMDGPUOperand &>(*Operands.back());
-  if (Op.isImm() && Op.Imm.IsFPImm) {
-    Error(Parser.getTok().getLoc(), "floating point operands not allowed with sext() modifier");
-    return MatchOperand_ParseFail;
-  }
-
   AMDGPUOperand::Modifiers Mods = {false, false, false};
   if (Sext) {
     if (getLexer().isNot(AsmToken::RParen)) {
@@ -1124,6 +1118,7 @@ AMDGPUAsmParser::parseRegOrImmWithIntInputMods(OperandVector &Operands) {
   }
   
   if (Mods.hasIntModifiers()) {
+    AMDGPUOperand &Op = static_cast<AMDGPUOperand &>(*Operands.back());
     Op.setModifiers(Mods);
   }
   return MatchOperand_Success;
index 22a4f91afefa316fd24318369c27c50020d0903d..e82206a7ada8fc762f33bb54489d7bae9b412bb8 100644 (file)
@@ -374,3 +374,13 @@ v_sin_f16 v1, v2
 // NOSICI: v_cos_f16 v1, v2
 // VI: v_cos_f16_e32 v1, v2 ; encoding: [0x02,0x95,0x02,0x7e]
 v_cos_f16 v1, v2
+
+//===----------------------------------------------------------------------===//
+// Floating point literals
+//===----------------------------------------------------------------------===//
+
+// GCN: v_mov_b32_e32 v0, 0.5 ; encoding: [0xf0,0x02,0x00,0x7e]
+v_mov_b32 v0, 0.5
+
+// GCN: v_mov_b32_e32 v0, 0x40480000 ; encoding: [0xff,0x02,0x00,0x7e,0x00,0x00,0x48,0x40]
+v_mov_b32 v0, 3.125
\ No newline at end of file
index 0cb464ac9493e635030461d537576d277201ad21..b4a19fee2909ad09f14d417a1eca9146d0768a2f 100644 (file)
@@ -94,6 +94,14 @@ v_mul_i32_i24 v1, s2, 3
 // SICI: v_mul_i32_i24_e64 v1, 3, s3 ; encoding: [0x01,0x00,0x12,0xd2,0x83,0x06,0x00,0x00]
 v_mul_i32_i24 v1, 3, s3
 
+// SICI: v_add_i32_e32 v0, vcc, 0.5, v0 ; encoding: [0xf0,0x00,0x00,0x4a]
+// VI: v_add_i32_e32 v0, vcc, 0.5, v0 ; encoding: [0xf0,0x00,0x00,0x32]
+v_add_i32 v0, vcc, 0.5, v0
+
+// SICI: v_add_i32_e32 v0, vcc, 0x40480000, v0 ; encoding: [0xff,0x00,0x00,0x4a,0x00,0x00,0x48,0x40]
+// VI: v_add_i32_e32 v0, vcc, 0x40480000, v0 ; encoding: [0xff,0x00,0x00,0x32,0x00,0x00,0x48,0x40]
+v_add_i32 v0, vcc, 3.125, v0
+
 //===----------------------------------------------------------------------===//
 // Instructions
 //===----------------------------------------------------------------------===//