1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
; RUN: llc -mtriple=riscv32 -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV32I %s
; RUN: llc -mtriple=riscv64 -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV64I %s
define void @test_ret_void() {
; RV32I-LABEL: name: test_ret_void
; RV32I: bb.1.entry:
; RV32I-NEXT: PseudoRET
; RV64I-LABEL: name: test_ret_void
; RV64I: bb.1.entry:
; RV64I-NEXT: PseudoRET
entry:
ret void
}
define i8 @test_ret_i8() {
; RV32I-LABEL: name: test_ret_i8
; RV32I: bb.1.entry:
; RV32I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
; RV32I-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[C]](s8)
; RV32I-NEXT: $x10 = COPY [[ANYEXT]](s32)
; RV32I-NEXT: PseudoRET implicit $x10
; RV64I-LABEL: name: test_ret_i8
; RV64I: bb.1.entry:
; RV64I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s8)
; RV64I-NEXT: $x10 = COPY [[ANYEXT]](s64)
; RV64I-NEXT: PseudoRET implicit $x10
entry:
ret i8 1
}
define zeroext i8 @test_ret_i8_zext() {
; RV32I-LABEL: name: test_ret_i8_zext
; RV32I: bb.1.entry:
; RV32I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
; RV32I-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[C]](s8)
; RV32I-NEXT: $x10 = COPY [[ZEXT]](s32)
; RV32I-NEXT: PseudoRET implicit $x10
; RV64I-LABEL: name: test_ret_i8_zext
; RV64I: bb.1.entry:
; RV64I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
; RV64I-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[C]](s8)
; RV64I-NEXT: $x10 = COPY [[ZEXT]](s64)
; RV64I-NEXT: PseudoRET implicit $x10
entry:
ret i8 1
}
define signext i16 @test_ret_i16_sext() {
; RV32I-LABEL: name: test_ret_i16_sext
; RV32I: bb.1.entry:
; RV32I-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
; RV32I-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[C]](s16)
; RV32I-NEXT: $x10 = COPY [[SEXT]](s32)
; RV32I-NEXT: PseudoRET implicit $x10
; RV64I-LABEL: name: test_ret_i16_sext
; RV64I: bb.1.entry:
; RV64I-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
; RV64I-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[C]](s16)
; RV64I-NEXT: $x10 = COPY [[SEXT]](s64)
; RV64I-NEXT: PseudoRET implicit $x10
entry:
ret i16 1
}
define i32 @test_ret_i32() {
; RV32I-LABEL: name: test_ret_i32
; RV32I: bb.1.entry:
; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; RV32I-NEXT: $x10 = COPY [[C]](s32)
; RV32I-NEXT: PseudoRET implicit $x10
; RV64I-LABEL: name: test_ret_i32
; RV64I: bb.1.entry:
; RV64I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
; RV64I-NEXT: $x10 = COPY [[ANYEXT]](s64)
; RV64I-NEXT: PseudoRET implicit $x10
entry:
ret i32 1
}
define i64 @test_ret_i64() {
; RV32I-LABEL: name: test_ret_i64
; RV32I: bb.1.entry:
; RV32I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967296
; RV32I-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C]](s64)
; RV32I-NEXT: $x10 = COPY [[UV]](s32)
; RV32I-NEXT: $x11 = COPY [[UV1]](s32)
; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11
; RV64I-LABEL: name: test_ret_i64
; RV64I: bb.1.entry:
; RV64I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967296
; RV64I-NEXT: $x10 = COPY [[C]](s64)
; RV64I-NEXT: PseudoRET implicit $x10
entry:
ret i64 4294967296
}
define ptr @test_ret_ptr() {
; RV32I-LABEL: name: test_ret_ptr
; RV32I: bb.1.entry:
; RV32I-NEXT: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
; RV32I-NEXT: $x10 = COPY [[DEF]](p0)
; RV32I-NEXT: PseudoRET implicit $x10
; RV64I-LABEL: name: test_ret_ptr
; RV64I: bb.1.entry:
; RV64I-NEXT: [[DEF:%[0-9]+]]:_(p0) = G_IMPLICIT_DEF
; RV64I-NEXT: $x10 = COPY [[DEF]](p0)
; RV64I-NEXT: PseudoRET implicit $x10
entry:
ret ptr undef
}
define [2 x i32] @test_ret_2xi32() {
; RV32I-LABEL: name: test_ret_2xi32
; RV32I: bb.1.entry:
; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; RV32I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
; RV32I-NEXT: $x10 = COPY [[C]](s32)
; RV32I-NEXT: $x11 = COPY [[C1]](s32)
; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11
; RV64I-LABEL: name: test_ret_2xi32
; RV64I: bb.1.entry:
; RV64I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
; RV64I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
; RV64I-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
; RV64I-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[C1]](s32)
; RV64I-NEXT: $x10 = COPY [[ANYEXT]](s64)
; RV64I-NEXT: $x11 = COPY [[ANYEXT1]](s64)
; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11
entry:
ret [2 x i32] [i32 1, i32 2]
}
|