[PATCH] D35375: [AArch64][Atomic] Canonicalize sub of immediate to add of -immediate.

Chad Rosier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 11:38:26 PDT 2017


mcrosier created this revision.
Herald added subscribers: kristof.beyls, javed.absar, rengolin, aemerson.

Please let me know if I've missed something or if there's an easier way to do this is tablegen.

This avoids ugliness such as:

  test_atomic_sub_fetch:                  // @test_atomic_sub_fetch
  // BB#0:                                // %entry
          mov     w8, #-1
          neg      w8, w8
          ldaddal w8, w8, [x0]
          add     w0, w8, #1              // =1
          ret

and instead generates:

  test_atomic_sub_fetch:                  // @test_atomic_sub_fetch
  // BB#0:                                // %entry
          orr     w8, wzr, #0x1
          ldaddal w8, w8, [x0]
          add     w0, w8, #1              // =1
          ret

Chad


https://reviews.llvm.org/D35375

Files:
  lib/Target/AArch64/AArch64ISelLowering.cpp
  test/CodeGen/AArch64/atomic-ops-lse.ll
  test/CodeGen/AArch64/atomic-ops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35375.106482.patch
Type: text/x-patch
Size: 6250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170713/556e2339/attachment.bin>


More information about the llvm-commits mailing list