[PATCH] D93158: [X86] Avoid %fs:(%eax) references in x32 mode

Harald van Dijk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 13:03:43 PST 2020


hvdijk marked 2 inline comments as done.
hvdijk added inline comments.


================
Comment at: llvm/test/CodeGen/X86/pic.ll:339
 ; CHECK-X32-DAG:	movl	%fs:0,
-; CHECK:	addl
+; CHECK:	{{addl|leal \(%.*,%.*\),}}
 ; CHECK-I686:	movl	tlsptrie at GOTNTPOFF(
----------------
hvdijk wrote:
> RKSimon wrote:
> > it doesn't look great to allow add or lea like this - maybe add an additional CHECK-X32-ISEL/CHECK-X32-FAST prefix and check them properly?
> My thinking was that the leal is just used as a three-operand add. This test does not check which registers get used, so it seemed odd to me to check that the add's output register is the same as one of its inputs, it seemed like either addl or leal would be fine for either I686 or X32. However, thinking about it some more, there is a difference, and it does make sense to restrict which instructions get accepted by the test: I686 gets addl, because that's the shorter instruction. X32 gets leal, because this prevents clobbering its inputs: for x32, both inputs are reused later on. So, done.
Looking at the new diff: for consistency with the other checks, I should have put `({{%.*,%.*}})` here rather than `({{.*,.*}})`. I missed this until after I had already submitted the updated version. It's a trivial change that does not affect anything, but will update nonetheless.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93158/new/

https://reviews.llvm.org/D93158



More information about the llvm-commits mailing list