1 ; RUN: llc < %s -march=bpf -mcpu=v2 -verify-machineinstrs | FileCheck %s
11 @b = common local_unnamed_addr global i32 0, align 4
12 @c = common local_unnamed_addr global i32 0, align 4
14 ; Function Attrs: norecurse nounwind readonly
15 define i32 @test() local_unnamed_addr #0 {
17 %0 = load i32, i32* @b, align 4
18 %tobool = icmp eq i32 %0, 0
19 %1 = load i32, i32* @c, align 4
20 %. = select i1 %tobool, i32 0, i32 %1
22 ; CHECK: r1 = *(u32 *)(r1 + 0)
23 ; CHECK: if r1 == 0 goto
27 attributes #0 = { norecurse nounwind readonly }
29 ; test immediate out of 32-bit range
33 ; load_word(void *buf, unsigned long long off)
34 ; asm("llvm.bpf.load.word");
39 ; unsigned long long sum = 0;
41 ; sum += load_word(buf, 100);
42 ; sum += load_word(buf, 104);
44 ; if (sum != 0x1ffffffffULL)
50 ; Function Attrs: nounwind readonly
51 define i32 @foo(i8*) local_unnamed_addr #0 {
52 %2 = tail call i64 @llvm.bpf.load.word(i8* %0, i64 100)
53 %3 = tail call i64 @llvm.bpf.load.word(i8* %0, i64 104)
55 %5 = icmp ne i64 %4, 8589934591
56 ; CHECK: r{{[0-9]+}} = 8589934591 ll
57 %6 = sext i1 %5 to i32
61 ; Function Attrs: nounwind readonly
62 declare i64 @llvm.bpf.load.word(i8*, i64) #1
73 @m = common local_unnamed_addr global i32 0, align 4
74 @n = common local_unnamed_addr global i32 0, align 4
76 ; Function Attrs: norecurse nounwind readonly
77 define i32 @test2() local_unnamed_addr #0 {
79 %0 = load i32, i32* @m, align 4
80 %cmp = icmp slt i32 %0, 6
81 ; CHECK: if r{{[0-9]+}} s{{<|>}} 6 goto
82 %1 = load i32, i32* @n, align 4
83 %spec.select = select i1 %cmp, i32 %1, i32 %0
87 attributes #0 = { norecurse nounwind readonly }