brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 271df8b Raw
44 lines · plain
1//===------- bswapdi2 - Implement bswapdi2 --------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "../assembly.h"10 11	.syntax unified12	.text13	DEFINE_CODE_STATE14 15//16// extern uint64_t __bswapdi2(uint64_t);17//18// Reverse all the bytes in a 64-bit integer.19//20	.p2align 221DEFINE_COMPILERRT_FUNCTION(__bswapdi2)22#if __ARM_ARCH < 623    // before armv6 does not have "rev" instruction24    // r2 = rev(r0)25    eor r2, r0, r0, ror #1626    bic r2, r2, #0xff000027    mov r2, r2, lsr #828    eor r2, r2, r0, ror #829    // r0 = rev(r1)30    eor r0, r1, r1, ror #1631    bic r0, r0, #0xff000032    mov r0, r0, lsr #833    eor r0, r0, r1, ror #834#else35    rev r2, r0  // r2 = rev(r0)36    rev r0, r1  // r0 = rev(r1)37#endif38    mov r1, r2  // r1 = r2 = rev(r0)39    JMP(lr)40END_COMPILERRT_FUNCTION(__bswapdi2)41 42NO_EXEC_STACK_DIRECTIVE43 44