1 # RUN: llc -mtriple=s390x-linux-gnu -mcpu=z14 -start-before=greedy %s -o - \
4 # Test folding of a memory operand into logical compare with an immediate.
7 define i32 @fun0(ptr %src, i32 %arg) { ret i32 0 }
8 define i64 @fun1(ptr %src, i64 %arg) { ret i64 0 }
9 define i32 @fun2(ptr %src, i32 %arg) { ret i32 0 }
10 define i64 @fun3(ptr %src, i64 %arg) { ret i64 0 }
15 # CHECK: mvhi 160(%r15), 0 # 4-byte Folded Spill
16 # CHECK: mvc 160(4,%r15), 0(%r2) # 4-byte Folded Spill
17 # CHECK-LABEL: .LBB0_2:
18 # CHECK: clfhsi 160(%r15), 2 # 4-byte Folded Reload
22 tracksRegLiveness: true
24 - { id: 0, class: grx32bit }
25 - { id: 1, class: grx32bit }
26 - { id: 2, class: addr64bit }
27 - { id: 3, class: gr32bit }
28 - { id: 4, class: grx32bit }
29 - { id: 5, class: grx32bit }
30 - { id: 6, class: gr32bit }
31 - { id: 7, class: gr32bit }
32 - { id: 8, class: grx32bit }
34 - { reg: '$r2d', virtual-reg: '%2' }
35 - { reg: '$r3l', virtual-reg: '%3' }
38 hasOpaqueSPAdjustment: true
39 machineFunctionInfo: {}
42 successors: %bb.1(0x30000000), %bb.2(0x50000000)
45 %3:gr32bit = COPY $r3l
46 %2:addr64bit = COPY $r2d
48 CHIMux %3, 0, implicit-def $cc
49 %8:grx32bit = LHIMux 0
50 BRC 14, 6, %bb.2, implicit killed $cc
54 %8:grx32bit = LMux %2, 0, $noreg :: (load (s32) from %ir.src)
55 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
58 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
59 CLFIMux %8, 2, implicit-def $cc
60 %6:gr32bit = LOCHIMux %6, 1, 14, 6, implicit killed $cc
61 %7:gr32bit = NRK %3, %6, implicit-def dead $cc
69 # CHECK: mvghi 160(%r15), 0 # 8-byte Folded Spill
70 # CHECK: mvc 160(8,%r15), 0(%r2) # 8-byte Folded Spill
71 # CHECK-LABEL: .LBB1_2:
72 # CHECK: clghsi 160(%r15), 2 # 8-byte Folded Reload
76 tracksRegLiveness: true
78 - { id: 0, class: gr64bit }
79 - { id: 1, class: gr64bit }
80 - { id: 2, class: addr64bit }
81 - { id: 3, class: gr64bit }
82 - { id: 4, class: gr64bit }
83 - { id: 5, class: gr64bit }
84 - { id: 6, class: gr64bit }
85 - { id: 7, class: gr64bit }
86 - { id: 8, class: gr64bit }
88 - { reg: '$r2d', virtual-reg: '%2' }
89 - { reg: '$r3d', virtual-reg: '%3' }
92 hasOpaqueSPAdjustment: true
93 machineFunctionInfo: {}
96 successors: %bb.1(0x30000000), %bb.2(0x50000000)
99 %3:gr64bit = COPY $r3d
100 %2:addr64bit = COPY $r2d
102 CGHI %3, 0, implicit-def $cc
104 BRC 14, 6, %bb.2, implicit killed $cc
108 %8:gr64bit = LG %2, 0, $noreg :: (load (s64) from %ir.src)
109 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
112 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
113 CLGFI %8, 2, implicit-def $cc
114 %6:gr64bit = LOCGHI %6, 1, 14, 6, implicit killed $cc
115 %7:gr64bit = NGRK %3, %6, implicit-def dead $cc
122 # 17-bit immediate can not be folded
125 # CHECK: mvhi 160(%r15), 0 # 4-byte Folded Spill
126 # CHECK: mvc 160(4,%r15), 0(%r2) # 4-byte Folded Spill
127 # CHECK-LABEL: .LBB2_2:
128 # CHECK: l %r0, 160(%r15) # 4-byte Folded Reload
129 # CHECK: clfi %r0, 65536
133 tracksRegLiveness: true
135 - { id: 0, class: grx32bit }
136 - { id: 1, class: grx32bit }
137 - { id: 2, class: addr64bit }
138 - { id: 3, class: gr32bit }
139 - { id: 4, class: grx32bit }
140 - { id: 5, class: grx32bit }
141 - { id: 6, class: gr32bit }
142 - { id: 7, class: gr32bit }
143 - { id: 8, class: grx32bit }
145 - { reg: '$r2d', virtual-reg: '%2' }
146 - { reg: '$r3l', virtual-reg: '%3' }
149 hasOpaqueSPAdjustment: true
150 machineFunctionInfo: {}
153 successors: %bb.1(0x30000000), %bb.2(0x50000000)
156 %3:gr32bit = COPY $r3l
157 %2:addr64bit = COPY $r2d
158 %6:gr32bit = LHIMux 0
159 CHIMux %3, 0, implicit-def $cc
160 %8:grx32bit = LHIMux 0
161 BRC 14, 6, %bb.2, implicit killed $cc
165 %8:grx32bit = LMux %2, 0, $noreg :: (load (s32) from %ir.src)
166 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
169 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
170 CLFIMux %8, 65536, implicit-def $cc
171 %6:gr32bit = LOCHIMux %6, 1, 14, 6, implicit killed $cc
172 %7:gr32bit = NRK %3, %6, implicit-def dead $cc
179 # 17-bit immediate can not be folded
182 # CHECK: mvghi 160(%r15), 0 # 8-byte Folded Spill
183 # CHECK: mvc 160(8,%r15), 0(%r2) # 8-byte Folded Spill
184 # CHECK-LABEL: .LBB3_2:
185 # CHECK: lg %r0, 160(%r15) # 8-byte Folded Reload
186 # CHECK: clgfi %r0, 65536
190 tracksRegLiveness: true
192 - { id: 0, class: gr64bit }
193 - { id: 1, class: gr64bit }
194 - { id: 2, class: addr64bit }
195 - { id: 3, class: gr64bit }
196 - { id: 4, class: gr64bit }
197 - { id: 5, class: gr64bit }
198 - { id: 6, class: gr64bit }
199 - { id: 7, class: gr64bit }
200 - { id: 8, class: gr64bit }
202 - { reg: '$r2d', virtual-reg: '%2' }
203 - { reg: '$r3d', virtual-reg: '%3' }
206 hasOpaqueSPAdjustment: true
207 machineFunctionInfo: {}
210 successors: %bb.1(0x30000000), %bb.2(0x50000000)
213 %3:gr64bit = COPY $r3d
214 %2:addr64bit = COPY $r2d
216 CGHI %3, 0, implicit-def $cc
218 BRC 14, 6, %bb.2, implicit killed $cc
222 %8:gr64bit = LG %2, 0, $noreg :: (load (s64) from %ir.src)
223 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
226 INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0d, 12, implicit-def dead early-clobber $r1d, 12, implicit-def dead early-clobber $r2d, 12, implicit-def dead early-clobber $r3d, 12, implicit-def dead early-clobber $r4d, 12, implicit-def dead early-clobber $r5d, 12, implicit-def dead early-clobber $r6d, 12, implicit-def dead early-clobber $r7d, 12, implicit-def dead early-clobber $r8d, 12, implicit-def dead early-clobber $r9d, 12, implicit-def dead early-clobber $r10d, 12, implicit-def dead early-clobber $r11d, 12, implicit-def dead early-clobber $r12d, 12, implicit-def dead early-clobber $r13d, 12, implicit-def dead early-clobber $r14d, 12, implicit-def early-clobber $r15d
227 CLGFI %8, 65536, implicit-def $cc
228 %6:gr64bit = LOCGHI %6, 1, 14, 6, implicit killed $cc
229 %7:gr64bit = NGRK %3, %6, implicit-def dead $cc