aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/LoopVectorize/bzip_reverse_loops.ll
blob: d7cbad06ddf0d9ef1e97bb22558fd816d4082567 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S -enable-if-conversion | FileCheck %s

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"
target triple = "x86_64-apple-macosx10.8.0"

;CHECK: fc
;CHECK: load <4 x i16>
;CHECK-NEXT: shufflevector <4 x i16>
;CHECK: select <4 x i1>
;CHECK: store <4 x i16>
;CHECK: ret
define void @fc(i16* nocapture %p, i32 %n, i32 %size) nounwind uwtable ssp {
entry:
  br label %do.body

do.body:                                          ; preds = %cond.end, %entry
  %n.addr.0 = phi i32 [ %n, %entry ], [ %dec, %cond.end ]
  %p.addr.0 = phi i16* [ %p, %entry ], [ %incdec.ptr, %cond.end ]
  %incdec.ptr = getelementptr inbounds i16* %p.addr.0, i64 -1
  %0 = load i16* %incdec.ptr, align 2
  %conv = zext i16 %0 to i32
  %cmp = icmp ult i32 %conv, %size
  br i1 %cmp, label %cond.end, label %cond.true

cond.true:                                        ; preds = %do.body
  %sub = sub i32 %conv, %size
  %phitmp = trunc i32 %sub to i16
  br label %cond.end

cond.end:                                         ; preds = %do.body, %cond.true
  %cond = phi i16 [ %phitmp, %cond.true ], [ 0, %do.body ]
  store i16 %cond, i16* %incdec.ptr, align 2
  %dec = add i32 %n.addr.0, -1
  %tobool = icmp eq i32 %dec, 0
  br i1 %tobool, label %do.end, label %do.body

do.end:                                           ; preds = %cond.end
  ret void
}

;CHECK: example1
;CHECK: load <4 x i32>
;CHECK-NEXT: shufflevector <4 x i32>
;CHECK: select <4 x i1>
;CHECK: store <4 x i32>
;CHECK: ret
define void @example1(i32* nocapture %a, i32 %n, i32 %wsize) nounwind uwtable ssp {
entry:
  br label %do.body

do.body:                                          ; preds = %do.body, %entry
  %n.addr.0 = phi i32 [ %n, %entry ], [ %dec, %do.body ]
  %p.0 = phi i32* [ %a, %entry ], [ %incdec.ptr, %do.body ]
  %incdec.ptr = getelementptr inbounds i32* %p.0, i64 -1
  %0 = load i32* %incdec.ptr, align 4
  %cmp = icmp slt i32 %0, %wsize
  %sub = sub nsw i32 %0, %wsize
  %cond = select i1 %cmp, i32 0, i32 %sub
  store i32 %cond, i32* %incdec.ptr, align 4
  %dec = add nsw i32 %n.addr.0, -1
  %tobool = icmp eq i32 %dec, 0
  br i1 %tobool, label %do.end, label %do.body

do.end:                                           ; preds = %do.body
  ret void
}