[AMDGPU] Add commute for some VOP3 inst (#121326)
[llvm-project.git] / compiler-rt / test / builtins / Unit / arm / aeabi_uidivmod_test.c
blobde5a43d5b8143cda210a4d927f9b3fc167834373
1 // REQUIRES: arm-target-arch || armv6m-target-arch
2 // RUN: %clang_builtins %s %librt -o %t && %run %t
4 #include "int_lib.h"
5 #include <stdio.h>
7 #if __arm__
8 // Based on udivmodsi4_test.c
10 extern du_int __aeabi_uidivmod(su_int a, su_int b);
12 int test__aeabi_uidivmod(su_int a, su_int b,
13 su_int expected_result, su_int expected_rem)
15 du_int ret = __aeabi_uidivmod(a, b);
16 su_int rem = ret >> 32;
17 si_int result = ret & 0xFFFFFFFF;
19 if (result != expected_result) {
20 printf("error in __aeabi_uidivmod: %u / %u = %u, expected %u\n",
21 a, b, result, expected_result);
22 return 1;
24 if (rem != expected_rem) {
25 printf("error in __aeabi_uidivmod: %u mod %u = %u, expected %u\n",
26 a, b, rem, expected_rem);
27 return 1;
30 return 0;
32 #endif
35 int main()
37 #if __arm__
38 if (test__aeabi_uidivmod(0, 1, 0, 0))
39 return 1;
41 if (test__aeabi_uidivmod(2, 1, 2, 0))
42 return 1;
44 if (test__aeabi_uidivmod(19, 5, 3, 4))
45 return 1;
47 if (test__aeabi_uidivmod(0x80000000, 8, 0x10000000, 0))
48 return 1;
50 if (test__aeabi_uidivmod(0x80000003, 8, 0x10000000, 3))
51 return 1;
52 #else
53 printf("skipped\n");
54 #endif
56 return 0;