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
4 ; void cal1(unsigned short *a, unsigned long *b, unsigned int k)
9 ; for (unsigned int i = 0; i < k; i++) {
15 ; void cal2(unsigned short *a, unsigned int *b, unsigned int k)
20 ; for (unsigned int i = 0; i < k; i++) {
26 ; Function Attrs: nofree norecurse nounwind optsize
27 define dso_local void @cal1(ptr nocapture readonly %a, ptr nocapture %b, i32 %k) local_unnamed_addr #0 {
29 %cmp8 = icmp eq i32 %k, 0
30 br i1 %cmp8, label %for.cond.cleanup, label %for.body.preheader
32 for.body.preheader: ; preds = %entry
33 %0 = load i16, ptr %a, align 2
34 %wide.trip.count = zext i32 %k to i64
37 for.cond.cleanup: ; preds = %for.body, %entry
40 for.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, ptr %b, i64 %indvars.iv
45 ; CHECK: r{{[0-9]+}} &= 65535
46 ; CHECK-32: r{{[0-9]+}} &= 65535
47 store i64 %conv, ptr %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
54 ; Function Attrs: nofree norecurse nounwind optsize
55 define dso_local void @cal2(ptr nocapture readonly %a, ptr nocapture %b, i32 %k) local_unnamed_addr #0 {
57 %cmp8 = icmp eq i32 %k, 0
58 br i1 %cmp8, label %for.cond.cleanup, label %for.body.preheader
60 for.body.preheader: ; preds = %entry
61 %0 = load i16, ptr %a, align 2
62 %wide.trip.count = zext i32 %k to i64
65 for.cond.cleanup: ; preds = %for.body, %entry
68 for.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, ptr %b, i64 %indvars.iv
73 ; CHECK: r{{[0-9]+}} &= 65535
74 ; CHECK-32: w{{[0-9]+}} &= 65535
75 store i32 %conv, ptr %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