// If that fails, try against the alternate table containing long-form NEON:
// "fadd v0.2s, v1.2s, v2.2s"
+ // But first, save the ErrorInfo: we can use it in case this try also fails.
+ uint64_t ShortFormNEONErrorInfo = ErrorInfo;
if (MatchResult != Match_Success)
MatchResult =
MatchInstructionImpl(Operands, Inst, ErrorInfo, MatchingInlineAsm, 0);
return showMatchError(IDLoc, MatchResult);
case Match_InvalidOperand: {
SMLoc ErrorLoc = IDLoc;
+
+ // If the long-form match failed on the mnemonic suffix token operand,
+ // the short-form match failure is probably more relevant: use it instead.
+ if (ErrorInfo == 1 &&
+ ((AArch64Operand &)*Operands[1]).isToken() &&
+ ((AArch64Operand &)*Operands[1]).isTokenSuffix())
+ ErrorInfo = ShortFormNEONErrorInfo;
+
if (ErrorInfo != ~0ULL) {
if (ErrorInfo >= Operands.size())
return Error(IDLoc, "too few operands for instruction");
; CHECK-ERRORS: error: specified tlbi op requires a register
tlbi vale3
; CHECK-ERRORS: error: specified tlbi op requires a register
+
+
+; Check that we give the proper "too few operands" diagnostic even when
+; using short-form NEON.
+
+ add.16b v0, v1, v2, v3
+ add.8b v0, v1
+ sub.8h v0, v1
+ fadd.4s v0
+ fmul.2s
+
+; CHECK-ERRORS: error: invalid operand for instruction
+; CHECK-ERRORS: add.16b v0, v1, v2, v3
+; CHECK-ERRORS: ^
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: add.8b v0, v1
+; CHECK-ERRORS: ^
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: sub.8h v0, v1
+; CHECK-ERRORS: ^
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: fadd.4s v0
+; CHECK-ERRORS: ^
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: fmul.2s
+; CHECK-ERRORS: ^
+
+; Also for 2-operand instructions.
+
+ frsqrte.4s v0, v1, v2
+ frsqrte.2s v0
+ frecpe.2d
+
+; CHECK-ERRORS: error: invalid operand for instruction
+; CHECK-ERRORS: frsqrte.4s v0, v1, v2
+; CHECK-ERRORS ^
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: frsqrte.2s v0
+; CHECK-ERRORS: ^
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: frecpe.2d
+; CHECK-ERRORS: ^
+
+; And check that we do the same for non-NEON instructions.
+
+ b.ne
+ b.eq 0, 0
+
+; CHECK-ERRORS: error: too few operands for instruction
+; CHECK-ERRORS: b.ne
+; CHECK-ERRORS: ^
+; CHECK-ERRORS: error: invalid operand for instruction
+; CHECK-ERRORS: b.eq 0, 0
+; CHECK-ERRORS: ^