summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Hexagon/early-if-vecpi.ll
blob: 6fd2aa134807c8dfeadfaf89dc7cf4467ba76997 (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
67
68
69
; RUN: llc -march=hexagon < %s | FileCheck %s

target triple = "hexagon-unknown--elf"

; Check that we can predicate base+offset vector stores.
; CHECK-LABEL: sammy
; CHECK: if{{.*}}vmem(r{{[0-9]+}}+#0) =
define void @sammy(<16 x i32>* nocapture %p, <16 x i32>* nocapture readonly %q, i32 %n) #0 {
entry:
  %0 = load <16 x i32>, <16 x i32>* %q, align 64
  %sub = add nsw i32 %n, -1
  br label %for.body

for.body:                                         ; preds = %if.end, %entry
  %p.addr.011 = phi <16 x i32>* [ %p, %entry ], [ %incdec.ptr, %if.end ]
  %i.010 = phi i32 [ 0, %entry ], [ %add, %if.end ]
  %mul = mul nsw i32 %i.010, %sub
  %add = add nuw nsw i32 %i.010, 1
  %mul1 = mul nsw i32 %add, %n
  %cmp2 = icmp slt i32 %mul, %mul1
  br i1 %cmp2, label %if.then, label %if.end

if.then:                                          ; preds = %for.body
  store <16 x i32> %0, <16 x i32>* %p.addr.011, align 64
  br label %if.end

if.end:                                           ; preds = %if.then, %for.body
  %incdec.ptr = getelementptr inbounds <16 x i32>, <16 x i32>* %p.addr.011, i32 1
  %exitcond = icmp eq i32 %add, 100
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %if.end
  ret void
}

; Check that we can predicate post-increment vector stores.
; CHECK-LABEL: danny
; CHECK: if{{.*}}vmem(r{{[0-9]+}}++#1) =
define void @danny(<16 x i32>* nocapture %p, <16 x i32>* nocapture readonly %q, i32 %n) #0 {
entry:
  %0 = load <16 x i32>, <16 x i32>* %q, align 64
  %sub = add nsw i32 %n, -1
  br label %for.body

for.body:                                         ; preds = %if.end, %entry
  %p.addr.012 = phi <16 x i32>* [ %p, %entry ], [ %incdec.ptr3, %if.end ]
  %i.011 = phi i32 [ 0, %entry ], [ %add, %if.end ]
  %mul = mul nsw i32 %i.011, %sub
  %add = add nuw nsw i32 %i.011, 1
  %mul1 = mul nsw i32 %add, %n
  %cmp2 = icmp slt i32 %mul, %mul1
  br i1 %cmp2, label %if.then, label %if.end

if.then:                                          ; preds = %for.body
  %incdec.ptr = getelementptr inbounds <16 x i32>, <16 x i32>* %p.addr.012, i32 1
  store <16 x i32> %0, <16 x i32>* %p.addr.012, align 64
  br label %if.end

if.end:                                           ; preds = %if.then, %for.body
  %p.addr.1 = phi <16 x i32>* [ %incdec.ptr, %if.then ], [ %p.addr.012, %for.body ]
  %incdec.ptr3 = getelementptr inbounds <16 x i32>, <16 x i32>* %p.addr.1, i32 1
  %exitcond = icmp eq i32 %add, 100
  br i1 %exitcond, label %for.end, label %for.body

for.end:                                          ; preds = %if.end
  ret void
}

attributes #0 = { norecurse nounwind "target-cpu"="hexagonv60" "target-features"="+hvxv60,+hvx-length64b" }
OpenPOWER on IntegriCloud