diff options
author | Tilmann Scheller <t.scheller@samsung.com> | 2014-05-26 13:36:47 +0000 |
---|---|---|
committer | Tilmann Scheller <t.scheller@samsung.com> | 2014-05-26 13:36:47 +0000 |
commit | 7aac65de51539ff21f5a4bfc8cb4d1dfda20cabe (patch) | |
tree | 856d0d6fa72eeb142dcf2ceb46d9657e84044b05 | |
parent | 3390e6c4a83b8df00a4e3d22972ba92fce4600ca (diff) | |
download | llvm-7aac65de51539ff21f5a4bfc8cb4d1dfda20cabe.tar.gz llvm-7aac65de51539ff21f5a4bfc8cb4d1dfda20cabe.tar.bz2 llvm-7aac65de51539ff21f5a4bfc8cb4d1dfda20cabe.tar.xz |
[AArch64] Add store + add folding regression tests for the load/store optimization pass.
Add tests for the following transform:
str X, [x0, #32]
...
add x0, x0, #32
->
str X, [x0, #32]!
with X being either w1, x1, s0, d0 or q0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209627 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/CodeGen/AArch64/ldst-opt.ll | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/test/CodeGen/AArch64/ldst-opt.ll b/test/CodeGen/AArch64/ldst-opt.ll index 9eeb938cec..103c23c737 100644 --- a/test/CodeGen/AArch64/ldst-opt.ll +++ b/test/CodeGen/AArch64/ldst-opt.ll @@ -16,11 +16,11 @@ ; Check the following transform: ; -; ldr X, [x0, #32] +; (ldr|str) X, [x0, #32] ; ... ; add x0, x0, #32 ; -> -; ldr X, [x0, #32]! +; (ldr|str) X, [x0, #32]! ; ; with X being either w1, x1, s0, d0 or q0. @@ -39,6 +39,19 @@ bar: ret void } +define void @store-pre-indexed-word(%struct.word* %ptr, i32 %val) nounwind { +; CHECK-LABEL: store-pre-indexed-word +; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #32]! +entry: + %a = getelementptr inbounds %struct.word* %ptr, i64 0, i32 1, i32 0 + store i32 %val, i32* %a, align 4 + br label %bar +bar: + %c = getelementptr inbounds %struct.word* %ptr, i64 0, i32 1 + tail call void @bar_word(%s.word* %c, i32 %val) + ret void +} + declare void @bar_doubleword(%s.doubleword*, i64) define void @load-pre-indexed-doubleword(%struct.doubleword* %ptr) nounwind { @@ -54,6 +67,19 @@ bar: ret void } +define void @store-pre-indexed-doubleword(%struct.doubleword* %ptr, i64 %val) nounwind { +; CHECK-LABEL: store-pre-indexed-doubleword +; CHECK: str x{{[0-9]+}}, [x{{[0-9]+}}, #32]! +entry: + %a = getelementptr inbounds %struct.doubleword* %ptr, i64 0, i32 1, i32 0 + store i64 %val, i64* %a, align 4 + br label %bar +bar: + %c = getelementptr inbounds %struct.doubleword* %ptr, i64 0, i32 1 + tail call void @bar_doubleword(%s.doubleword* %c, i64 %val) + ret void +} + declare void @bar_quadword(%s.quadword*, fp128) define void @load-pre-indexed-quadword(%struct.quadword* %ptr) nounwind { @@ -69,6 +95,19 @@ bar: ret void } +define void @store-pre-indexed-quadword(%struct.quadword* %ptr, fp128 %val) nounwind { +; CHECK-LABEL: store-pre-indexed-quadword +; CHECK: str q{{[0-9]+}}, [x{{[0-9]+}}, #32]! +entry: + %a = getelementptr inbounds %struct.quadword* %ptr, i64 0, i32 1, i32 0 + store fp128 %val, fp128* %a, align 4 + br label %bar +bar: + %c = getelementptr inbounds %struct.quadword* %ptr, i64 0, i32 1 + tail call void @bar_quadword(%s.quadword* %c, fp128 %val) + ret void +} + declare void @bar_float(%s.float*, float) define void @load-pre-indexed-float(%struct.float* %ptr) nounwind { @@ -84,6 +123,19 @@ bar: ret void } +define void @store-pre-indexed-float(%struct.float* %ptr, float %val) nounwind { +; CHECK-LABEL: store-pre-indexed-float +; CHECK: str s{{[0-9]+}}, [x{{[0-9]+}}, #32]! +entry: + %a = getelementptr inbounds %struct.float* %ptr, i64 0, i32 1, i32 0 + store float %val, float* %a, align 4 + br label %bar +bar: + %c = getelementptr inbounds %struct.float* %ptr, i64 0, i32 1 + tail call void @bar_float(%s.float* %c, float %val) + ret void +} + declare void @bar_double(%s.double*, double) define void @load-pre-indexed-double(%struct.double* %ptr) nounwind { @@ -99,3 +151,15 @@ bar: ret void } +define void @store-pre-indexed-double(%struct.double* %ptr, double %val) nounwind { +; CHECK-LABEL: store-pre-indexed-double +; CHECK: str d{{[0-9]+}}, [x{{[0-9]+}}, #32]! +entry: + %a = getelementptr inbounds %struct.double* %ptr, i64 0, i32 1, i32 0 + store double %val, double* %a, align 4 + br label %bar +bar: + %c = getelementptr inbounds %struct.double* %ptr, i64 0, i32 1 + tail call void @bar_double(%s.double* %c, double %val) + ret void +} |