[X86][MC] no error diagnostic for out-of-range jrcxz/jecxz/jcxz
authorAlexey Lapshin <a.v.lapshin@mail.ru>
Fri, 15 Nov 2019 18:48:55 +0000 (21:48 +0300)
committerAlexey Lapshin <a.v.lapshin@mail.ru>
Tue, 26 Nov 2019 11:32:17 +0000 (14:32 +0300)
commite73f78acd34360f7450b81167d9dc858ccddc262
treede129e3de8c2c14e5222b05afb0b865633e97ef0
parent8f2b57d257e87b0244f9883cd8075898005ba757
[X86][MC] no error diagnostic for out-of-range jrcxz/jecxz/jcxz

Fix for PR24072:

X86 instructions jrcxz/jecxz/jcxz performs short jumps if rcx/ecx/cx register is 0
The maximum relative offset for a forward short jump is 127 Bytes (0x7F).
The maximum relative offset for a backward short jump is 128 Bytes (0x80).

Gnu assembler warns when the distance of the jump exceeds the maximum but llvm-as does not.

Patch by Konstantin Belochapka and Alexey Lapshin

Differential Revision: https://reviews.llvm.org/D70652
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/test/MC/MachO/reloc.s
llvm/test/MC/X86/x86-jcxz-loop-fixup.s [new file with mode: 0644]