diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -3012,6 +3012,17 @@ return Error(NameLoc, "'data32' is not supported in 64-bit mode"); // Hack to 'data16' for the table lookup. PatchedName = "data16"; + + if (getLexer().isNot(AsmToken::EndOfStatement)) { + StringRef Next = Parser.getTok().getString(); + // Parse data32 call as calll. + if (Next == "call" || Next == "callw") { + getLexer().Lex(); + Name = "calll"; + PatchedName = Name; + isPrefix = false; + } + } } Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc)); diff --git a/llvm/test/MC/X86/data-prefix-fail.s b/llvm/test/MC/X86/data-prefix-fail.s --- a/llvm/test/MC/X86/data-prefix-fail.s +++ b/llvm/test/MC/X86/data-prefix-fail.s @@ -23,3 +23,6 @@ // 32: encoding: [0x0f,0x01,0x15,0x00,0x00,0x00,0x00] // ERR16: error: redundant data16 prefix data16 lgdt 0 + +// ERR16: {{.*}}.s:[[#@LINE+1]]:1: error: redundant data16 prefix +data16 call 0 diff --git a/llvm/test/MC/X86/x86-16.s b/llvm/test/MC/X86/x86-16.s --- a/llvm/test/MC/X86/x86-16.s +++ b/llvm/test/MC/X86/x86-16.s @@ -546,8 +546,12 @@ jmp $0x7ace,$0x7ace ljmp $0x7ace,$0x7ace +// CHECK: calll a +// CHECK: calll a // CHECK: calll a calll a +data32 call a +data32 callw a // CHECK: incb %al # encoding: [0xfe,0xc0] incb %al