1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck -check-prefix=FAST %s
3# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck -check-prefix=GREEDY %s
4
5---
6name: sadde_s32_sss
7legalized: true
8
9body: |
10  bb.0:
11    liveins: $sgpr0, $sgpr1, $sgpr2
12    ; FAST-LABEL: name: sadde_s32_sss
13    ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
14    ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
15    ; FAST: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
16    ; FAST: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
17    ; FAST: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
18    ; FAST: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
19    ; FAST: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
20    ; FAST: [[SADDE:%[0-9]+]]:sgpr(s32), [[SADDE1:%[0-9]+]]:sgpr(s32) = G_SADDE [[COPY]], [[COPY1]], [[ZEXT]]
21    ; FAST: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[SADDE1]](s32)
22    ; GREEDY-LABEL: name: sadde_s32_sss
23    ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
24    ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
25    ; GREEDY: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
26    ; GREEDY: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
27    ; GREEDY: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
28    ; GREEDY: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
29    ; GREEDY: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
30    ; GREEDY: [[SADDE:%[0-9]+]]:sgpr(s32), [[SADDE1:%[0-9]+]]:sgpr(s32) = G_SADDE [[COPY]], [[COPY1]], [[ZEXT]]
31    ; GREEDY: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[SADDE1]](s32)
32    %0:_(s32) = COPY $sgpr0
33    %1:_(s32) = COPY $sgpr1
34    %2:_(s32) = COPY $sgpr2
35    %3:_(s32) = G_CONSTANT i32 0
36    %4:_(s1) = G_ICMP intpred(eq), %2, %3
37    %5:_(s32), %6:_(s1) = G_SADDE %0, %1, %4
38...
39
40---
41name: sadde_s32_vss
42legalized: true
43
44body: |
45  bb.0:
46    liveins: $vgpr0, $sgpr0, $sgpr1
47    ; FAST-LABEL: name: sadde_s32_vss
48    ; FAST: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
49    ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
50    ; FAST: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
51    ; FAST: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
52    ; FAST: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
53    ; FAST: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
54    ; FAST: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
55    ; FAST: [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
56    ; FAST: [[SADDE:%[0-9]+]]:vgpr(s32), [[SADDE1:%[0-9]+]]:vcc(s1) = G_SADDE [[COPY]], [[COPY3]], [[COPY4]]
57    ; GREEDY-LABEL: name: sadde_s32_vss
58    ; GREEDY: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
59    ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
60    ; GREEDY: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
61    ; GREEDY: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 0
62    ; GREEDY: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
63    ; GREEDY: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[ICMP]](s32)
64    ; GREEDY: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
65    ; GREEDY: [[COPY4:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
66    ; GREEDY: [[SADDE:%[0-9]+]]:vgpr(s32), [[SADDE1:%[0-9]+]]:vcc(s1) = G_SADDE [[COPY]], [[COPY3]], [[COPY4]]
67    %0:_(s32) = COPY $vgpr0
68    %1:_(s32) = COPY $sgpr0
69    %2:_(s32) = COPY $sgpr1
70    %3:_(s32) = G_CONSTANT i32 0
71    %4:_(s1) = G_ICMP intpred(eq), %2, %3
72    %5:_(s32), %6:_(s1) = G_SADDE %0, %1, %4
73...
74---
75name: sadde_s32_ssv
76legalized: true
77
78body: |
79  bb.0:
80    liveins: $sgpr0, $sgpr1, $vgpr0
81    ; FAST-LABEL: name: sadde_s32_ssv
82    ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
83    ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
84    ; FAST: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
85    ; FAST: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY2]](s32)
86    ; FAST: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
87    ; FAST: [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
88    ; FAST: [[COPY5:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
89    ; FAST: [[SADDE:%[0-9]+]]:vgpr(s32), [[SADDE1:%[0-9]+]]:vcc(s1) = G_SADDE [[COPY3]], [[COPY4]], [[COPY5]]
90    ; GREEDY-LABEL: name: sadde_s32_ssv
91    ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
92    ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
93    ; GREEDY: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
94    ; GREEDY: [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY2]](s32)
95    ; GREEDY: [[COPY3:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
96    ; GREEDY: [[COPY4:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
97    ; GREEDY: [[COPY5:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
98    ; GREEDY: [[SADDE:%[0-9]+]]:vgpr(s32), [[SADDE1:%[0-9]+]]:vcc(s1) = G_SADDE [[COPY3]], [[COPY4]], [[COPY5]]
99    %0:_(s32) = COPY $sgpr0
100    %1:_(s32) = COPY $sgpr1
101    %2:_(s32) = COPY $vgpr0
102    %3:_(s1) = G_TRUNC %2
103    %4:_(s32), %5:_(s1) = G_SADDE %0, %1, %3
104...
105
106---
107name: sadde_s32_vvs
108legalized: true
109
110body: |
111  bb.0:
112    liveins: $vgpr0, $vgpr1, $sgpr0
113    ; FAST-LABEL: name: sadde_s32_vvs
114    ; FAST: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
115    ; FAST: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
116    ; FAST: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
117    ; FAST: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY2]](s32)
118    ; FAST: [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
119    ; FAST: [[SADDE:%[0-9]+]]:vgpr(s32), [[SADDE1:%[0-9]+]]:vcc(s1) = G_SADDE [[COPY]], [[COPY1]], [[COPY3]]
120    ; GREEDY-LABEL: name: sadde_s32_vvs
121    ; GREEDY: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
122    ; GREEDY: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
123    ; GREEDY: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
124    ; GREEDY: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY2]](s32)
125    ; GREEDY: [[COPY3:%[0-9]+]]:vcc(s1) = COPY [[TRUNC]](s1)
126    ; GREEDY: [[SADDE:%[0-9]+]]:vgpr(s32), [[SADDE1:%[0-9]+]]:vcc(s1) = G_SADDE [[COPY]], [[COPY1]], [[COPY3]]
127    %0:_(s32) = COPY $vgpr0
128    %1:_(s32) = COPY $vgpr1
129    %2:_(s32) = COPY $sgpr0
130    %3:_(s1) = G_TRUNC %2
131    %4:_(s32), %5:_(s1) = G_SADDE %0, %1, %3
132...
133
134---
135name: sadde_s32_sss_noscc
136legalized: true
137
138body: |
139  bb.0:
140    liveins: $sgpr0, $sgpr1, $sgpr2
141    ; FAST-LABEL: name: sadde_s32_sss_noscc
142    ; FAST: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
143    ; FAST: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
144    ; FAST: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
145    ; FAST: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY2]](s32)
146    ; FAST: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
147    ; FAST: [[SADDE:%[0-9]+]]:sgpr(s32), [[SADDE1:%[0-9]+]]:sgpr(s32) = G_SADDE [[COPY]], [[COPY1]], [[ZEXT]]
148    ; FAST: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[SADDE1]](s32)
149    ; GREEDY-LABEL: name: sadde_s32_sss_noscc
150    ; GREEDY: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
151    ; GREEDY: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
152    ; GREEDY: [[COPY2:%[0-9]+]]:sgpr(s32) = COPY $sgpr2
153    ; GREEDY: [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY2]](s32)
154    ; GREEDY: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s1)
155    ; GREEDY: [[SADDE:%[0-9]+]]:sgpr(s32), [[SADDE1:%[0-9]+]]:sgpr(s32) = G_SADDE [[COPY]], [[COPY1]], [[ZEXT]]
156    ; GREEDY: [[TRUNC1:%[0-9]+]]:sgpr(s1) = G_TRUNC [[SADDE1]](s32)
157    %0:_(s32) = COPY $sgpr0
158    %1:_(s32) = COPY $sgpr1
159    %2:_(s32) = COPY $sgpr2
160    %3:_(s1) = G_TRUNC %2
161    %4:_(s32), %5:_(s1) = G_SADDE %0, %1, %3
162...
163