• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=bpf -verify-machineinstrs | FileCheck %s
2; RUN: llc < %s -march=bpf -mattr=+alu32 -verify-machineinstrs | FileCheck --check-prefix=CHECK-32 %s
3;
4; void cal1(unsigned short *a, unsigned long *b, unsigned int k)
5; {
6;   unsigned short e;
7;
8;   e = *a;
9;   for (unsigned int i = 0; i < k; i++) {
10;     b[i] = e;
11;     e = ~e;
12;   }
13; }
14;
15; void cal2(unsigned short *a, unsigned int *b, unsigned int k)
16; {
17;   unsigned short e;
18;
19;   e = *a;
20;   for (unsigned int i = 0; i < k; i++) {
21;     b[i] = e;
22;     e = ~e;
23;   }
24; }
25
26; Function Attrs: nofree norecurse nounwind optsize
27define dso_local void @cal1(i16* nocapture readonly %a, i64* nocapture %b, i32 %k) local_unnamed_addr #0 {
28entry:
29  %cmp8 = icmp eq i32 %k, 0
30  br i1 %cmp8, label %for.cond.cleanup, label %for.body.preheader
31
32for.body.preheader:                               ; preds = %entry
33  %0 = load i16, i16* %a, align 2
34  %wide.trip.count = zext i32 %k to i64
35  br label %for.body
36
37for.cond.cleanup:                                 ; preds = %for.body, %entry
38  ret void
39
40for.body:                                         ; preds = %for.body, %for.body.preheader
41  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
42  %e.09 = phi i16 [ %0, %for.body.preheader ], [ %neg, %for.body ]
43  %conv = zext i16 %e.09 to i64
44  %arrayidx = getelementptr inbounds i64, i64* %b, i64 %indvars.iv
45; CHECK: r{{[0-9]+}} &= 65535
46; CHECK-32: r{{[0-9]+}} &= 65535
47  store i64 %conv, i64* %arrayidx, align 8
48  %neg = xor i16 %e.09, -1
49  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
50  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
51  br i1 %exitcond, label %for.cond.cleanup, label %for.body
52}
53
54; Function Attrs: nofree norecurse nounwind optsize
55define dso_local void @cal2(i16* nocapture readonly %a, i32* nocapture %b, i32 %k) local_unnamed_addr #0 {
56entry:
57  %cmp8 = icmp eq i32 %k, 0
58  br i1 %cmp8, label %for.cond.cleanup, label %for.body.preheader
59
60for.body.preheader:                               ; preds = %entry
61  %0 = load i16, i16* %a, align 2
62  %wide.trip.count = zext i32 %k to i64
63  br label %for.body
64
65for.cond.cleanup:                                 ; preds = %for.body, %entry
66  ret void
67
68for.body:                                         ; preds = %for.body, %for.body.preheader
69  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
70  %e.09 = phi i16 [ %0, %for.body.preheader ], [ %neg, %for.body ]
71  %conv = zext i16 %e.09 to i32
72  %arrayidx = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
73; CHECK: r{{[0-9]+}} &= 65535
74; CHECK-32: w{{[0-9]+}} &= 65535
75  store i32 %conv, i32* %arrayidx, align 4
76  %neg = xor i16 %e.09, -1
77  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
78  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
79  br i1 %exitcond, label %for.cond.cleanup, label %for.body
80}
81