1 | // UNSUPPORTED: armv6m-target-arch |
---|---|
2 | // RUN: %clang_builtins %s %librt -o %t && %run %t |
3 | // REQUIRES: librt_has_bswapdi2 |
4 | |
5 | #include <math.h> |
6 | #include <stdint.h> |
7 | #include <stdio.h> |
8 | #include <stdlib.h> |
9 | |
10 | extern uint64_t __bswapdi2(uint64_t); |
11 | |
12 | int test__bswapdi2(uint64_t a, uint64_t expected) { |
13 | uint64_t actual = __bswapdi2(a); |
14 | if (actual != expected) |
15 | printf(format: "error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\n", a, |
16 | actual, expected); |
17 | return actual != expected; |
18 | } |
19 | |
20 | int main() { |
21 | if (test__bswapdi2(a: 0x123456789ABCDEF0LL, expected: 0xF0DEBC9A78563412LL)) |
22 | return 1; |
23 | if (test__bswapdi2(a: 0x0000000100000002LL, expected: 0x0200000001000000LL)) |
24 | return 1; |
25 | return 0; |
26 | } |
27 |