1 # RUN: llc -mtriple=powerpc64le--linux-gnu -stop-after ppc-pre-emit-peephole %s -o - -verify-machineinstrs | FileCheck %s
3 # ADDI instr: ToBeChangedReg = ADDI FrameBaseReg, OffsetAddi
4 # ADD instr: ToBeDeletedReg = ADD ToBeChangedReg(killed), ScaleReg
5 # Imm instr: Reg = op OffsetImm, ToBeDeletedReg(killed)
9 # new ADDI instr: ToBeChangedReg = ADDI FrameBaseReg, (OffsetAddi + OffsetImm)
10 # Index instr: Reg = opx ScaleReg, ToBeChangedReg(killed)
14 #CHECK : name : testIndexForm1
15 # ToBeDeletedReg equals to ScaleReg
16 tracksRegLiveness: true
19 liveins: $x3, $x1, $x4, $x6
21 ; CHECK: $x3 = ADDI8 $x1, -80
22 $x4 = ADD8 killed $x3, killed $x4
23 ; CHECK: $x4 = ADD8 killed $x3, killed $x4
24 $x6 = LD 4, killed $x4
25 ; CHECK: $x6 = LD 4, killed $x4
26 BLR8 implicit $lr8, implicit $rm
30 #CHECK : name : testIndexForm2
31 # ToBeDeletedReg equals to ToBeChangedReg
32 tracksRegLiveness: true
35 liveins: $x3, $x1, $x4, $x6
37 ; CHECK: $x3 = ADDI8 $x1, -80
38 $x3 = ADD8 killed $x3, killed $x4
39 ; CHECK: $x3 = ADD8 killed $x3, killed $x4
40 $x6 = LD 4, killed $x3
41 ; CHECK: $x6 = LD 4, killed $x3
42 BLR8 implicit $lr8, implicit $rm
46 #CHECK : name : testIndexForm3
47 # There is other use for ToBeDeletedReg between ADD instr and Imm instr
48 tracksRegLiveness: true
51 liveins: $x3, $x1, $x4, $x6
53 ; CHECK: $x3 = ADDI8 $x1, -80
54 $x3 = ADD8 killed $x3, killed $x4
55 ; CHECK: $x3 = ADD8 killed $x3, killed $x4
56 STD $x3, killed $x6, 100
57 ; CHECK: STD $x3, killed $x6, 100
58 $x6 = LD 4, killed $x3
59 ; CHECK: $x6 = LD 4, killed $x3
60 BLR8 implicit $lr8, implicit $rm
64 #CHECK : name : testIndexForm3
65 # There is other use for ToBeChangedReg between ADDI instr and ADD instr
66 tracksRegLiveness: true
69 liveins: $x3, $x1, $x4, $x6
71 ; CHECK: $x3 = ADDI8 $x1, -80
72 STD $x3, killed $x6, 100
73 ; CHECK: STD $x3, killed $x6, 100
74 $x3 = ADD8 killed $x3, killed $x4
75 ; CHECK: $x3 = ADD8 killed $x3, killed $x4
76 $x6 = LD 4, killed $x3
77 ; CHECK: $x6 = LD 4, killed $x3
78 BLR8 implicit $lr8, implicit $rm
82 #CHECK : name : testIndexForm5
83 # ToBeChangedReg has no killed flag
84 tracksRegLiveness: true
87 liveins: $x3, $x1, $x4, $x6
89 ; CHECK: $x3 = ADDI8 $x1, -80
90 $x4 = ADD8 $x3, killed $x4
91 ; CHECK: $x4 = ADD8 $x3, killed $x4
92 STD killed $x3, killed $x6, 100
93 ; CHECK: STD killed $x3, killed $x6, 100
94 $x6 = LD 4, killed $x4
95 ; CHECK: $x6 = LD 4, killed $x4
96 BLR8 implicit $lr8, implicit $rm
100 #CHECK : name : testIndexForm6
101 # ToBeDeletedReg has no killed flag
102 tracksRegLiveness: true
105 liveins: $x3, $x1, $x4, $x6
107 ; CHECK: $x3 = ADDI8 $x1, -80
108 $x4 = ADD8 killed $x3, killed $x4
109 ; CHECK: $x4 = ADD8 killed $x3, killed $x4
111 ; CHECK: $x6 = LD 4, $x4
112 STD killed $x4, killed $x6, 100
113 BLR8 implicit $lr8, implicit $rm