custom message type for VM_INFO
[minix3.git] / sys / external / bsd / compiler_rt / dist / test / Unit / subvsi3_test.c
blob14e6ce19390408fae9fa1e86af1980d71f8d3ff9
1 //===-- subvsi3_test.c - Test __subvsi3 -----------------------------------===//
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 __subvsi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
14 #include "int_lib.h"
15 #include <stdio.h>
16 #include <stdlib.h>
18 // Returns: a - b
20 // Effects: aborts if a - b overflows
22 si_int __subvsi3(si_int a, si_int b);
24 int test__subvsi3(si_int a, si_int b)
26 si_int x = __subvsi3(a, b);
27 si_int expected = a - b;
28 if (x != expected)
29 printf("error in test__subvsi3(0x%X, 0x%X) = %d, expected %d\n",
30 a, b, x, expected);
31 return x != expected;
34 int main()
36 // test__subvsi3(0x80000000, 1); // should abort
37 // test__subvsi3(0, 0x80000000); // should abort
38 // test__subvsi3(1, 0x80000000); // should abort
39 // test__subvsi3(0x7FFFFFFF, -1); // should abort
40 // test__subvsi3(-2, 0x7FFFFFFF); // should abort
42 if (test__subvsi3(0x80000000, -1))
43 return 1;
44 if (test__subvsi3(0x80000000, 0))
45 return 1;
46 if (test__subvsi3(-1, 0x80000000))
47 return 1;
48 if (test__subvsi3(0x7FFFFFFF, 1))
49 return 1;
50 if (test__subvsi3(0x7FFFFFFF, 0))
51 return 1;
52 if (test__subvsi3(1, 0x7FFFFFFF))
53 return 1;
54 if (test__subvsi3(0, 0x7FFFFFFF))
55 return 1;
56 if (test__subvsi3(-1, 0x7FFFFFFF))
57 return 1;
59 return 0;