1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -mtriple=riscv64 -global-isel -stop-after=irtranslator \
3 ; RUN: -verify-machineinstrs < %s \
4 ; RUN: | FileCheck -check-prefixes=RV64,RV64I %s
5 ; RUN: llc -mtriple=riscv64 -mattr=+f -target-abi=lp64 \
6 ; RUN: -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
7 ; RUN: | FileCheck -check-prefixes=RV64,RV64F %s
9 ; Any tests that would have identical output for some combination of the lp64*
10 ; ABIs belong in calling-conv-*-common.ll. This file contains tests that will
11 ; have different output across those ABIs. i.e. where some arguments would be
12 ; passed according to the floating point ABI.
14 define i64 @callee_float_in_regs(i64 %a, float %b) nounwind {
15 ; RV64-LABEL: name: callee_float_in_regs
16 ; RV64: bb.1 (%ir-block.0):
17 ; RV64-NEXT: liveins: $x10, $x11
19 ; RV64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
20 ; RV64-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
21 ; RV64-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
22 ; RV64-NEXT: [[FPTOSI:%[0-9]+]]:_(s64) = G_FPTOSI [[TRUNC]](s32)
23 ; RV64-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[FPTOSI]]
24 ; RV64-NEXT: $x10 = COPY [[ADD]](s64)
25 ; RV64-NEXT: PseudoRET implicit $x10
26 %b_fptosi = fptosi float %b to i64
27 %1 = add i64 %a, %b_fptosi
31 define i64 @caller_float_in_regs() nounwind {
32 ; RV64I-LABEL: name: caller_float_in_regs
33 ; RV64I: bb.1 (%ir-block.0):
34 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
35 ; RV64I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 2.000000e+00
36 ; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C1]](s32)
37 ; RV64I-NEXT: $x10 = COPY [[C]](s64)
38 ; RV64I-NEXT: $x11 = COPY [[ANYEXT]](s64)
39 ; RV64I-NEXT: PseudoCALL target-flags(riscv-call) @callee_float_in_regs, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
40 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
41 ; RV64I-NEXT: $x10 = COPY [[COPY]](s64)
42 ; RV64I-NEXT: PseudoRET implicit $x10
44 ; RV64F-LABEL: name: caller_float_in_regs
45 ; RV64F: bb.1 (%ir-block.0):
46 ; RV64F-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
47 ; RV64F-NEXT: [[C1:%[0-9]+]]:_(s32) = G_FCONSTANT float 2.000000e+00
48 ; RV64F-NEXT: $x10 = COPY [[C]](s64)
49 ; RV64F-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C1]](s32)
50 ; RV64F-NEXT: $x11 = COPY [[ANYEXT]](s64)
51 ; RV64F-NEXT: PseudoCALL target-flags(riscv-call) @callee_float_in_regs, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
52 ; RV64F-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
53 ; RV64F-NEXT: $x10 = COPY [[COPY]](s64)
54 ; RV64F-NEXT: PseudoRET implicit $x10
55 %1 = call i64 @callee_float_in_regs(i64 1, float 2.0)
59 define float @callee_tiny_scalar_ret() nounwind {
60 ; RV64-LABEL: name: callee_tiny_scalar_ret
61 ; RV64: bb.1 (%ir-block.0):
62 ; RV64-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
63 ; RV64-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
64 ; RV64-NEXT: $x10 = COPY [[ANYEXT]](s64)
65 ; RV64-NEXT: PseudoRET implicit $x10
69 define i64 @caller_tiny_scalar_ret() nounwind {
70 ; RV64-LABEL: name: caller_tiny_scalar_ret
71 ; RV64: bb.1 (%ir-block.0):
72 ; RV64-NEXT: PseudoCALL target-flags(riscv-call) @callee_tiny_scalar_ret, implicit-def $x1, implicit-def $x10
73 ; RV64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
74 ; RV64-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
75 ; RV64-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[TRUNC]](s32)
76 ; RV64-NEXT: $x10 = COPY [[SEXT]](s64)
77 ; RV64-NEXT: PseudoRET implicit $x10
78 %1 = call float @callee_tiny_scalar_ret()
79 %2 = bitcast float %1 to i32
80 %3 = sext i32 %2 to i64