Skip to content

Commit 130d19c

Browse files
Update tests
1 parent c9f6888 commit 130d19c

File tree

1 file changed

+69
-18
lines changed

1 file changed

+69
-18
lines changed

llvm/test/Transforms/InstCombine/pr125228.ll

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
22
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
33

4-
define <16 x i8> @wombat(<16 x i8> %arg) {
5-
; CHECK-LABEL: define <16 x i8> @wombat(
4+
define <16 x i8> @knownbits_bitcast_masked_shift(<16 x i8> %arg) {
5+
; CHECK-LABEL: define <16 x i8> @knownbits_bitcast_masked_shift(
66
; CHECK-SAME: <16 x i8> [[ARG:%.*]]) {
77
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <16 x i8> [[ARG]] to <8 x i16>
88
; CHECK-NEXT: [[LSHR:%.*]] = lshr <8 x i16> [[BITCAST]], splat (i16 4)
@@ -17,6 +17,7 @@ define <16 x i8> @wombat(<16 x i8> %arg) {
1717
; CHECK-NEXT: [[BITCAST6:%.*]] = bitcast <8 x i16> [[SHL5]] to <16 x i8>
1818
; CHECK-NEXT: ret <16 x i8> [[BITCAST6]]
1919
;
20+
2021
%bitcast = bitcast <16 x i8> %arg to <8 x i16>
2122
%lshr = lshr <8 x i16> %bitcast, splat (i16 4)
2223
%bitcast1 = bitcast <8 x i16> %lshr to <16 x i8>
@@ -32,8 +33,8 @@ define <16 x i8> @wombat(<16 x i8> %arg) {
3233
ret <16 x i8> %and7
3334
}
3435

35-
define <16 x i8> @snork(<8 x i16> %arg) {
36-
; CHECK-LABEL: define <16 x i8> @snork(
36+
define <16 x i8> @knownbits_shuffle_bitcast_masked_shift(<8 x i16> %arg) {
37+
; CHECK-LABEL: define <16 x i8> @knownbits_shuffle_bitcast_masked_shift(
3738
; CHECK-SAME: <8 x i16> [[ARG:%.*]]) {
3839
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <8 x i16> [[ARG]] to <16 x i8>
3940
; CHECK-NEXT: [[SHUFFLEVECTOR:%.*]] = shufflevector <16 x i8> [[BITCAST]], <16 x i8> poison, <16 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 13, i32 12, i32 15, i32 14>
@@ -50,6 +51,7 @@ define <16 x i8> @snork(<8 x i16> %arg) {
5051
; CHECK-NEXT: [[BITCAST7:%.*]] = bitcast <8 x i16> [[SHL6]] to <16 x i8>
5152
; CHECK-NEXT: ret <16 x i8> [[BITCAST7]]
5253
;
54+
5355
%bitcast = bitcast <8 x i16> %arg to <16 x i8>
5456
%shufflevector = shufflevector <16 x i8> %bitcast, <16 x i8> poison, <16 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 13, i32 12, i32 15, i32 14>
5557
%bitcast1 = bitcast <16 x i8> %shufflevector to <8 x i16>
@@ -67,8 +69,8 @@ define <16 x i8> @snork(<8 x i16> %arg) {
6769
ret <16 x i8> %and8
6870
}
6971

70-
define <16 x i8> @wobble(<8 x i16> %arg) {
71-
; CHECK-LABEL: define <16 x i8> @wobble(
72+
define <16 x i8> @knownbits_shuffle_masked_nibble_shift(<8 x i16> %arg) {
73+
; CHECK-LABEL: define <16 x i8> @knownbits_shuffle_masked_nibble_shift(
7274
; CHECK-SAME: <8 x i16> [[ARG:%.*]]) {
7375
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <8 x i16> [[ARG]] to <16 x i8>
7476
; CHECK-NEXT: [[AND:%.*]] = and <16 x i8> [[BITCAST]], splat (i8 15)
@@ -78,6 +80,7 @@ define <16 x i8> @wobble(<8 x i16> %arg) {
7880
; CHECK-NEXT: [[BITCAST2:%.*]] = bitcast <8 x i16> [[SHL]] to <16 x i8>
7981
; CHECK-NEXT: ret <16 x i8> [[BITCAST2]]
8082
;
83+
8184
%bitcast = bitcast <8 x i16> %arg to <16 x i8>
8285
%and = and <16 x i8> %bitcast, splat (i8 15)
8386
%shufflevector = shufflevector <16 x i8> %and, <16 x i8> poison, <16 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 9, i32 8, i32 11, i32 10, i32 13, i32 12, i32 15, i32 14>
@@ -88,8 +91,8 @@ define <16 x i8> @wobble(<8 x i16> %arg) {
8891
ret <16 x i8> %and3
8992
}
9093

91-
define <16 x i8> @wobble.1(<8 x i16> %arg) {
92-
; CHECK-LABEL: define <16 x i8> @wobble.1(
94+
define <16 x i8> @knownbits_reverse_shuffle_masked_shift(<8 x i16> %arg) {
95+
; CHECK-LABEL: define <16 x i8> @knownbits_reverse_shuffle_masked_shift(
9396
; CHECK-SAME: <8 x i16> [[ARG:%.*]]) {
9497
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <8 x i16> [[ARG]] to <16 x i8>
9598
; CHECK-NEXT: [[AND:%.*]] = and <16 x i8> [[BITCAST]], splat (i8 15)
@@ -99,6 +102,7 @@ define <16 x i8> @wobble.1(<8 x i16> %arg) {
99102
; CHECK-NEXT: [[BITCAST2:%.*]] = bitcast <8 x i16> [[SHL]] to <16 x i8>
100103
; CHECK-NEXT: ret <16 x i8> [[BITCAST2]]
101104
;
105+
102106
%bitcast = bitcast <8 x i16> %arg to <16 x i8>
103107
%and = and <16 x i8> %bitcast, splat (i8 15)
104108
%shufflevector = shufflevector <16 x i8> %and, <16 x i8> poison, <16 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4, i32 11, i32 10, i32 9, i32 8, i32 15, i32 14, i32 13, i32 12>
@@ -109,8 +113,8 @@ define <16 x i8> @wobble.1(<8 x i16> %arg) {
109113
ret <16 x i8> %and3
110114
}
111115

112-
define <16 x i8> @pluto(<16 x i8> %arg) {
113-
; CHECK-LABEL: define <16 x i8> @pluto(
116+
define <16 x i8> @knownbits_interleave_mul_extract_bit(<16 x i8> %arg) {
117+
; CHECK-LABEL: define <16 x i8> @knownbits_interleave_mul_extract_bit(
114118
; CHECK-SAME: <16 x i8> [[ARG:%.*]]) {
115119
; CHECK-NEXT: [[SHUFFLEVECTOR:%.*]] = shufflevector <16 x i8> [[ARG]], <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>, <16 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23>
116120
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <16 x i8> [[SHUFFLEVECTOR]] to <8 x i16>
@@ -119,6 +123,7 @@ define <16 x i8> @pluto(<16 x i8> %arg) {
119123
; CHECK-NEXT: [[BITCAST1:%.*]] = bitcast <8 x i16> [[LSHR]] to <16 x i8>
120124
; CHECK-NEXT: ret <16 x i8> [[BITCAST1]]
121125
;
126+
122127
%shufflevector = shufflevector <16 x i8> %arg, <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison, i8 poison>, <16 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23>
123128
%bitcast = bitcast <16 x i8> %shufflevector to <8 x i16>
124129
%mul = mul nuw <8 x i16> %bitcast, <i16 171, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
@@ -128,8 +133,8 @@ define <16 x i8> @pluto(<16 x i8> %arg) {
128133
ret <16 x i8> %and
129134
}
130135

131-
define <16 x i8> @wibble(<8 x i16> %arg) {
132-
; CHECK-LABEL: define <16 x i8> @wibble(
136+
define <16 x i8> @knownbits_reverse_shuffle_masked_ops(<8 x i16> %arg) {
137+
; CHECK-LABEL: define <16 x i8> @knownbits_reverse_shuffle_masked_ops(
133138
; CHECK-SAME: <8 x i16> [[ARG:%.*]]) {
134139
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <8 x i16> [[ARG]] to <16 x i8>
135140
; CHECK-NEXT: [[SHUFFLEVECTOR:%.*]] = shufflevector <16 x i8> [[BITCAST]], <16 x i8> poison, <16 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4, i32 11, i32 10, i32 9, i32 8, i32 15, i32 14, i32 13, i32 12>
@@ -146,6 +151,7 @@ define <16 x i8> @wibble(<8 x i16> %arg) {
146151
; CHECK-NEXT: [[BITCAST7:%.*]] = bitcast <8 x i16> [[SHL6]] to <16 x i8>
147152
; CHECK-NEXT: ret <16 x i8> [[BITCAST7]]
148153
;
154+
149155
%bitcast = bitcast <8 x i16> %arg to <16 x i8>
150156
%shufflevector = shufflevector <16 x i8> %bitcast, <16 x i8> poison, <16 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4, i32 11, i32 10, i32 9, i32 8, i32 15, i32 14, i32 13, i32 12>
151157
%bitcast1 = bitcast <16 x i8> %shufflevector to <8 x i16>
@@ -163,8 +169,8 @@ define <16 x i8> @wibble(<8 x i16> %arg) {
163169
ret <16 x i8> %and8
164170
}
165171

166-
define <16 x i8> @hoge(<4 x i32> %arg) {
167-
; CHECK-LABEL: define <16 x i8> @hoge(
172+
define <16 x i8> @knownbits_v4i32_to_v16i8_shuffle_masked_pipeline(<4 x i32> %arg) {
173+
; CHECK-LABEL: define <16 x i8> @knownbits_v4i32_to_v16i8_shuffle_masked_pipeline(
168174
; CHECK-SAME: <4 x i32> [[ARG:%.*]]) {
169175
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <4 x i32> [[ARG]] to <16 x i8>
170176
; CHECK-NEXT: [[SHUFFLEVECTOR:%.*]] = shufflevector <16 x i8> [[BITCAST]], <16 x i8> poison, <16 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4, i32 11, i32 10, i32 9, i32 8, i32 15, i32 14, i32 13, i32 12>
@@ -181,6 +187,7 @@ define <16 x i8> @hoge(<4 x i32> %arg) {
181187
; CHECK-NEXT: [[BITCAST7:%.*]] = bitcast <8 x i16> [[SHL6]] to <16 x i8>
182188
; CHECK-NEXT: ret <16 x i8> [[BITCAST7]]
183189
;
190+
184191
%bitcast = bitcast <4 x i32> %arg to <16 x i8>
185192
%shufflevector = shufflevector <16 x i8> %bitcast, <16 x i8> poison, <16 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4, i32 11, i32 10, i32 9, i32 8, i32 15, i32 14, i32 13, i32 12>
186193
%bitcast1 = bitcast <16 x i8> %shufflevector to <8 x i16>
@@ -198,8 +205,8 @@ define <16 x i8> @hoge(<4 x i32> %arg) {
198205
ret <16 x i8> %and8
199206
}
200207

201-
define { i32, i1 } @wombat.2(i32 %arg, i32 %arg1, i32 %arg2, i32 %arg3) {
202-
; CHECK-LABEL: define { i32, i1 } @wombat.2(
208+
define { i32, i1 } @knownbits_popcount_add_with_overflow(i32 %arg, i32 %arg1, i32 %arg2, i32 %arg3) {
209+
; CHECK-LABEL: define { i32, i1 } @knownbits_popcount_add_with_overflow(
203210
; CHECK-SAME: i32 [[ARG:%.*]], i32 [[ARG1:%.*]], i32 [[ARG2:%.*]], i32 [[ARG3:%.*]]) {
204211
; CHECK-NEXT: [[INSERTELEMENT:%.*]] = insertelement <4 x i32> poison, i32 [[ARG2]], i64 0
205212
; CHECK-NEXT: [[INSERTELEMENT4:%.*]] = insertelement <4 x i32> [[INSERTELEMENT]], i32 [[ARG3]], i64 1
@@ -217,6 +224,7 @@ define { i32, i1 } @wombat.2(i32 %arg, i32 %arg1, i32 %arg2, i32 %arg3) {
217224
; CHECK-NEXT: [[TMP1:%.*]] = insertvalue { i32, i1 } { i32 poison, i1 false }, i32 [[CALL12]], 0
218225
; CHECK-NEXT: ret { i32, i1 } [[TMP1]]
219226
;
227+
220228
%insertelement = insertelement <4 x i32> poison, i32 %arg2, i64 0
221229
%insertelement4 = insertelement <4 x i32> %insertelement, i32 %arg3, i64 1
222230
%bitcast = bitcast <4 x i32> %insertelement4 to <2 x i64>
@@ -233,10 +241,53 @@ define { i32, i1 } @wombat.2(i32 %arg, i32 %arg1, i32 %arg2, i32 %arg3) {
233241
ret { i32, i1 } %call12
234242
}
235243

236-
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
244+
define <16 x i8> @knownbits_shuffle_add_shift_v32i8(<32 x i8> %arg, <32 x i8> %arg1) local_unnamed_addr #0 {
245+
; CHECK-LABEL: define <16 x i8> @knownbits_shuffle_add_shift_v32i8(
246+
; CHECK-SAME: <32 x i8> [[ARG:%.*]], <32 x i8> [[ARG1:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
247+
; CHECK-NEXT: [[SHUFFLEVECTOR:%.*]] = shufflevector <32 x i8> [[ARG]], <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
248+
; CHECK-NEXT: [[SHUFFLEVECTOR2:%.*]] = shufflevector <32 x i8> [[ARG]], <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
249+
; CHECK-NEXT: [[ADD:%.*]] = add <16 x i8> [[SHUFFLEVECTOR]], [[SHUFFLEVECTOR2]]
250+
; CHECK-NEXT: [[BITCAST:%.*]] = bitcast <16 x i8> [[ADD]] to <8 x i16>
251+
; CHECK-NEXT: [[SHL:%.*]] = shl <8 x i16> [[BITCAST]], splat (i16 8)
252+
; CHECK-NEXT: [[BITCAST3:%.*]] = bitcast <8 x i16> [[SHL]] to <16 x i8>
253+
; CHECK-NEXT: [[BITCAST4:%.*]] = bitcast <32 x i8> [[ARG1]] to <16 x i16>
254+
; CHECK-NEXT: [[SHUFFLEVECTOR5:%.*]] = shufflevector <16 x i16> [[BITCAST4]], <16 x i16> poison, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
255+
; CHECK-NEXT: [[SHL6:%.*]] = shl <8 x i16> [[SHUFFLEVECTOR5]], splat (i16 8)
256+
; CHECK-NEXT: [[BITCAST7:%.*]] = bitcast <8 x i16> [[SHL6]] to <16 x i8>
257+
; CHECK-NEXT: [[BITCAST8:%.*]] = bitcast <32 x i8> [[ARG1]] to <16 x i16>
258+
; CHECK-NEXT: [[SHUFFLEVECTOR9:%.*]] = shufflevector <16 x i16> [[BITCAST8]], <16 x i16> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
259+
; CHECK-NEXT: [[SHL10:%.*]] = shl <8 x i16> [[SHUFFLEVECTOR9]], splat (i16 8)
260+
; CHECK-NEXT: [[BITCAST11:%.*]] = bitcast <8 x i16> [[SHL10]] to <16 x i8>
261+
; CHECK-NEXT: [[ADD12:%.*]] = add <16 x i8> [[BITCAST11]], [[BITCAST7]]
262+
; CHECK-NEXT: [[ADD13:%.*]] = add <16 x i8> [[ADD12]], [[BITCAST3]]
263+
; CHECK-NEXT: ret <16 x i8> [[ADD13]]
264+
;
265+
266+
%shufflevector = shufflevector <32 x i8> %arg, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
267+
%shufflevector2 = shufflevector <32 x i8> %arg, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
268+
%add = add <16 x i8> %shufflevector, %shufflevector2
269+
%bitcast = bitcast <16 x i8> %add to <8 x i16>
270+
%shl = shl <8 x i16> %bitcast, splat (i16 8)
271+
%bitcast3 = bitcast <8 x i16> %shl to <16 x i8>
272+
%bitcast4 = bitcast <32 x i8> %arg1 to <16 x i16>
273+
%shufflevector5 = shufflevector <16 x i16> %bitcast4, <16 x i16> poison, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
274+
%shl6 = shl <8 x i16> %shufflevector5, splat (i16 8)
275+
%bitcast7 = bitcast <8 x i16> %shl6 to <16 x i8>
276+
%bitcast8 = bitcast <32 x i8> %arg1 to <16 x i16>
277+
%shufflevector9 = shufflevector <16 x i16> %bitcast8, <16 x i16> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
278+
%shl10 = shl <8 x i16> %shufflevector9, splat (i16 8)
279+
%bitcast11 = bitcast <8 x i16> %shl10 to <16 x i8>
280+
%add12 = add <16 x i8> %bitcast11, %bitcast7
281+
%add13 = add <16 x i8> %add12, %bitcast3
282+
%bitcast14 = bitcast <16 x i8> %add12 to <8 x i16>
283+
%shl15 = shl <8 x i16> %bitcast14, splat (i16 8)
284+
%bitcast16 = bitcast <8 x i16> %shl15 to <16 x i8>
285+
%add17 = add <16 x i8> %add13, %bitcast16
286+
ret <16 x i8> %add17
287+
}
288+
237289
declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>) #0
238290

239-
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
240291
declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) #0
241292

242293
attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

0 commit comments

Comments
 (0)