Nick Kledzik | e80e978 | 2009-09-12 01:23:48 +0000 | [diff] [blame] | 1 | //===-- bswapdi2_test.c - Test __bswapdi2 ---------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | 9ad441f | 2010-11-16 22:13:33 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Nick Kledzik | e80e978 | 2009-09-12 01:23:48 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file tests __bswapdi2 for the compiler_rt library. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include <stdlib.h> |
| 15 | #include <stdint.h> |
| 16 | #include <stdio.h> |
| 17 | #include <math.h> |
| 18 | |
| 19 | |
| 20 | extern uint64_t __bswapdi2(uint64_t); |
| 21 | |
| 22 | #if __arm__ |
| 23 | int test__bswapdi2(uint64_t a, uint64_t expected) |
| 24 | { |
| 25 | uint64_t actual = __bswapdi2(a); |
| 26 | if (actual != expected) |
| 27 | printf("error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\n", |
| 28 | a, actual, expected); |
| 29 | return actual != expected; |
| 30 | } |
| 31 | #endif |
| 32 | |
| 33 | int main() |
| 34 | { |
| 35 | #if __arm__ |
| 36 | if (test__bswapdi2(0x123456789ABCDEF0LL, 0xF0DEBC9A78563412LL)) |
| 37 | return 1; |
| 38 | if (test__bswapdi2(0x0000000100000002LL, 0x0200000001000000LL)) |
| 39 | return 1; |
Joerg Sonnenberger | 7482815 | 2011-05-29 21:43:29 +0000 | [diff] [blame] | 40 | #else |
| 41 | printf("skipped\n"); |
Nick Kledzik | e80e978 | 2009-09-12 01:23:48 +0000 | [diff] [blame] | 42 | #endif |
| 43 | return 0; |
| 44 | } |