Skip to content

Commit 1fe6017

Browse files
committed
[X86] Add a Requires<[In64BitMode]> to FARJMP64
Otherwise we can try to assemble it in 32-bit mode and throw an assert in the encoder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331161 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 1f7a4c8 commit 1fe6017

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

lib/Target/X86/X86InstrControl.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
178178
OpSize32, Sched<[WriteJump]>;
179179
}
180180
def FARJMP64 : RI<0xFF, MRM5m, (outs), (ins opaque80mem:$dst),
181-
"ljmp{q}\t{*}$dst", []>, Sched<[WriteJump]>;
181+
"ljmp{q}\t{*}$dst", []>, Sched<[WriteJump]>, Requires<[In64BitMode]>;
182182

183183
let AsmVariantName = "att" in
184184
def FARJMP16m : I<0xFF, MRM5m, (outs), (ins opaque32mem:$dst),

test/MC/X86/intel-syntax.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ main:
6262
lcall [rax]
6363
// CHECK: ljmpl *(%rax)
6464
jmp FWORD ptr [rax]
65-
// CHECK: ljmpl *(%rax)
65+
// CHECK: ljmpq *(%rax)
6666
ljmp [rax]
6767

6868
// CHECK: movl $257, -4(%rsp)

test/MC/X86/x86_errors.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,6 @@ mov %rip, %rax
7878
// 32: error: register %rax is only available in 64-bit mode
7979
// 64: error: %rip is not allowed as an index register
8080
mov (%rax,%rip), %rbx
81+
82+
// 32: error: instruction requires: 64-bit mode
83+
ljmpq *(%eax)

0 commit comments

Comments
 (0)