1 ; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
2 ; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
3 ; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
4 ; RUN: llc %t1 -mcpu=v3 -o - | FileCheck -check-prefixes=CHECK,CHECK-V3 %s
7 ; int test1(unsigned long a) {
8 ; if ((unsigned)a > 3) return 2;
11 ; int test2(unsigned long a) {
12 ; if ((unsigned)a >= 4) return 2;
16 ; clang -target bpf -O2 -S -emit-llvm -Xclang -disable-llvm-passes test.c
18 ; Function Attrs: nounwind
19 define dso_local i32 @test1(i64 %a) #0 {
21 %retval = alloca i32, align 4
22 %a.addr = alloca i64, align 8
23 store i64 %a, ptr %a.addr, align 8, !tbaa !3
24 %0 = load i64, ptr %a.addr, align 8, !tbaa !3
25 %conv = trunc i64 %0 to i32
26 %cmp = icmp ugt i32 %conv, 3
27 br i1 %cmp, label %if.then, label %if.end
29 if.then: ; preds = %entry
30 store i32 2, ptr %retval, align 4
33 if.end: ; preds = %entry
34 store i32 3, ptr %retval, align 4
37 return: ; preds = %if.end, %if.then
38 %1 = load i32, ptr %retval, align 4
43 ; CHECK-V1: if r[[#]] > 3 goto
44 ; CHECK-V3: if w[[#]] > 3 goto
46 ; Function Attrs: nounwind
47 define dso_local i32 @test2(i64 %a) #0 {
49 %retval = alloca i32, align 4
50 %a.addr = alloca i64, align 8
51 store i64 %a, ptr %a.addr, align 8, !tbaa !3
52 %0 = load i64, ptr %a.addr, align 8, !tbaa !3
53 %conv = trunc i64 %0 to i32
54 %cmp = icmp uge i32 %conv, 4
55 br i1 %cmp, label %if.then, label %if.end
57 if.then: ; preds = %entry
58 store i32 2, ptr %retval, align 4
61 if.end: ; preds = %entry
62 store i32 3, ptr %retval, align 4
65 return: ; preds = %if.end, %if.then
66 %1 = load i32, ptr %retval, align 4
71 ; CHECK-V1: if r[[#]] > 3 goto
72 ; CHECK-V3: if w[[#]] > 3 goto
74 attributes #0 = { nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
76 !llvm.module.flags = !{!0, !1}
79 !0 = !{i32 1, !"wchar_size", i32 4}
80 !1 = !{i32 7, !"frame-pointer", i32 2}
81 !2 = !{!"clang version 14.0.0 (https://github.com/llvm/llvm-project.git 930ccf0191b4a33332d924522e5676fff583f083)"}
83 !4 = !{!"long", !5, i64 0}
84 !5 = !{!"omnipotent char", !6, i64 0}
85 !6 = !{!"Simple C/C++ TBAA"}