1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_negvsi2
3 //===-- negvsi2_test.c - Test __negvsi2 -----------------------------------===//
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 __negvsi2 for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
20 // Effects: aborts if -a overflows
22 COMPILER_RT_ABI si_int
__negvsi2(si_int a
);
24 int test__negvsi2(si_int a
)
26 si_int x
= __negvsi2(a
);
29 printf("error in __negvsi2(0x%X) = %d, expected %d\n", a
, x
, expected
);
35 // if (test__negvsi2(0x80000000)) // should abort
37 if (test__negvsi2(0x00000000))
39 if (test__negvsi2(0x00000001))
41 if (test__negvsi2(0x00000002))
43 if (test__negvsi2(0x7FFFFFFE))
45 if (test__negvsi2(0x7FFFFFFF))
47 if (test__negvsi2(0x80000001))
49 if (test__negvsi2(0x80000002))
51 if (test__negvsi2(0xFFFFFFFE))
53 if (test__negvsi2(0xFFFFFFFF))