1 //===- AArch64GlobalISelUtils.h ----------------------------------*- C++ -*-==// 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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 /// \file APIs for AArch64-specific helper functions used in the GlobalISel 9 /// pipeline. 10 //===----------------------------------------------------------------------===// 11 12 #ifndef LLVM_LIB_TARGET_AARCH64_GISEL_AARCH64GLOBALISELUTILS_H 13 #define LLVM_LIB_TARGET_AARCH64_GISEL_AARCH64GLOBALISELUTILS_H 14 15 #include <cstdint> 16 17 namespace llvm { 18 namespace AArch64GISelUtils { 19 20 /// \returns true if \p C is a legal immediate operand for an arithmetic 21 /// instruction. 22 constexpr bool isLegalArithImmed(const uint64_t C) { 23 return (C >> 12 == 0) || ((C & 0xFFFULL) == 0 && C >> 24 == 0); 24 } 25 26 } // namespace AArch64GISelUtils 27 } // namespace llvm 28 29 #endif 30