Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/arm/bswapdi2.S
35291 views
//===------- bswapdi2 - Implement bswapdi2 --------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "../assembly.h"910.syntax unified11.text12DEFINE_CODE_STATE1314//15// extern uint64_t __bswapdi2(uint64_t);16//17// Reverse all the bytes in a 64-bit integer.18//19.p2align 220DEFINE_COMPILERRT_FUNCTION(__bswapdi2)21#if __ARM_ARCH < 622// before armv6 does not have "rev" instruction23// r2 = rev(r0)24eor r2, r0, r0, ror #1625bic r2, r2, #0xff000026mov r2, r2, lsr #827eor r2, r2, r0, ror #828// r0 = rev(r1)29eor r0, r1, r1, ror #1630bic r0, r0, #0xff000031mov r0, r0, lsr #832eor r0, r0, r1, ror #833#else34rev r2, r0 // r2 = rev(r0)35rev r0, r1 // r0 = rev(r1)36#endif37mov r1, r2 // r1 = r2 = rev(r0)38JMP(lr)39END_COMPILERRT_FUNCTION(__bswapdi2)4041NO_EXEC_STACK_DIRECTIVE42434445