1 // UNSUPPORTED: armv6m-target-arch
2 // RUN: %clang_builtins %s %librt -o %t && %run %t
3 // REQUIRES: librt_has_bswapdi2
4 //===-- bswapdi2_test.c - Test __bswapdi2 ---------------------------------===//
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
10 //===----------------------------------------------------------------------===//
12 // This file tests __bswapdi2 for the compiler_rt library.
14 //===----------------------------------------------------------------------===//
21 extern uint64_t __bswapdi2(uint64_t);
23 int test__bswapdi2(uint64_t a
, uint64_t expected
) {
24 uint64_t actual
= __bswapdi2(a
);
25 if (actual
!= expected
)
26 printf("error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\n", a
,
28 return actual
!= expected
;
32 if (test__bswapdi2(0x123456789ABCDEF0LL
, 0xF0DEBC9A78563412LL
))
34 if (test__bswapdi2(0x0000000100000002LL
, 0x0200000001000000LL
))