Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/addvdi3.c
35260 views
//===-- addvdi3.c - Implement __addvdi3 -----------------------------------===//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 __addvdi3 for the compiler_rt library.9//10//===----------------------------------------------------------------------===//1112#include "int_lib.h"1314// Returns: a + b1516// Effects: aborts if a + b overflows1718COMPILER_RT_ABI di_int __addvdi3(di_int a, di_int b) {19di_int s = (du_int)a + (du_int)b;20if (b >= 0) {21if (s < a)22compilerrt_abort();23} else {24if (s >= a)25compilerrt_abort();26}27return s;28}293031