1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -mtriple=riscv64 \
3 ; RUN: -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
4 ; RUN: | FileCheck -check-prefixes=RV64I,LP64 %s
5 ; RUN: llc -mtriple=riscv64 -mattr=+f -target-abi lp64f \
6 ; RUN: -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
7 ; RUN: | FileCheck -check-prefixes=RV64I,LP64F %s
9 ; This file contains tests that should have identical output for the lp64 and
12 define i64 @callee_double_in_regs(i64 %a, double %b) nounwind {
13 ; RV64I-LABEL: name: callee_double_in_regs
14 ; RV64I: bb.1 (%ir-block.0):
15 ; RV64I-NEXT: liveins: $x10, $x11
17 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
18 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
19 ; RV64I-NEXT: [[FPTOSI:%[0-9]+]]:_(s64) = G_FPTOSI [[COPY1]](s64)
20 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[FPTOSI]]
21 ; RV64I-NEXT: $x10 = COPY [[ADD]](s64)
22 ; RV64I-NEXT: PseudoRET implicit $x10
23 %b_fptosi = fptosi double %b to i64
24 %1 = add i64 %a, %b_fptosi
28 define i64 @caller_double_in_regs() nounwind {
29 ; LP64-LABEL: name: caller_double_in_regs
30 ; LP64: bb.1 (%ir-block.0):
31 ; LP64-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
32 ; LP64-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
33 ; LP64-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
34 ; LP64-NEXT: $x10 = COPY [[C]](s64)
35 ; LP64-NEXT: $x11 = COPY [[C1]](s64)
36 ; LP64-NEXT: PseudoCALL target-flags(riscv-call) @callee_double_in_regs, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
37 ; LP64-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
38 ; LP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
39 ; LP64-NEXT: $x10 = COPY [[COPY]](s64)
40 ; LP64-NEXT: PseudoRET implicit $x10
42 ; LP64F-LABEL: name: caller_double_in_regs
43 ; LP64F: bb.1 (%ir-block.0):
44 ; LP64F-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
45 ; LP64F-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
46 ; LP64F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
47 ; LP64F-NEXT: $x10 = COPY [[C]](s64)
48 ; LP64F-NEXT: $x11 = COPY [[C1]](s64)
49 ; LP64F-NEXT: PseudoCALL target-flags(riscv-call) @callee_double_in_regs, csr_ilp32f_lp64f, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
50 ; LP64F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
51 ; LP64F-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
52 ; LP64F-NEXT: $x10 = COPY [[COPY]](s64)
53 ; LP64F-NEXT: PseudoRET implicit $x10
54 %1 = call i64 @callee_double_in_regs(i64 1, double 2.0)
58 define double @callee_double_ret() nounwind {
59 ; RV64I-LABEL: name: callee_double_ret
60 ; RV64I: bb.1 (%ir-block.0):
61 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+00
62 ; RV64I-NEXT: $x10 = COPY [[C]](s64)
63 ; RV64I-NEXT: PseudoRET implicit $x10
67 define i64 @caller_double_ret() nounwind {
68 ; LP64-LABEL: name: caller_double_ret
69 ; LP64: bb.1 (%ir-block.0):
70 ; LP64-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
71 ; LP64-NEXT: PseudoCALL target-flags(riscv-call) @callee_double_ret, csr_ilp32_lp64, implicit-def $x1, implicit-def $x10
72 ; LP64-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
73 ; LP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
74 ; LP64-NEXT: $x10 = COPY [[COPY]](s64)
75 ; LP64-NEXT: PseudoRET implicit $x10
77 ; LP64F-LABEL: name: caller_double_ret
78 ; LP64F: bb.1 (%ir-block.0):
79 ; LP64F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
80 ; LP64F-NEXT: PseudoCALL target-flags(riscv-call) @callee_double_ret, csr_ilp32f_lp64f, implicit-def $x1, implicit-def $x10
81 ; LP64F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
82 ; LP64F-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
83 ; LP64F-NEXT: $x10 = COPY [[COPY]](s64)
84 ; LP64F-NEXT: PseudoRET implicit $x10
85 %1 = call double @callee_double_ret()
86 %2 = bitcast double %1 to i64