public:
enum X86MatchResultTy {
Match_Unsupported = FIRST_TARGET_MATCH_RESULT_TY,
+#define GET_OPERAND_DIAGNOSTIC_TYPES
+#include "X86GenAsmMatcher.inc"
};
X86AsmParser(const MCSubtargetInfo &sti, MCAsmParser &Parser,
EmitInstruction(Inst, Operands, Out);
Opcode = Inst.getOpcode();
return false;
+ case Match_InvalidImmUnsignedi4: {
+ SMLoc ErrorLoc = ((X86Operand &)*Operands[ErrorInfo]).getStartLoc();
+ if (ErrorLoc == SMLoc())
+ ErrorLoc = IDLoc;
+ return Error(ErrorLoc, "immediate must be an integer in range [0, 15]",
+ EmptyRange, MatchingInlineAsm);
+ }
case Match_MissingFeature:
return ErrorMissingFeature(IDLoc, MissingFeatures, MatchingInlineAsm);
case Match_InvalidOperand:
MatchingInlineAsm);
}
+ if (std::count(std::begin(Match), std::end(Match),
+ Match_InvalidImmUnsignedi4) == 1) {
+ SMLoc ErrorLoc = ((X86Operand &)*Operands[ErrorInfo]).getStartLoc();
+ if (ErrorLoc == SMLoc())
+ ErrorLoc = IDLoc;
+ return Error(ErrorLoc, "immediate must be an integer in range [0, 15]",
+ EmptyRange, MatchingInlineAsm);
+ }
+
// If all of these were an outright failure, report it in a useless way.
return Error(IDLoc, "unknown instruction mnemonic", EmptyRange,
MatchingInlineAsm);
bool isImmUnsignedi4() const {
if (!isImm()) return false;
- // If this isn't a constant expr, just assume it fits and let relaxation
- // handle it.
+ // If this isn't a constant expr, reject it. The immediate byte is shared
+ // with a register encoding. We can't have it affected by a relocation.
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
- if (!CE) return true;
+ if (!CE) return false;
return isImmUnsignedi4Value(CE->getValue());
}
// 64: error: unsupported instruction
{evex} vmovdqu %xmm0, %xmm0
-// 32: 12: error: invalid operand for instruction
-// 64: 12: error: invalid operand for instruction
+// 32: 12: error: immediate must be an integer in range [0, 15]
+// 64: 12: error: immediate must be an integer in range [0, 15]
vpermil2pd $16, %xmm3, %xmm5, %xmm1, %xmm2