[llvm] r335668 - [X86][AsmParser] Recommit r335658
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 26 14:30:34 PDT 2018
Author: paquette
Date: Tue Jun 26 14:30:34 2018
New Revision: 335668
URL: http://llvm.org/viewvc/llvm-project?rev=335668&view=rev
Log:
[X86][AsmParser] Recommit r335658
Recommit of r335658 so that it does not change the behaviour of any
existing error output.
Added:
llvm/trunk/test/CodeGen/X86/eip-addressing-i386.ll
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=335668&r1=335667&r2=335668&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Jun 26 14:30:34 2018
@@ -1049,6 +1049,14 @@ static bool CheckBaseRegAndIndexRegAndSc
}
}
}
+
+ // 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);
}
Added: llvm/trunk/test/CodeGen/X86/eip-addressing-i386.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/eip-addressing-i386.ll?rev=335668&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/eip-addressing-i386.ll (added)
+++ llvm/trunk/test/CodeGen/X86/eip-addressing-i386.ll Tue Jun 26 14:30:34 2018
@@ -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
+}
More information about the llvm-commits
mailing list