1// UNSUPPORTED: armv6m-target-arch 2// RUN: %clang_builtins %s %librt -o %t && %run %t 3//===-- bswapsi2_test.c - Test __bswapsi2 ---------------------------------===// 4// 5// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 6// See https://llvm.org/LICENSE.txt for license information. 7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 8// 9//===----------------------------------------------------------------------===// 10// 11// This file tests __bswapsi2 for the compiler_rt library. 12// 13//===----------------------------------------------------------------------===// 14 15#include <math.h> 16#include <stdint.h> 17#include <stdio.h> 18#include <stdlib.h> 19 20extern uint32_t __bswapsi2(uint32_t); 21 22int test__bswapsi2(uint32_t a, uint32_t expected) { 23 uint32_t actual = __bswapsi2(a); 24 if (actual != expected) 25 printf("error in test__bswapsi2(0x%0X) = 0x%0X, expected 0x%0X\n", a, 26 actual, expected); 27 return actual != expected; 28} 29 30int main() { 31 if (test__bswapsi2(0x12345678, 0x78563412)) 32 return 1; 33 if (test__bswapsi2(0x00000001, 0x01000000)) 34 return 1; 35 return 0; 36} 37