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 pr33597.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer pr33597.s > pr33597.ll
6 ; ModuleID = 'pr33597.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 define void @rgb15to24_C(i8* %src, i8* %dst, i64 %src_size) nounwind uwtable {
12 %tmp10 = bitcast i8* %src to i16*
13 %div = sdiv i64 %src_size, 2
14 %add.ptr = getelementptr inbounds i16* %tmp10, i64 %div
17 while.cond: ; preds = %while.body, %entry
18 %indvar = phi i64 [ %indvar.next, %while.body ], [ 0, %entry ]
19 %tmp = mul i64 %indvar, 2
20 %scevgep = getelementptr i8* %src, i64 %tmp
21 %s.0 = bitcast i8* %scevgep to i16*
22 %tmp4 = mul i64 %indvar, 3
23 %tmp5 = add i64 %tmp4, 2
24 %incdec.ptr19 = getelementptr i8* %dst, i64 %tmp5
25 %tmp7 = add i64 %tmp4, 1
26 %incdec.ptr13 = getelementptr i8* %dst, i64 %tmp7
27 %d.0 = getelementptr i8* %dst, i64 %tmp4
28 %cmp = icmp ult i16* %s.0, %add.ptr
29 br i1 %cmp, label %while.body, label %while.end
31 while.body: ; preds = %while.cond
32 %tmp9 = load i16* %s.0, align 2
33 %conv = trunc i16 %tmp9 to i8
34 %and = shl i8 %conv, 3
35 store i8 %and, i8* %d.0, align 1
36 %and16 = lshr i16 %tmp9, 2
37 %and16.tr = trunc i16 %and16 to i8
38 %conv17 = and i8 %and16.tr, -8
39 store i8 %conv17, i8* %incdec.ptr13, align 1
40 %and22 = lshr i16 %tmp9, 7
41 %and22.tr = trunc i16 %and22 to i8
42 %conv24 = and i8 %and22.tr, -8
43 store i8 %conv24, i8* %incdec.ptr19, align 1
44 %indvar.next = add i64 %indvar, 1
47 while.end: ; preds = %while.cond