89 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 32; RUN: llc -mtriple=riscv64 \3; RUN: -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \4; RUN: | FileCheck -check-prefixes=RV64I,LP64 %s5; 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 %s8 9; This file contains tests that should have identical output for the lp64 and10; lp64f ABIs.11 12define i64 @callee_double_in_regs(i64 %a, double %b) nounwind {13 ; RV64I-LABEL: name: callee_double_in_regs14 ; RV64I: bb.1 (%ir-block.0):15 ; RV64I-NEXT: liveins: $x10, $x1116 ; RV64I-NEXT: {{ $}}17 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1018 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1119 ; 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 $x1023 %b_fptosi = fptosi double %b to i6424 %1 = add i64 %a, %b_fptosi25 ret i64 %126}27 28define i64 @caller_double_in_regs() nounwind {29 ; LP64-LABEL: name: caller_double_in_regs30 ; LP64: bb.1 (%ir-block.0):31 ; LP64-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 132 ; LP64-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+0033 ; LP64-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x234 ; 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 $x1037 ; LP64-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x238 ; LP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1039 ; LP64-NEXT: $x10 = COPY [[COPY]](s64)40 ; LP64-NEXT: PseudoRET implicit $x1041 ;42 ; LP64F-LABEL: name: caller_double_in_regs43 ; LP64F: bb.1 (%ir-block.0):44 ; LP64F-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 145 ; LP64F-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+0046 ; LP64F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x247 ; 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 $x1050 ; LP64F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x251 ; LP64F-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1052 ; LP64F-NEXT: $x10 = COPY [[COPY]](s64)53 ; LP64F-NEXT: PseudoRET implicit $x1054 %1 = call i64 @callee_double_in_regs(i64 1, double 2.0)55 ret i64 %156}57 58define double @callee_double_ret() nounwind {59 ; RV64I-LABEL: name: callee_double_ret60 ; RV64I: bb.1 (%ir-block.0):61 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 1.000000e+0062 ; RV64I-NEXT: $x10 = COPY [[C]](s64)63 ; RV64I-NEXT: PseudoRET implicit $x1064 ret double 1.065}66 67define i64 @caller_double_ret() nounwind {68 ; LP64-LABEL: name: caller_double_ret69 ; LP64: bb.1 (%ir-block.0):70 ; LP64-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x271 ; LP64-NEXT: PseudoCALL target-flags(riscv-call) @callee_double_ret, csr_ilp32_lp64, implicit-def $x1, implicit-def $x1072 ; LP64-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x273 ; LP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1074 ; LP64-NEXT: $x10 = COPY [[COPY]](s64)75 ; LP64-NEXT: PseudoRET implicit $x1076 ;77 ; LP64F-LABEL: name: caller_double_ret78 ; LP64F: bb.1 (%ir-block.0):79 ; LP64F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x280 ; LP64F-NEXT: PseudoCALL target-flags(riscv-call) @callee_double_ret, csr_ilp32f_lp64f, implicit-def $x1, implicit-def $x1081 ; LP64F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x282 ; LP64F-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x1083 ; LP64F-NEXT: $x10 = COPY [[COPY]](s64)84 ; LP64F-NEXT: PseudoRET implicit $x1085 %1 = call double @callee_double_ret()86 %2 = bitcast double %1 to i6487 ret i64 %288}89