1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer %s -o - | FileCheck %s
8 liveins: $vgpr0, $vgpr1, $vgpr2
10 ; CHECK-LABEL: name: test_ssube_s32
11 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
14 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
15 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
16 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
17 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
18 ; CHECK-NEXT: [[SSUBE:%[0-9]+]]:_(s32), [[SSUBE1:%[0-9]+]]:_(s1) = G_SSUBE [[COPY]], [[COPY1]], [[ICMP]]
19 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SSUBE1]](s1)
20 ; CHECK-NEXT: $vgpr0 = COPY [[SSUBE]](s32)
21 ; CHECK-NEXT: $vgpr1 = COPY [[ZEXT]](s32)
22 %0:_(s32) = COPY $vgpr0
23 %1:_(s32) = COPY $vgpr1
24 %2:_(s32) = COPY $vgpr2
25 %3:_(s32) = G_CONSTANT i32 0
26 %4:_(s1) = G_ICMP intpred(eq), %2, %3
27 %5:_(s32), %6:_(s1) = G_SSUBE %0, %1, %4
34 name: test_ssube_v2s32
37 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
39 ; CHECK-LABEL: name: test_ssube_v2s32
40 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
42 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
43 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3
44 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr4_vgpr5
45 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
46 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY2]](<2 x s32>)
47 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV]](s32), [[C]]
48 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV1]](s32), [[C]]
49 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
50 ; CHECK-NEXT: [[UV4:%[0-9]+]]:_(s32), [[UV5:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<2 x s32>)
51 ; CHECK-NEXT: [[SSUBE:%[0-9]+]]:_(s32), [[SSUBE1:%[0-9]+]]:_(s1) = G_SSUBE [[UV2]], [[UV4]], [[ICMP]]
52 ; CHECK-NEXT: [[SSUBE2:%[0-9]+]]:_(s32), [[SSUBE3:%[0-9]+]]:_(s1) = G_SSUBE [[UV3]], [[UV5]], [[ICMP1]]
53 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SSUBE]](s32), [[SSUBE2]](s32)
54 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SSUBE1]](s1)
55 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[SSUBE3]](s1)
56 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
57 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C1]]
58 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[ANYEXT1]], [[C1]]
59 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[AND]](s32), [[AND1]](s32)
60 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
61 ; CHECK-NEXT: $vgpr2_vgpr3 = COPY [[BUILD_VECTOR1]](<2 x s32>)
62 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
63 %1:_(<2 x s32>) = COPY $vgpr2_vgpr3
64 %2:_(<2 x s32>) = COPY $vgpr4_vgpr5
65 %3:_(s32) = G_CONSTANT i32 0
66 %4:_(<2 x s32>) = G_BUILD_VECTOR %3, %3
67 %5:_(<2 x s1>) = G_ICMP intpred(eq), %2, %4
68 %6:_(<2 x s32>), %7:_(<2 x s1>) = G_SSUBE %0, %1, %5
69 %8:_(<2 x s32>) = G_ZEXT %7
70 $vgpr0_vgpr1 = COPY %6
71 $vgpr2_vgpr3 = COPY %8
77 liveins: $vgpr0, $vgpr1, $vgpr2
79 ; CHECK-LABEL: name: test_ssube_s16
80 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2
82 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr1
83 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
84 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
85 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY1]](s32), [[C]]
86 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 16
87 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG %13, 16
88 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SEXT_INREG1]](s32)
89 ; CHECK-NEXT: [[USUBE:%[0-9]+]]:_(s32), [[USUBE1:%[0-9]+]]:_(s1) = G_USUBE [[SEXT_INREG]], [[COPY2]], [[ICMP]]
90 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[USUBE]](s32), [[SEXT_INREG1]]
91 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP1]](s1)
92 ; CHECK-NEXT: $vgpr0 = COPY [[USUBE]](s32)
93 ; CHECK-NEXT: $vgpr1 = COPY [[ZEXT]](s32)
94 %0:_(s32) = COPY $vgpr0
95 %1:_(s32) = COPY $vgpr1
96 %2:_(s32) = COPY $vgpr2
97 %3:_(s32) = G_CONSTANT i32 0
98 %4:_(s1) = G_ICMP intpred(eq), %2, %3
99 %5:_(s16) = G_TRUNC %0
100 %6:_(s16) = G_TRUNC %1
101 %7:_(s16), %8:_(s1) = G_SSUBE %6, %7, %4
102 %9:_(s32) = G_ANYEXT %7
103 %10:_(s32) = G_ZEXT %8
112 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4
114 ; CHECK-LABEL: name: test_ssube_s64
115 ; CHECK: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4
117 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
118 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
119 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4
120 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
121 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
122 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
123 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](s64)
124 ; CHECK-NEXT: [[USUBE:%[0-9]+]]:_(s32), [[USUBE1:%[0-9]+]]:_(s1) = G_USUBE [[UV]], [[UV2]], [[ICMP]]
125 ; CHECK-NEXT: [[SSUBE:%[0-9]+]]:_(s32), [[SSUBE1:%[0-9]+]]:_(s1) = G_SSUBE [[UV1]], [[UV3]], [[USUBE1]]
126 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[USUBE]](s32), [[SSUBE]](s32)
127 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SSUBE1]](s1)
128 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[MV]](s64)
129 ; CHECK-NEXT: $vgpr2 = COPY [[ZEXT]](s32)
130 %0:_(s64) = COPY $vgpr0_vgpr1
131 %1:_(s64) = COPY $vgpr2_vgpr3
132 %2:_(s32) = COPY $vgpr4
133 %3:_(s32) = G_CONSTANT i32 0
134 %4:_(s1) = G_ICMP intpred(eq), %2, %3
135 %5:_(s64), %6:_(s1) = G_SSUBE %0, %1, %4
136 %7:_(s32) = G_ZEXT %6
137 $vgpr0_vgpr1 = COPY %5