276 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2 3; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP324; RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP645 6define float @float_in_fpr(float %a, float %b) {7 ; FP32-LABEL: name: float_in_fpr8 ; FP32: bb.1.entry:9 ; FP32-NEXT: liveins: $f12, $f1410 ; FP32-NEXT: {{ $}}11 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f1212 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f1413 ; FP32-NEXT: $f0 = COPY [[COPY1]](s32)14 ; FP32-NEXT: RetRA implicit $f015 ;16 ; FP64-LABEL: name: float_in_fpr17 ; FP64: bb.1.entry:18 ; FP64-NEXT: liveins: $f12, $f1419 ; FP64-NEXT: {{ $}}20 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f1221 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f1422 ; FP64-NEXT: $f0 = COPY [[COPY1]](s32)23 ; FP64-NEXT: RetRA implicit $f024entry:25 ret float %b26}27 28define double @double_in_fpr(double %a, double %b) {29 ; FP32-LABEL: name: double_in_fpr30 ; FP32: bb.1.entry:31 ; FP32-NEXT: liveins: $d6, $d732 ; FP32-NEXT: {{ $}}33 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d634 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d735 ; FP32-NEXT: $d0 = COPY [[COPY1]](s64)36 ; FP32-NEXT: RetRA implicit $d037 ;38 ; FP64-LABEL: name: double_in_fpr39 ; FP64: bb.1.entry:40 ; FP64-NEXT: liveins: $d12_64, $d14_6441 ; FP64-NEXT: {{ $}}42 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d12_6443 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d14_6444 ; FP64-NEXT: $d0_64 = COPY [[COPY1]](s64)45 ; FP64-NEXT: RetRA implicit $d0_6446entry:47 ret double %b48}49 50define float @float_in_gpr(i32 %a, float %b) {51 ; FP32-LABEL: name: float_in_gpr52 ; FP32: bb.1.entry:53 ; FP32-NEXT: liveins: $a0, $a154 ; FP32-NEXT: {{ $}}55 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a056 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a157 ; FP32-NEXT: $f0 = COPY [[COPY1]](s32)58 ; FP32-NEXT: RetRA implicit $f059 ;60 ; FP64-LABEL: name: float_in_gpr61 ; FP64: bb.1.entry:62 ; FP64-NEXT: liveins: $a0, $a163 ; FP64-NEXT: {{ $}}64 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a065 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a166 ; FP64-NEXT: $f0 = COPY [[COPY1]](s32)67 ; FP64-NEXT: RetRA implicit $f068entry:69 ret float %b70}71 72define double @double_in_gpr(i32 %a, double %b) {73 ; FP32-LABEL: name: double_in_gpr74 ; FP32: bb.1.entry:75 ; FP32-NEXT: liveins: $a0, $a2, $a376 ; FP32-NEXT: {{ $}}77 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a078 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a279 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a380 ; FP32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)81 ; FP32-NEXT: $d0 = COPY [[MV]](s64)82 ; FP32-NEXT: RetRA implicit $d083 ;84 ; FP64-LABEL: name: double_in_gpr85 ; FP64: bb.1.entry:86 ; FP64-NEXT: liveins: $a0, $a2, $a387 ; FP64-NEXT: {{ $}}88 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a089 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a290 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a391 ; FP64-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)92 ; FP64-NEXT: $d0_64 = COPY [[MV]](s64)93 ; FP64-NEXT: RetRA implicit $d0_6494entry:95 ret double %b96}97 98define double @two_double_in_gpr(i32 %a, double %b, double %c) {99 ; FP32-LABEL: name: two_double_in_gpr100 ; FP32: bb.1.entry:101 ; FP32-NEXT: liveins: $a0, $a2, $a3102 ; FP32-NEXT: {{ $}}103 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0104 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2105 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3106 ; FP32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)107 ; FP32-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0108 ; FP32-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s64) from %fixed-stack.0)109 ; FP32-NEXT: $d0 = COPY [[LOAD]](s64)110 ; FP32-NEXT: RetRA implicit $d0111 ;112 ; FP64-LABEL: name: two_double_in_gpr113 ; FP64: bb.1.entry:114 ; FP64-NEXT: liveins: $a0, $a2, $a3115 ; FP64-NEXT: {{ $}}116 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0117 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2118 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3119 ; FP64-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)120 ; FP64-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0121 ; FP64-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s64) from %fixed-stack.0)122 ; FP64-NEXT: $d0_64 = COPY [[LOAD]](s64)123 ; FP64-NEXT: RetRA implicit $d0_64124entry:125 ret double %c126}127 128define float @call_float_in_fpr(float %a, float %b) {129 ; FP32-LABEL: name: call_float_in_fpr130 ; FP32: bb.1.entry:131 ; FP32-NEXT: liveins: $f12, $f14132 ; FP32-NEXT: {{ $}}133 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12134 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14135 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp136 ; FP32-NEXT: $f12 = COPY [[COPY]](s32)137 ; FP32-NEXT: $f14 = COPY [[COPY1]](s32)138 ; FP32-NEXT: JAL @float_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0139 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0140 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp141 ; FP32-NEXT: $f0 = COPY [[COPY2]](s32)142 ; FP32-NEXT: RetRA implicit $f0143 ;144 ; FP64-LABEL: name: call_float_in_fpr145 ; FP64: bb.1.entry:146 ; FP64-NEXT: liveins: $f12, $f14147 ; FP64-NEXT: {{ $}}148 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12149 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $f14150 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp151 ; FP64-NEXT: $f12 = COPY [[COPY]](s32)152 ; FP64-NEXT: $f14 = COPY [[COPY1]](s32)153 ; FP64-NEXT: JAL @float_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $f12, implicit $f14, implicit-def $f0154 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0155 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp156 ; FP64-NEXT: $f0 = COPY [[COPY2]](s32)157 ; FP64-NEXT: RetRA implicit $f0158entry:159 %call = call float @float_in_fpr(float %a, float %b)160 ret float %call161}162 163define double @call_double_in_fpr(double %a, double %b) {164 ; FP32-LABEL: name: call_double_in_fpr165 ; FP32: bb.1.entry:166 ; FP32-NEXT: liveins: $d6, $d7167 ; FP32-NEXT: {{ $}}168 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6169 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7170 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp171 ; FP32-NEXT: $d6 = COPY [[COPY]](s64)172 ; FP32-NEXT: $d7 = COPY [[COPY1]](s64)173 ; FP32-NEXT: JAL @double_in_fpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit $d7, implicit-def $d0174 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0175 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp176 ; FP32-NEXT: $d0 = COPY [[COPY2]](s64)177 ; FP32-NEXT: RetRA implicit $d0178 ;179 ; FP64-LABEL: name: call_double_in_fpr180 ; FP64: bb.1.entry:181 ; FP64-NEXT: liveins: $d12_64, $d14_64182 ; FP64-NEXT: {{ $}}183 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d12_64184 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $d14_64185 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp186 ; FP64-NEXT: $d12_64 = COPY [[COPY]](s64)187 ; FP64-NEXT: $d14_64 = COPY [[COPY1]](s64)188 ; FP64-NEXT: JAL @double_in_fpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $d12_64, implicit $d14_64, implicit-def $d0_64189 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $d0_64190 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp191 ; FP64-NEXT: $d0_64 = COPY [[COPY2]](s64)192 ; FP64-NEXT: RetRA implicit $d0_64193entry:194 %call = call double @double_in_fpr(double %a, double %b)195 ret double %call196}197 198define float @call_float_in_gpr(i32 %a, float %b) {199 ; FP32-LABEL: name: call_float_in_gpr200 ; FP32: bb.1.entry:201 ; FP32-NEXT: liveins: $a0, $a1202 ; FP32-NEXT: {{ $}}203 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0204 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1205 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp206 ; FP32-NEXT: $a0 = COPY [[COPY]](s32)207 ; FP32-NEXT: $a1 = COPY [[COPY1]](s32)208 ; FP32-NEXT: JAL @float_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $f0209 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0210 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp211 ; FP32-NEXT: $f0 = COPY [[COPY2]](s32)212 ; FP32-NEXT: RetRA implicit $f0213 ;214 ; FP64-LABEL: name: call_float_in_gpr215 ; FP64: bb.1.entry:216 ; FP64-NEXT: liveins: $a0, $a1217 ; FP64-NEXT: {{ $}}218 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0219 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1220 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp221 ; FP64-NEXT: $a0 = COPY [[COPY]](s32)222 ; FP64-NEXT: $a1 = COPY [[COPY1]](s32)223 ; FP64-NEXT: JAL @float_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $f0224 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $f0225 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp226 ; FP64-NEXT: $f0 = COPY [[COPY2]](s32)227 ; FP64-NEXT: RetRA implicit $f0228entry:229 %call = call float @float_in_gpr(i32 %a, float %b)230 ret float %call231}232 233 234define double @call_double_in_gpr(i32 %a, double %b) {235 ; FP32-LABEL: name: call_double_in_gpr236 ; FP32: bb.1.entry:237 ; FP32-NEXT: liveins: $a0, $a2, $a3238 ; FP32-NEXT: {{ $}}239 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0240 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2241 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3242 ; FP32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)243 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp244 ; FP32-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)245 ; FP32-NEXT: $a0 = COPY [[COPY]](s32)246 ; FP32-NEXT: $a2 = COPY [[UV]](s32)247 ; FP32-NEXT: $a3 = COPY [[UV1]](s32)248 ; FP32-NEXT: JAL @double_in_gpr, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0249 ; FP32-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0250 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp251 ; FP32-NEXT: $d0 = COPY [[COPY3]](s64)252 ; FP32-NEXT: RetRA implicit $d0253 ;254 ; FP64-LABEL: name: call_double_in_gpr255 ; FP64: bb.1.entry:256 ; FP64-NEXT: liveins: $a0, $a2, $a3257 ; FP64-NEXT: {{ $}}258 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0259 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2260 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3261 ; FP64-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)262 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp263 ; FP64-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)264 ; FP64-NEXT: $a0 = COPY [[COPY]](s32)265 ; FP64-NEXT: $a2 = COPY [[UV]](s32)266 ; FP64-NEXT: $a3 = COPY [[UV1]](s32)267 ; FP64-NEXT: JAL @double_in_gpr, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $a0, implicit-def $d0_64268 ; FP64-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $d0_64269 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp270 ; FP64-NEXT: $d0_64 = COPY [[COPY3]](s64)271 ; FP64-NEXT: RetRA implicit $d0_64272entry:273 %call = call double @double_in_gpr(i32 %a, double %b)274 ret double %call275}276