1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_negvdi2
3 //===-- negvdi2_test.c - Test __negvdi2 -----------------------------------===//
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //===----------------------------------------------------------------------===//
11 // This file tests __negvdi2 for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
20 // Effects: aborts if -a overflows
22 COMPILER_RT_ABI di_int
__negvdi2(di_int a
);
24 int test__negvdi2(di_int a
)
26 di_int x
= __negvdi2(a
);
29 printf("error in __negvdi2(0x%llX) = %lld, expected %lld\n",
36 // if (test__negvdi2(0x8000000000000000LL)) // should abort
38 if (test__negvdi2(0x0000000000000000LL
))
40 if (test__negvdi2(0x0000000000000001LL
))
42 if (test__negvdi2(0x0000000000000002LL
))
44 if (test__negvdi2(0x7FFFFFFFFFFFFFFELL
))
46 if (test__negvdi2(0x7FFFFFFFFFFFFFFFLL
))
48 if (test__negvdi2(0x8000000000000001LL
))
50 if (test__negvdi2(0x8000000000000002LL
))
52 if (test__negvdi2(0xFFFFFFFFFFFFFFFELL
))
54 if (test__negvdi2(0xFFFFFFFFFFFFFFFFLL
))