1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -mtriple=riscv32 -global-isel -stop-after=irtranslator \
3 ; RUN: -verify-machineinstrs < %s \
4 ; RUN: | FileCheck -check-prefix=RV32I %s
5 ; RUN: llc -mtriple=riscv32 -mattr=+f -target-abi ilp32f \
6 ; RUN: -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
7 ; RUN: | FileCheck -check-prefix=RV32I %s
9 ; This file contains tests that should have identical output for the ilp32,
12 ; Check that on RV32 ilp32[f], double is passed in a pair of registers. Unlike
13 ; the convention for varargs, this need not be an aligned pair.
15 define i32 @callee_double_in_regs(i32 %a, double %b) nounwind {
16 ; RV32I-LABEL: name: callee_double_in_regs
17 ; RV32I: bb.1 (%ir-block.0):
18 ; RV32I-NEXT: liveins: $x10, $x11, $x12
20 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
21 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
22 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
23 ; RV32I-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
24 ; RV32I-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[MV]](s64)
25 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[FPTOSI]]
26 ; RV32I-NEXT: $x10 = COPY [[ADD]](s32)
27 ; RV32I-NEXT: PseudoRET implicit $x10
28 %b_fptosi = fptosi double %b to i32
29 %1 = add i32 %a, %b_fptosi
33 define i32 @caller_double_in_regs() nounwind {
34 ; RV32I-LABEL: name: caller_double_in_regs
35 ; RV32I: bb.1 (%ir-block.0):
36 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
37 ; RV32I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
38 ; RV32I-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C1]](s64)
39 ; RV32I-NEXT: $x10 = COPY [[C]](s32)
40 ; RV32I-NEXT: $x11 = COPY [[UV]](s32)
41 ; RV32I-NEXT: $x12 = COPY [[UV1]](s32)
42 ; RV32I-NEXT: PseudoCALL target-flags(riscv-call) @callee_double_in_regs, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit-def $x10
43 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
44 ; RV32I-NEXT: $x10 = COPY [[COPY]](s32)
45 ; RV32I-NEXT: PseudoRET implicit $x10
46 %1 = call i32 @callee_double_in_regs(i32 1, double 2.0)
50 define double @callee_small_scalar_ret() nounwind {
51 ; RV32I-LABEL: name: callee_small_scalar_ret
52 ; RV32I: bb.1 (%ir-block.0):
53 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
54 ; RV32I-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C]](s64)
55 ; RV32I-NEXT: $x10 = COPY [[UV]](s32)
56 ; RV32I-NEXT: $x11 = COPY [[UV1]](s32)
57 ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11
61 define i64 @caller_small_scalar_ret() nounwind {
62 ; RV32I-LABEL: name: caller_small_scalar_ret
63 ; RV32I: bb.1 (%ir-block.0):
64 ; RV32I-NEXT: PseudoCALL target-flags(riscv-call) @callee_small_scalar_ret, implicit-def $x1, implicit-def $x10, implicit-def $x11
65 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
66 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
67 ; RV32I-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
68 ; RV32I-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[MV]](s64)
69 ; RV32I-NEXT: $x10 = COPY [[UV]](s32)
70 ; RV32I-NEXT: $x11 = COPY [[UV1]](s32)
71 ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11
72 %1 = call double @callee_small_scalar_ret()
73 %2 = bitcast double %1 to i64