Debian Codegraph @

llvm/test/CodeGen/PowerPC/opt-cmp-rec-postra.mir

raw
1 # RUN: llc -mtriple=powerpc64le-linux-gnu -stop-after ppc-pre-emit-peephole %s -o - -verify-machineinstrs | FileCheck %s
2
3 ---
4 name: test1
5 # The cmp instr is optimized with the record form.
6 tracksRegLiveness: true
7 body: |
8 bb.0.entry:
9 successors: %bb.1(0x30000000), %bb.2(0x50000000)
10 liveins: $x3, $x4
11 renamable $x3 = OR8 killed renamable $x3, killed renamable $x4
12 renamable $cr0 = CMPDI renamable $x3, 0, implicit killed $x3
13 ; CHECK-LABEL: name: test1
14 ; CHECK: renamable $x3 = OR8_rec killed renamable $x3, killed renamable $x4, implicit-def $cr0
15 ; CHECK-NOT: CMPDI
16 BCC 68, killed renamable $cr0, %bb.2
17
18 bb.1:
19 $x3 = LI8 102
20 BLR8 implicit $lr8, implicit $rm, implicit $x3
21
22 bb.2:
23 $x3 = LI8 116
24 BLR8 implicit $lr8, implicit $rm, implicit $x3
25 ...
26
27 ---
28 name: test2
29 # The imm of the comparison instr isn't 0.
30 tracksRegLiveness: true
31 body: |
32 bb.0.entry:
33 successors: %bb.1(0x30000000), %bb.2(0x50000000)
34 liveins: $x3, $x4
35 renamable $x3 = OR8 killed renamable $x3, killed renamable $x4
36 renamable $cr0 = CMPDI renamable $x3, 2, implicit killed $x3
37 ; CHECK-LABEL: name: test2
38 ; CHECK: CMPDI
39 BCC 68, killed renamable $cr0, %bb.2
40
41 bb.1:
42 $x3 = LI8 102
43 BLR8 implicit $lr8, implicit $rm, implicit $x3
44
45 bb.2:
46 $x3 = LI8 116
47 BLR8 implicit $lr8, implicit $rm, implicit $x3
48 ...
49
50 ---
51 name: test3
52 # The comparison instr has a implicit def.
53 tracksRegLiveness: true
54 body: |
55 bb.0.entry:
56 successors: %bb.1(0x30000000), %bb.2(0x50000000)
57 liveins: $x3, $x4
58 renamable $x3 = OR8 killed renamable $x3, killed renamable $x4
59 renamable $cr0 = CMPDI renamable $x3, 0, implicit-def $x3
60 ; CHECK-LABEL: name: test3
61 ; CHECK: CMPDI
62 BCC 68, killed renamable $cr0, %bb.2
63
64 bb.1:
65 $x3 = LI8 102
66 BLR8 implicit $lr8, implicit $rm, implicit $x3
67
68 bb.2:
69 $x3 = LI8 116
70 BLR8 implicit $lr8, implicit $rm, implicit $x3
71 ...
72
73 ---
74 name: test4
75 # There is another use for cr0 between OR8 instr and CMPWI instr.
76 tracksRegLiveness: true
77 body: |
78 bb.0.entry:
79 successors: %bb.1(0x30000000), %bb.2(0x50000000)
80 liveins: $x3, $x4, $cr0
81 renamable $x3 = OR8 killed renamable $x3, killed renamable $x4
82 renamable $cr1 = MCRF killed $cr0, implicit $x3
83 renamable $cr0 = CMPDI renamable $x3, 0, implicit killed $x3, implicit $cr1
84 ; CHECK-LABEL: name: test4
85 ; CHECK: CMPDI
86 BCC 68, killed renamable $cr0, %bb.2
87
88 bb.1:
89 $x3 = LI8 102
90 BLR8 implicit $lr8, implicit $rm, implicit $x3
91
92 bb.2:
93 $x3 = LI8 116
94 BLR8 implicit $lr8, implicit $rm, implicit $x3
95 ...
96
97 ---
98 name: test5
99 # There is another def for cr0 between OR8 instr and CMPWI instr.
100 tracksRegLiveness: true
101 body: |
102 bb.0.entry:
103 successors: %bb.1(0x30000000), %bb.2(0x50000000)
104 liveins: $x3, $x4
105 renamable $x3 = OR8 killed renamable $x3, renamable $x4
106 renamable $cr1 = CMPD renamable $x3, renamable $x4, implicit-def $cr0
107 renamable $cr0 = CMPDI renamable $x3, 0, implicit killed $x3, implicit $cr1
108 ; CHECK-LABEL: name: test5
109 ; CHECK: CMPDI
110 BCC 68, killed renamable $cr0, %bb.2
111
112 bb.1:
113 $x3 = LI8 102
114 BLR8 implicit $lr8, implicit $rm, implicit $x3
115
116 bb.2:
117 $x3 = LI8 116
118 BLR8 implicit $lr8, implicit $rm, implicit $x3
119 ...
120
121 ---
122 name: test6
123 # The SrcReg isn't CR0.
124 tracksRegLiveness: true
125 body: |
126 bb.0.entry:
127 successors: %bb.1(0x30000000), %bb.2(0x50000000)
128 liveins: $x3, $x4
129 renamable $x3 = OR8 killed renamable $x3, killed renamable $x4
130 renamable $cr1 = CMPDI renamable $x3, 0, implicit killed $x3
131 ; CHECK-LABEL: name: test6
132 ; CHECK: CMPDI
133 BCC 68, killed renamable $cr1, %bb.2
134
135 bb.1:
136 $x3 = LI8 102
137 BLR8 implicit $lr8, implicit $rm, implicit $x3
138
139 bb.2:
140 $x3 = LI8 116
141 BLR8 implicit $lr8, implicit $rm, implicit $x3
142 ...