blob: 4488a888e1eb02723115f9d99a5f30ea7c5861ca [file] [log] [blame]
Nick Kledzike80e9782009-09-12 01:23:48 +00001//===-- bswapsi2_test.c - Test __bswapsi2 ---------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnant9ad441f2010-11-16 22:13:33 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Nick Kledzike80e9782009-09-12 01:23:48 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file tests __bswapsi2 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
20extern uint32_t __bswapsi2(uint32_t);
21
22#if __arm__
23int test__bswapsi2(uint32_t a, uint32_t expected)
24{
25 uint32_t actual = __bswapsi2(a);
26 if (actual != expected)
27 printf("error in test__bswapsi2(0x%0X) = 0x%0X, expected 0x%0X\n",
28 a, actual, expected);
29 return actual != expected;
30}
31#endif
32
33int main()
34{
35#if __arm__
36 if (test__bswapsi2(0x12345678, 0x78563412))
37 return 1;
38 if (test__bswapsi2(0x00000001, 0x01000000))
39 return 1;
Joerg Sonnenberger74828152011-05-29 21:43:29 +000040#else
41 printf("skipped\n");
Nick Kledzike80e9782009-09-12 01:23:48 +000042#endif
43 return 0;
44}