1; RUN: llc -march=hexagon -mcpu=hexagonv5 -disable-hsdr < %s | FileCheck %s
2
3; Check that store is post-incremented.
4; CHECK: memh(r{{[0-9]+}}++#2)
5
6target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a0:0-n16:32"
7target triple = "hexagon"
8
9define void @matrix_add_const(i32 %N, i16* nocapture %A, i16 signext %val) #0 {
10entry:
11  %cmp5 = icmp eq i32 %N, 0
12  br i1 %cmp5, label %for.end, label %polly.cond
13
14for.end.loopexit:                                 ; preds = %polly.stmt.for.body29
15  br label %for.end
16
17for.end:                                          ; preds = %for.end.loopexit, %polly.loop_header24.preheader, %entry
18  ret void
19
20polly.cond:                                       ; preds = %entry
21  %0 = icmp sgt i32 %N, 3
22  br i1 %0, label %polly.then, label %polly.loop_header24.preheader
23
24polly.then:                                       ; preds = %polly.cond
25  %1 = add i32 %N, -1
26  %leftover_lb = and i32 %1, -4
27  %2 = icmp sgt i32 %leftover_lb, 0
28  br i1 %2, label %polly.loop_body.lr.ph, label %polly.loop_header24.preheader
29
30polly.loop_body.lr.ph:                            ; preds = %polly.then
31  %3 = insertelement <4 x i16> undef, i16 %val, i32 0
32  %4 = insertelement <4 x i16> %3, i16 %val, i32 1
33  %5 = insertelement <4 x i16> %4, i16 %val, i32 2
34  %6 = insertelement <4 x i16> %5, i16 %val, i32 3
35  br label %polly.loop_body
36
37polly.loop_header24.preheader.loopexit:           ; preds = %polly.loop_body
38  br label %polly.loop_header24.preheader
39
40polly.loop_header24.preheader:                    ; preds = %polly.loop_header24.preheader.loopexit, %polly.then, %polly.cond
41  %polly.loopiv27.ph = phi i32 [ 0, %polly.cond ], [ %leftover_lb, %polly.then ], [ %leftover_lb, %polly.loop_header24.preheader.loopexit ]
42  %7 = icmp slt i32 %polly.loopiv27.ph, %N
43  br i1 %7, label %polly.stmt.for.body29.preheader, label %for.end
44
45polly.stmt.for.body29.preheader:                  ; preds = %polly.loop_header24.preheader
46  br label %polly.stmt.for.body29
47
48polly.loop_body:                                  ; preds = %polly.loop_body.lr.ph, %polly.loop_body
49  %p_arrayidx.phi = phi i16* [ %A, %polly.loop_body.lr.ph ], [ %p_arrayidx.inc, %polly.loop_body ]
50  %polly.loopiv34 = phi i32 [ 0, %polly.loop_body.lr.ph ], [ %polly.next_loopiv, %polly.loop_body ]
51  %polly.next_loopiv = add nsw i32 %polly.loopiv34, 4
52  %vector_ptr = bitcast i16* %p_arrayidx.phi to <4 x i16>*
53  %_p_vec_full = load <4 x i16>, <4 x i16>* %vector_ptr, align 2
54  %addp_vec = add <4 x i16> %_p_vec_full, %6
55  store <4 x i16> %addp_vec, <4 x i16>* %vector_ptr, align 2
56  %8 = icmp slt i32 %polly.next_loopiv, %leftover_lb
57  %p_arrayidx.inc = getelementptr i16, i16* %p_arrayidx.phi, i32 4
58  br i1 %8, label %polly.loop_body, label %polly.loop_header24.preheader.loopexit
59
60polly.stmt.for.body29:                            ; preds = %polly.stmt.for.body29.preheader, %polly.stmt.for.body29
61  %polly.loopiv2733 = phi i32 [ %polly.next_loopiv28, %polly.stmt.for.body29 ], [ %polly.loopiv27.ph, %polly.stmt.for.body29.preheader ]
62  %polly.next_loopiv28 = add nsw i32 %polly.loopiv2733, 1
63  %p_arrayidx30 = getelementptr i16, i16* %A, i32 %polly.loopiv2733
64  %_p_scalar_ = load i16, i16* %p_arrayidx30, align 2
65  %p_add = add i16 %_p_scalar_, %val
66  store i16 %p_add, i16* %p_arrayidx30, align 2
67  %exitcond = icmp eq i32 %polly.next_loopiv28, %N
68  br i1 %exitcond, label %for.end.loopexit, label %polly.stmt.for.body29
69}
70
71attributes #0 = { nounwind "fp-contract-model"="standard" "no-frame-pointer-elim-non-leaf" "realign-stack" "relocation-model"="static" "ssp-buffers-size"="8" }
72