1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32FP32
3 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32FP64
6 define void @select_i32() {entry: ret void}
7 define void @select_ptr() {entry: ret void}
8 define void @select_float() {entry: ret void}
9 define void @select_double() {entry: ret void}
17 tracksRegLiveness: true
20 liveins: $a0, $a1, $a2
22 ; MIPS32FP32-LABEL: name: select_i32
23 ; MIPS32FP32: liveins: $a0, $a1, $a2
24 ; MIPS32FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
25 ; MIPS32FP32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
26 ; MIPS32FP32: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
27 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
28 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
29 ; MIPS32FP32: [[MOVN_I_I:%[0-9]+]]:gpr32 = MOVN_I_I [[COPY1]], [[AND]], [[COPY2]]
30 ; MIPS32FP32: $v0 = COPY [[MOVN_I_I]]
31 ; MIPS32FP32: RetRA implicit $v0
32 ; MIPS32FP64-LABEL: name: select_i32
33 ; MIPS32FP64: liveins: $a0, $a1, $a2
34 ; MIPS32FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
35 ; MIPS32FP64: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
36 ; MIPS32FP64: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
37 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
38 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
39 ; MIPS32FP64: [[MOVN_I_I:%[0-9]+]]:gpr32 = MOVN_I_I [[COPY1]], [[AND]], [[COPY2]]
40 ; MIPS32FP64: $v0 = COPY [[MOVN_I_I]]
41 ; MIPS32FP64: RetRA implicit $v0
42 %3:gprb(s32) = COPY $a0
43 %1:gprb(s32) = COPY $a1
44 %2:gprb(s32) = COPY $a2
45 %6:gprb(s32) = G_CONSTANT i32 1
46 %7:gprb(s32) = COPY %3(s32)
47 %5:gprb(s32) = G_AND %7, %6
48 %4:gprb(s32) = G_SELECT %5(s32), %1, %2
58 tracksRegLiveness: true
61 liveins: $a0, $a1, $a2
63 ; MIPS32FP32-LABEL: name: select_ptr
64 ; MIPS32FP32: liveins: $a0, $a1, $a2
65 ; MIPS32FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
66 ; MIPS32FP32: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
67 ; MIPS32FP32: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
68 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
69 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
70 ; MIPS32FP32: [[MOVN_I_I:%[0-9]+]]:gpr32 = MOVN_I_I [[COPY1]], [[AND]], [[COPY2]]
71 ; MIPS32FP32: $v0 = COPY [[MOVN_I_I]]
72 ; MIPS32FP32: RetRA implicit $v0
73 ; MIPS32FP64-LABEL: name: select_ptr
74 ; MIPS32FP64: liveins: $a0, $a1, $a2
75 ; MIPS32FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
76 ; MIPS32FP64: [[COPY1:%[0-9]+]]:gpr32 = COPY $a1
77 ; MIPS32FP64: [[COPY2:%[0-9]+]]:gpr32 = COPY $a2
78 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
79 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
80 ; MIPS32FP64: [[MOVN_I_I:%[0-9]+]]:gpr32 = MOVN_I_I [[COPY1]], [[AND]], [[COPY2]]
81 ; MIPS32FP64: $v0 = COPY [[MOVN_I_I]]
82 ; MIPS32FP64: RetRA implicit $v0
83 %3:gprb(s32) = COPY $a0
84 %1:gprb(p0) = COPY $a1
85 %2:gprb(p0) = COPY $a2
86 %6:gprb(s32) = G_CONSTANT i32 1
87 %7:gprb(s32) = COPY %3(s32)
88 %5:gprb(s32) = G_AND %7, %6
89 %4:gprb(p0) = G_SELECT %5(s32), %1, %2
99 tracksRegLiveness: true
102 liveins: $a0, $a1, $a2
104 ; MIPS32FP32-LABEL: name: select_float
105 ; MIPS32FP32: liveins: $a0, $a1, $a2
106 ; MIPS32FP32: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
107 ; MIPS32FP32: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
108 ; MIPS32FP32: [[MTC1_1:%[0-9]+]]:fgr32 = MTC1 $a2
109 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
110 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
111 ; MIPS32FP32: [[MOVN_I_S:%[0-9]+]]:fgr32 = MOVN_I_S [[MTC1_]], [[AND]], [[MTC1_1]]
112 ; MIPS32FP32: $f0 = COPY [[MOVN_I_S]]
113 ; MIPS32FP32: RetRA implicit $f0
114 ; MIPS32FP64-LABEL: name: select_float
115 ; MIPS32FP64: liveins: $a0, $a1, $a2
116 ; MIPS32FP64: [[COPY:%[0-9]+]]:gpr32 = COPY $a0
117 ; MIPS32FP64: [[MTC1_:%[0-9]+]]:fgr32 = MTC1 $a1
118 ; MIPS32FP64: [[MTC1_1:%[0-9]+]]:fgr32 = MTC1 $a2
119 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
120 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[COPY]], [[ORi]]
121 ; MIPS32FP64: [[MOVN_I_S:%[0-9]+]]:fgr32 = MOVN_I_S [[MTC1_]], [[AND]], [[MTC1_1]]
122 ; MIPS32FP64: $f0 = COPY [[MOVN_I_S]]
123 ; MIPS32FP64: RetRA implicit $f0
124 %3:gprb(s32) = COPY $a0
125 %1:fgr32(s32) = MTC1 $a1
126 %2:fgr32(s32) = MTC1 $a2
127 %6:gprb(s32) = G_CONSTANT i32 1
128 %7:gprb(s32) = COPY %3(s32)
129 %5:gprb(s32) = G_AND %7, %6
130 %4:fprb(s32) = G_SELECT %5(s32), %1, %2
139 regBankSelected: true
140 tracksRegLiveness: true
142 - { id: 0, offset: 16, size: 4, alignment: 8, isImmutable: true }
147 ; MIPS32FP32-LABEL: name: select_double
148 ; MIPS32FP32: liveins: $d6, $d7
149 ; MIPS32FP32: [[COPY:%[0-9]+]]:afgr64 = COPY $d6
150 ; MIPS32FP32: [[COPY1:%[0-9]+]]:afgr64 = COPY $d7
151 ; MIPS32FP32: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
152 ; MIPS32FP32: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load 4 from %fixed-stack.0, align 8)
153 ; MIPS32FP32: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
154 ; MIPS32FP32: [[AND:%[0-9]+]]:gpr32 = AND [[LW]], [[ORi]]
155 ; MIPS32FP32: [[MOVN_I_D32_:%[0-9]+]]:afgr64 = MOVN_I_D32 [[COPY]], [[AND]], [[COPY1]]
156 ; MIPS32FP32: $d0 = COPY [[MOVN_I_D32_]]
157 ; MIPS32FP32: RetRA implicit $d0
158 ; MIPS32FP64-LABEL: name: select_double
159 ; MIPS32FP64: liveins: $d6, $d7
160 ; MIPS32FP64: [[COPY:%[0-9]+]]:fgr64 = COPY $d6
161 ; MIPS32FP64: [[COPY1:%[0-9]+]]:fgr64 = COPY $d7
162 ; MIPS32FP64: [[ADDiu:%[0-9]+]]:gpr32 = ADDiu %fixed-stack.0, 0
163 ; MIPS32FP64: [[LW:%[0-9]+]]:gpr32 = LW [[ADDiu]], 0 :: (load 4 from %fixed-stack.0, align 8)
164 ; MIPS32FP64: [[ORi:%[0-9]+]]:gpr32 = ORi $zero, 1
165 ; MIPS32FP64: [[AND:%[0-9]+]]:gpr32 = AND [[LW]], [[ORi]]
166 ; MIPS32FP64: [[MOVN_I_D64_:%[0-9]+]]:fgr64 = MOVN_I_D64 [[COPY]], [[AND]], [[COPY1]]
167 ; MIPS32FP64: $d0 = COPY [[MOVN_I_D64_]]
168 ; MIPS32FP64: RetRA implicit $d0
169 %0:fprb(s64) = COPY $d6
170 %1:fprb(s64) = COPY $d7
171 %4:gprb(p0) = G_FRAME_INDEX %fixed-stack.0
172 %3:gprb(s32) = G_LOAD %4(p0) :: (load 4 from %fixed-stack.0, align 8)
173 %7:gprb(s32) = G_CONSTANT i32 1
174 %8:gprb(s32) = COPY %3(s32)
175 %6:gprb(s32) = G_AND %8, %7
176 %5:fprb(s64) = G_SELECT %6(s32), %0, %1