1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \ 3# RUN: | FileCheck --check-prefix=RV32 %s 4 5--- 6name: merge_i32 7body: | 8 bb.0.entry: 9 liveins: $x10 10 ; RV32-LABEL: name: merge_i32 11 ; RV32: liveins: $x10 12 ; RV32-NEXT: {{ $}} 13 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 14 ; RV32-NEXT: [[ASSERT_ZEXT:%[0-9]+]]:_(s32) = G_ASSERT_ZEXT [[COPY]], 16 15 ; RV32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 16 ; RV32-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[ASSERT_ZEXT]], [[C]](s32) 17 ; RV32-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[ASSERT_ZEXT]], [[SHL]] 18 ; RV32-NEXT: $x10 = COPY [[OR]](s32) 19 ; RV32-NEXT: PseudoRET implicit $x10 20 %0:_(s32) = COPY $x10 21 %1:_(s32) = G_ASSERT_ZEXT %0, 16 22 %2:_(s16) = G_TRUNC %1(s32) 23 %3:_(s32) = G_MERGE_VALUES %2(s16), %2(s16) 24 $x10 = COPY %3(s32) 25 PseudoRET implicit $x10 26... 27--- 28name: merge_i64 29body: | 30 bb.0.entry: 31 liveins: $x10 32 ; RV32-LABEL: name: merge_i64 33 ; RV32: liveins: $x10 34 ; RV32-NEXT: {{ $}} 35 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 36 ; RV32-NEXT: $x10 = COPY [[COPY]](s32) 37 ; RV32-NEXT: PseudoRET implicit $x10 38 %0:_(s32) = COPY $x10 39 %1:_(s64) = G_MERGE_VALUES %0(s32), %0(s32) 40 %2:_(s32) = G_TRUNC %1(s64) 41 $x10 = COPY %2(s32) 42 PseudoRET implicit $x10 43... 44--- 45name: merge_i128 46body: | 47 bb.0.entry: 48 liveins: $x10 49 ; RV32-LABEL: name: merge_i128 50 ; RV32: liveins: $x10 51 ; RV32-NEXT: {{ $}} 52 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 53 ; RV32-NEXT: $x10 = COPY [[COPY]](s32) 54 ; RV32-NEXT: PseudoRET implicit $x10 55 %1:_(s32) = COPY $x10 56 %2:_(s64) = G_ZEXT %1(s32) 57 %0:_(s128) = G_MERGE_VALUES %2(s64), %2(s64) 58 %3:_(s32) = G_TRUNC %0(s128) 59 $x10 = COPY %3(s32) 60 PseudoRET implicit $x10 61... 62--- 63name: unmerge_i32 64body: | 65 bb.0.entry: 66 liveins: $x10 67 ; RV32-LABEL: name: unmerge_i32 68 ; RV32: liveins: $x10 69 ; RV32-NEXT: {{ $}} 70 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 71 ; RV32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535 72 ; RV32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]] 73 ; RV32-NEXT: $x10 = COPY [[AND]](s32) 74 ; RV32-NEXT: PseudoRET implicit $x10 75 %0:_(s32) = COPY $x10 76 %2:_(s16), %3:_(s16) = G_UNMERGE_VALUES %0(s32) 77 %4:_(s32) = G_ZEXT %2(s16) 78 $x10 = COPY %4(s32) 79 PseudoRET implicit $x10 80... 81--- 82name: unmerge_i64 83body: | 84 bb.0.entry: 85 liveins: $x10 86 ; RV32-LABEL: name: unmerge_i64 87 ; RV32: liveins: $x10 88 ; RV32-NEXT: {{ $}} 89 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 90 ; RV32-NEXT: $x10 = COPY [[COPY]](s32) 91 ; RV32-NEXT: PseudoRET implicit $x10 92 %0:_(s32) = COPY $x10 93 %1:_(s64) = G_ZEXT %0(s32) 94 %2:_(s32), %3:_(s32) = G_UNMERGE_VALUES %1(s64) 95 $x10 = COPY %2(s32) 96 PseudoRET implicit $x10 97... 98--- 99name: unmerge_i128 100body: | 101 bb.0.entry: 102 liveins: $x10 103 ; RV32-LABEL: name: unmerge_i128 104 ; RV32: liveins: $x10 105 ; RV32-NEXT: {{ $}} 106 ; RV32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 107 ; RV32-NEXT: $x10 = COPY [[C]](s32) 108 ; RV32-NEXT: PseudoRET implicit $x10 109 %0:_(s32) = COPY $x10 110 %1:_(s128) = G_ZEXT %0(s32) 111 %2:_(s64), %3:_(s64) = G_UNMERGE_VALUES %1(s128) 112 %4:_(s32) = G_TRUNC %3(s64) 113 $x10 = COPY %4(s32) 114 PseudoRET implicit $x10 115... 116--- 117name: unmerge_i256 118body: | 119 bb.0.entry: 120 liveins: $x10 121 ; RV32-LABEL: name: unmerge_i256 122 ; RV32: liveins: $x10 123 ; RV32-NEXT: {{ $}} 124 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 125 ; RV32-NEXT: $x10 = COPY [[COPY]](s32) 126 ; RV32-NEXT: PseudoRET implicit $x10 127 %0:_(s32) = COPY $x10 128 %1:_(s256) = G_ZEXT %0(s32) 129 %2:_(s128), %3:_(s128) = G_UNMERGE_VALUES %1(s256) 130 %4:_(s32) = G_TRUNC %2(s128) 131 $x10 = COPY %4(s32) 132 PseudoRET implicit $x10 133... 134