1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -run-pass=legalizer -global-isel-abort=1 %s -o - | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6 target triple = "aarch64--"
7 define void @test_combines_2() { ret void }
8 define void @test_combines_3() { ret void }
9 define void @test_combines_4() { ret void }
10 define void @test_combines_5() { ret void }
11 define void @test_combines_6() { ret void }
20 ; Here the types don't match.
21 ; CHECK-LABEL: name: test_combines_2
22 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
23 ; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY]]
24 ; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[ADD]](s32)
25 ; CHECK: [[EXTRACT:%[0-9]+]]:_(s1) = G_EXTRACT [[COPY]](s32), 0
26 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[EXTRACT]](s1)
27 ; CHECK: $w0 = COPY [[ANYEXT]](s32)
28 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[MV]](s64)
29 ; CHECK: $x0 = COPY [[COPY1]](s64)
32 %1:_(s32) = G_ADD %0, %0
33 %2:_(s64) = G_MERGE_VALUES %0, %1
34 %3:_(s1) = G_EXTRACT %2, 0
35 %5:_(s32) = G_ANYEXT %3
47 ; CHECK-LABEL: name: test_combines_3
48 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
49 ; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY]]
50 ; CHECK: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[ADD]]
51 ; CHECK: $w0 = COPY [[ADD1]](s32)
54 %1:_(s32) = G_ADD %0, %0
55 %2:_(s64) = G_MERGE_VALUES %0, %1
56 %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %2
57 %5:_(s32) = G_ADD %3, %4
67 ; CHECK-LABEL: name: test_combines_4
68 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
69 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
70 ; CHECK: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY1]], [[COPY1]]
71 ; CHECK: $x0 = COPY [[ADD]](s64)
74 %1:_(s128) = G_MERGE_VALUES %0, %0
75 %2:_(s64) = G_EXTRACT %1, 0
76 %3:_(s64) = G_ADD %2, %2
86 ; CHECK-LABEL: name: test_combines_5
87 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
88 ; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY]]
89 ; CHECK: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[ADD]]
90 ; CHECK: $w0 = COPY [[ADD1]](s32)
93 %1:_(s32) = G_ADD %0, %0
94 %2:_(s64) = G_MERGE_VALUES %0, %1
98 %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %8
99 %5:_(s32) = G_ADD %3, %4
104 name: test_combines_6
109 ; CHECK-LABEL: name: test_combines_6
110 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
111 ; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY]]
112 ; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[ADD]](s32)
113 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[MV]](s64)
114 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[COPY1]](s64)
115 ; CHECK: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[ADD]]
116 ; CHECK: $w0 = COPY [[ADD1]](s32)
117 ; CHECK: $x0 = COPY [[COPY2]](s64)
120 %1:_(s32) = G_ADD %0, %0
121 %2:_(s64) = G_MERGE_VALUES %0, %1
125 %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %8
126 %5:_(s32) = G_ADD %3, %4