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_sadde_s32
6body: |
7  bb.0:
8    liveins: $vgpr0, $vgpr1, $vgpr2
9
10    ; CHECK-LABEL: name: test_sadde_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: [[SADDE:%[0-9]+]]:_(s32), [[SADDE1:%[0-9]+]]:_(s1) = G_SADDE [[COPY]], [[COPY1]], [[ICMP]]
17    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SADDE1]](s1)
18    ; CHECK: $vgpr0 = COPY [[SADDE]](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_SADDE %0, %1, %4
26    %7:_(s32) = G_ZEXT %6
27    $vgpr0 = COPY %5
28    $vgpr1 = COPY %7
29...
30
31---
32name: test_sadde_v2s32
33body: |
34  bb.0:
35    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
36
37    ; CHECK-LABEL: name: test_sadde_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: [[SADDE:%[0-9]+]]:_(<2 x s32>), [[SADDE1:%[0-9]+]]:_(<2 x s1>) = G_SADDE [[COPY]], [[COPY1]], [[ICMP]]
45    ; CHECK: [[ZEXT:%[0-9]+]]:_(<2 x s32>) = G_ZEXT [[SADDE1]](<2 x s1>)
46    ; CHECK: $vgpr0_vgpr1 = COPY [[SADDE]](<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_SADDE %0, %1, %5
55    %8:_(<2 x s32>) = G_ZEXT %7
56    $vgpr0_vgpr1 = COPY %6
57    $vgpr2_vgpr3 = COPY %8
58...
59
60---
61name: test_sadde_s16
62body: |
63  bb.0:
64    liveins: $vgpr0, $vgpr1, $vgpr2
65
66    ; CHECK-LABEL: name: test_sadde_s16
67    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
68    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
69    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
70    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
71    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
72    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
73    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
74    ; CHECK: [[SADDE:%[0-9]+]]:_(s16), [[SADDE1:%[0-9]+]]:_(s1) = G_SADDE [[TRUNC1]], [[SADDE]], [[ICMP]]
75    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SADDE]](s16)
76    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SADDE1]](s1)
77    ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32)
78    ; CHECK: $vgpr1 = COPY [[ZEXT]](s32)
79    %0:_(s32) = COPY $vgpr0
80    %1:_(s32) = COPY $vgpr1
81    %2:_(s32) = COPY $vgpr2
82    %3:_(s32) = G_CONSTANT i32 0
83    %4:_(s1) = G_ICMP intpred(eq), %2, %3
84    %5:_(s16) = G_TRUNC %0
85    %6:_(s16) = G_TRUNC %1
86    %7:_(s16), %8:_(s1) = G_SADDE %6, %7, %4
87    %9:_(s32) = G_ANYEXT %7
88    %10:_(s32) = G_ZEXT %8
89    $vgpr0 = COPY %9
90    $vgpr1 = COPY %10
91...
92
93---
94name: test_sadde_s64
95body: |
96  bb.0:
97    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4
98
99    ; CHECK-LABEL: name: test_sadde_s64
100    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
101    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
102    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4
103    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
104    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[C]]
105    ; CHECK: [[SADDE:%[0-9]+]]:_(s64), [[SADDE1:%[0-9]+]]:_(s1) = G_SADDE [[COPY]], [[COPY1]], [[ICMP]]
106    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[SADDE1]](s1)
107    ; CHECK: $vgpr0_vgpr1 = COPY [[SADDE]](s64)
108    ; CHECK: $vgpr2 = COPY [[ZEXT]](s32)
109    %0:_(s64) = COPY $vgpr0_vgpr1
110    %1:_(s64) = COPY $vgpr2_vgpr3
111    %2:_(s32) = COPY $vgpr4
112    %3:_(s32) = G_CONSTANT i32 0
113    %4:_(s1) = G_ICMP intpred(eq), %2, %3
114    %5:_(s64), %6:_(s1) = G_SADDE %0, %1, %4
115    %7:_(s32) = G_ZEXT %6
116    $vgpr0_vgpr1 = COPY %5
117    $vgpr2 = COPY %7
118...
119