From 6b2c98ba795a1edf81647482ae9f2560397f56bb Mon Sep 17 00:00:00 2001 From: Mateusz Naƛciszewski Date: Sat, 14 Sep 2019 16:53:39 +0200 Subject: Move intrinsics tests to the proper directory --- test/Feature/IntrinsicTrap.ll | 31 ---------------- test/Feature/Overflow.ll | 44 ----------------------- test/Feature/OverflowMul.ll | 44 ----------------------- test/Feature/Saturating.ll | 77 ---------------------------------------- test/Intrinsics/IntrinsicTrap.ll | 31 ++++++++++++++++ test/Intrinsics/Overflow.ll | 44 +++++++++++++++++++++++ test/Intrinsics/OverflowMul.ll | 44 +++++++++++++++++++++++ test/Intrinsics/Saturating.ll | 77 ++++++++++++++++++++++++++++++++++++++++ 8 files changed, 196 insertions(+), 196 deletions(-) delete mode 100644 test/Feature/IntrinsicTrap.ll delete mode 100644 test/Feature/Overflow.ll delete mode 100644 test/Feature/OverflowMul.ll delete mode 100644 test/Feature/Saturating.ll create mode 100644 test/Intrinsics/IntrinsicTrap.ll create mode 100644 test/Intrinsics/Overflow.ll create mode 100644 test/Intrinsics/OverflowMul.ll create mode 100644 test/Intrinsics/Saturating.ll (limited to 'test') diff --git a/test/Feature/IntrinsicTrap.ll b/test/Feature/IntrinsicTrap.ll deleted file mode 100644 index c88a328a..00000000 --- a/test/Feature/IntrinsicTrap.ll +++ /dev/null @@ -1,31 +0,0 @@ -; RUN: llvm-as %s -f -o %t1.bc -; RUN: rm -rf %t.klee-out -; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc -; RUN: FileCheck %s --input-file=%t.klee-out/assembly.ll - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @main() nounwind { -entry: - %a = add i32 1, 2 - %b = add i32 %a, 3 - %c = icmp ne i32 %b, 6 - br i1 %c, label %btrue, label %bfalse - -btrue: - ; CHECK-NOT: call void @llvm.trap() - ; CHECK: call void @abort() - call void @llvm.trap() noreturn nounwind - unreachable - -bfalse: - br label %return - -return: - ret i32 0 -} - -; CHECK-NOT: call void @llvm.trap() -; CHECK: declare void @abort() -declare void @llvm.trap() noreturn nounwind diff --git a/test/Feature/Overflow.ll b/test/Feature/Overflow.ll deleted file mode 100644 index 31311029..00000000 --- a/test/Feature/Overflow.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: llvm-as %s -f -o %t1.bc -; RUN: rm -rf %t.klee-out -; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc > %t2 -; RUN: grep PASS %t2 - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -target triple = "x86_64-unknown-linux-gnu" - -declare {i8, i1} @llvm.uadd.with.overflow.i8(i8 %a, i8 %b) - -declare i32 @puts(i8*) - -@.passstr = private constant [5 x i8] c"PASS\00", align 1 -@.failstr = private constant [5 x i8] c"FAIL\00", align 1 - -define i32 @main() { -bb0: - %s0 = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 0, i8 -1) - %v0 = extractvalue {i8, i1} %s0, 0 - %c0 = icmp eq i8 %v0, -1 - br i1 %c0, label %bb0_1, label %bbfalse - -bb0_1: - %o0 = extractvalue {i8, i1} %s0, 1 - br i1 %o0, label %bbfalse, label %bb1 - -bb1: - %s1 = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 1, i8 -1) - %v1 = extractvalue {i8, i1} %s1, 0 - %c1 = icmp eq i8 %v1, 0 - br i1 %c1, label %bb1_1, label %bbfalse - -bb1_1: - %o1 = extractvalue {i8, i1} %s1, 1 - br i1 %o1, label %bbtrue, label %bbfalse - -bbtrue: - %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind - ret i32 0 - -bbfalse: - %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind - ret i32 0 -} diff --git a/test/Feature/OverflowMul.ll b/test/Feature/OverflowMul.ll deleted file mode 100644 index 9343fdd8..00000000 --- a/test/Feature/OverflowMul.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: llvm-as %s -f -o %t1.bc -; RUN: rm -rf %t.klee-out -; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc > %t2 -; RUN: grep PASS %t2 - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -target triple = "x86_64-unknown-linux-gnu" - -declare {i8, i1} @llvm.umul.with.overflow.i8(i8 %a, i8 %b) - -declare i32 @puts(i8*) - -@.passstr = private constant [5 x i8] c"PASS\00", align 1 -@.failstr = private constant [5 x i8] c"FAIL\00", align 1 - -define i32 @main() { -bb0: - %s0 = call {i8, i1} @llvm.umul.with.overflow.i8(i8 1, i8 128) - %v0 = extractvalue {i8, i1} %s0, 0 - %c0 = icmp eq i8 %v0, 128 - br i1 %c0, label %bb0_1, label %bbfalse - -bb0_1: - %o0 = extractvalue {i8, i1} %s0, 1 - br i1 %o0, label %bbfalse, label %bb1 - -bb1: - %s1 = call {i8, i1} @llvm.umul.with.overflow.i8(i8 2, i8 128) - %v1 = extractvalue {i8, i1} %s1, 0 - %c1 = icmp eq i8 %v1, 0 - br i1 %c1, label %bb1_1, label %bbfalse - -bb1_1: - %o1 = extractvalue {i8, i1} %s1, 1 - br i1 %o1, label %bbtrue, label %bbfalse - -bbtrue: - %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind - ret i32 0 - -bbfalse: - %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind - ret i32 0 -} diff --git a/test/Feature/Saturating.ll b/test/Feature/Saturating.ll deleted file mode 100644 index cce8b6cb..00000000 --- a/test/Feature/Saturating.ll +++ /dev/null @@ -1,77 +0,0 @@ -; REQUIRES: geq-llvm-8.0 -; RUN: llvm-as %s -f -o %t1.bc -; RUN: rm -rf %t.klee-out -; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc | FileCheck %s - -declare i8 @llvm.uadd.sat.i8(i8 %a, i8 %b) -declare i8 @llvm.usub.sat.i8(i8 %a, i8 %b) -declare i8 @llvm.sadd.sat.i8(i8 %a, i8 %b) -declare i8 @llvm.ssub.sat.i8(i8 %a, i8 %b) -declare <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> %b) -declare i4 @llvm.sadd.sat.i4(i4 %a, i4 %b) -declare i4 @llvm.ssub.sat.i4(i4 %a, i4 %b) - -declare i32 @puts(i8*) - -@.passstr = private constant [5 x i8] c"PASS\00", align 1 -@.failstr = private constant [5 x i8] c"FAIL\00", align 1 - -define i32 @main() { -bb0: - %v0 = call i8 @llvm.uadd.sat.i8(i8 1, i8 253) - %c0 = icmp eq i8 %v0, 254 - br i1 %c0, label %bb1, label %bbfalse -bb1: - %v1 = call i8 @llvm.uadd.sat.i8(i8 1, i8 255) - %c1 = icmp eq i8 %v1, 255 - br i1 %c1, label %bb2, label %bbfalse -bb2: - %v2 = call i8 @llvm.usub.sat.i8(i8 5, i8 3) - %c2 = icmp eq i8 %v2, 2 - br i1 %c2, label %bb3, label %bbfalse -bb3: - %v3 = call i8 @llvm.usub.sat.i8(i8 3, i8 5) - %c3 = icmp eq i8 %v3, 0 - br i1 %c3, label %bb4, label %bbfalse -bb4: - %v4 = call i8 @llvm.sadd.sat.i8(i8 120, i8 3) - %c4 = icmp eq i8 %v4, 123 - br i1 %c4, label %bb5, label %bbfalse -bb5: - %v5 = call i8 @llvm.sadd.sat.i8(i8 120, i8 10) - %c5 = icmp eq i8 %v5, 127 - br i1 %c5, label %bb6, label %bbfalse -bb6: - %v6 = call i8 @llvm.ssub.sat.i8(i8 20, i8 70) - %c6 = icmp eq i8 %v6, -50 - br i1 %c6, label %bb7, label %bbfalse -bb7: - %v7 = call i8 @llvm.ssub.sat.i8(i8 -10, i8 120) - %c7 = icmp eq i8 %v7, -128 - br i1 %c7, label %bb8, label %bbfalse -bb8: - %v8 = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> , <2 x i8> ) - %v8_0 = extractelement <2 x i8> %v8, i32 0 - %v8_1 = extractelement <2 x i8> %v8, i32 1 - %c8_0 = icmp eq i8 %v8_0, -128 - %c8_1 = icmp eq i8 %v8_1, -70 - %c8 = and i1 %c8_0, %c8_1 - br i1 %c8, label %bb9, label %bbfalse -bb9: - %v9 = call i4 @llvm.sadd.sat.i4(i4 -4, i4 -5) - %c9 = icmp eq i4 %v9, -8 - br i1 %c9, label %bb10, label %bbfalse -bb10: - %v10 = call i4 @llvm.ssub.sat.i4(i4 4, i4 -5) - %c10 = icmp eq i4 %v10, 7 - br i1 %c10, label %bbtrue, label %bbfalse - -bbtrue: -; CHECK: PASS - %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind - ret i32 0 - -bbfalse: - %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind - ret i32 0 -} diff --git a/test/Intrinsics/IntrinsicTrap.ll b/test/Intrinsics/IntrinsicTrap.ll new file mode 100644 index 00000000..c88a328a --- /dev/null +++ b/test/Intrinsics/IntrinsicTrap.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as %s -f -o %t1.bc +; RUN: rm -rf %t.klee-out +; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc +; RUN: FileCheck %s --input-file=%t.klee-out/assembly.ll + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + +define i32 @main() nounwind { +entry: + %a = add i32 1, 2 + %b = add i32 %a, 3 + %c = icmp ne i32 %b, 6 + br i1 %c, label %btrue, label %bfalse + +btrue: + ; CHECK-NOT: call void @llvm.trap() + ; CHECK: call void @abort() + call void @llvm.trap() noreturn nounwind + unreachable + +bfalse: + br label %return + +return: + ret i32 0 +} + +; CHECK-NOT: call void @llvm.trap() +; CHECK: declare void @abort() +declare void @llvm.trap() noreturn nounwind diff --git a/test/Intrinsics/Overflow.ll b/test/Intrinsics/Overflow.ll new file mode 100644 index 00000000..31311029 --- /dev/null +++ b/test/Intrinsics/Overflow.ll @@ -0,0 +1,44 @@ +; RUN: llvm-as %s -f -o %t1.bc +; RUN: rm -rf %t.klee-out +; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc > %t2 +; RUN: grep PASS %t2 + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + +declare {i8, i1} @llvm.uadd.with.overflow.i8(i8 %a, i8 %b) + +declare i32 @puts(i8*) + +@.passstr = private constant [5 x i8] c"PASS\00", align 1 +@.failstr = private constant [5 x i8] c"FAIL\00", align 1 + +define i32 @main() { +bb0: + %s0 = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 0, i8 -1) + %v0 = extractvalue {i8, i1} %s0, 0 + %c0 = icmp eq i8 %v0, -1 + br i1 %c0, label %bb0_1, label %bbfalse + +bb0_1: + %o0 = extractvalue {i8, i1} %s0, 1 + br i1 %o0, label %bbfalse, label %bb1 + +bb1: + %s1 = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 1, i8 -1) + %v1 = extractvalue {i8, i1} %s1, 0 + %c1 = icmp eq i8 %v1, 0 + br i1 %c1, label %bb1_1, label %bbfalse + +bb1_1: + %o1 = extractvalue {i8, i1} %s1, 1 + br i1 %o1, label %bbtrue, label %bbfalse + +bbtrue: + %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind + ret i32 0 + +bbfalse: + %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind + ret i32 0 +} diff --git a/test/Intrinsics/OverflowMul.ll b/test/Intrinsics/OverflowMul.ll new file mode 100644 index 00000000..9343fdd8 --- /dev/null +++ b/test/Intrinsics/OverflowMul.ll @@ -0,0 +1,44 @@ +; RUN: llvm-as %s -f -o %t1.bc +; RUN: rm -rf %t.klee-out +; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc > %t2 +; RUN: grep PASS %t2 + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + +declare {i8, i1} @llvm.umul.with.overflow.i8(i8 %a, i8 %b) + +declare i32 @puts(i8*) + +@.passstr = private constant [5 x i8] c"PASS\00", align 1 +@.failstr = private constant [5 x i8] c"FAIL\00", align 1 + +define i32 @main() { +bb0: + %s0 = call {i8, i1} @llvm.umul.with.overflow.i8(i8 1, i8 128) + %v0 = extractvalue {i8, i1} %s0, 0 + %c0 = icmp eq i8 %v0, 128 + br i1 %c0, label %bb0_1, label %bbfalse + +bb0_1: + %o0 = extractvalue {i8, i1} %s0, 1 + br i1 %o0, label %bbfalse, label %bb1 + +bb1: + %s1 = call {i8, i1} @llvm.umul.with.overflow.i8(i8 2, i8 128) + %v1 = extractvalue {i8, i1} %s1, 0 + %c1 = icmp eq i8 %v1, 0 + br i1 %c1, label %bb1_1, label %bbfalse + +bb1_1: + %o1 = extractvalue {i8, i1} %s1, 1 + br i1 %o1, label %bbtrue, label %bbfalse + +bbtrue: + %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind + ret i32 0 + +bbfalse: + %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind + ret i32 0 +} diff --git a/test/Intrinsics/Saturating.ll b/test/Intrinsics/Saturating.ll new file mode 100644 index 00000000..cce8b6cb --- /dev/null +++ b/test/Intrinsics/Saturating.ll @@ -0,0 +1,77 @@ +; REQUIRES: geq-llvm-8.0 +; RUN: llvm-as %s -f -o %t1.bc +; RUN: rm -rf %t.klee-out +; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc | FileCheck %s + +declare i8 @llvm.uadd.sat.i8(i8 %a, i8 %b) +declare i8 @llvm.usub.sat.i8(i8 %a, i8 %b) +declare i8 @llvm.sadd.sat.i8(i8 %a, i8 %b) +declare i8 @llvm.ssub.sat.i8(i8 %a, i8 %b) +declare <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> %b) +declare i4 @llvm.sadd.sat.i4(i4 %a, i4 %b) +declare i4 @llvm.ssub.sat.i4(i4 %a, i4 %b) + +declare i32 @puts(i8*) + +@.passstr = private constant [5 x i8] c"PASS\00", align 1 +@.failstr = private constant [5 x i8] c"FAIL\00", align 1 + +define i32 @main() { +bb0: + %v0 = call i8 @llvm.uadd.sat.i8(i8 1, i8 253) + %c0 = icmp eq i8 %v0, 254 + br i1 %c0, label %bb1, label %bbfalse +bb1: + %v1 = call i8 @llvm.uadd.sat.i8(i8 1, i8 255) + %c1 = icmp eq i8 %v1, 255 + br i1 %c1, label %bb2, label %bbfalse +bb2: + %v2 = call i8 @llvm.usub.sat.i8(i8 5, i8 3) + %c2 = icmp eq i8 %v2, 2 + br i1 %c2, label %bb3, label %bbfalse +bb3: + %v3 = call i8 @llvm.usub.sat.i8(i8 3, i8 5) + %c3 = icmp eq i8 %v3, 0 + br i1 %c3, label %bb4, label %bbfalse +bb4: + %v4 = call i8 @llvm.sadd.sat.i8(i8 120, i8 3) + %c4 = icmp eq i8 %v4, 123 + br i1 %c4, label %bb5, label %bbfalse +bb5: + %v5 = call i8 @llvm.sadd.sat.i8(i8 120, i8 10) + %c5 = icmp eq i8 %v5, 127 + br i1 %c5, label %bb6, label %bbfalse +bb6: + %v6 = call i8 @llvm.ssub.sat.i8(i8 20, i8 70) + %c6 = icmp eq i8 %v6, -50 + br i1 %c6, label %bb7, label %bbfalse +bb7: + %v7 = call i8 @llvm.ssub.sat.i8(i8 -10, i8 120) + %c7 = icmp eq i8 %v7, -128 + br i1 %c7, label %bb8, label %bbfalse +bb8: + %v8 = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> , <2 x i8> ) + %v8_0 = extractelement <2 x i8> %v8, i32 0 + %v8_1 = extractelement <2 x i8> %v8, i32 1 + %c8_0 = icmp eq i8 %v8_0, -128 + %c8_1 = icmp eq i8 %v8_1, -70 + %c8 = and i1 %c8_0, %c8_1 + br i1 %c8, label %bb9, label %bbfalse +bb9: + %v9 = call i4 @llvm.sadd.sat.i4(i4 -4, i4 -5) + %c9 = icmp eq i4 %v9, -8 + br i1 %c9, label %bb10, label %bbfalse +bb10: + %v10 = call i4 @llvm.ssub.sat.i4(i4 4, i4 -5) + %c10 = icmp eq i4 %v10, 7 + br i1 %c10, label %bbtrue, label %bbfalse + +bbtrue: +; CHECK: PASS + %0 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.passstr, i64 0, i64 0)) nounwind + ret i32 0 + +bbfalse: + %1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.failstr, i64 0, i64 0)) nounwind + ret i32 0 +} -- cgit 1.4.1