Remove building with NOCRYPTO option
[minix3.git] / sys / external / bsd / compiler_rt / dist / test / Unit / negvsi2_test.c
blob5ea0e2e86c2aa46a97d7cba6e0be7dd41b0b1e06
1 //===-- negvsi2_test.c - Test __negvsi2 -----------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file tests __negvsi2 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
14 #include "int_lib.h"
15 #include <stdio.h>
17 // Returns: -a
19 // Effects: aborts if -a overflows
21 si_int __negvsi2(si_int a);
23 int test__negvsi2(si_int a)
25 si_int x = __negvsi2(a);
26 si_int expected = -a;
27 if (x != expected)
28 printf("error in __negvsi2(0x%X) = %d, expected %d\n", a, x, expected);
29 return x != expected;
32 int main()
34 // if (test__negvsi2(0x80000000)) // should abort
35 // return 1;
36 if (test__negvsi2(0x00000000))
37 return 1;
38 if (test__negvsi2(0x00000001))
39 return 1;
40 if (test__negvsi2(0x00000002))
41 return 1;
42 if (test__negvsi2(0x7FFFFFFE))
43 return 1;
44 if (test__negvsi2(0x7FFFFFFF))
45 return 1;
46 if (test__negvsi2(0x80000001))
47 return 1;
48 if (test__negvsi2(0x80000002))
49 return 1;
50 if (test__negvsi2(0xFFFFFFFE))
51 return 1;
52 if (test__negvsi2(0xFFFFFFFF))
53 return 1;
55 return 0;