1 ; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S -enable-if-conversion | FileCheck %s
3 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-S128"
7 ;CHECK-NEXT: shufflevector <4 x i16>
8 ;CHECK: select <4 x i1>
9 ;CHECK: store <4 x i16>
11 define void @fc(i16* nocapture %p, i32 %n, i32 %size) nounwind uwtable ssp {
15 do.body: ; preds = %cond.end, %entry
16 %n.addr.0 = phi i32 [ %n, %entry ], [ %dec, %cond.end ]
17 %p.addr.0 = phi i16* [ %p, %entry ], [ %incdec.ptr, %cond.end ]
18 %incdec.ptr = getelementptr inbounds i16, i16* %p.addr.0, i64 -1
19 %0 = load i16, i16* %incdec.ptr, align 2
20 %conv = zext i16 %0 to i32
21 %cmp = icmp ult i32 %conv, %size
22 br i1 %cmp, label %cond.end, label %cond.true
24 cond.true: ; preds = %do.body
25 %sub = sub i32 %conv, %size
26 %phitmp = trunc i32 %sub to i16
29 cond.end: ; preds = %do.body, %cond.true
30 %cond = phi i16 [ %phitmp, %cond.true ], [ 0, %do.body ]
31 store i16 %cond, i16* %incdec.ptr, align 2
32 %dec = add i32 %n.addr.0, -1
33 %tobool = icmp eq i32 %dec, 0
34 br i1 %tobool, label %do.end, label %do.body
36 do.end: ; preds = %cond.end
41 ;CHECK: load <4 x i32>
42 ;CHECK-NEXT: shufflevector <4 x i32>
43 ;CHECK: select <4 x i1>
44 ;CHECK: store <4 x i32>
46 define void @example1(i32* nocapture %a, i32 %n, i32 %wsize) nounwind uwtable ssp {
50 do.body: ; preds = %do.body, %entry
51 %n.addr.0 = phi i32 [ %n, %entry ], [ %dec, %do.body ]
52 %p.0 = phi i32* [ %a, %entry ], [ %incdec.ptr, %do.body ]
53 %incdec.ptr = getelementptr inbounds i32, i32* %p.0, i64 -1
54 %0 = load i32, i32* %incdec.ptr, align 4
55 %cmp = icmp slt i32 %0, %wsize
56 %sub = sub nsw i32 %0, %wsize
57 %cond = select i1 %cmp, i32 0, i32 %sub
58 store i32 %cond, i32* %incdec.ptr, align 4
59 %dec = add nsw i32 %n.addr.0, -1
60 %tobool = icmp eq i32 %dec, 0
61 br i1 %tobool, label %do.end, label %do.body
63 do.end: ; preds = %do.body