2015-11-24 05:33:58 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2015-09-03 23:03:19 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=-slow-unaligned-mem-16 | FileCheck %s --check-prefix=FAST
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+slow-unaligned-mem-16 | FileCheck %s --check-prefix=SLOW
|
|
|
|
|
|
|
|
; Verify that the DAGCombiner is creating unaligned 16-byte loads and stores
|
|
|
|
; if and only if those are fast.
|
|
|
|
|
|
|
|
define void @merge_const_vec_store(i64* %ptr) {
|
|
|
|
; FAST-LABEL: merge_const_vec_store:
|
2017-12-05 01:18:51 +08:00
|
|
|
; FAST: # %bb.0:
|
2015-09-03 23:03:19 +08:00
|
|
|
; FAST-NEXT: xorps %xmm0, %xmm0
|
|
|
|
; FAST-NEXT: movups %xmm0, (%rdi)
|
|
|
|
; FAST-NEXT: retq
|
|
|
|
;
|
|
|
|
; SLOW-LABEL: merge_const_vec_store:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SLOW: # %bb.0:
|
2015-09-03 23:03:19 +08:00
|
|
|
; SLOW-NEXT: movq $0, (%rdi)
|
|
|
|
; SLOW-NEXT: movq $0, 8(%rdi)
|
|
|
|
; SLOW-NEXT: retq
|
|
|
|
|
|
|
|
%idx0 = getelementptr i64, i64* %ptr, i64 0
|
|
|
|
%idx1 = getelementptr i64, i64* %ptr, i64 1
|
|
|
|
|
|
|
|
store i64 0, i64* %idx0, align 8
|
|
|
|
store i64 0, i64* %idx1, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
define void @merge_vec_element_store(<4 x double> %v, double* %ptr) {
|
|
|
|
; FAST-LABEL: merge_vec_element_store:
|
2017-12-05 01:18:51 +08:00
|
|
|
; FAST: # %bb.0:
|
2015-09-03 23:03:19 +08:00
|
|
|
; FAST-NEXT: movups %xmm0, (%rdi)
|
|
|
|
; FAST-NEXT: retq
|
|
|
|
;
|
|
|
|
; SLOW-LABEL: merge_vec_element_store:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SLOW: # %bb.0:
|
2019-07-07 01:59:51 +08:00
|
|
|
; SLOW-NEXT: movlps %xmm0, (%rdi)
|
|
|
|
; SLOW-NEXT: movhps %xmm0, 8(%rdi)
|
2015-09-03 23:03:19 +08:00
|
|
|
; SLOW-NEXT: retq
|
|
|
|
|
|
|
|
%vecext0 = extractelement <4 x double> %v, i32 0
|
|
|
|
%vecext1 = extractelement <4 x double> %v, i32 1
|
|
|
|
|
|
|
|
%idx0 = getelementptr double, double* %ptr, i64 0
|
|
|
|
%idx1 = getelementptr double, double* %ptr, i64 1
|
|
|
|
|
|
|
|
store double %vecext0, double* %idx0, align 8
|
|
|
|
store double %vecext1, double* %idx1, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
define void @merge_vec_load_and_stores(i64 *%ptr) {
|
|
|
|
; FAST-LABEL: merge_vec_load_and_stores:
|
2017-12-05 01:18:51 +08:00
|
|
|
; FAST: # %bb.0:
|
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Recommiting with compiler time improvements
Recommitting after fixup of 32-bit aliasing sign offset bug in DAGCombiner.
* Simplify Consecutive Merge Store Candidate Search
Now that address aliasing is much less conservative, push through
simplified store merging search and chain alias analysis which only
checks for parallel stores through the chain subgraph. This is cleaner
as the separation of non-interfering loads/stores from the
store-merging logic.
When merging stores search up the chain through a single load, and
finds all possible stores by looking down from through a load and a
TokenFactor to all stores visited.
This improves the quality of the output SelectionDAG and the output
Codegen (save perhaps for some ARM cases where we correctly constructs
wider loads, but then promotes them to float operations which appear
but requires more expensive constant generation).
Some minor peephole optimizations to deal with improved SubDAG shapes (listed below)
Additional Minor Changes:
1. Finishes removing unused AliasLoad code
2. Unifies the chain aggregation in the merged stores across code
paths
3. Re-add the Store node to the worklist after calling
SimplifyDemandedBits.
4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
arbitrary, but seems sufficient to not cause regressions in
tests.
5. Remove Chain dependencies of Memory operations on CopyfromReg
nodes as these are captured by data dependence
6. Forward loads-store values through tokenfactors containing
{CopyToReg,CopyFromReg} Values.
7. Peephole to convert buildvector of extract_vector_elt to
extract_subvector if possible (see
CodeGen/AArch64/store-merge.ll)
8. Store merging for the ARM target is restricted to 32-bit as
some in some contexts invalid 64-bit operations are being
generated. This can be removed once appropriate checks are
added.
This finishes the change Matt Arsenault started in r246307 and
jyknight's original patch.
Many tests required some changes as memory operations are now
reorderable, improving load-store forwarding. One test in
particular is worth noting:
CodeGen/PowerPC/ppc64-align-long-double.ll - Improved load-store
forwarding converts a load-store pair into a parallel store and
a memory-realized bitcast of the same value. However, because we
lose the sharing of the explicit and implicit store values we
must create another local store. A similar transformation
happens before SelectionDAG as well.
Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle
llvm-svn: 297695
2017-03-14 08:34:14 +08:00
|
|
|
; FAST-NEXT: movups (%rdi), %xmm0
|
|
|
|
; FAST-NEXT: movups %xmm0, 40(%rdi)
|
2015-09-03 23:03:19 +08:00
|
|
|
; FAST-NEXT: retq
|
|
|
|
;
|
|
|
|
; SLOW-LABEL: merge_vec_load_and_stores:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SLOW: # %bb.0:
|
2015-09-03 23:03:19 +08:00
|
|
|
; SLOW-NEXT: movq (%rdi), %rax
|
|
|
|
; SLOW-NEXT: movq 8(%rdi), %rcx
|
|
|
|
; SLOW-NEXT: movq %rax, 40(%rdi)
|
|
|
|
; SLOW-NEXT: movq %rcx, 48(%rdi)
|
|
|
|
; SLOW-NEXT: retq
|
|
|
|
|
|
|
|
%idx0 = getelementptr i64, i64* %ptr, i64 0
|
|
|
|
%idx1 = getelementptr i64, i64* %ptr, i64 1
|
|
|
|
|
|
|
|
%ld0 = load i64, i64* %idx0, align 4
|
|
|
|
%ld1 = load i64, i64* %idx1, align 4
|
|
|
|
|
|
|
|
%idx4 = getelementptr i64, i64* %ptr, i64 5
|
|
|
|
%idx5 = getelementptr i64, i64* %ptr, i64 6
|
|
|
|
|
|
|
|
store i64 %ld0, i64* %idx4, align 4
|
|
|
|
store i64 %ld1, i64* %idx5, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|