1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32I %s
4 ; RUN: llc -mtriple=riscv64 -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
5 ; RUN: | FileCheck -check-prefix=RV64I %s
7 define void @test_ret_void() {
8 ; RV32I-LABEL: name: test_ret_void
10 ; RV32I-NEXT: PseudoRET
11 ; RV64I-LABEL: name: test_ret_void
13 ; RV64I-NEXT: PseudoRET
18 define i8 @test_ret_i8() {
19 ; RV32I-LABEL: name: test_ret_i8
21 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
22 ; RV32I-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[C]](s8)
23 ; RV32I-NEXT: $x10 = COPY [[ANYEXT]](s32)
24 ; RV32I-NEXT: PseudoRET implicit $x10
25 ; RV64I-LABEL: name: test_ret_i8
27 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
28 ; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s8)
29 ; RV64I-NEXT: $x10 = COPY [[ANYEXT]](s64)
30 ; RV64I-NEXT: PseudoRET implicit $x10
35 define zeroext i8 @test_ret_i8_zext() {
36 ; RV32I-LABEL: name: test_ret_i8_zext
38 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
39 ; RV32I-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[C]](s8)
40 ; RV32I-NEXT: $x10 = COPY [[ZEXT]](s32)
41 ; RV32I-NEXT: PseudoRET implicit $x10
42 ; RV64I-LABEL: name: test_ret_i8_zext
44 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
45 ; RV64I-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[C]](s8)
46 ; RV64I-NEXT: $x10 = COPY [[ZEXT]](s64)
47 ; RV64I-NEXT: PseudoRET implicit $x10
52 define signext i16 @test_ret_i16_sext() {
53 ; RV32I-LABEL: name: test_ret_i16_sext
55 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
56 ; RV32I-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[C]](s16)
57 ; RV32I-NEXT: $x10 = COPY [[SEXT]](s32)
58 ; RV32I-NEXT: PseudoRET implicit $x10
59 ; RV64I-LABEL: name: test_ret_i16_sext
61 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
62 ; RV64I-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[C]](s16)
63 ; RV64I-NEXT: $x10 = COPY [[SEXT]](s64)
64 ; RV64I-NEXT: PseudoRET implicit $x10
69 define i32 @test_ret_i32() {
70 ; RV32I-LABEL: name: test_ret_i32
72 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
73 ; RV32I-NEXT: $x10 = COPY [[C]](s32)
74 ; RV32I-NEXT: PseudoRET implicit $x10
75 ; RV64I-LABEL: name: test_ret_i32
77 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
78 ; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
79 ; RV64I-NEXT: $x10 = COPY [[ANYEXT]](s64)
80 ; RV64I-NEXT: PseudoRET implicit $x10
85 define i64 @test_ret_i64() {
86 ; RV32I-LABEL: name: test_ret_i64
88 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967296
89 ; RV32I-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C]](s64)
90 ; RV32I-NEXT: $x10 = COPY [[UV]](s32)
91 ; RV32I-NEXT: $x11 = COPY [[UV1]](s32)
92 ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11
93 ; RV64I-LABEL: name: test_ret_i64
95 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967296
96 ; RV64I-NEXT: $x10 = COPY [[C]](s64)
97 ; RV64I-NEXT: PseudoRET implicit $x10
102 define ptr @test_ret_ptr() {
103 ; RV32I-LABEL: name: test_ret_ptr
105 ; RV32I-NEXT: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
106 ; RV32I-NEXT: $x10 = COPY [[DEF]](p0)
107 ; RV32I-NEXT: PseudoRET implicit $x10
108 ; RV64I-LABEL: name: test_ret_ptr
110 ; RV64I-NEXT: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
111 ; RV64I-NEXT: $x10 = COPY [[DEF]](p0)
112 ; RV64I-NEXT: PseudoRET implicit $x10
117 define [2 x i32] @test_ret_2xi32() {
118 ; RV32I-LABEL: name: test_ret_2xi32
120 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
121 ; RV32I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
122 ; RV32I-NEXT: $x10 = COPY [[C]](s32)
123 ; RV32I-NEXT: $x11 = COPY [[C1]](s32)
124 ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11
125 ; RV64I-LABEL: name: test_ret_2xi32
127 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
128 ; RV64I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
129 ; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
130 ; RV64I-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[C1]](s32)
131 ; RV64I-NEXT: $x10 = COPY [[ANYEXT]](s64)
132 ; RV64I-NEXT: $x11 = COPY [[ANYEXT1]](s64)
133 ; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11
135 ret [2 x i32] [i32 1, i32 2]