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
10 ; RV32-LABEL: name: merge_i32
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
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)
25 PseudoRET implicit $x10
32 ; RV32-LABEL: name: merge_i64
35 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
36 ; RV32-NEXT: $x10 = COPY [[COPY]](s32)
37 ; RV32-NEXT: PseudoRET implicit $x10
39 %1:_(s64) = G_MERGE_VALUES %0(s32), %0(s32)
40 %2:_(s32) = G_TRUNC %1(s64)
42 PseudoRET implicit $x10
49 ; RV32-LABEL: name: merge_i128
52 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
53 ; RV32-NEXT: $x10 = COPY [[COPY]](s32)
54 ; RV32-NEXT: PseudoRET implicit $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)
60 PseudoRET implicit $x10
67 ; RV32-LABEL: name: unmerge_i32
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
76 %2:_(s16), %3:_(s16) = G_UNMERGE_VALUES %0(s32)
77 %4:_(s32) = G_ZEXT %2(s16)
79 PseudoRET implicit $x10
86 ; RV32-LABEL: name: unmerge_i64
89 ; RV32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
90 ; RV32-NEXT: $x10 = COPY [[COPY]](s32)
91 ; RV32-NEXT: PseudoRET implicit $x10
93 %1:_(s64) = G_ZEXT %0(s32)
94 %2:_(s32), %3:_(s32) = G_UNMERGE_VALUES %1(s64)
96 PseudoRET implicit $x10
103 ; RV32-LABEL: name: unmerge_i128
104 ; RV32: liveins: $x10
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)
114 PseudoRET implicit $x10
121 ; RV32-LABEL: name: unmerge_i256
122 ; RV32: liveins: $x10
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)
132 PseudoRET implicit $x10