128 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 32; RUN: llc -mtriple=riscv32 -global-isel -stop-after=irtranslator \3; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=RV32I %s4 5; Any tests that would have identical output for some combination of the ilp32*6; ABIs belong in calling-conv-*-common.ll. This file contains tests that will7; have different output across those ABIs. i.e. where some arguments would be8; passed according to the floating point ABI.9 10define i32 @callee_float_in_regs(i32 %a, float %b) nounwind {11 ; RV32I-LABEL: name: callee_float_in_regs12 ; RV32I: bb.1 (%ir-block.0):13 ; RV32I-NEXT: liveins: $x10, $x1114 ; RV32I-NEXT: {{ $}}15 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x1016 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x1117 ; RV32I-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY1]](s32)18 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[FPTOSI]]19 ; RV32I-NEXT: $x10 = COPY [[ADD]](s32)20 ; RV32I-NEXT: PseudoRET implicit $x1021 %b_fptosi = fptosi float %b to i3222 %1 = add i32 %a, %b_fptosi23 ret i32 %124}25 26define i32 @caller_float_in_regs() nounwind {27 ; RV32I-LABEL: name: caller_float_in_regs28 ; RV32I: bb.1 (%ir-block.0):29 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 130 ; RV32I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 2.000000e+0031 ; RV32I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x232 ; RV32I-NEXT: $x10 = COPY [[C]](s32)33 ; RV32I-NEXT: $x11 = COPY [[C1]](s32)34 ; RV32I-NEXT: PseudoCALL target-flags(riscv-call) @callee_float_in_regs, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x1035 ; RV32I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x236 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x1037 ; RV32I-NEXT: $x10 = COPY [[COPY]](s32)38 ; RV32I-NEXT: PseudoRET implicit $x1039 %1 = call i32 @callee_float_in_regs(i32 1, float 2.0)40 ret i32 %141}42 43define i32 @callee_float_on_stack(i64 %a, i64 %b, i64 %c, i64 %d, float %e) nounwind {44 ; RV32I-LABEL: name: callee_float_on_stack45 ; RV32I: bb.1 (%ir-block.0):46 ; RV32I-NEXT: liveins: $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x1747 ; RV32I-NEXT: {{ $}}48 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x1049 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x1150 ; RV32I-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)51 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x1252 ; RV32I-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x1353 ; RV32I-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY2]](s32), [[COPY3]](s32)54 ; RV32I-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $x1455 ; RV32I-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY $x1556 ; RV32I-NEXT: [[MV2:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY4]](s32), [[COPY5]](s32)57 ; RV32I-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY $x1658 ; RV32I-NEXT: [[COPY7:%[0-9]+]]:_(s32) = COPY $x1759 ; RV32I-NEXT: [[MV3:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY6]](s32), [[COPY7]](s32)60 ; RV32I-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.061 ; RV32I-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s32) from %fixed-stack.0, align 16)62 ; RV32I-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[MV3]](s64)63 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[TRUNC]], [[LOAD]]64 ; RV32I-NEXT: $x10 = COPY [[ADD]](s32)65 ; RV32I-NEXT: PseudoRET implicit $x1066 %1 = trunc i64 %d to i3267 %2 = bitcast float %e to i3268 %3 = add i32 %1, %269 ret i32 %370}71 72define i32 @caller_float_on_stack() nounwind {73 ; RV32I-LABEL: name: caller_float_on_stack74 ; RV32I: bb.1 (%ir-block.0):75 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 176 ; RV32I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 277 ; RV32I-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 378 ; RV32I-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 479 ; RV32I-NEXT: [[C4:%[0-9]+]]:_(s32) = G_FCONSTANT float 5.000000e+0080 ; RV32I-NEXT: ADJCALLSTACKDOWN 4, 0, implicit-def $x2, implicit $x281 ; RV32I-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C]](s64)82 ; RV32I-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C1]](s64)83 ; RV32I-NEXT: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C2]](s64)84 ; RV32I-NEXT: [[UV6:%[0-9]+]]:_(s32), [[UV7:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C3]](s64)85 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x286 ; RV32I-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 087 ; RV32I-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C5]](s32)88 ; RV32I-NEXT: G_STORE [[C4]](s32), [[PTR_ADD]](p0) :: (store (s32) into stack, align 16)89 ; RV32I-NEXT: $x10 = COPY [[UV]](s32)90 ; RV32I-NEXT: $x11 = COPY [[UV1]](s32)91 ; RV32I-NEXT: $x12 = COPY [[UV2]](s32)92 ; RV32I-NEXT: $x13 = COPY [[UV3]](s32)93 ; RV32I-NEXT: $x14 = COPY [[UV4]](s32)94 ; RV32I-NEXT: $x15 = COPY [[UV5]](s32)95 ; RV32I-NEXT: $x16 = COPY [[UV6]](s32)96 ; RV32I-NEXT: $x17 = COPY [[UV7]](s32)97 ; RV32I-NEXT: PseudoCALL target-flags(riscv-call) @callee_float_on_stack, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit $x14, implicit $x15, implicit $x16, implicit $x17, implicit-def $x1098 ; RV32I-NEXT: ADJCALLSTACKUP 4, 0, implicit-def $x2, implicit $x299 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x10100 ; RV32I-NEXT: $x10 = COPY [[COPY1]](s32)101 ; RV32I-NEXT: PseudoRET implicit $x10102 %1 = call i32 @callee_float_on_stack(i64 1, i64 2, i64 3, i64 4, float 5.0)103 ret i32 %1104}105 106define float @callee_tiny_scalar_ret() nounwind {107 ; RV32I-LABEL: name: callee_tiny_scalar_ret108 ; RV32I: bb.1 (%ir-block.0):109 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00110 ; RV32I-NEXT: $x10 = COPY [[C]](s32)111 ; RV32I-NEXT: PseudoRET implicit $x10112 ret float 1.0113}114 115define i32 @caller_tiny_scalar_ret() nounwind {116 ; RV32I-LABEL: name: caller_tiny_scalar_ret117 ; RV32I: bb.1 (%ir-block.0):118 ; RV32I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2119 ; RV32I-NEXT: PseudoCALL target-flags(riscv-call) @callee_tiny_scalar_ret, csr_ilp32_lp64, implicit-def $x1, implicit-def $x10120 ; RV32I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2121 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10122 ; RV32I-NEXT: $x10 = COPY [[COPY]](s32)123 ; RV32I-NEXT: PseudoRET implicit $x10124 %1 = call float @callee_tiny_scalar_ret()125 %2 = bitcast float %1 to i32126 ret i32 %2127}128