Skip to content

Commit e8379ea

Browse files
committed
[SLP]Add a test with incorrect bitwidth after minbitwidth analysis, NFC
1 parent d39f4a1 commit e8379ea

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -slp-threshold=-100 < %s | FileCheck %s
3+
4+
@f = global i32 zeroinitializer
5+
6+
define i32 @test() {
7+
; CHECK-LABEL: define i32 @test() {
8+
; CHECK-NEXT: [[ENTRY:.*:]]
9+
; CHECK-NEXT: store i32 152, ptr @f, align 4
10+
; CHECK-NEXT: [[AGG_TMP_SROA_0_0_COPYLOAD_I:%.*]] = load i32, ptr @f, align 4
11+
; CHECK-NEXT: [[ADD_I_I:%.*]] = shl i32 [[AGG_TMP_SROA_0_0_COPYLOAD_I]], 24
12+
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x i32> <i32 poison, i32 83886080, i32 83886080, i32 83886080, i32 83886080, i32 83886080, i32 83886080, i32 83886080>, i32 [[ADD_I_I]], i32 0
13+
; CHECK-NEXT: [[TMP1:%.*]] = add <8 x i32> <i32 83886080, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>, [[TMP0]]
14+
; CHECK-NEXT: [[TMP2:%.*]] = ashr <8 x i32> [[TMP1]], splat (i32 24)
15+
; CHECK-NEXT: [[TMP3:%.*]] = trunc <8 x i32> [[TMP2]] to <8 x i8>
16+
; CHECK-NEXT: [[TMP4:%.*]] = and <8 x i8> [[TMP3]], <i8 -65, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
17+
; CHECK-NEXT: [[TMP5:%.*]] = zext <8 x i8> [[TMP4]] to <8 x i32>
18+
; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <8 x i32> [[TMP5]], <8 x i32> poison, <2 x i32> <i32 0, i32 poison>
19+
; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x i32> [[TMP6]], <2 x i32> <i32 poison, i32 0>, <2 x i32> <i32 0, i32 3>
20+
; CHECK-NEXT: [[TMP8:%.*]] = icmp ugt <2 x i32> [[TMP7]], <i32 33554431, i32 0>
21+
; CHECK-NEXT: [[TMP9:%.*]] = call <8 x i1> @llvm.vector.insert.v8i1.v2i1(<8 x i1> <i1 poison, i1 poison, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false>, <2 x i1> [[TMP8]], i64 0)
22+
; CHECK-NEXT: [[TMP10:%.*]] = select <8 x i1> [[TMP9]], <8 x i8> zeroinitializer, <8 x i8> <i8 6, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>
23+
; CHECK-NEXT: [[TMP11:%.*]] = shl <8 x i8> [[TMP4]], [[TMP10]]
24+
; CHECK-NEXT: [[TMP12:%.*]] = call i8 @llvm.vector.reduce.and.v8i8(<8 x i8> [[TMP11]])
25+
; CHECK-NEXT: [[CONV:%.*]] = zext i8 [[TMP12]] to i32
26+
; CHECK-NEXT: ret i32 [[CONV]]
27+
;
28+
entry:
29+
store i32 152, ptr @f, align 4
30+
%agg.tmp.sroa.0.0.copyload.i = load i32, ptr @f, align 4
31+
%add.i.i = shl i32 %agg.tmp.sroa.0.0.copyload.i, 24
32+
%sext.i = add i32 %add.i.i, 83886080
33+
%conv2.i = ashr i32 %sext.i, 24
34+
%and.i = and i32 %conv2.i, 66440127
35+
%cmp3.i.i = icmp ugt i32 %and.i, 33554431
36+
%shl.i.i = select i1 %cmp3.i.i, i32 0, i32 6
37+
%cond.i.i = shl i32 %and.i, %shl.i.i
38+
%0 = trunc i32 %cond.i.i to i8
39+
%sext.1.i = add i32 0, 83886080
40+
%conv2.1.i = ashr i32 %sext.1.i, 24
41+
%and.1.i = and i32 %conv2.1.i, 1
42+
%cmp3.i.1.i = icmp ugt i32 0, 0
43+
%shl.i.1.i = select i1 %cmp3.i.1.i, i32 0, i32 0
44+
%cond.i.1.i = shl i32 %and.1.i, %shl.i.1.i
45+
%1 = trunc i32 %cond.i.1.i to i8
46+
%conv17.1.i = and i8 %0, %1
47+
%sext.2.i = add i32 0, 83886080
48+
%conv2.2.i = ashr i32 %sext.2.i, 24
49+
%and.2.i = and i32 %conv2.2.i, 1
50+
%shl.i.2.i = select i1 false, i32 0, i32 0
51+
%cond.i.2.i = shl i32 %and.2.i, %shl.i.2.i
52+
%2 = trunc i32 %cond.i.2.i to i8
53+
%conv17.2.i = and i8 %conv17.1.i, %2
54+
%sext.3.i = add i32 0, 83886080
55+
%conv2.3.i = ashr i32 %sext.3.i, 24
56+
%and.3.i = and i32 %conv2.3.i, 1
57+
%shl.i.3.i = select i1 false, i32 0, i32 0
58+
%cond.i.3.i = shl i32 %and.3.i, %shl.i.3.i
59+
%3 = trunc i32 %cond.i.3.i to i8
60+
%conv17.3.i = and i8 %conv17.2.i, %3
61+
%sext.4.i = add i32 0, 83886080
62+
%conv2.4.i = ashr i32 %sext.4.i, 24
63+
%and.4.i = and i32 %conv2.4.i, 1
64+
%shl.i.4.i = select i1 false, i32 0, i32 0
65+
%cond.i.4.i = shl i32 %and.4.i, %shl.i.4.i
66+
%4 = trunc i32 %cond.i.4.i to i8
67+
%conv17.4.i = and i8 %conv17.3.i, %4
68+
%sext.5.i = add i32 0, 83886080
69+
%conv2.5.i = ashr i32 %sext.5.i, 24
70+
%and.5.i = and i32 %conv2.5.i, 1
71+
%shl.i.5.i = select i1 false, i32 0, i32 0
72+
%cond.i.5.i = shl i32 %and.5.i, %shl.i.5.i
73+
%5 = trunc i32 %cond.i.5.i to i8
74+
%conv17.5.i = and i8 %conv17.4.i, %5
75+
%sext.6.i = add i32 0, 83886080
76+
%conv2.6.i = ashr i32 %sext.6.i, 24
77+
%and.6.i = and i32 %conv2.6.i, 1
78+
%shl.i.6.i = select i1 false, i32 0, i32 0
79+
%cond.i.6.i = shl i32 %and.6.i, %shl.i.6.i
80+
%6 = trunc i32 %cond.i.6.i to i8
81+
%conv17.6.i = and i8 %conv17.5.i, %6
82+
%sext.7.i = add i32 0, 83886080
83+
%conv2.7.i = ashr i32 %sext.7.i, 24
84+
%and.7.i = and i32 %conv2.7.i, 1
85+
%shl.i.7.i = select i1 false, i32 0, i32 0
86+
%cond.i.7.i = shl i32 %and.7.i, %shl.i.7.i
87+
%7 = trunc i32 %cond.i.7.i to i8
88+
%conv17.7.i = and i8 %conv17.6.i, %7
89+
%conv = zext i8 %conv17.7.i to i32
90+
ret i32 %conv
91+
}
92+

0 commit comments

Comments
 (0)