1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -verify-machineinstrs -run-pass=legalizer -debugify-and-strip-all-safe %s -o - | FileCheck %s
5 name: narrow_scalar_sadde_s128
8 ; CHECK-LABEL: name: narrow_scalar_sadde_s128
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
11 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
12 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3
13 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY $x4
14 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
15 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY4]](s64)
16 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
17 ; CHECK-NEXT: [[UADDE:%[0-9]+]]:_(s64), [[UADDE1:%[0-9]+]]:_(s32) = G_UADDE [[COPY]], [[COPY2]], [[AND]]
18 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[UADDE1]], [[C]]
19 ; CHECK-NEXT: [[SADDE:%[0-9]+]]:_(s64), [[SADDE1:%[0-9]+]]:_(s32) = G_SADDE [[COPY1]], [[COPY3]], [[AND1]]
20 ; CHECK-NEXT: %carry_out_ext:_(s64) = G_ANYEXT [[SADDE1]](s32)
21 ; CHECK-NEXT: $x0 = COPY [[UADDE]](s64)
22 ; CHECK-NEXT: $x1 = COPY [[SADDE]](s64)
23 ; CHECK-NEXT: $x2 = COPY %carry_out_ext(s64)
29 %lhs:_(s128) = G_MERGE_VALUES %0, %1
30 %rhs:_(s128) = G_MERGE_VALUES %2, %3
31 %carry_in:_(s1) = G_TRUNC %4
32 %add:_(s128), %carry_out:_(s1) = G_SADDE %lhs, %rhs, %carry_in
33 %add0:_(s64), %add1:_(s64) = G_UNMERGE_VALUES %add
34 %carry_out_ext:_(s64) = G_ANYEXT %carry_out
37 $x2 = COPY %carry_out_ext
41 name: narrow_scalar_sadde_big_nonpow2
44 ; CHECK-LABEL: name: narrow_scalar_sadde_big_nonpow2
45 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
46 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
47 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
48 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3
49 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY $x4
50 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
51 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY4]](s64)
52 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
53 ; CHECK-NEXT: [[UADDE:%[0-9]+]]:_(s64), [[UADDE1:%[0-9]+]]:_(s32) = G_UADDE [[COPY]], [[COPY1]], [[AND]]
54 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[UADDE1]], [[C]]
55 ; CHECK-NEXT: [[UADDE2:%[0-9]+]]:_(s64), [[UADDE3:%[0-9]+]]:_(s32) = G_UADDE [[COPY1]], [[COPY2]], [[AND1]]
56 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[UADDE3]], [[C]]
57 ; CHECK-NEXT: [[SADDE:%[0-9]+]]:_(s64), [[SADDE1:%[0-9]+]]:_(s32) = G_SADDE [[COPY2]], [[COPY3]], [[AND2]]
58 ; CHECK-NEXT: %carry_out_ext:_(s64) = G_ANYEXT [[SADDE1]](s32)
59 ; CHECK-NEXT: $x0 = COPY [[UADDE]](s64)
60 ; CHECK-NEXT: $x1 = COPY [[UADDE2]](s64)
61 ; CHECK-NEXT: $x2 = COPY [[SADDE]](s64)
62 ; CHECK-NEXT: $x3 = COPY %carry_out_ext(s64)
68 %lhs:_(s192) = G_MERGE_VALUES %0, %1, %2
69 %rhs:_(s192) = G_MERGE_VALUES %1, %2, %3
70 %carry_in:_(s1) = G_TRUNC %4
71 %add:_(s192), %carry_out:_(s1) = G_SADDE %lhs, %rhs, %carry_in
72 %add0:_(s64), %add1:_(s64), %add2:_(s64) = G_UNMERGE_VALUES %add
73 %carry_out_ext:_(s64) = G_ANYEXT %carry_out
77 $x3 = COPY %carry_out_ext
81 name: widen_scalar_sadde_s8
84 ; CHECK-LABEL: name: widen_scalar_sadde_s8
85 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
86 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
87 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
88 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
89 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC]], 8
90 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
91 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC1]], 8
92 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
93 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY2]](s64)
94 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC2]], [[C]]
95 ; CHECK-NEXT: [[UADDE:%[0-9]+]]:_(s32), [[UADDE1:%[0-9]+]]:_(s32) = G_UADDE [[SEXT_INREG]], [[SEXT_INREG1]], [[AND]]
96 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s32) = G_SEXT_INREG [[UADDE]], 8
97 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[UADDE]](s32), [[SEXT_INREG2]]
98 ; CHECK-NEXT: %add_ext:_(s64) = G_ANYEXT [[UADDE]](s32)
99 ; CHECK-NEXT: %carry_out_ext:_(s64) = G_ANYEXT [[ICMP]](s32)
100 ; CHECK-NEXT: $x0 = COPY %add_ext(s64)
101 ; CHECK-NEXT: $x1 = COPY %carry_out_ext(s64)
105 %lhs:_(s8) = G_TRUNC %0
106 %rhs:_(s8) = G_TRUNC %1
107 %carry_in:_(s1) = G_TRUNC %2
108 %add:_(s8), %carry_out:_(s1) = G_SADDE %lhs, %rhs, %carry_in
109 %add_ext:_(s64) = G_ANYEXT %add
110 %carry_out_ext:_(s64) = G_ANYEXT %carry_out
112 $x1 = COPY %carry_out_ext
116 name: test_scalar_sadde_32
119 ; CHECK-LABEL: name: test_scalar_sadde_32
120 ; CHECK: %lhs:_(s32) = COPY $w0
121 ; CHECK-NEXT: %rhs:_(s32) = COPY $w1
122 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w2
123 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
124 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
125 ; CHECK-NEXT: %add:_(s32), %8:_(s32) = G_SADDE %lhs, %rhs, [[AND]]
126 ; CHECK-NEXT: $w0 = COPY %add(s32)
127 ; CHECK-NEXT: $w1 = COPY %8(s32)
128 %lhs:_(s32) = COPY $w0
129 %rhs:_(s32) = COPY $w1
131 %carry_in:_(s1) = G_TRUNC %2
132 %add:_(s32), %carry_out:_(s1) = G_SADDE %lhs, %rhs, %carry_in
133 %carry_out_ext:_(s32) = G_ANYEXT %carry_out
135 $w1 = COPY %carry_out_ext