brintos

brintos / llvm-project-archived public Read only

0
0
Text · 812 B · 3d3e8bb Raw
35 lines · c
1// RUN: %clang_builtins %s %librt -o %t && %run %t2// REQUIRES: librt_has_umoddi33 4#include "int_lib.h"5#include <stdio.h>6 7// Returns: a % b8 9COMPILER_RT_ABI du_int __umoddi3(du_int a, du_int b);10 11int test__umoddi3(du_int a, du_int b, du_int expected_r)12{13    du_int r = __umoddi3(a, b);14    if (r != expected_r)15        printf("error in __umoddi3: %lld %% %lld = %lld, expected %lld\n",16               a, b, r, expected_r);17    return r != expected_r;18}19 20int main()21{22    if (test__umoddi3(0, 1, 0))23        return 1;24    if (test__umoddi3(2, 1, 0))25        return 1;26    if (test__umoddi3(0x8000000000000000uLL, 1, 0x0uLL))27        return 1;28    if (test__umoddi3(0x8000000000000000uLL, 2, 0x0uLL))29        return 1;30    if (test__umoddi3(0xFFFFFFFFFFFFFFFFuLL, 2, 0x1uLL))31        return 1;32 33    return 0;34}35