287 lines · plain
1# RUN: llc -mtriple=aarch64-none-linux-gnu -mattr=+mte -run-pass aarch64-ldst-opt -verify-machineinstrs -o - %s | FileCheck %s2# RUN: llc -debugify-and-strip-all-safe -mtriple=aarch64-none-linux-gnu -mattr=+mte -run-pass aarch64-ldst-opt -verify-machineinstrs -o - %s | FileCheck %s3---4 5### STG and its offset limits6 7# CHECK-LABEL: name: test_STG_post8# CHECK: STGPostIndex $x0, $x0, 79name: test_STG_post10body: |11 bb.0.entry:12 liveins: $x013 14 STGi $x0, $x0, 015 $x0 = ADDXri $x0, 112, 016 RET_ReallyLR implicit $x017...18 19# CHECK-LABEL: name: test_STG_post_same_reg20# CHECK: STGPostIndex $x1, $x0, 721name: test_STG_post_same_reg22body: |23 bb.0.entry:24 liveins: $x0, $x125 26 STGi $x1, $x0, 027 $x0 = ADDXri $x0, 112, 028 RET_ReallyLR implicit $x029...30 31# CHECK-LABEL: name: test_STG_post_unaligned32# CHECK: STGi $x0, $x0, 033# CHECK-NEXT: ADDXri $x0, 8, 034name: test_STG_post_unaligned35body: |36 bb.0.entry:37 liveins: $x038 39 STGi $x0, $x0, 040 $x0 = ADDXri $x0, 8, 041 RET_ReallyLR implicit $x042...43 44# CHECK-LABEL: name: test_STG_post245# CHECK: STGPostIndex $x0, $x0, -25646name: test_STG_post247body: |48 bb.0.entry:49 liveins: $x050 51 STGi $x0, $x0, 052 $x0 = SUBXri $x0, 4096, 053 RET_ReallyLR implicit $x054...55 56# CHECK-LABEL: name: test_STG_post357# CHECK: STGi $x0, $x0, 058# CHECK-NEXT: SUBXri $x0, 4112, 059name: test_STG_post360body: |61 bb.0.entry:62 liveins: $x063 64 STGi $x0, $x0, 065 $x0 = SUBXri $x0, 4112, 066 RET_ReallyLR implicit $x067...68 69# CHECK-LABEL: name: test_STG_post470# CHECK: STGPostIndex $x0, $x0, 25571name: test_STG_post472body: |73 bb.0.entry:74 liveins: $x075 76 STGi $x0, $x0, 077 $x0 = ADDXri $x0, 4080, 078 RET_ReallyLR implicit $x079...80 81# CHECK-LABEL: name: test_STG_post582# CHECK: STGi $x0, $x0, 083# CHECK-NEXT: ADDXri $x0, 4096, 084name: test_STG_post585body: |86 bb.0.entry:87 liveins: $x088 89 STGi $x0, $x0, 090 $x0 = ADDXri $x0, 4096, 091 RET_ReallyLR implicit $x092...93 94### The rest of ST*G variants.95 96# CHECK-LABEL: name: test_STZG_post97# CHECK: STZGPostIndex $x0, $x0, 798name: test_STZG_post99body: |100 bb.0.entry:101 liveins: $x0102 103 STZGi $x0, $x0, 0104 $x0 = ADDXri $x0, 112, 0105 RET_ReallyLR implicit $x0106...107 108# CHECK-LABEL: name: test_ST2G_post109# CHECK: ST2GPostIndex $x0, $x0, 7110name: test_ST2G_post111body: |112 bb.0.entry:113 liveins: $x0114 115 ST2Gi $x0, $x0, 0116 $x0 = ADDXri $x0, 112, 0117 RET_ReallyLR implicit $x0118...119 120# CHECK-LABEL: name: test_STZ2G_post121# CHECK: STZ2GPostIndex $x0, $x0, 7122name: test_STZ2G_post123body: |124 bb.0.entry:125 liveins: $x0126 127 STZ2Gi $x0, $x0, 0128 $x0 = ADDXri $x0, 112, 0129 RET_ReallyLR implicit $x0130...131 132### STGP and its offset limits133 134# CHECK-LABEL: name: test_STGP_post135# CHECK: STGPpost $x1, $x2, $x0, 7136name: test_STGP_post137body: |138 bb.0.entry:139 liveins: $x0, $x1, $x2140 141 STGPi $x1, $x2, $x0, 0142 $x0 = ADDXri $x0, 112, 0143 RET_ReallyLR implicit $x0144...145 146# CHECK-LABEL: name: test_STGP_post2147# CHECK: STGPpost $x1, $x2, $x0, -64148name: test_STGP_post2149body: |150 bb.0.entry:151 liveins: $x0, $x1, $x2152 153 STGPi $x1, $x2, $x0, 0154 $x0 = SUBXri $x0, 1024, 0155 RET_ReallyLR implicit $x0156...157 158# CHECK-LABEL: name: test_STGP_post3159# CHECK: STGPi $x1, $x2, $x0, 0160# CHECK-NEXT: SUBXri $x0, 1040, 0161name: test_STGP_post3162body: |163 bb.0.entry:164 liveins: $x0, $x1, $x2165 166 STGPi $x1, $x2, $x0, 0167 $x0 = SUBXri $x0, 1040, 0168 RET_ReallyLR implicit $x0169...170 171# CHECK-LABEL: name: test_STGP_post4172# CHECK: STGPpost $x1, $x2, $x0, 63173name: test_STGP_post4174body: |175 bb.0.entry:176 liveins: $x0, $x1, $x2177 178 STGPi $x1, $x2, $x0, 0179 $x0 = ADDXri $x0, 1008, 0180 RET_ReallyLR implicit $x0181...182 183# CHECK-LABEL: name: test_STGP_post5184# CHECK: STGPi $x1, $x2, $x0, 0185# CHECK-NEXT: ADDXri $x0, 1024, 0186name: test_STGP_post5187body: |188 bb.0.entry:189 liveins: $x0, $x1, $x2190 191 STGPi $x1, $x2, $x0, 0192 $x0 = ADDXri $x0, 1024, 0193 RET_ReallyLR implicit $x0194...195 196### Pre-indexed forms197 198# CHECK-LABEL: name: test_STG_pre199# CHECK: STGPreIndex $x0, $x0, 10200name: test_STG_pre201body: |202 bb.0.entry:203 liveins: $x0204 205 STGi $x0, $x0, 10206 $x0 = ADDXri $x0, 160, 0207 RET_ReallyLR implicit $x0208...209 210# CHECK-LABEL: name: test_STGP_pre211# CHECK: STGPpre $x1, $x2, $x0, 10212name: test_STGP_pre213body: |214 bb.0.entry:215 liveins: $x0, $x1, $x2216 217 STGPi $x1, $x2, $x0, 10218 $x0 = ADDXri $x0, 160, 0219 RET_ReallyLR implicit $x0220...221 222### Pre-indexed forms with add/sub coming before the store.223 224# CHECK-LABEL: name: test_STG_pre_back225# CHECK: STGPreIndex $x0, $x0, 2226name: test_STG_pre_back227body: |228 bb.0.entry:229 liveins: $x0230 231 $x0 = ADDXri $x0, 32, 0232 STGi $x0, $x0, 0233 RET_ReallyLR implicit $x0234...235 236# CHECK-LABEL: name: test_STGP_pre_back237# CHECK: STGPpre $x1, $x2, $x0, -3238name: test_STGP_pre_back239body: |240 bb.0.entry:241 liveins: $x0, $x1, $x2242 243 $x0 = SUBXri $x0, 48, 0244 STGPi $x1, $x2, $x0, 0245 RET_ReallyLR implicit $x0246...247 248### STGP with source register == address register249 250# CHECK-LABEL: name: test_STGP_post_same_reg251# CHECK: STGPpost $x0, $x0, $x0, 7252name: test_STGP_post_same_reg253body: |254 bb.0.entry:255 liveins: $x0256 257 STGPi $x0, $x0, $x0, 0258 $x0 = ADDXri $x0, 112, 0259 RET_ReallyLR implicit $x0260...261 262# CHECK-LABEL: name: test_STGP_pre_same_reg263# CHECK: STGPpre $x0, $x0, $x0, 7264name: test_STGP_pre_same_reg265body: |266 bb.0.entry:267 liveins: $x0268 269 STGPi $x0, $x0, $x0, 7270 $x0 = ADDXri $x0, 112, 0271 RET_ReallyLR implicit $x0272...273 274# This case can not be merged because the source register is always read before writeback.275# CHECK-LABEL: name: test_STGP_pre_back_same_reg276# CHECK: SUBXri $x0, 48, 0277# CHECK-NEXT: STGPi $x0, $x0, $x0, 0278name: test_STGP_pre_back_same_reg279body: |280 bb.0.entry:281 liveins: $x0282 283 $x0 = SUBXri $x0, 48, 0284 STGPi $x0, $x0, $x0, 0285 RET_ReallyLR implicit $x0286...287