Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 1 | //===-- X86AsmParserCommon.h - Common functions for X86AsmParser ---------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMPARSERCOMMON_H |
| 11 | #define LLVM_LIB_TARGET_X86_ASMPARSER_X86ASMPARSERCOMMON_H |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 12 | |
Benjamin Kramer | 391be79 | 2016-01-27 19:29:56 +0000 | [diff] [blame] | 13 | #include "llvm/Support/MathExtras.h" |
| 14 | |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 15 | namespace llvm { |
| 16 | |
| 17 | inline bool isImmSExti16i8Value(uint64_t Value) { |
Craig Topper | a716307 | 2015-10-11 16:38:14 +0000 | [diff] [blame] | 18 | return isInt<8>(Value) || |
| 19 | (isUInt<16>(Value) && isInt<8>(static_cast<int16_t>(Value))); |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | inline bool isImmSExti32i8Value(uint64_t Value) { |
Craig Topper | a716307 | 2015-10-11 16:38:14 +0000 | [diff] [blame] | 23 | return isInt<8>(Value) || |
| 24 | (isUInt<32>(Value) && isInt<8>(static_cast<int32_t>(Value))); |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 25 | } |
| 26 | |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 27 | inline bool isImmSExti64i8Value(uint64_t Value) { |
Craig Topper | a716307 | 2015-10-11 16:38:14 +0000 | [diff] [blame] | 28 | return isInt<8>(Value); |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | inline bool isImmSExti64i32Value(uint64_t Value) { |
Craig Topper | a716307 | 2015-10-11 16:38:14 +0000 | [diff] [blame] | 32 | return isInt<32>(Value); |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 33 | } |
| 34 | |
Craig Topper | f38dea1 | 2015-01-21 06:07:53 +0000 | [diff] [blame] | 35 | inline bool isImmUnsignedi8Value(uint64_t Value) { |
Craig Topper | a716307 | 2015-10-11 16:38:14 +0000 | [diff] [blame] | 36 | return isUInt<8>(Value) || isInt<8>(Value); |
Craig Topper | f38dea1 | 2015-01-21 06:07:53 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Evgeniy Stepanov | e3804d4 | 2014-02-28 12:28:07 +0000 | [diff] [blame] | 39 | } // End of namespace llvm |
| 40 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 41 | #endif |