1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 vect-widen-mult-half-u8.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-widen-mult-half-u8.s > vect-widen-mult-half-u8.ll
6 ; ModuleID = 'vect-widen-mult-half-u8.s'
7 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
8 target triple = "x86_64-unknown-linux-gnu"
10 @in = common global [32 x i8] zeroinitializer, align 16
11 @out = common global [32 x i32] zeroinitializer, align 16
13 define void @foo() nounwind uwtable noinline {
17 for.cond: ; preds = %for.inc, %entry
18 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
19 %arrayidx5 = getelementptr [32 x i32]* @out, i64 0, i64 %indvar
20 %arrayidx = getelementptr [32 x i8]* @in, i64 0, i64 %indvar
21 %exitcond = icmp ne i64 %indvar, 32
22 br i1 %exitcond, label %for.body, label %for.end
24 for.body: ; preds = %for.cond
25 %tmp2 = load i8* %arrayidx, align 1
26 %conv = zext i8 %tmp2 to i32
27 %mul = mul nsw i32 %conv, 32470
28 store i32 %mul, i32* %arrayidx5, align 4
31 for.inc: ; preds = %for.body
32 %indvar.next = add i64 %indvar, 1
35 for.end: ; preds = %for.cond
39 define void @bar() nounwind uwtable noinline {
43 for.cond: ; preds = %for.inc, %entry
44 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
45 %arrayidx5 = getelementptr [32 x i32]* @out, i64 0, i64 %indvar
46 %arrayidx = getelementptr [32 x i8]* @in, i64 0, i64 %indvar
47 %exitcond = icmp ne i64 %indvar, 32
48 br i1 %exitcond, label %for.body, label %for.end
50 for.body: ; preds = %for.cond
51 %tmp2 = load i8* %arrayidx, align 1
52 %conv = zext i8 %tmp2 to i32
53 %mul = mul nsw i32 %conv, 32470
54 store i32 %mul, i32* %arrayidx5, align 4
57 for.inc: ; preds = %for.body
58 %indvar.next = add i64 %indvar, 1
61 for.end: ; preds = %for.cond
65 define i32 @main() nounwind uwtable {
69 for.cond: ; preds = %for.inc, %entry
70 %indvar3 = phi i64 [ %indvar.next4, %for.inc ], [ 0, %entry ]
71 %arrayidx = getelementptr [32 x i8]* @in, i64 0, i64 %indvar3
72 %conv = trunc i64 %indvar3 to i8
73 %exitcond = icmp ne i64 %indvar3, 32
74 br i1 %exitcond, label %for.body, label %for.end
76 for.body: ; preds = %for.cond
77 store i8 %conv, i8* %arrayidx, align 1
78 call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0
81 for.inc: ; preds = %for.body
82 %indvar.next4 = add i64 %indvar3, 1
85 for.end: ; preds = %for.cond
89 for.cond4: ; preds = %for.inc20, %for.end
90 %indvar1 = phi i64 [ %indvar.next2, %for.inc20 ], [ 0, %for.end ]
91 %arrayidx15 = getelementptr [32 x i8]* @in, i64 0, i64 %indvar1
92 %arrayidx11 = getelementptr [32 x i32]* @out, i64 0, i64 %indvar1
93 %i.1 = trunc i64 %indvar1 to i32
94 %cmp6 = icmp slt i32 %i.1, 32
95 br i1 %cmp6, label %for.body8, label %for.end23
97 for.body8: ; preds = %for.cond4
98 %tmp12 = load i32* %arrayidx11, align 4
99 %tmp16 = load i8* %arrayidx15, align 1
100 %conv17 = zext i8 %tmp16 to i32
101 %mul = mul nsw i32 %conv17, 32470
102 %cmp18 = icmp eq i32 %tmp12, %mul
103 br i1 %cmp18, label %if.end, label %if.then
105 if.then: ; preds = %for.body8
106 call void @abort() noreturn nounwind
109 if.end: ; preds = %for.body8
112 for.inc20: ; preds = %if.end
113 %indvar.next2 = add i64 %indvar1, 1
116 for.end23: ; preds = %for.cond4
120 for.cond24: ; preds = %for.inc43, %for.end23
121 %indvar = phi i64 [ %indvar.next, %for.inc43 ], [ 0, %for.end23 ]
122 %arrayidx35 = getelementptr [32 x i8]* @in, i64 0, i64 %indvar
123 %arrayidx31 = getelementptr [32 x i32]* @out, i64 0, i64 %indvar
124 %i.2 = trunc i64 %indvar to i32
125 %cmp26 = icmp slt i32 %i.2, 32
126 br i1 %cmp26, label %for.body28, label %for.end46
128 for.body28: ; preds = %for.cond24
129 %tmp32 = load i32* %arrayidx31, align 4
130 %tmp36 = load i8* %arrayidx35, align 1
131 %conv37 = zext i8 %tmp36 to i32
132 %mul38 = mul nsw i32 %conv37, 32470
133 %cmp39 = icmp eq i32 %tmp32, %mul38
134 br i1 %cmp39, label %if.end42, label %if.then41
136 if.then41: ; preds = %for.body28
137 call void @abort() noreturn nounwind
140 if.end42: ; preds = %for.body28
143 for.inc43: ; preds = %if.end42
144 %indvar.next = add i64 %indvar, 1
147 for.end46: ; preds = %for.cond24
151 declare void @abort() noreturn nounwind
153 !0 = metadata !{i32 476}