diff options
author | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
commit | 1176aa52646fe641a4243a246aa7f960c708a274 (patch) | |
tree | c8086addb211fa670a9d2b1038d8c2e453229755 /test/CodeGen/CBackend/2011-06-08-addWithOverflow.ll | |
parent | ece02cd5829cea836e9365b0845a8ef042d17b0a (diff) | |
download | FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.zip FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.tar.gz |
Vendor import of llvm trunk r135360:
http://llvm.org/svn/llvm-project/llvm/trunk@135360
Diffstat (limited to 'test/CodeGen/CBackend/2011-06-08-addWithOverflow.ll')
-rw-r--r-- | test/CodeGen/CBackend/2011-06-08-addWithOverflow.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/CodeGen/CBackend/2011-06-08-addWithOverflow.ll b/test/CodeGen/CBackend/2011-06-08-addWithOverflow.ll new file mode 100644 index 0000000..0ae480d --- /dev/null +++ b/test/CodeGen/CBackend/2011-06-08-addWithOverflow.ll @@ -0,0 +1,35 @@ +; RUN: llc < %s -march=c +; Check that uadd and sadd with overflow are handled by C Backend. + +%0 = type { i32, i1 } ; type %0 + +define i1 @func1(i32 zeroext %v1, i32 zeroext %v2) nounwind { +entry: + %t = call %0 @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) ; <%0> [#uses=1] + %obit = extractvalue %0 %t, 1 ; <i1> [#uses=1] + br i1 %obit, label %carry, label %normal + +normal: ; preds = %entry + ret i1 true + +carry: ; preds = %entry + ret i1 false +} + +define i1 @func2(i32 signext %v1, i32 signext %v2) nounwind { +entry: + %t = call %0 @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2) ; <%0> [#uses=1] + %obit = extractvalue %0 %t, 1 ; <i1> [#uses=1] + br i1 %obit, label %carry, label %normal + +normal: ; preds = %entry + ret i1 true + +carry: ; preds = %entry + ret i1 false +} + +declare %0 @llvm.sadd.with.overflow.i32(i32, i32) nounwind + +declare %0 @llvm.uadd.with.overflow.i32(i32, i32) nounwind + |