1 # RUN: llc -mtriple=aarch64--linux-gnu -run-pass=aarch64-ldst-opt %s -verify-machineinstrs -o - | FileCheck %s
3 name: promote-load-from-store
4 tracksRegLiveness: true
9 STRWui killed $w1, $x0, 0 :: (store (s32))
30 $w0 = LDRHHui killed $x0, 1 :: (load (s16))
34 # Don't count transient instructions towards search limits.
35 # CHECK-LABEL: name: promote-load-from-store
37 # CHECK: UBFMWri killed $w1
40 tracksRegLiveness: true
43 liveins: $w1, $x0, $lr
45 STRWui $w1, $x0, 0 :: (store (s32))
66 STRWui killed $w1, killed $x0, 1 :: (store (s32))
70 # CHECK-LABEL: name: store-pair
73 name: store-pair-clearkill0
74 tracksRegLiveness: true
77 liveins: $w1, $x0, $lr
79 STRWui $w1, $x0, 0 :: (store (s32))
82 STRWui killed $w1, killed $x0, 1 :: (store (s32))
85 # When merging a lower store with an upper one, we must clear kill flags on
87 # CHECK-LABEL: store-pair-clearkill0
88 # CHECK-NOT: STPWi $w1, killed $w1, $x0, 0 :: (store (s32))
89 # CHECK: STPWi $w1, $w1, $x0, 0 :: (store (s32))
90 # CHECK: $w2 = COPY $w1
93 name: store-pair-clearkill1
94 tracksRegLiveness: true
101 STRWui $w1, $x0, 1 :: (store (s32))
102 $w2 = COPY killed $w1
103 STRWui killed $w2, $x0, 0 :: (store (s32))
107 STRWui $w1, $x0, 0 :: (store (s32))
108 $w2 = COPY killed $w1
109 STRWui killed $w2, killed $x0, 1 :: (store (s32))
113 # When merging an upper store with a lower one, kill flags along the way need
114 # to be removed; In this case the kill flag on $w1.
115 # CHECK-LABEL: store-pair-clearkill1
116 # CHECK: $w1 = MOVi32imm
117 # CHECK: $w2 = MOVi32imm
118 # CHECK-NOT: $w2 = COPY killed $w1
119 # CHECK: $w2 = COPY $w1
120 # CHECK: STPWi killed $w2, $w1, $x0, 0
122 # CHECK: $w1 = MOVi32imm
123 # CHECK: $w2 = MOVi32imm
124 # CHECK-NOT: $w2 = COPY killed $w1
125 # CHECK: $w2 = COPY $w1
126 # CHECK: STPWi $w1, killed $w2, killed $x0, 0
128 name: store-load-clearkill
129 tracksRegLiveness: true
134 STRWui $w1, $sp, 0 :: (store (s32))
135 $wzr = COPY killed $w1 ; killing use of $w1
136 $w11 = LDRWui $sp, 0 :: (load (s32))
137 HINT 0, implicit $w11 ; some use of $w11
139 # When replaceing the load of a store-load pair with a copy the kill flags
140 # along the way need to be cleared.
141 # CHECK-LABEL: name: store-load-clearkill
142 # CHECK: STRWui $w1, $sp, 0 :: (store (s32))
143 # CHECK-NOT: COPY killed $w1
144 # CHECK: $wzr = COPY $w1
145 # CHECK: $w11 = ORRWrs $wzr, $w1, 0
146 # CHECK: HINT 0, implicit $w11
148 name: promote-load-from-store-undef
149 tracksRegLiveness: true
152 liveins: $x0, $x2, $lr
154 STRWui undef $w1, $x0, 0 :: (store (s32))
155 $w0 = LDRBBui $x0, 1 :: (load (s16))
156 STRHHui undef $w3, $x2, 0 :: (store (s32))
157 $w1 = LDRBBui $x2, 0 :: (load (s32))
158 RET $lr, implicit $w0
160 # CHECK-LABEL: name: promote-load-from-store-undef
161 # CHECK: STRWui undef $w1
162 # CHECK: UBFMWri undef $w1
163 # CHECK: STRHHui undef $w3
164 # CHECK: ANDWri undef $w3
166 name: promote-load-from-store-trivial-kills
167 tracksRegLiveness: true
172 STRXui $x0, $sp, 0 :: (store (s64))
173 STRXui killed $x0, $sp, 2 :: (store (s64))
174 $x0 = LDRXui $sp, 0 :: (load (s64))
175 BL &bar, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def $sp
178 # CHECK-LABEL: name: promote-load-from-store-trivial-kills
179 # CHECK: STRXui $x0, $sp, 0
180 # CHECK: STRXui $x0, $sp, 2
183 # CHECK: BL &bar, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def $sp