1 # RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -run-pass=aarch64-ldst-opt %s -o - | FileCheck %s
3 # When the AArch64 Load Store Optimization pass tries to convert load instructions
4 # into a ldp instruction, and when the base register of the second ldr instruction
5 # has been modified in between these two ldr instructions, the conversion should not
8 # For example, for the following pattern:
12 # the first and third ldr instructions cannot be converted to ldp x9, x10, [x10].
14 # CHECK-LABEL: name: ldr-modified-baseReg-no-ldp1
16 # CHECK: $x9 = LDRXui $x10, 1 :: (load (s64))
17 # CHECK: $x10 = LDURXi $x8, 1 :: (load (s64))
18 # CHECK: $x10 = LDRXui $x10, 0 :: (load (s64))
21 name: ldr-modified-baseReg-no-ldp1
22 tracksRegLiveness: true
27 $x9 = LDRXui $x10, 1 :: (load (s64))
28 $x10 = LDURXi $x8, 1 :: (load (s64))
29 $x10 = LDRXui $x10, 0 :: (load (s64))
30 RET undef $lr, implicit undef $w0
33 # CHECK-LABEL: name: str-modified-baseReg-no-stp1
35 # CHECK: STRXui $x9, $x10, 1 :: (store (s64))
36 # CHECK: $x10 = LDRXui $x8, 0 :: (load (s64))
37 # CHECK: STRXui $x10, $x10, 0 :: (store (s64))
40 name: str-modified-baseReg-no-stp1
41 tracksRegLiveness: true
44 liveins: $x9, $x8, $x10
46 STRXui $x9, $x10, 1 :: (store (s64))
47 $x10 = LDRXui $x8, 0 :: (load (s64))
48 STRXui $x10, $x10, 0 :: (store (s64))
49 RET undef $lr, implicit undef $w0
52 # CHECK-LABEL: name: ldr-modified-baseReg-no-ldp2
54 # CHECK: $x9 = LDRXui $x10, 1 :: (load (s64))
55 # CHECK: $x10 = MOVi64imm 13
56 # CHECK: $x11 = LDRXui $x10, 0 :: (load (s64))
59 name: ldr-modified-baseReg-no-ldp2
60 tracksRegLiveness: true
65 $x9 = LDRXui $x10, 1 :: (load (s64))
67 $x11 = LDRXui $x10, 0 :: (load (s64))
68 RET undef $lr, implicit undef $w0
71 # CHECK-LABEL: name: ldr-modified-baseReg-no-ldp3
73 # CHECK: $x9 = LDRXui $x10, 1 :: (load (s64))
74 # CHECK: $x10 = ADDXri $x8, $x11, 0
75 # CHECK: $x12 = LDRXui $x10, 0 :: (load (s64))
78 name: ldr-modified-baseReg-no-ldp3
79 tracksRegLiveness: true
82 liveins: $x8, $x10, $x11
84 $x9 = LDRXui $x10, 1 :: (load (s64))
85 $x10 = ADDXri $x8, $x11, 0
86 $x12 = LDRXui $x10, 0 :: (load (s64))
87 RET undef $lr, implicit undef $w0
90 # CHECK-LABEL: name: ldr-modified-baseAddr-convert-to-ldp
91 # CHECK: $x12, $x9 = LDPXi $x10, 0 :: (load (s64))
92 # CHECK: STRXui $x11, $x10, 1 :: (store (s64))
95 name: ldr-modified-baseAddr-convert-to-ldp
96 tracksRegLiveness: true
99 liveins: $x8, $x10, $x11
101 $x9 = LDRXui $x10, 1 :: (load (s64))
102 STRXui $x11, $x10, 1 :: (store (s64))
103 $x12 = LDRXui $x10, 0 :: (load (s64))
104 RET undef $lr, implicit undef $w0