1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
5 define void @select_i8() {entry: ret void}
6 define void @select_i16() {entry: ret void}
7 define void @select_i32() {entry: ret void}
8 define void @select_ptr() {entry: ret void}
9 define void @select_with_negation() {entry: ret void}
15 tracksRegLiveness: true
18 liveins: $a0, $a1, $a2
20 ; MIPS32-LABEL: name: select_i8
21 ; MIPS32: liveins: $a0, $a1, $a2
22 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
23 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
24 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
25 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
26 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
27 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
28 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
29 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C]]
30 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY3]], [[COPY4]]
31 ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
32 ; MIPS32: $v0 = COPY [[COPY6]](s32)
33 ; MIPS32: RetRA implicit $v0
35 %0:_(s1) = G_TRUNC %3(s32)
37 %1:_(s8) = G_TRUNC %4(s32)
39 %2:_(s8) = G_TRUNC %5(s32)
40 %6:_(s8) = G_SELECT %0(s1), %1, %2
41 %7:_(s32) = G_ANYEXT %6(s8)
49 tracksRegLiveness: true
52 liveins: $a0, $a1, $a2
54 ; MIPS32-LABEL: name: select_i16
55 ; MIPS32: liveins: $a0, $a1, $a2
56 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
57 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
58 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
59 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
60 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
61 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
62 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
63 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C]]
64 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY3]], [[COPY4]]
65 ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
66 ; MIPS32: $v0 = COPY [[COPY6]](s32)
67 ; MIPS32: RetRA implicit $v0
69 %0:_(s1) = G_TRUNC %3(s32)
71 %1:_(s16) = G_TRUNC %4(s32)
73 %2:_(s16) = G_TRUNC %5(s32)
74 %6:_(s16) = G_SELECT %0(s1), %1, %2
75 %7:_(s32) = G_ANYEXT %6(s16)
83 tracksRegLiveness: true
86 liveins: $a0, $a1, $a2
88 ; MIPS32-LABEL: name: select_i32
89 ; MIPS32: liveins: $a0, $a1, $a2
90 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
91 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
92 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
93 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
94 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
95 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
96 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
97 ; MIPS32: $v0 = COPY [[SELECT]](s32)
98 ; MIPS32: RetRA implicit $v0
100 %0:_(s1) = G_TRUNC %3(s32)
103 %4:_(s32) = G_SELECT %0(s1), %1, %2
111 tracksRegLiveness: true
114 liveins: $a0, $a1, $a2
116 ; MIPS32-LABEL: name: select_ptr
117 ; MIPS32: liveins: $a0, $a1, $a2
118 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
119 ; MIPS32: [[COPY1:%[0-9]+]]:_(p0) = COPY $a1
120 ; MIPS32: [[COPY2:%[0-9]+]]:_(p0) = COPY $a2
121 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
122 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
123 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
124 ; MIPS32: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
125 ; MIPS32: $v0 = COPY [[SELECT]](p0)
126 ; MIPS32: RetRA implicit $v0
128 %0:_(s1) = G_TRUNC %3(s32)
131 %4:_(p0) = G_SELECT %0(s1), %1, %2
137 name: select_with_negation
139 tracksRegLiveness: true
142 liveins: $a0, $a1, $a2, $a3
144 ; MIPS32-LABEL: name: select_with_negation
145 ; MIPS32: liveins: $a0, $a1, $a2, $a3
146 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
147 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
148 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
149 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
150 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
151 ; MIPS32: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]]
152 ; MIPS32: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ICMP]](s32)
153 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY [[C]](s32)
154 ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY4]], [[COPY5]]
155 ; MIPS32: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
156 ; MIPS32: [[COPY6:%[0-9]+]]:_(s32) = COPY [[XOR]](s32)
157 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C1]]
158 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY2]], [[COPY3]]
159 ; MIPS32: $v0 = COPY [[SELECT]](s32)
160 ; MIPS32: RetRA implicit $v0
165 %5:_(s1) = G_CONSTANT i1 true
166 %4:_(s1) = G_ICMP intpred(slt), %0(s32), %1
167 %6:_(s1) = G_XOR %4, %5
168 %7:_(s32) = G_SELECT %6(s1), %2, %3