From ebe69fe11e48d322045d5949c83283927a0d790b Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Mon, 23 Mar 2015 12:10:34 -0700 Subject: Update aosp/master LLVM for rebase to r230699. Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9 --- test/CodeGen/BPF/sanity.ll | 117 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 test/CodeGen/BPF/sanity.ll (limited to 'test/CodeGen/BPF/sanity.ll') diff --git a/test/CodeGen/BPF/sanity.ll b/test/CodeGen/BPF/sanity.ll new file mode 100644 index 0000000..db63c07 --- /dev/null +++ b/test/CodeGen/BPF/sanity.ll @@ -0,0 +1,117 @@ +; RUN: llc < %s -march=bpf | FileCheck %s + +@foo_printf.fmt = private unnamed_addr constant [9 x i8] c"hello \0A\00", align 1 + +; Function Attrs: nounwind readnone uwtable +define i32 @foo_int(i32 %a, i32 %b) #0 { + %1 = add nsw i32 %b, %a + ret i32 %1 +; CHECK-LABEL: foo_int: +; CHECK: add r2, r1 +} + +; Function Attrs: nounwind readnone uwtable +define signext i8 @foo_char(i8 signext %a, i8 signext %b) #0 { + %1 = add i8 %b, %a + ret i8 %1 +; CHECK-LABEL: foo_char: +; CHECK: add r2, r1 +; CHECK: slli r2, 56 +; CHECK: srai r2, 56 +} + +; Function Attrs: nounwind readnone uwtable +define i64 @foo_ll(i64 %a, i64 %b, i64 %c) #0 { + %1 = add nsw i64 %b, %a + %2 = sub i64 %1, %c + ret i64 %2 +; CHECK-LABEL: foo_ll: +; CHECK: add r2, r1 +; CHECK: sub r2, r3 +; CHECK: mov r0, r2 +} + +; Function Attrs: nounwind uwtable +define void @foo_call2(i32 %a, i32 %b) #1 { + %1 = trunc i32 %b to i8 + tail call void @foo_2arg(i8 signext %1, i32 %a) #3 + ret void +; CHECK-LABEL: foo_call2: +; CHECK: slli r2, 56 +; CHECK: srai r2, 56 +; CHECK: mov r1, r2 +} + +declare void @foo_2arg(i8 signext, i32) #2 + +; Function Attrs: nounwind uwtable +define i32 @foo_call5(i8 signext %a, i16 signext %b, i32 %c, i64 %d) #1 { + %1 = tail call i32 @bar(i8 signext %a, i16 signext %b, i32 %c, i64 %d) #3 + ret i32 0 +; CHECK-LABEL: foo_call5: +; CHECK: call bar +} + +declare i32 @bar(i8 signext, i16 signext, i32, i64) #2 + +; Function Attrs: nounwind readnone uwtable +define signext i8 @foo_cmp(i8 signext %a, i8 signext %b) #0 { + %1 = icmp slt i8 %a, %b + %a.b = select i1 %1, i8 %a, i8 %b + ret i8 %a.b +; CHECK-LABEL: foo_cmp: +; CHECK: jsgt r2, r1 +} + +; Function Attrs: nounwind readnone uwtable +define i32 @foo_muldiv(i8 signext %a, i16 signext %b, i32 %c, i64 %d) #0 { + %1 = icmp eq i8 %a, 0 + br i1 %1, label %5, label %2 + +;