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