[PATCH] [X86] Allow atomic operations using immediates to avoid using a register

Robin Morisset morisset at google.com
Tue Aug 5 14:36:55 PDT 2014


Hi jfb,

The only valid lowering of atomic stores in the X86 backend was mov from
register to memory. As a result, storing an immediate required a useless copy
of the immediate in a register. Now these can be compiled as a simple mov.

Similarily, adding/and-ing/or-ing/xor-ing an
immediate to an atomic location (but through an atomic_store/atomic_load,
not a fetch_whatever intrinsic) can now make use of an 'add $imm, x(%rip)'
instead of using a register. And the same applies to inc/dec.

This second point matches the first issue identified in
  http://llvm.org/bugs/show_bug.cgi?id=17281

http://reviews.llvm.org/D4796

Files:
  lib/Target/X86/X86CodeEmitter.cpp
  lib/Target/X86/X86InstrCompiler.td
  lib/Target/X86/X86MCInstLower.cpp
  test/CodeGen/X86/atomic_mi.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4796.12209.patch
Type: text/x-patch
Size: 25707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140805/220b0a8c/attachment.bin>


More information about the llvm-commits mailing list