[MIPS GlobalISel] Register bank select for G_STORE. Select i64 store
[llvm-complete.git] / test / CodeGen / Mips / GlobalISel / legalizer / select.mir
blob249c4d3a7f23e4609c01af4c4389dd4338eb236a
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
3 --- |
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}
11 ...
12 ---
13 name:            select_i8
14 alignment:       2
15 tracksRegLiveness: true
16 body:             |
17   bb.1.entry:
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
34     %3:_(s32) = COPY $a0
35     %0:_(s1) = G_TRUNC %3(s32)
36     %4:_(s32) = COPY $a1
37     %1:_(s8) = G_TRUNC %4(s32)
38     %5:_(s32) = COPY $a2
39     %2:_(s8) = G_TRUNC %5(s32)
40     %6:_(s8) = G_SELECT %0(s1), %1, %2
41     %7:_(s32) = G_ANYEXT %6(s8)
42     $v0 = COPY %7(s32)
43     RetRA implicit $v0
45 ...
46 ---
47 name:            select_i16
48 alignment:       2
49 tracksRegLiveness: true
50 body:             |
51   bb.1.entry:
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
68     %3:_(s32) = COPY $a0
69     %0:_(s1) = G_TRUNC %3(s32)
70     %4:_(s32) = COPY $a1
71     %1:_(s16) = G_TRUNC %4(s32)
72     %5:_(s32) = COPY $a2
73     %2:_(s16) = G_TRUNC %5(s32)
74     %6:_(s16) = G_SELECT %0(s1), %1, %2
75     %7:_(s32) = G_ANYEXT %6(s16)
76     $v0 = COPY %7(s32)
77     RetRA implicit $v0
79 ...
80 ---
81 name:            select_i32
82 alignment:       2
83 tracksRegLiveness: true
84 body:             |
85   bb.1.entry:
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
99     %3:_(s32) = COPY $a0
100     %0:_(s1) = G_TRUNC %3(s32)
101     %1:_(s32) = COPY $a1
102     %2:_(s32) = COPY $a2
103     %4:_(s32) = G_SELECT %0(s1), %1, %2
104     $v0 = COPY %4(s32)
105     RetRA implicit $v0
109 name:            select_ptr
110 alignment:       2
111 tracksRegLiveness: true
112 body:             |
113   bb.1.entry:
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
127     %3:_(s32) = COPY $a0
128     %0:_(s1) = G_TRUNC %3(s32)
129     %1:_(p0) = COPY $a1
130     %2:_(p0) = COPY $a2
131     %4:_(p0) = G_SELECT %0(s1), %1, %2
132     $v0 = COPY %4(p0)
133     RetRA implicit $v0
137 name:            select_with_negation
138 alignment:       2
139 tracksRegLiveness: true
140 body:             |
141   bb.1.entry:
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
161     %0:_(s32) = COPY $a0
162     %1:_(s32) = COPY $a1
163     %2:_(s32) = COPY $a2
164     %3:_(s32) = COPY $a3
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
169     $v0 = COPY %7(s32)
170     RetRA implicit $v0