1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown -stop-after \
3# RUN:   ppc-pre-emit-peephole %s -o - | FileCheck %s
4
5---
6name: testFoldRLWINM
7tracksRegLiveness: true
8body: |
9  bb.0.entry:
10    liveins: $r3
11    ; CHECK-LABEL: name: testFoldRLWINM
12    ; CHECK: liveins: $r3
13    ; CHECK: renamable $r3 = RLWINM killed renamable $r3, 14, 0, 12, implicit-def $x3
14    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
15    $r3 = RLWINM killed $r3, 27, 5, 31
16    dead renamable $r3 = RLWINM killed renamable $r3, 19, 0, 12, implicit-def $x3
17    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
18...
19---
20name: testFoldRLWINMSrcFullMask1
21tracksRegLiveness: true
22body: |
23  bb.0.entry:
24    liveins: $r3
25    ; CHECK-LABEL: name: testFoldRLWINMSrcFullMask1
26    ; CHECK: liveins: $r3
27    ; CHECK: renamable $r3 = RLWINM killed renamable $r3, 14, 0, 12, implicit-def $x3
28    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
29    $r3 = RLWINM killed $r3, 27, 0, 31
30    dead renamable $r3 = RLWINM killed renamable $r3, 19, 0, 12, implicit-def $x3
31    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
32...
33---
34name: testFoldRLWINMSrcFullMask2
35tracksRegLiveness: true
36body: |
37  bb.0.entry:
38    liveins: $r2, $r3
39    ; CHECK-LABEL: name: testFoldRLWINMSrcFullMask2
40    ; CHECK: liveins: $r2, $r3
41    ; CHECK: renamable $r3 = RLWINM $r2, 14, 10, 1, implicit-def $x3
42    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
43    $r3 = RLWINM killed $r2, 27, 10, 9
44    dead renamable $r3 = RLWINM killed renamable $r3, 19, 10, 1, implicit-def $x3
45    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
46...
47---
48name: testFoldRLWINMSrcWrapped
49tracksRegLiveness: true
50body: |
51  bb.0.entry:
52    liveins: $r3
53    ; CHECK-LABEL: name: testFoldRLWINMSrcWrapped
54    ; CHECK: liveins: $r3
55    ; CHECK: renamable $r3 = RLWINM killed renamable $r3, 14, 11, 12, implicit-def $x3
56    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
57    $r3 = RLWINM killed $r3, 27, 30, 10
58    dead renamable $r3 = RLWINM killed renamable $r3, 19, 0, 12, implicit-def $x3
59    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
60...
61---
62name: testFoldRLWINMUserWrapped
63tracksRegLiveness: true
64body: |
65  bb.0.entry:
66    liveins: $r3
67    ; CHECK-LABEL: name: testFoldRLWINMUserWrapped
68    ; CHECK: liveins: $r3
69    ; CHECK: $r3 = RLWINM killed $r3, 10, 5, 31
70    ; CHECK: renamable $r3 = RLWINM killed renamable $r3, 10, 30, 5, implicit-def $x3
71    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
72    $r3 = RLWINM killed $r3, 10, 5, 31
73    dead renamable $r3 = RLWINM killed renamable $r3, 10, 30, 5, implicit-def $x3
74    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
75...
76---
77name: testFoldRLWINMResultWrapped
78tracksRegLiveness: true
79body: |
80  bb.0.entry:
81    liveins: $r3
82    ; CHECK-LABEL: name: testFoldRLWINMResultWrapped
83    ; CHECK: liveins: $r3
84    ; CHECK: $r3 = RLWINM killed $r3, 10, 20, 10
85    ; CHECK: renamable $r3 = RLWINM killed renamable $r3, 10, 0, 31, implicit-def $x3
86    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
87    $r3 = RLWINM killed $r3, 10, 20, 10
88    dead renamable $r3 = RLWINM killed renamable $r3, 10, 0, 31, implicit-def $x3
89    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
90...
91---
92name: testFoldRLWINMToZero
93tracksRegLiveness: true
94body: |
95  bb.0.entry:
96    liveins: $r3
97    ; CHECK-LABEL: name: testFoldRLWINMToZero
98    ; CHECK: liveins: $r3
99    ; CHECK: renamable $r3 = LI 0, implicit-def $x3
100    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
101    $r3 = RLWINM killed $r3, 27, 5, 10
102    dead renamable $r3 = RLWINM killed renamable $r3, 8, 5, 10, implicit-def $x3
103    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
104...
105---
106name: testFoldRLWINM_recToZero
107tracksRegLiveness: true
108body: |
109  bb.0.entry:
110    liveins: $r3
111    ; CHECK-LABEL: name: testFoldRLWINM_recToZero
112    ; CHECK: liveins: $r3
113    ; CHECK: dead renamable $r3 = ANDI_rec killed renamable $r3, 0, implicit-def $cr0
114    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $cr0
115    $r3 = RLWINM killed $r3, 27, 5, 10
116    dead renamable $r3 = RLWINM_rec killed renamable $r3, 8, 5, 10, implicit-def $cr0
117    BLR8 implicit $lr8, implicit $rm, implicit killed $cr0
118...
119---
120name: testFoldRLWINMInvalidMask
121tracksRegLiveness: true
122body: |
123  bb.0.entry:
124    liveins: $r3
125    ; CHECK-LABEL: name: testFoldRLWINMInvalidMask
126    ; CHECK: liveins: $r3
127    ; CHECK: $r3 = RLWINM killed $r3, 20, 5, 31
128    ; CHECK: renamable $r3 = RLWINM killed renamable $r3, 19, 10, 20, implicit-def $x3
129    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $x3
130    $r3 = RLWINM killed $r3, 20, 5, 31
131    dead renamable $r3 = RLWINM killed renamable $r3, 19, 10, 20, implicit-def $x3
132    BLR8 implicit $lr8, implicit $rm, implicit killed $x3
133...
134---
135name: testFoldRLWINCanNotBeDeleted
136tracksRegLiveness: true
137body: |
138  bb.0.entry:
139    liveins: $r2, $r3
140    ; CHECK-LABEL: name: testFoldRLWINCanNotBeDeleted
141    ; CHECK: liveins: $r2, $r3
142    ; CHECK: $r3 = RLWINM_rec $r2, 27, 5, 10, implicit-def dead $cr0
143    ; CHECK: dead renamable $r3 = ANDI_rec $r2, 0, implicit-def $cr0
144    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $cr0
145    $r3 = RLWINM_rec $r2, 27, 5, 10, implicit-def $cr0
146    dead renamable $r3 = RLWINM_rec killed renamable $r3, 8, 5, 10, implicit-def $cr0
147    BLR8 implicit $lr8, implicit $rm, implicit killed $cr0
148...
149---
150name: testCanNotFoldRLWINM
151tracksRegLiveness: true
152body: |
153  bb.0.entry:
154    liveins: $r3
155    ; CHECK-LABEL: name: testCanNotFoldRLWINM
156    ; CHECK: liveins: $r3
157    ; CHECK: $r3 = RLWINM_rec killed $r3, 27, 5, 10, implicit-def dead $cr0
158    ; CHECK: dead renamable $r3 = RLWINM_rec killed renamable $r3, 8, 5, 10, implicit-def $cr0
159    ; CHECK: BLR8 implicit $lr8, implicit $rm, implicit killed $cr0
160    $r3 = RLWINM_rec $r3, 27, 5, 10, implicit-def $cr0
161    dead renamable $r3 = RLWINM_rec killed renamable $r3, 8, 5, 10, implicit-def $cr0
162    BLR8 implicit $lr8, implicit $rm, implicit killed $cr0
163...
164