• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=hexagon -mcpu=hexagonv5 < %s | FileCheck %s
2
3; Check that we do not generate extract.
4; CHECK-NOT: extractu
5target 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"
6target triple = "hexagon"
7
8define void @foo(i32 %N, i32* nocapture %C, i16* nocapture %A, i16 signext %val) #0 {
9entry:
10  %cmp14 = icmp eq i32 %N, 0
11  br i1 %cmp14, label %for.end11, label %for.cond1.preheader.single_entry.preheader
12
13for.cond1.preheader.single_entry.preheader:       ; preds = %entry
14  %0 = add i32 %N, -1
15  %leftover_lb = and i32 %0, -2
16  %p_conv4 = sext i16 %val to i32
17  br label %for.cond1.preheader.single_entry
18
19for.cond1.preheader.single_entry:                 ; preds = %for.inc9, %for.cond1.preheader.single_entry.preheader
20  %indvar = phi i32 [ %indvar.next, %for.inc9 ], [ 0, %for.cond1.preheader.single_entry.preheader ]
21  %1 = mul i32 %indvar, %N
22  %.not = icmp slt i32 %N, 2
23  %.not41 = icmp slt i32 %leftover_lb, 1
24  %brmerge = or i1 %.not, %.not41
25  %.mux = select i1 %.not, i32 0, i32 %leftover_lb
26  br i1 %brmerge, label %polly.loop_header26.preheader, label %polly.loop_body.lr.ph
27
28for.inc9.loopexit:                                ; preds = %polly.stmt.for.body331
29  br label %for.inc9
30
31for.inc9:                                         ; preds = %for.inc9.loopexit, %polly.loop_header26.preheader
32  %indvar.next = add i32 %indvar, 1
33  %exitcond40 = icmp eq i32 %indvar.next, %N
34  br i1 %exitcond40, label %for.end11.loopexit, label %for.cond1.preheader.single_entry
35
36for.end11.loopexit:                               ; preds = %for.inc9
37  br label %for.end11
38
39for.end11:                                        ; preds = %for.end11.loopexit, %entry
40  ret void
41
42polly.loop_body.lr.ph:                            ; preds = %for.cond1.preheader.single_entry
43  %2 = call i64 @llvm.hexagon.A2.combinew(i32 %1, i32 %1)
44  %3 = bitcast i64 %2 to <2 x i32>
45  %4 = extractelement <2 x i32> %3, i32 0
46  %5 = call i64 @llvm.hexagon.A2.combinew(i32 %p_conv4, i32 %p_conv4)
47  %6 = bitcast i64 %5 to <2 x i32>
48  %p_arrayidx8.gep = getelementptr i32, i32* %C, i32 %4
49  %p_arrayidx.gep = getelementptr i16, i16* %A, i32 %4
50  br label %polly.loop_body
51
52polly.loop_body:                                  ; preds = %polly.loop_body.lr.ph, %polly.loop_body
53  %p_arrayidx8.phi = phi i32* [ %p_arrayidx8.gep, %polly.loop_body.lr.ph ], [ %p_arrayidx8.inc, %polly.loop_body ]
54  %p_arrayidx.phi = phi i16* [ %p_arrayidx.gep, %polly.loop_body.lr.ph ], [ %p_arrayidx.inc, %polly.loop_body ]
55  %polly.loopiv38 = phi i32 [ 0, %polly.loop_body.lr.ph ], [ %polly.next_loopiv, %polly.loop_body ]
56  %polly.next_loopiv = add nsw i32 %polly.loopiv38, 2
57  %vector_ptr = bitcast i16* %p_arrayidx.phi to <2 x i16>*
58  %_p_vec_full = load <2 x i16>, <2 x i16>* %vector_ptr, align 2
59  %7 = sext <2 x i16> %_p_vec_full to <2 x i32>
60  %mul5p_vec = mul <2 x i32> %7, %6
61  %vector_ptr21 = bitcast i32* %p_arrayidx8.phi to <2 x i32>*
62  store <2 x i32> %mul5p_vec, <2 x i32>* %vector_ptr21, align 4
63  %8 = icmp slt i32 %polly.next_loopiv, %leftover_lb
64  %p_arrayidx8.inc = getelementptr i32, i32* %p_arrayidx8.phi, i32 2
65  %p_arrayidx.inc = getelementptr i16, i16* %p_arrayidx.phi, i32 2
66  br i1 %8, label %polly.loop_body, label %polly.loop_header26.preheader.loopexit
67
68polly.loop_header26.preheader.loopexit:           ; preds = %polly.loop_body
69  br label %polly.loop_header26.preheader
70
71polly.loop_header26.preheader:                    ; preds = %polly.loop_header26.preheader.loopexit, %for.cond1.preheader.single_entry
72  %polly.loopiv29.ph = phi i32 [ %.mux, %for.cond1.preheader.single_entry ], [ %leftover_lb, %polly.loop_header26.preheader.loopexit ]
73  %9 = icmp slt i32 %polly.loopiv29.ph, %N
74  br i1 %9, label %polly.stmt.for.body331.preheader, label %for.inc9
75
76polly.stmt.for.body331.preheader:                 ; preds = %polly.loop_header26.preheader
77  br label %polly.stmt.for.body331
78
79polly.stmt.for.body331:                           ; preds = %polly.stmt.for.body331.preheader, %polly.stmt.for.body331
80  %polly.loopiv2939 = phi i32 [ %polly.next_loopiv30, %polly.stmt.for.body331 ], [ %polly.loopiv29.ph, %polly.stmt.for.body331.preheader ]
81  %polly.next_loopiv30 = add nsw i32 %polly.loopiv2939, 1
82  %p_32 = add i32 %polly.loopiv2939, %1
83  %p_arrayidx833 = getelementptr i32, i32* %C, i32 %p_32
84  %p_arrayidx34 = getelementptr i16, i16* %A, i32 %p_32
85  %_p_scalar_ = load i16, i16* %p_arrayidx34, align 2
86  %p_conv = sext i16 %_p_scalar_ to i32
87  %p_mul5 = mul nsw i32 %p_conv, %p_conv4
88  store i32 %p_mul5, i32* %p_arrayidx833, align 4
89  %exitcond = icmp eq i32 %polly.next_loopiv30, %N
90  br i1 %exitcond, label %for.inc9.loopexit, label %polly.stmt.for.body331
91}
92
93declare i64 @llvm.hexagon.A2.combinew(i32, i32) #1
94
95attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
96attributes #1 = { nounwind readnone }
97