1*7c3d14c8STreehugger Robot //===-- bswapsi2_test.c - Test __bswapsi2 ---------------------------------===// 2*7c3d14c8STreehugger Robot // 3*7c3d14c8STreehugger Robot // The LLVM Compiler Infrastructure 4*7c3d14c8STreehugger Robot // 5*7c3d14c8STreehugger Robot // This file is dual licensed under the MIT and the University of Illinois Open 6*7c3d14c8STreehugger Robot // Source Licenses. See LICENSE.TXT for details. 7*7c3d14c8STreehugger Robot // 8*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===// 9*7c3d14c8STreehugger Robot // 10*7c3d14c8STreehugger Robot // This file tests __bswapsi2 for the compiler_rt library. 11*7c3d14c8STreehugger Robot // 12*7c3d14c8STreehugger Robot //===----------------------------------------------------------------------===// 13*7c3d14c8STreehugger Robot 14*7c3d14c8STreehugger Robot #include <stdlib.h> 15*7c3d14c8STreehugger Robot #include <stdint.h> 16*7c3d14c8STreehugger Robot #include <stdio.h> 17*7c3d14c8STreehugger Robot #include <math.h> 18*7c3d14c8STreehugger Robot 19*7c3d14c8STreehugger Robot 20*7c3d14c8STreehugger Robot extern uint32_t __bswapsi2(uint32_t); 21*7c3d14c8STreehugger Robot 22*7c3d14c8STreehugger Robot #if __arm__ test__bswapsi2(uint32_t a,uint32_t expected)23*7c3d14c8STreehugger Robotint test__bswapsi2(uint32_t a, uint32_t expected) 24*7c3d14c8STreehugger Robot { 25*7c3d14c8STreehugger Robot uint32_t actual = __bswapsi2(a); 26*7c3d14c8STreehugger Robot if (actual != expected) 27*7c3d14c8STreehugger Robot printf("error in test__bswapsi2(0x%0X) = 0x%0X, expected 0x%0X\n", 28*7c3d14c8STreehugger Robot a, actual, expected); 29*7c3d14c8STreehugger Robot return actual != expected; 30*7c3d14c8STreehugger Robot } 31*7c3d14c8STreehugger Robot #endif 32*7c3d14c8STreehugger Robot main()33*7c3d14c8STreehugger Robotint main() 34*7c3d14c8STreehugger Robot { 35*7c3d14c8STreehugger Robot #if __arm__ 36*7c3d14c8STreehugger Robot if (test__bswapsi2(0x12345678, 0x78563412)) 37*7c3d14c8STreehugger Robot return 1; 38*7c3d14c8STreehugger Robot if (test__bswapsi2(0x00000001, 0x01000000)) 39*7c3d14c8STreehugger Robot return 1; 40*7c3d14c8STreehugger Robot #else 41*7c3d14c8STreehugger Robot printf("skipped\n"); 42*7c3d14c8STreehugger Robot #endif 43*7c3d14c8STreehugger Robot return 0; 44*7c3d14c8STreehugger Robot } 45