Commit Graph

90 Commits

Author SHA1 Message Date
Chad Rosier 1f88b2d0b7 [AArch64] Add support for Qualcomm Kryo CPU.
Machine model description by Dave Estes <cestes@codeaurora.org>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260686 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 15:51:51 +00:00
Jun Bum Lim 844cafe1c8 [AArch64] Merge two adjacent str WZR into str XZR
Summary:
This change merges adjacent 32 bit zero stores into a 64 bit zero store.
e.g.,
  str wzr, [x0]
  str wzr, [x0, #4]
becomes
  str xzr, [x0]

Therefore, four adjacent 32 bit zero stores will be a single stp.
e.g.,
  str wzr, [x0]
  str wzr, [x0, #4]
  str wzr, [x0, #8]
  str wzr, [x0, #12]
becomes
  stp xzr, xzr, [x0]

Reviewers: mcrosier, jmolloy, gberry, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

Differential Revision: http://reviews.llvm.org/D16933

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 15:25:39 +00:00
Jun Bum Lim 45279e6a90 [AArch64] Refactoring findMatchingStore() in aarch64-ldst-opt; NFC
Summary: This change makes findMatchingStore() follow the same coding style introduced in r260275.

Reviewers: gberry, junbuml

Subscribers: aemerson, rengolin, haicheng, bmakam, mssimpso

Differential Revision: http://reviews.llvm.org/D17083

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 16:18:24 +00:00
Chad Rosier ac5172baad [AArch64] Improve load/store optimizer to handle LDUR + LDR.
This patch allows the mixing of scaled and unscaled load/stores to form
load/store pairs.

This is a reapplication of r259812, which had an incorrect assert.  The
test_stur_str_no_assert() test is a reduced version of the issue hit in
the AArch64 self-host.

PR24465

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 14:25:08 +00:00
Chad Rosier 43fe5fc136 [AArch64] Refactor is logic into a helper function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260419 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 19:45:48 +00:00
Chad Rosier 0b08398212 [AArch64] Update comment to match reality. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 18:49:28 +00:00
Chad Rosier d013f79f46 [AArch64] This bit of logic is specific to pairing. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 15:52:46 +00:00
Chad Rosier 3b3e0dc608 [AArch64] This check is specific to merging instructions. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 21:20:12 +00:00
Geoff Berry d3a670dcad [AArch64] AArch64LoadStoreOptimizer: fix bug in pre-inc check iterator
Summary:
Fix case where a pre-inc/dec load/store would not be formed if the
add/sub that forms the inc/dec part of the operation was the first
instruction in the block being examined.

Reviewers: mcrosier, jmolloy, t.p.northover, junbuml

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

Differential Revision: http://reviews.llvm.org/D16785

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 20:47:21 +00:00
Chad Rosier a9adb28214 [AArch64] Bail even earlier if the instructions modifieds the base register. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260274 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 20:44:41 +00:00
Chad Rosier ea51072695 [AArch64] Simplify. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260273 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 20:27:45 +00:00
Chad Rosier 466cf9cf32 [AArch64] Add an assert to ensure we don't scale an offset that can't be scaled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 20:18:07 +00:00
Chad Rosier 452287c5a0 [AArch64] Add a FIXME about invalid KILL markers after the ld/st opt pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260264 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 19:42:19 +00:00
Chad Rosier 41dc0a6d10 [AArch64] Remove redundant calls and clang format. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260260 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 19:33:42 +00:00
Chad Rosier 9c3c7d8479 [AArch64] Hoist now common logic. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260257 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 19:17:18 +00:00
Chad Rosier 14c18a3a4a [AArch64] Rename variable to make it clear we're merging here, not pairing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260256 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 19:09:22 +00:00
Chad Rosier 74ced0a85e [AArch64] Separage the codegen logic for widening vs. pairing. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260249 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 19:02:12 +00:00
Chad Rosier 7fd6a2c433 [AArch64] Cleanup to simplify logic when widening vs. pairing loads/stores. NFC.
The logic to pair instructions and merge narrow instructions has become cloogy
and error prone.  This patch beings to unravel these two similar, but distinct
optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260242 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 18:10:20 +00:00
Chad Rosier b0a81e9335 [AArch64] Rename variable to improve readability. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260228 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 15:59:57 +00:00
Chad Rosier 95fa36a182 [AArch64] Remove stale comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260226 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 15:51:33 +00:00
Jun Bum Lim e1451a3ca9 [AArch64] Refactoring aarch64-ldst-opt. NCF.
Remove narrow load / store instructions from getMatchingPairOpcode(),
and add getMatchingWideOpcode().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259914 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 20:02:03 +00:00
Renato Golin 78492103af Revert "[AArch64] Improve load/store optimizer to handle LDUR + LDR (take 3)."
This reverts commit r259812 as it broke AArch64 self-hosting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259881 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 12:14:30 +00:00
Chad Rosier 6f9d22989f [AArch64] Bound the number of instructions we scan when searching for updates.
This only impacts the creation of pre-/post-index instructions.  The bound was
set high enough such that it did not change code generation for SPEC200X.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259828 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 21:26:02 +00:00
Chad Rosier 6cced9c3cd [AArch64] Improve load/store optimizer to handle LDUR + LDR (take 3).
This patch allows the mixing of scaled and unscaled load/stores to form
load/store pairs.

PR24465
http://reviews.llvm.org/D12116
Many thanks to Ahmed and Michael for fixes and code review.

This is a reapplication of r246769 and r259790.  The tramp3d failure was caused
by an incorrect refactoring in the patch.  Specifically, we weren't always
properly clearing the SExtIdx flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259812 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 18:59:49 +00:00
Chad Rosier 954ec75da9 Revert "[AArch64] Improve load/store optimizer to handle LDUR + LDR."
This reverts commit r259790. tramp3d-v4 is still having problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259795 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 16:01:40 +00:00
Chad Rosier 1f06a18efb [AArch64] Improve load/store optimizer to handle LDUR + LDR.
This patch allows the mixing of scaled and unscaled load/stores to form
load/store pairs.

PR24465
http://reviews.llvm.org/D12116
Many thanks to Ahmed and Michael for fixes and code review.

This is a reapplication of r246769, which was reverted in r246782 due to a
test-suite failure.  I'm unable to reproduce the issue at this time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259790 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 14:42:55 +00:00
Chad Rosier 808a3d2826 [AArch64] Add a FIXME comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02 15:22:55 +00:00
Chad Rosier bba05d1386 [AArch64] Allocate the modified and used regs only once per function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02 15:02:30 +00:00
Chad Rosier 0158ba6445 Move comments a bit closer to associated code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-01 21:38:31 +00:00
Chad Rosier b328af8b73 [AArch64] Set MMOs on pre- and post-index instructions.
Without the MMOs the MI scheduler is unable to reason about the dependencies of
these instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 15:38:24 +00:00
Chad Rosier e15795f83d [AArch64] Remove a bunch of useless FIXME comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258193 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 21:47:24 +00:00
Chad Rosier 8ead0df472 [AArch64] Remove more dead code after r258093.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258191 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 21:27:05 +00:00
Chad Rosier 279f4a957c [AArch64] Remove unused arguments. NFC.
AFAICT, these have been unused since the initial backend import.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258093 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 21:56:40 +00:00
Rui Ueyama 3edb0ec229 Update to use new name alignTo().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257804 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 21:06:47 +00:00
Philip Reames f5d467572c Extract helper function to merge MemoryOperand lists [NFC]
In the discussion on http://reviews.llvm.org/D15730, Andy pointed out we had a utility function for merging MMO lists. Since it turned we actually had two copies and there's another review in progress (http://reviews.llvm.org/D15230) which needs the same, extract it into a utility function and clean up the interfaces to make it easier to use with a MachineInstBuilder.

I introduced a pair here to track size and allocation together. I think we should probably move in the direction of the MachineOperandsRef helper class, but I'm leaving that for further work. I want to get the poison state introduced before I make major changes to the interface.

Differential Revision: http://reviews.llvm.org/D15757



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 04:39:03 +00:00
Jun Bum Lim 3ff9f0996f [AArch64] Promote loads from stored
This is a recommit of r256004 which was reverted in r256160. The issue was the
incorrect promotion for half and byte loads transformed into mov instructions.
This fix will replace half and byte type loads only with bit field extracts.

Original commit message:

This change promotes load instructions which directly read from stored by
replacing them with mov instructions. If the store is wider than the load,
the load will be replaced with a bitfield extract.
For example :
  STRWui %W1, %X0, 1
  %W0 = LDRHHui %X0, 3
becomes
  STRWui %W1, %X0, 1
  %W0 = UBFMWri %W1, 16, 31

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256249 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-22 16:36:16 +00:00
Jun Bum Lim 35733957df Revert "[AArch64] Promote loads from stores"
This reverts commit r256004 due to a failure in cortex-a53.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-21 15:36:49 +00:00
Jun Bum Lim cb2bad780b [AArch64] Promote loads from stores
This change promotes load instructions which directly read from stores by
replacing them with mov instructions. If the store is wider than the load,
the load will be replaced with a bitfield extract.
For example :
  STRWui %W1, %X0, 1
  %W0 = LDRHHui %X0, 3
becomes
  STRWui %W1, %X0, 1
  %W0 = UBFMWri %W1, 16, 31

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 18:08:30 +00:00
Jun Bum Lim c8ef580c58 [AArch64]Merge narrow zero stores to a wider store
This change merges adjacent zero stores into a wider single store.
For example :
  strh wzr, [x0]
  strh wzr, [x0, #2]
becomes
  str wzr, [x0]

This will fix PR25410.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253711 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 21:14:07 +00:00
Jun Bum Lim 0b669e1aec [AArch64] Refactoring aarch64-ldst-opt. NCF.
Summary :
 * Rename isSmallTypeLdMerge() to isNarrowLoad().
 * Rename NumSmallTypeMerged to NumNarrowTypePromoted.
 * Use Subtarget defined as a member variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253587 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 18:41:27 +00:00
Jun Bum Lim 575b88edcb [AArch64]Extend merging narrow loads into a wider load
This change extends r251438 to handle more narrow load promotions
including byte type, unscaled, and signed. For example, this change will
convert :
  ldursh w1, [x0, #-2]
  ldurh  w2, [x0, #-4]
into
  ldur  w2, [x0, #-4]
  asr   w1, w2, #16
  and   w2, w2, #0xffff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253577 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 17:21:41 +00:00
Oliver Stannard 2358986dd4 [AArch64] Fix halfword load merging for big-endian targets
For big-endian targets, when we merge two halfword loads into a word load, the
order of the halfwords in the loaded value is reversed compared to
little-endian, so the load-store optimiser needs to swap the destination
registers.

This does not affect merging of two word loads, as we use ldp, which treats the
memory as two separate 32-bit words.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252597 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 11:04:18 +00:00
Jun Bum Lim de4969d37c [AArch64]Enable the narrow ld promotion only on profitable microarchitectures
The benefit from converting narrow loads into a wider load (r251438) could be
micro-architecturally dependent, as it assumes that a single load with two bitfield
extracts is cheaper than two narrow loads. Currently, this conversion is
enabled only in cortex-a57 on which performance benefits were verified.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252316 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-06 16:27:47 +00:00
Jun Bum Lim b0bca8e168 [AArch64]Merge halfword loads into a 32-bit load
This recommits r250719, which caused a failure in SPEC2000.gcc
because of the incorrect insert point for the new wider load.

Convert two halfword loads into a single 32-bit word load with bitfield extract
instructions. For example :
  ldrh w0, [x2]
  ldrh w1, [x2, #2]
becomes
  ldr w0, [x2]
  ubfx w1, w0, #16, #16
  and  w0, w0, #ffff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251438 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-27 19:16:03 +00:00
James Molloy 61f012782b Revert "[AArch64]Merge halfword loads into a 32-bit load"
This reverts commit r250719. This introduced a codegen fault in SPEC2000.gcc, when compiled for Cortex-A53.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251108 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23 10:41:38 +00:00
Jun Bum Lim 38a9a5302b [AArch64]Merge halfword loads into a 32-bit load
Convert two halfword loads into a single 32-bit word load with bitfield extract
instructions. For example :
  ldrh w0, [x2]
  ldrh w1, [x2, #2]
becomes
  ldr w0, [x2]
  ubfx w1, w0, #16, #16
  and  w0, w0, #ffff

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-19 18:34:53 +00:00
Chad Rosier 40fed821f0 [AArch64] Deprecate a command-line option used for testing.
Support for pairing unscaled loads and stores has been enabled since the
original ARM64 port.  This feature is no longer experimental, AFAICT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249049 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 18:17:12 +00:00
Chad Rosier 2bbda57bc9 [AArch64] Hoist commonly failing check. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249011 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 13:43:05 +00:00
Chad Rosier bfce81ba26 [AArch64] Rename variable to improve readability. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249008 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 13:33:31 +00:00
Chad Rosier a46ce637f8 [AArch64] Update comment to reflect reality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249007 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 13:09:44 +00:00