Index: lib/Target/X86/Disassembler/X86Disassembler.cpp =================================================================== --- lib/Target/X86/Disassembler/X86Disassembler.cpp +++ lib/Target/X86/Disassembler/X86Disassembler.cpp @@ -553,6 +553,12 @@ if(immediate & 0x80) immediate |= ~(0xffull); break; + case TYPE_REL16: + isBranch = true; + pcrel = insn.startLocation + insn.immediateOffset + insn.immediateSize; + if(immediate & 0x8000) + immediate |= ~(0xffffull); + break; case TYPE_REL32: case TYPE_REL64: isBranch = true; Index: test/MC/Disassembler/X86/x86-16.txt =================================================================== --- test/MC/Disassembler/X86/x86-16.txt +++ test/MC/Disassembler/X86/x86-16.txt @@ -786,3 +786,5 @@ # CHECK: lretl 0x66 0xcb +# CHECK: callw -1 +0xe8 0xff 0xff Index: test/MC/Disassembler/X86/x86-32.txt =================================================================== --- test/MC/Disassembler/X86/x86-32.txt +++ test/MC/Disassembler/X86/x86-32.txt @@ -54,6 +54,9 @@ # CHECK: calll -1234 0xe8 0x2e 0xfb 0xff 0xff +# CHECK: callw -1 +0x66 0xe8 0xff 0xff + # CHECK: lfence 0x0f 0xae 0xe8 Index: test/MC/Disassembler/X86/x86-64.txt =================================================================== --- test/MC/Disassembler/X86/x86-64.txt +++ test/MC/Disassembler/X86/x86-64.txt @@ -301,3 +301,9 @@ # CHECK: movq %rax, 1515870810 0x67, 0x48 0xa3 0x5a 0x5a 0x5a 0x5a + +# CHECK: callq 32767 +0xe8 0xff 0x7f 0x00 0x00 + +# CHECK: callq -32769 +0xe8 0xff 0x7f 0xff 0xff