def FPImmOperand : AsmOperandClass {
let Name = "FPImm";
let ParserMethod = "tryParseFPImm";
+ let DiagnosticType = "InvalidFPImm";
}
def CondCode : AsmOperandClass {
// as we handle that special case in post-processing before matching in
// order to use the zero register for it.
if (Val == -1 && !RealVal.isZero()) {
- TokError("floating point value out of range");
+ TokError("expected compatible register or floating-point constant");
return MatchOperand_ParseFail;
}
Operands.push_back(ARM64Operand::CreateFPImm(Val, S, getContext()));
if (getLexer().is(AsmToken::Hash))
Parser.Lex();
+ // Parse a negative sign
+ bool isNegative = false;
+ if (Parser.getTok().is(AsmToken::Minus)) {
+ isNegative = true;
+ // We need to consume this token only when we have a Real, otherwise
+ // we let parseSymbolicImmVal take care of it
+ if (Parser.getLexer().peekTok().is(AsmToken::Real))
+ Parser.Lex();
+ }
+
// The only Real that should come through here is a literal #0.0 for
// the fcmp[e] r, #0.0 instructions. They expect raw token operands,
// so convert the value.
Mnemonic != "fcmge" && Mnemonic != "fcmgt" && Mnemonic != "fcmle" &&
Mnemonic != "fcmlt")
return TokError("unexpected floating point literal");
- else if (IntVal != 0)
- return TokError("only valid floating-point immediate is #0.0");
+ else if (IntVal != 0 || isNegative)
+ return TokError("expected floating-point constant #0.0");
Parser.Lex(); // Eat the token.
Operands.push_back(
case Match_AddSubRegShift64:
return Error(Loc,
"expected 'lsl', 'lsr' or 'asr' with optional integer in range [0, 63]");
+ case Match_InvalidFPImm:
+ return Error(Loc,
+ "expected compatible register or floating-point constant");
case Match_InvalidMemoryIndexedSImm9:
return Error(Loc, "index must be an integer in range [-256, 255].");
case Match_InvalidMemoryIndexed32SImm7:
case Match_AddSubRegShift64:
case Match_InvalidMovImm32Shift:
case Match_InvalidMovImm64Shift:
+ case Match_InvalidFPImm:
case Match_InvalidMemoryIndexed8:
case Match_InvalidMemoryIndexed16:
case Match_InvalidMemoryIndexed32SImm7:
// CHECK-AARCH64-ERROR: fcmeq v0.8b, v1.4h, #1
// CHECK-AARCH64-ERROR: ^
-// CHECK-ARM64-ERROR: error: only valid floating-point immediate is #0.0
+// CHECK-ARM64-ERROR: error: expected floating-point constant #0.0
// CHECK-ARM64-ERROR: fcmeq v0.8b, v1.4h, #1.0
// CHECK-ARM64-ERROR: ^
// CHECK-ARM64-ERROR: error: invalid operand for instruction
// CHECK-AARCH64-ERROR: fcmle v17.8h, v15.2d, #2
// CHECK-AARCH64-ERROR: ^
-// CHECK-ARM64-ERROR: error: invalid operand for instruction
+// CHECK-ARM64-ERROR: error: expected floating-point constant #0.0
// CHECK-ARM64-ERROR: fcmle v17.8h, v15.2d, #-1.0
// CHECK-ARM64-ERROR: ^
// CHECK-ARM64-ERROR: error: invalid operand for instruction
// CHECK-AARCH64-ERROR: fcmlt v29.2d, v5.2d, #255
// CHECK-AARCH64-ERROR: ^
-// CHECK-ARM64-ERROR: error: only valid floating-point immediate is #0.0
+// CHECK-ARM64-ERROR: error: expected floating-point constant #0.0
// CHECK-ARM64-ERROR: fcmlt v29.2d, v5.2d, #255.0
// CHECK-ARM64-ERROR: ^
// CHECK-ARM64-ERROR: error: invalid operand for instruction
// CHECK-AARCH64-ERROR: fcmle v17.2d, v15.2d, #15
// CHECK-AARCH64-ERROR: ^
-// CHECK-ARM64-ERROR: error: only valid floating-point immediate is #0.0
+// CHECK-ARM64-ERROR: error: expected floating-point constant #0.0
// CHECK-ARM64-ERROR: fcmle v17.2d, v15.2d, #15.0
// CHECK-ARM64-ERROR: ^
// CHECK-ARM64-ERROR: error: invalid operand for instruction
// CHECK-AARCH64-ERROR: fcmlt v29.2d, v5.2d, #2
// CHECK-AARCH64-ERROR: ^
-// CHECK-ARM64-ERROR: error: only valid floating-point immediate is #0.0
+// CHECK-ARM64-ERROR: error: expected floating-point constant #0.0
// CHECK-ARM64-ERROR: fcmlt v29.2d, v5.2d, #16.0
// CHECK-ARM64-ERROR: ^
// CHECK-ARM64-ERROR: error: invalid operand for instruction