Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/addvti3.c
35260 views
//===-- addvti3.c - Implement __addvti3 -----------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file implements __addvti3 for the compiler_rt library.9//10//===----------------------------------------------------------------------===//1112#include "int_lib.h"1314#ifdef CRT_HAS_128BIT1516// Returns: a + b1718// Effects: aborts if a + b overflows1920COMPILER_RT_ABI ti_int __addvti3(ti_int a, ti_int b) {21ti_int s = (tu_int)a + (tu_int)b;22if (b >= 0) {23if (s < a)24compilerrt_abort();25} else {26if (s >= a)27compilerrt_abort();28}29return s;30}3132#endif // CRT_HAS_128BIT333435