1/*===-- negvti2.c - Implement __negvti2 -----------------------------------===
2 *
3 *                     The LLVM Compiler Infrastructure
4 *
5 * This file is distributed under the University of Illinois Open Source
6 * License. See LICENSE.TXT for details.
7 *
8 *===----------------------------------------------------------------------===
9 *
10 *This file implements __negvti2 for the compiler_rt library.
11 *
12 *===----------------------------------------------------------------------===
13 */
14
15#if __x86_64
16
17#include "int_lib.h"
18#include <stdlib.h>
19
20/* Returns: -a */
21
22/* Effects: aborts if -a overflows */
23
24ti_int
25__negvti2(ti_int a)
26{
27    const ti_int MIN = (ti_int)1 << ((int)(sizeof(ti_int) * CHAR_BIT)-1);
28    if (a == MIN)
29        abort();
30    return -a;
31}
32
33#endif
34