1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer -global-isel-abort=0 %s -o - | FileCheck %s
3
4---
5name: test_ssube_s32
6body: |
7  bb.0:
8    liveins: $vgpr0, $vgpr1, $vgpr2
9
10    ; CHECK-LABEL: name: test_ssube_s32
11    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
12    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
13    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
14    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
15    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
16    ; CHECK: [[SSUBE:%[0-9]+]]:_(s32), [[SSUBE1:%[0-9]+]]:_(s1) = G_SSUBE [[COPY]], [[COPY1]], [[ICMP]]
17    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SSUBE1]](s1)
18    ; CHECK: $vgpr0 = COPY [[SSUBE]](s32)
19    ; CHECK: $vgpr1 = COPY [[ZEXT]](s32)
20    %0:_(s32) = COPY $vgpr0
21    %1:_(s32) = COPY $vgpr1
22    %2:_(s32) = COPY $vgpr2
23    %3:_(s32) = G_CONSTANT i32 0
24    %4:_(s1) = G_ICMP intpred(eq), %2, %3
25    %5:_(s32), %6:_(s1) = G_SSUBE %0, %1, %4
26    %7:_(s32) = G_ZEXT %6
27    $vgpr0 = COPY %5
28    $vgpr1 = COPY %7
29...
30
31---
32name: test_ssube_v2s32
33body: |
34  bb.0:
35    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
36
37    ; CHECK-LABEL: name: test_ssube_v2s32
38    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
39    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3
40    ; CHECK: [[COPY2:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr4_vgpr5
41    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
42    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32)
43    ; CHECK: [[ICMP:%[0-9]+]]:_(<2 x s1>) = G_ICMP intpred(eq), [[COPY2]](<2 x s32>), [[BUILD_VECTOR]]
44    ; CHECK: [[SSUBE:%[0-9]+]]:_(<2 x s32>), [[SSUBE1:%[0-9]+]]:_(<2 x s1>) = G_SSUBE [[COPY]], [[COPY1]], [[ICMP]]
45    ; CHECK: [[ZEXT:%[0-9]+]]:_(<2 x s32>) = G_ZEXT [[SSUBE1]](<2 x s1>)
46    ; CHECK: $vgpr0_vgpr1 = COPY [[SSUBE]](<2 x s32>)
47    ; CHECK: $vgpr2_vgpr3 = COPY [[ZEXT]](<2 x s32>)
48    %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
49    %1:_(<2 x s32>) = COPY $vgpr2_vgpr3
50    %2:_(<2 x s32>) = COPY $vgpr4_vgpr5
51    %3:_(s32) = G_CONSTANT i32 0
52    %4:_(<2 x s32>) = G_BUILD_VECTOR %3, %3
53    %5:_(<2 x s1>) = G_ICMP intpred(eq), %2, %4
54    %6:_(<2 x s32>), %7:_(<2 x s1>) = G_SSUBE %0, %1, %5
55    %8:_(<2 x s32>) = G_ZEXT %7
56    $vgpr0_vgpr1 = COPY %6
57    $vgpr2_vgpr3 = COPY %8
58...
59---
60name: test_ssube_s16
61body: |
62  bb.0:
63    liveins: $vgpr0, $vgpr1, $vgpr2
64
65    ; CHECK-LABEL: name: test_ssube_s16
66    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
67    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
68    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
69    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
70    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
71    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
72    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
73    ; CHECK: [[SSUBE:%[0-9]+]]:_(s16), [[SSUBE1:%[0-9]+]]:_(s1) = G_SSUBE [[TRUNC1]], [[SSUBE]], [[ICMP]]
74    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SSUBE]](s16)
75    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SSUBE1]](s1)
76    ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
77    ; CHECK: $vgpr1 = COPY [[ZEXT]](s32)
78    %0:_(s32) = COPY $vgpr0
79    %1:_(s32) = COPY $vgpr1
80    %2:_(s32) = COPY $vgpr2
81    %3:_(s32) = G_CONSTANT i32 0
82    %4:_(s1) = G_ICMP intpred(eq), %2, %3
83    %5:_(s16) = G_TRUNC %0
84    %6:_(s16) = G_TRUNC %1
85    %7:_(s16), %8:_(s1) = G_SSUBE %6, %7, %4
86    %9:_(s32) = G_ANYEXT %7
87    %10:_(s32) = G_ZEXT %8
88    $vgpr0 = COPY %9
89    $vgpr1 = COPY %10
90...
91
92---
93name: test_ssube_s64
94body: |
95  bb.0:
96    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4
97
98    ; CHECK-LABEL: name: test_ssube_s64
99    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
100    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
101    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4
102    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
103    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
104    ; CHECK: [[SSUBE:%[0-9]+]]:_(s64), [[SSUBE1:%[0-9]+]]:_(s1) = G_SSUBE [[COPY]], [[COPY1]], [[ICMP]]
105    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SSUBE1]](s1)
106    ; CHECK: $vgpr0_vgpr1 = COPY [[SSUBE]](s64)
107    ; CHECK: $vgpr2 = COPY [[ZEXT]](s32)
108    %0:_(s64) = COPY $vgpr0_vgpr1
109    %1:_(s64) = COPY $vgpr2_vgpr3
110    %2:_(s32) = COPY $vgpr4
111    %3:_(s32) = G_CONSTANT i32 0
112    %4:_(s1) = G_ICMP intpred(eq), %2, %3
113    %5:_(s64), %6:_(s1) = G_SSUBE %0, %1, %4
114    %7:_(s32) = G_ZEXT %6
115    $vgpr0_vgpr1 = COPY %5
116    $vgpr2 = COPY %7
117...
118