1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_umodti3
4 //===-- umodti3_test.c - Test __umodti3 -----------------------------------===//
6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7 // See https://llvm.org/LICENSE.txt for license information.
8 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10 //===----------------------------------------------------------------------===//
12 // This file tests __umodti3 for the compiler_rt library.
14 //===----------------------------------------------------------------------===//
23 COMPILER_RT_ABI tu_int
__umodti3(tu_int a
, tu_int b
);
25 int test__umodti3(tu_int a
, tu_int b
, tu_int expected_r
)
27 tu_int r
= __umodti3(a
, b
);
37 expected_rt
.all
= expected_r
;
38 printf("error in __umodti3: 0x%llX%.16llX %% 0x%llX%.16llX = "
39 "0x%llX%.16llX, expected 0x%llX%.16llX\n",
40 at
.s
.high
, at
.s
.low
, bt
.s
.high
, bt
.s
.low
, rt
.s
.high
, rt
.s
.low
,
41 expected_rt
.s
.high
, expected_rt
.s
.low
);
43 return r
!= expected_r
;
51 if (test__umodti3(0, 1, 0))
53 if (test__umodti3(2, 1, 0))
55 if (test__umodti3(make_tu(0x8000000000000000uLL
, 0), 1, 0x0uLL
))
57 if (test__umodti3(make_tu(0x8000000000000000uLL
, 0), 2, 0x0uLL
))
59 if (test__umodti3(make_tu(0xFFFFFFFFFFFFFFFFuLL
, 0xFFFFFFFFFFFFFFFFuLL
),