aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-11-21 00:05:31 +0000
committerBill Wendling <isanbard@gmail.com>2008-11-21 00:05:31 +0000
commite6ed6ecfb0096e1e6d10ef5e3de71ba29b7bbdbf (patch)
tree258f519a001ce13139c35c45c44071ae939137d7
parent370387c736ad6da71398f851c63f9f0d81b36209 (diff)
Introduce two new "add" intrinsics. These return the sum plus a bit indicating
that an overflow/carry occured. These are converted into ISD::[SU]ADDO nodes, which are lowered in a target-independent way into something sane. Eventually, each target can implement their own method of checking the overflow/carry flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59756 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Intrinsics.td9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
index 9a713cedde..194ab5bee2 100644
--- a/include/llvm/Intrinsics.td
+++ b/include/llvm/Intrinsics.td
@@ -314,6 +314,15 @@ def int_init_trampoline : Intrinsic<[llvm_ptr_ty],
[]>,
GCCBuiltin<"__builtin_init_trampoline">;
+//===------------------------ Overflow Intrinsics -------------------------===//
+//
+
+// Expose the carry flag from add operations on two integrals.
+def int_sadd_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
+ [LLVMMatchType<0>, LLVMMatchType<0>]>;
+def int_uadd_with_overflow : Intrinsic<[llvm_anyint_ty, llvm_i1_ty],
+ [LLVMMatchType<0>, LLVMMatchType<0>]>;
+
//===------------------------- Atomic Intrinsics --------------------------===//
//
def int_memory_barrier : Intrinsic<[llvm_void_ty],