diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86AsmParserCommon.h | 19 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.td | 12 |
2 files changed, 13 insertions, 18 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParserCommon.h b/llvm/lib/Target/X86/AsmParser/X86AsmParserCommon.h index 7610806c457..54538c804a0 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParserCommon.h +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParserCommon.h @@ -13,30 +13,25 @@ namespace llvm { inline bool isImmSExti16i8Value(uint64_t Value) { - return (( Value <= 0x000000000000007FULL)|| - (0x000000000000FF80ULL <= Value && Value <= 0x000000000000FFFFULL)|| - (0xFFFFFFFFFFFFFF80ULL <= Value && Value <= 0xFFFFFFFFFFFFFFFFULL)); + return isInt<8>(Value) || + (isUInt<16>(Value) && isInt<8>(static_cast<int16_t>(Value))); } inline bool isImmSExti32i8Value(uint64_t Value) { - return (( Value <= 0x000000000000007FULL)|| - (0x00000000FFFFFF80ULL <= Value && Value <= 0x00000000FFFFFFFFULL)|| - (0xFFFFFFFFFFFFFF80ULL <= Value && Value <= 0xFFFFFFFFFFFFFFFFULL)); + return isInt<8>(Value) || + (isUInt<32>(Value) && isInt<8>(static_cast<int32_t>(Value))); } inline bool isImmSExti64i8Value(uint64_t Value) { - return (( Value <= 0x000000000000007FULL)|| - (0xFFFFFFFFFFFFFF80ULL <= Value && Value <= 0xFFFFFFFFFFFFFFFFULL)); + return isInt<8>(Value); } inline bool isImmSExti64i32Value(uint64_t Value) { - return (( Value <= 0x000000007FFFFFFFULL)|| - (0xFFFFFFFF80000000ULL <= Value && Value <= 0xFFFFFFFFFFFFFFFFULL)); + return isInt<32>(Value); } inline bool isImmUnsignedi8Value(uint64_t Value) { - return (( Value <= 0x00000000000000FFULL)|| - (0xFFFFFFFFFFFFFF80ULL <= Value && Value <= 0xFFFFFFFFFFFFFFFFULL)); + return isUInt<8>(Value) || isInt<8>(Value); } } // End of namespace llvm diff --git a/llvm/lib/Target/X86/X86InstrInfo.td b/llvm/lib/Target/X86/X86InstrInfo.td index d92a23afdee..b4199fe30b2 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.td +++ b/llvm/lib/Target/X86/X86InstrInfo.td @@ -867,9 +867,9 @@ def X86_COND_E_OR_NE : ImmLeaf<i8, [{ }]>; -def i16immSExt8 : ImmLeaf<i16, [{ return Imm == (int8_t)Imm; }]>; -def i32immSExt8 : ImmLeaf<i32, [{ return Imm == (int8_t)Imm; }]>; -def i64immSExt8 : ImmLeaf<i64, [{ return Imm == (int8_t)Imm; }]>; +def i16immSExt8 : ImmLeaf<i16, [{ return isInt<8>(Imm); }]>; +def i32immSExt8 : ImmLeaf<i32, [{ return isInt<8>(Imm); }]>; +def i64immSExt8 : ImmLeaf<i64, [{ return isInt<8>(Imm); }]>; // If we have multiple users of an immediate, it's much smaller to reuse // the register, rather than encode the immediate in every instruction. @@ -906,15 +906,15 @@ def i32immSExt8_su : PatLeaf<(i32immSExt8), [{ }]>; -def i64immSExt32 : ImmLeaf<i64, [{ return Imm == (int32_t)Imm; }]>; +def i64immSExt32 : ImmLeaf<i64, [{ return isInt<32>(Imm); }]>; // i64immZExt32 predicate - True if the 64-bit immediate fits in a 32-bit // unsigned field. -def i64immZExt32 : ImmLeaf<i64, [{ return (uint64_t)Imm == (uint32_t)Imm; }]>; +def i64immZExt32 : ImmLeaf<i64, [{ return isUInt<32>(Imm); }]>; def i64immZExt32SExt8 : ImmLeaf<i64, [{ - return (uint64_t)Imm == (uint32_t)Imm && (int32_t)Imm == (int8_t)Imm; + return isUInt<32>(Imm) && isInt<8>(static_cast<int32_t>(Imm)); }]>; // Helper fragments for loads. |