aboutsummaryrefslogtreecommitdiff
path: root/third_party/llvm/llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-ssube-rv32.mir
blob: 2bad70a0f7592039aa544f0e39571156cce12bac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - | FileCheck %s

---
name:            ssube_i8
body:             |
  bb.1:
    liveins: $x10, $x11, $x12

    ; CHECK-LABEL: name: ssube_i8
    ; CHECK: liveins: $x10, $x11, $x12
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
    ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[ASHR]], [[ASHR1]]
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C1]]
    ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[SUB]], [[AND]]
    ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[SUB1]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[SHL2]], [[C]](s32)
    ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[SUB1]](s32), [[ASHR2]]
    ; CHECK-NEXT: $x10 = COPY [[SUB1]](s32)
    ; CHECK-NEXT: $x11 = COPY [[ICMP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
    %0:_(s32) = COPY $x10
    %1:_(s8) = G_TRUNC %0(s32)
    %2:_(s32) = COPY $x11
    %3:_(s8) = G_TRUNC %2(s32)
    %4:_(s32) = COPY $x12
    %5:_(s1) = G_TRUNC %4(s32)
    %6:_(s8), %7:_(s1) = G_SSUBE %1, %3, %5
    %8:_(s32) = G_ANYEXT %6(s8)
    %9:_(s32) = G_ANYEXT %7(s1)
    $x10 = COPY %8(s32)
    $x11 = COPY %9(s32)
    PseudoRET implicit $x10, implicit $x11

...
---
name:            ssube_i16
body:             |
  bb.1:
    liveins: $x10, $x11, $x12

    ; CHECK-LABEL: name: ssube_i16
    ; CHECK: liveins: $x10, $x11, $x12
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
    ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
    ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[ASHR]], [[ASHR1]]
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C1]]
    ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[SUB]], [[AND]]
    ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[SUB1]], [[C]](s32)
    ; CHECK-NEXT: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[SHL2]], [[C]](s32)
    ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ne), [[SUB1]](s32), [[ASHR2]]
    ; CHECK-NEXT: $x10 = COPY [[SUB1]](s32)
    ; CHECK-NEXT: $x11 = COPY [[ICMP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
    %0:_(s32) = COPY $x10
    %1:_(s16) = G_TRUNC %0(s32)
    %2:_(s32) = COPY $x11
    %3:_(s16) = G_TRUNC %2(s32)
    %4:_(s32) = COPY $x12
    %5:_(s1) = G_TRUNC %4(s32)
    %6:_(s16), %7:_(s1) = G_SSUBE %1, %3, %5
    %8:_(s32) = G_ANYEXT %6(s16)
    %9:_(s32) = G_ANYEXT %7(s1)
    $x10 = COPY %8(s32)
    $x11 = COPY %9(s32)
    PseudoRET implicit $x10, implicit $x11

...
---
name:            ssube_i32
body:             |
  bb.1:
    liveins: $x10, $x11, $x12

    ; CHECK-LABEL: name: ssube_i32
    ; CHECK: liveins: $x10, $x11, $x12
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
    ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY1]], [[AND]]
    ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[ADD]]
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
    ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY]], [[COPY1]]
    ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s32) = G_XOR [[COPY]], [[SUB]]
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[XOR]], [[XOR1]]
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
    ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[AND1]](s32), [[C1]]
    ; CHECK-NEXT: $x10 = COPY [[COPY3]](s32)
    ; CHECK-NEXT: $x11 = COPY [[ICMP]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
    %0:_(s32) = COPY $x10
    %1:_(s32) = COPY $x11
    %2:_(s32) = COPY $x12
    %3:_(s1) = G_TRUNC %2(s32)
    %4:_(s32), %5:_(s1) = G_SSUBE %0, %1, %3
    %6:_(s32) = G_ANYEXT %5(s1)
    $x10 = COPY %4(s32)
    $x11 = COPY %6(s32)
    PseudoRET implicit $x10, implicit $x11

...
---
name:            ssube_i64
body:             |
  bb.1:
    liveins: $x10, $x11, $x12, $x13, $x14

    ; CHECK-LABEL: name: ssube_i64
    ; CHECK: liveins: $x10, $x11, $x12, $x13, $x14
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
    ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x13
    ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY $x14
    ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
    ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
    ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
    ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[DEF]], [[C1]]
    ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[AND]]
    ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), [[AND]]
    ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY [[ADD]](s32)
    ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY3]], [[AND1]]
    ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ADD1]], [[ICMP]]
    ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY [[ADD2]](s32)
    ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY5]]
    ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY5]]
    ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[COPY1]], [[COPY6]]
    ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP1]]
    ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[COPY]], [[COPY2]]
    ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(s32) = G_XOR [[COPY1]], [[COPY3]]
    ; CHECK-NEXT: [[XOR2:%[0-9]+]]:_(s32) = G_XOR [[COPY]], [[SUB]]
    ; CHECK-NEXT: [[XOR3:%[0-9]+]]:_(s32) = G_XOR [[COPY1]], [[SUB2]]
    ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[XOR]], [[XOR2]]
    ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[XOR1]], [[XOR3]]
    ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[AND2]](s32), [[C1]]
    ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[AND3]](s32), [[C1]]
    ; CHECK-NEXT: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[AND3]](s32), [[C1]]
    ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP4]](s32), [[ICMP2]], [[ICMP3]]
    ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
    ; CHECK-NEXT: $x11 = COPY [[SUB2]](s32)
    ; CHECK-NEXT: $x12 = COPY [[SELECT]](s32)
    ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
    %0:_(s32) = COPY $x10
    %1:_(s32) = COPY $x11
    %2:_(s64) = G_MERGE_VALUES %0(s32), %1(s32)
    %3:_(s32) = COPY $x12
    %4:_(s32) = COPY $x13
    %5:_(s64) = G_MERGE_VALUES %3(s32), %4(s32)
    %6:_(s32) = COPY $x14
    %7:_(s1)  = G_TRUNC %6(s32)
    %8:_(s64), %9:_(s1) = G_SSUBE %2, %5, %7
    %10:_(s32), %11:_(s32) = G_UNMERGE_VALUES %8(s64)
    %12:_(s32) = G_ANYEXT %9(s1)
    $x10 = COPY %10(s32)
    $x11 = COPY %11(s32)
    $x12 = COPY %12(s32)
    PseudoRET implicit $x10, implicit $x11, implicit $x12
...