1 //===-- muldi3_test.c - Test __muldi3 -------------------------------------===//
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 __muldi3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
17 di_int
__muldi3(di_int a
, di_int b
);
19 int test__muldi3(di_int a
, di_int b
, di_int expected
)
21 di_int x
= __muldi3(a
, b
);
23 printf("error in __muldi3: %lld * %lld = %lld, expected %lld\n",
24 a
, b
, __muldi3(a
, b
), expected
);
28 char assumption_1
[sizeof(di_int
) == 2*sizeof(si_int
)] = {0};
32 if (test__muldi3(0, 0, 0))
34 if (test__muldi3(0, 1, 0))
36 if (test__muldi3(1, 0, 0))
38 if (test__muldi3(0, 10, 0))
40 if (test__muldi3(10, 0, 0))
42 if (test__muldi3(0, 81985529216486895LL, 0))
44 if (test__muldi3(81985529216486895LL, 0, 0))
47 if (test__muldi3(0, -1, 0))
49 if (test__muldi3(-1, 0, 0))
51 if (test__muldi3(0, -10, 0))
53 if (test__muldi3(-10, 0, 0))
55 if (test__muldi3(0, -81985529216486895LL, 0))
57 if (test__muldi3(-81985529216486895LL, 0, 0))
60 if (test__muldi3(1, 1, 1))
62 if (test__muldi3(1, 10, 10))
64 if (test__muldi3(10, 1, 10))
66 if (test__muldi3(1, 81985529216486895LL, 81985529216486895LL))
68 if (test__muldi3(81985529216486895LL, 1, 81985529216486895LL))
71 if (test__muldi3(1, -1, -1))
73 if (test__muldi3(1, -10, -10))
75 if (test__muldi3(-10, 1, -10))
77 if (test__muldi3(1, -81985529216486895LL, -81985529216486895LL))
79 if (test__muldi3(-81985529216486895LL, 1, -81985529216486895LL))
82 if (test__muldi3(3037000499LL, 3037000499LL, 9223372030926249001LL))
84 if (test__muldi3(-3037000499LL, 3037000499LL, -9223372030926249001LL))
86 if (test__muldi3(3037000499LL, -3037000499LL, -9223372030926249001LL))
88 if (test__muldi3(-3037000499LL, -3037000499LL, 9223372030926249001LL))
91 if (test__muldi3(4398046511103LL, 2097152LL, 9223372036852678656LL))
93 if (test__muldi3(-4398046511103LL, 2097152LL, -9223372036852678656LL))
95 if (test__muldi3(4398046511103LL, -2097152LL, -9223372036852678656LL))
97 if (test__muldi3(-4398046511103LL, -2097152LL, 9223372036852678656LL))
100 if (test__muldi3(2097152LL, 4398046511103LL, 9223372036852678656LL))
102 if (test__muldi3(-2097152LL, 4398046511103LL, -9223372036852678656LL))
104 if (test__muldi3(2097152LL, -4398046511103LL, -9223372036852678656LL))
106 if (test__muldi3(-2097152LL, -4398046511103LL, 9223372036852678656LL))