tsan: fix strerror interceptor (eliminate false positives)
[blocksruntime.git] / lib / addvsi3.c
blob81f515cd7bb17c8e85a57967f22fca60fa81c06f
1 /* ===-- addvsi3.c - Implement __addvsi3 -----------------------------------===
3 * The LLVM Compiler Infrastructure
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
8 * ===----------------------------------------------------------------------===
10 * This file implements __addvsi3 for the compiler_rt library.
12 * ===----------------------------------------------------------------------===
15 #include "int_lib.h"
17 /* Returns: a + b */
19 /* Effects: aborts if a + b overflows */
21 COMPILER_RT_ABI si_int
22 __addvsi3(si_int a, si_int b)
24 si_int s = a + b;
25 if (b >= 0)
27 if (s < a)
28 compilerrt_abort();
30 else
32 if (s >= a)
33 compilerrt_abort();
35 return s;