1# RUN: llc -mtriple=aarch64--linux-gnu -run-pass=aarch64-ldst-opt %s -verify-machineinstrs -o - | FileCheck %s 2--- 3name: promote-load-from-store 4tracksRegLiveness: true 5body: | 6 bb.0: 7 liveins: $w1, $x0, $lr 8 9 STRWui killed $w1, $x0, 0 :: (store 4) 10 CFI_INSTRUCTION 0 11 CFI_INSTRUCTION 0 12 CFI_INSTRUCTION 0 13 CFI_INSTRUCTION 0 14 CFI_INSTRUCTION 0 15 CFI_INSTRUCTION 0 16 CFI_INSTRUCTION 0 17 CFI_INSTRUCTION 0 18 CFI_INSTRUCTION 0 19 CFI_INSTRUCTION 0 20 CFI_INSTRUCTION 0 21 CFI_INSTRUCTION 0 22 CFI_INSTRUCTION 0 23 CFI_INSTRUCTION 0 24 CFI_INSTRUCTION 0 25 CFI_INSTRUCTION 0 26 CFI_INSTRUCTION 0 27 CFI_INSTRUCTION 0 28 CFI_INSTRUCTION 0 29 CFI_INSTRUCTION 0 30 $w0 = LDRHHui killed $x0, 1 :: (load 2) 31 RET $lr, implicit $w0 32 33... 34# Don't count transient instructions towards search limits. 35# CHECK-LABEL: name: promote-load-from-store 36# CHECK: STRWui $w1 37# CHECK: UBFMWri killed $w1 38--- 39name: store-pair 40tracksRegLiveness: true 41body: | 42 bb.0: 43 liveins: $w1, $x0, $lr 44 45 STRWui $w1, $x0, 0 :: (store 4) 46 CFI_INSTRUCTION 0 47 CFI_INSTRUCTION 0 48 CFI_INSTRUCTION 0 49 CFI_INSTRUCTION 0 50 CFI_INSTRUCTION 0 51 CFI_INSTRUCTION 0 52 CFI_INSTRUCTION 0 53 CFI_INSTRUCTION 0 54 CFI_INSTRUCTION 0 55 CFI_INSTRUCTION 0 56 CFI_INSTRUCTION 0 57 CFI_INSTRUCTION 0 58 CFI_INSTRUCTION 0 59 CFI_INSTRUCTION 0 60 CFI_INSTRUCTION 0 61 CFI_INSTRUCTION 0 62 CFI_INSTRUCTION 0 63 CFI_INSTRUCTION 0 64 CFI_INSTRUCTION 0 65 CFI_INSTRUCTION 0 66 STRWui killed $w1, killed $x0, 1 :: (store 4) 67 RET $lr 68 69... 70# CHECK-LABEL: name: store-pair 71# CHECK: STPWi 72--- 73name: store-pair-clearkill0 74tracksRegLiveness: true 75body: | 76 bb.0: 77 liveins: $w1, $x0, $lr 78 79 STRWui $w1, $x0, 0 :: (store 4) 80 $w2 = COPY $w1 81 $x3 = COPY $x0 82 STRWui killed $w1, killed $x0, 1 :: (store 4) 83 RET $lr 84... 85# When merging a lower store with an upper one, we must clear kill flags on 86# the lower store. 87# CHECK-LABEL: store-pair-clearkill0 88# CHECK-NOT: STPWi $w1, killed $w1, $x0, 0 :: (store 4) 89# CHECK: STPWi $w1, $w1, $x0, 0 :: (store 4) 90# CHECK: $w2 = COPY $w1 91# CHECK: RET $lr 92--- 93name: store-pair-clearkill1 94tracksRegLiveness: true 95body: | 96 bb.0: 97 liveins: $x0, $lr 98 99 $w1 = MOVi32imm 13 100 $w2 = MOVi32imm 7 101 STRWui $w1, $x0, 1 :: (store 4) 102 $w2 = COPY killed $w1 103 STRWui killed $w2, $x0, 0 :: (store 4) 104 105 $w1 = MOVi32imm 42 106 $w2 = MOVi32imm 7 107 STRWui $w1, $x0, 0 :: (store 4) 108 $w2 = COPY killed $w1 109 STRWui killed $w2, killed $x0, 1 :: (store 4) 110 111 RET $lr 112... 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 121 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 127--- 128name: store-load-clearkill 129tracksRegLiveness: true 130body: | 131 bb.0: 132 liveins: $w1 133 134 STRWui $w1, $sp, 0 :: (store 4) 135 $wzr = COPY killed $w1 ; killing use of $w1 136 $w11 = LDRWui $sp, 0 :: (load 4) 137 HINT 0, implicit $w11 ; some use of $w11 138... 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 4) 143# CHECK-NOT: COPY killed $w1 144# CHECK: $wzr = COPY $w1 145# CHECK: $w11 = ORRWrs $wzr, $w1, 0 146# CHECK: HINT 0, implicit $w11 147--- 148name: promote-load-from-store-undef 149tracksRegLiveness: true 150body: | 151 bb.0: 152 liveins: $x0, $x2, $lr 153 154 STRWui undef $w1, $x0, 0 :: (store 4) 155 $w0 = LDRBBui $x0, 1 :: (load 2) 156 STRHHui undef $w3, $x2, 0 :: (store 4) 157 $w1 = LDRBBui $x2, 0 :: (load 4) 158 RET $lr, implicit $w0 159... 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 165--- 166name: promote-load-from-store-trivial-kills 167tracksRegLiveness: true 168body: | 169 bb.0: 170 liveins: $x0, $lr 171 172 STRXui $x0, $sp, 0 :: (store 8) 173 STRXui killed $x0, $sp, 2 :: (store 8) 174 $x0 = LDRXui $sp, 0 :: (load 8) 175 BL &bar, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def $sp 176 RET $lr 177... 178# CHECK-LABEL: name: promote-load-from-store-trivial-kills 179# CHECK: STRXui $x0, $sp, 0 180# CHECK: STRXui $x0, $sp, 2 181# CHECK-NOT: LDRXui 182# CHECK-NOT: ORR 183# CHECK: BL &bar, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def $sp 184