X86AsmParserCommon.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //===-- X86AsmParserCommon.h - Common functions for X86AsmParser ---------===//
  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. #ifndef LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMPARSERCOMMON_H
  9. #define LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMPARSERCOMMON_H
  10. #include "llvm/Support/MathExtras.h"
  11. namespace llvm {
  12. inline bool isImmSExti16i8Value(uint64_t Value) {
  13. return isInt<8>(Value) ||
  14. (isUInt<16>(Value) && isInt<8>(static_cast<int16_t>(Value)));
  15. }
  16. inline bool isImmSExti32i8Value(uint64_t Value) {
  17. return isInt<8>(Value) ||
  18. (isUInt<32>(Value) && isInt<8>(static_cast<int32_t>(Value)));
  19. }
  20. inline bool isImmSExti64i8Value(uint64_t Value) {
  21. return isInt<8>(Value);
  22. }
  23. inline bool isImmSExti64i32Value(uint64_t Value) {
  24. return isInt<32>(Value);
  25. }
  26. inline bool isImmUnsignedi8Value(uint64_t Value) {
  27. return isUInt<8>(Value) || isInt<8>(Value);
  28. }
  29. inline bool isImmUnsignedi4Value(uint64_t Value) {
  30. return isUInt<4>(Value);
  31. }
  32. } // End of namespace llvm
  33. #endif