1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[X86][AsmParser] Recommit r335658

Recommit of r335658 so that it does not change the behaviour of any
existing error output.

llvm-svn: 335668
This commit is contained in:
Jessica Paquette 2018-06-26 21:30:34 +00:00
parent a8f12623d6
commit e5195a2cfc
2 changed files with 21 additions and 0 deletions

View File

@ -1049,6 +1049,14 @@ static bool CheckBaseRegAndIndexRegAndScale(unsigned BaseReg, unsigned IndexReg,
}
}
}
// RIP/EIP-relative addressing is only supported in 64-bit mode.
if (!Is64BitMode && BaseReg != 0 &&
(BaseReg == X86::RIP || BaseReg == X86::EIP)) {
ErrMsg = "RIP-relative addressing requires 64-bit mode";
return true;
}
return checkScale(Scale, ErrMsg);
}

View File

@ -0,0 +1,13 @@
; RUN: not llc -mtriple i386-apple-- -o /dev/null < %s 2>&1| FileCheck %s
; CHECK: <inline asm>:1:13: error: RIP-relative addressing requires 64-bit mode
; CHECK-NEXT: jmpl *_foo(%eip)
; Make sure that we emit an error if we encounter RIP-relative instructions in
; 32-bit mode.
define i32 @foo() { ret i32 0 }
define i32 @bar() {
call void asm sideeffect "jmpl *_foo(%eip)\0A", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}