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
9#ifndef LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMPARSERCOMMON_H
10#define LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMPARSERCOMMON_H
11
12#include "llvm/Support/MathExtras.h"
13
14namespace llvm {
15
16inline bool isImmSExti16i8Value(uint64_t Value) {
17 return isInt<8>(x: Value) ||
18 (isUInt<16>(x: Value) && isInt<8>(x: static_cast<int16_t>(Value)));
19}
20
21inline bool isImmSExti32i8Value(uint64_t Value) {
22 return isInt<8>(x: Value) ||
23 (isUInt<32>(x: Value) && isInt<8>(x: static_cast<int32_t>(Value)));
24}
25
26inline bool isImmSExti64i8Value(uint64_t Value) {
27 return isInt<8>(x: Value);
28}
29
30inline bool isImmSExti64i32Value(uint64_t Value) {
31 return isInt<32>(x: Value);
32}
33
34inline bool isImmUnsignedi8Value(uint64_t Value) {
35 return isUInt<8>(x: Value) || isInt<8>(x: Value);
36}
37
38inline bool isImmUnsignedi4Value(uint64_t Value) {
39 return isUInt<4>(x: Value);
40}
41
42} // End of namespace llvm
43
44#endif
45