[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
This commit is contained in:
Tilmann Scheller 2014-05-26 13:36:47 +00:00
parent 3390e6c4a8
commit 7aac65de51

View File

@ -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
}