1 //===-- addvsi3_test.c - Test __addvsi3 -----------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file tests __addvsi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
19 // Effects: aborts if a + b overflows
21 si_int
__addvsi3(si_int a
, si_int b
);
23 int test__addvsi3(si_int a
, si_int b
)
25 si_int x
= __addvsi3(a
, b
);
26 si_int expected
= a
+ b
;
28 printf("error in test__addvsi3(0x%X, 0x%X) = %d, expected %d\n",
35 // test__addvsi3(0x80000000, -1); // should abort
36 // test__addvsi3(-1, 0x80000000); // should abort
37 // test__addvsi3(1, 0x7FFFFFFF); // should abort
38 // test__addvsi3(0x7FFFFFFF, 1); // should abort
40 if (test__addvsi3(0x80000000, 1))
42 if (test__addvsi3(1, 0x80000000))
44 if (test__addvsi3(0x80000000, 0))
46 if (test__addvsi3(0, 0x80000000))
48 if (test__addvsi3(0x7FFFFFFF, -1))
50 if (test__addvsi3(-1, 0x7FFFFFFF))
52 if (test__addvsi3(0x7FFFFFFF, 0))
54 if (test__addvsi3(0, 0x7FFFFFFF))