• Home
  • Raw
  • Download

Lines Matching full:imm

73 static inline AArch64_AM::ShiftExtendType getShiftType(unsigned Imm) {  in getShiftType()  argument
74 switch ((Imm >> 6) & 0x7) { in getShiftType()
85 static inline unsigned getShiftValue(unsigned Imm) { in getShiftValue() argument
86 return Imm & 0x3f; in getShiftValue()
90 /// imm: 6-bit shift amount
97 /// {5-0} = imm
99 unsigned Imm) { in getShifterImm() argument
100 assert((Imm & 0x3f) == Imm && "Illegal shifted immedate value!"); in getShifterImm()
110 return (STEnc << 6) | (Imm & 0x3f); in getShifterImm()
118 static inline unsigned getArithShiftValue(unsigned Imm) { in getArithShiftValue() argument
119 return Imm & 0x7; in getArithShiftValue()
123 static inline AArch64_AM::ShiftExtendType getExtendType(unsigned Imm) { in getExtendType() argument
124 assert((Imm & 0x7) == Imm && "invalid immediate!"); in getExtendType()
125 switch (Imm) { in getExtendType()
138 static inline AArch64_AM::ShiftExtendType getArithExtendType(unsigned Imm) { in getArithExtendType() argument
139 return getExtendType((Imm >> 3) & 0x7); in getArithExtendType()
167 /// imm: 3-bit extend amount
171 unsigned Imm) { in getArithExtendImm() argument
172 assert((Imm & 0x7) == Imm && "Illegal shifted immedate value!"); in getArithExtendImm()
173 return (getExtendEncoding(ET) << 3) | (Imm & 0x7); in getArithExtendImm()
178 static inline bool getMemDoShift(unsigned Imm) { in getMemDoShift() argument
179 return (Imm & 0x1) != 0; in getMemDoShift()
184 static inline AArch64_AM::ShiftExtendType getMemExtendType(unsigned Imm) { in getMemExtendType() argument
185 return getExtendType((Imm >> 1) & 0x7); in getMemExtendType()
213 static inline bool processLogicalImmediate(uint64_t Imm, unsigned RegSize, in processLogicalImmediate() argument
215 if (Imm == 0ULL || Imm == ~0ULL || in processLogicalImmediate()
217 (Imm >> RegSize != 0 || Imm == (~0ULL >> (64 - RegSize))))) in processLogicalImmediate()
227 if ((Imm & Mask) != ((Imm >> Size) & Mask)) { in processLogicalImmediate()
236 Imm &= Mask; in processLogicalImmediate()
238 if (isShiftedMask_64(Imm)) { in processLogicalImmediate()
239 I = countTrailingZeros(Imm); in processLogicalImmediate()
241 CTO = countTrailingOnes(Imm >> I); in processLogicalImmediate()
243 Imm |= ~Mask; in processLogicalImmediate()
244 if (!isShiftedMask_64(~Imm)) in processLogicalImmediate()
247 unsigned CLO = countLeadingOnes(Imm); in processLogicalImmediate()
249 CTO = CLO + countTrailingOnes(Imm) - (64 - Size); in processLogicalImmediate()
275 static inline bool isLogicalImmediate(uint64_t imm, unsigned regSize) { in isLogicalImmediate() argument
277 return processLogicalImmediate(imm, regSize, encoding); in isLogicalImmediate()
282 static inline uint64_t encodeLogicalImmediate(uint64_t imm, unsigned regSize) { in encodeLogicalImmediate() argument
284 bool res = processLogicalImmediate(imm, regSize, encoding); in encodeLogicalImmediate()
343 static inline float getFPImmFloat(unsigned Imm) { in getFPImmFloat() argument
346 uint8_t Sign = (Imm >> 7) & 0x1; in getFPImmFloat()
347 uint8_t Exp = (Imm >> 4) & 0x7; in getFPImmFloat()
348 uint8_t Mantissa = Imm & 0xf; in getFPImmFloat()
367 static inline int getFP16Imm(const APInt &Imm) { in getFP16Imm() argument
368 uint32_t Sign = Imm.lshr(15).getZExtValue() & 1; in getFP16Imm()
369 int32_t Exp = (Imm.lshr(10).getSExtValue() & 0x1f) - 15; // -14 to 15 in getFP16Imm()
370 int32_t Mantissa = Imm.getZExtValue() & 0x3ff; // 10 bits in getFP16Imm()
393 static inline int getFP32Imm(const APInt &Imm) { in getFP32Imm() argument
394 uint32_t Sign = Imm.lshr(31).getZExtValue() & 1; in getFP32Imm()
395 int32_t Exp = (Imm.lshr(23).getSExtValue() & 0xff) - 127; // -126 to 127 in getFP32Imm()
396 int64_t Mantissa = Imm.getZExtValue() & 0x7fffff; // 23 bits in getFP32Imm()
421 static inline int getFP64Imm(const APInt &Imm) { in getFP64Imm() argument
422 uint64_t Sign = Imm.lshr(63).getZExtValue() & 1; in getFP64Imm()
423 int64_t Exp = (Imm.lshr(52).getSExtValue() & 0x7ff) - 1023; // -1022 to 1023 in getFP64Imm()
424 uint64_t Mantissa = Imm.getZExtValue() & 0xfffffffffffffULL; in getFP64Imm()
451 static inline bool isAdvSIMDModImmType1(uint64_t Imm) { in isAdvSIMDModImmType1() argument
452 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType1()
453 ((Imm & 0xffffff00ffffff00ULL) == 0); in isAdvSIMDModImmType1()
456 static inline uint8_t encodeAdvSIMDModImmType1(uint64_t Imm) { in encodeAdvSIMDModImmType1() argument
457 return (Imm & 0xffULL); in encodeAdvSIMDModImmType1()
460 static inline uint64_t decodeAdvSIMDModImmType1(uint8_t Imm) { in decodeAdvSIMDModImmType1() argument
461 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType1()
466 static inline bool isAdvSIMDModImmType2(uint64_t Imm) { in isAdvSIMDModImmType2() argument
467 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType2()
468 ((Imm & 0xffff00ffffff00ffULL) == 0); in isAdvSIMDModImmType2()
471 static inline uint8_t encodeAdvSIMDModImmType2(uint64_t Imm) { in encodeAdvSIMDModImmType2() argument
472 return (Imm & 0xff00ULL) >> 8; in encodeAdvSIMDModImmType2()
475 static inline uint64_t decodeAdvSIMDModImmType2(uint8_t Imm) { in decodeAdvSIMDModImmType2() argument
476 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType2()
481 static inline bool isAdvSIMDModImmType3(uint64_t Imm) { in isAdvSIMDModImmType3() argument
482 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType3()
483 ((Imm & 0xff00ffffff00ffffULL) == 0); in isAdvSIMDModImmType3()
486 static inline uint8_t encodeAdvSIMDModImmType3(uint64_t Imm) { in encodeAdvSIMDModImmType3() argument
487 return (Imm & 0xff0000ULL) >> 16; in encodeAdvSIMDModImmType3()
490 static inline uint64_t decodeAdvSIMDModImmType3(uint8_t Imm) { in decodeAdvSIMDModImmType3() argument
491 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType3()
496 static inline bool isAdvSIMDModImmType4(uint64_t Imm) { in isAdvSIMDModImmType4() argument
497 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType4()
498 ((Imm & 0x00ffffff00ffffffULL) == 0); in isAdvSIMDModImmType4()
501 static inline uint8_t encodeAdvSIMDModImmType4(uint64_t Imm) { in encodeAdvSIMDModImmType4() argument
502 return (Imm & 0xff000000ULL) >> 24; in encodeAdvSIMDModImmType4()
505 static inline uint64_t decodeAdvSIMDModImmType4(uint8_t Imm) { in decodeAdvSIMDModImmType4() argument
506 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType4()
511 static inline bool isAdvSIMDModImmType5(uint64_t Imm) { in isAdvSIMDModImmType5() argument
512 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType5()
513 (((Imm & 0x00ff0000ULL) >> 16) == (Imm & 0x000000ffULL)) && in isAdvSIMDModImmType5()
514 ((Imm & 0xff00ff00ff00ff00ULL) == 0); in isAdvSIMDModImmType5()
517 static inline uint8_t encodeAdvSIMDModImmType5(uint64_t Imm) { in encodeAdvSIMDModImmType5() argument
518 return (Imm & 0xffULL); in encodeAdvSIMDModImmType5()
521 static inline uint64_t decodeAdvSIMDModImmType5(uint8_t Imm) { in decodeAdvSIMDModImmType5() argument
522 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType5()
527 static inline bool isAdvSIMDModImmType6(uint64_t Imm) { in isAdvSIMDModImmType6() argument
528 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType6()
529 (((Imm & 0xff000000ULL) >> 16) == (Imm & 0x0000ff00ULL)) && in isAdvSIMDModImmType6()
530 ((Imm & 0x00ff00ff00ff00ffULL) == 0); in isAdvSIMDModImmType6()
533 static inline uint8_t encodeAdvSIMDModImmType6(uint64_t Imm) { in encodeAdvSIMDModImmType6() argument
534 return (Imm & 0xff00ULL) >> 8; in encodeAdvSIMDModImmType6()
537 static inline uint64_t decodeAdvSIMDModImmType6(uint8_t Imm) { in decodeAdvSIMDModImmType6() argument
538 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType6()
543 static inline bool isAdvSIMDModImmType7(uint64_t Imm) { in isAdvSIMDModImmType7() argument
544 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType7()
545 ((Imm & 0xffff00ffffff00ffULL) == 0x000000ff000000ffULL); in isAdvSIMDModImmType7()
548 static inline uint8_t encodeAdvSIMDModImmType7(uint64_t Imm) { in encodeAdvSIMDModImmType7() argument
549 return (Imm & 0xff00ULL) >> 8; in encodeAdvSIMDModImmType7()
552 static inline uint64_t decodeAdvSIMDModImmType7(uint8_t Imm) { in decodeAdvSIMDModImmType7() argument
553 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType7()
558 static inline bool isAdvSIMDModImmType8(uint64_t Imm) { in isAdvSIMDModImmType8() argument
559 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType8()
560 ((Imm & 0xff00ffffff00ffffULL) == 0x0000ffff0000ffffULL); in isAdvSIMDModImmType8()
563 static inline uint64_t decodeAdvSIMDModImmType8(uint8_t Imm) { in decodeAdvSIMDModImmType8() argument
564 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType8()
568 static inline uint8_t encodeAdvSIMDModImmType8(uint64_t Imm) { in encodeAdvSIMDModImmType8() argument
569 return (Imm & 0x00ff0000ULL) >> 16; in encodeAdvSIMDModImmType8()
573 static inline bool isAdvSIMDModImmType9(uint64_t Imm) { in isAdvSIMDModImmType9() argument
574 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType9()
575 ((Imm >> 48) == (Imm & 0x0000ffffULL)) && in isAdvSIMDModImmType9()
576 ((Imm >> 56) == (Imm & 0x000000ffULL)); in isAdvSIMDModImmType9()
579 static inline uint8_t encodeAdvSIMDModImmType9(uint64_t Imm) { in encodeAdvSIMDModImmType9() argument
580 return (Imm & 0xffULL); in encodeAdvSIMDModImmType9()
583 static inline uint64_t decodeAdvSIMDModImmType9(uint8_t Imm) { in decodeAdvSIMDModImmType9() argument
584 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType9()
593 static inline bool isAdvSIMDModImmType10(uint64_t Imm) { in isAdvSIMDModImmType10() argument
594 uint64_t ByteA = Imm & 0xff00000000000000ULL; in isAdvSIMDModImmType10()
595 uint64_t ByteB = Imm & 0x00ff000000000000ULL; in isAdvSIMDModImmType10()
596 uint64_t ByteC = Imm & 0x0000ff0000000000ULL; in isAdvSIMDModImmType10()
597 uint64_t ByteD = Imm & 0x000000ff00000000ULL; in isAdvSIMDModImmType10()
598 uint64_t ByteE = Imm & 0x00000000ff000000ULL; in isAdvSIMDModImmType10()
599 uint64_t ByteF = Imm & 0x0000000000ff0000ULL; in isAdvSIMDModImmType10()
600 uint64_t ByteG = Imm & 0x000000000000ff00ULL; in isAdvSIMDModImmType10()
601 uint64_t ByteH = Imm & 0x00000000000000ffULL; in isAdvSIMDModImmType10()
613 static inline uint8_t encodeAdvSIMDModImmType10(uint64_t Imm) { in encodeAdvSIMDModImmType10() argument
614 uint8_t BitA = (Imm & 0xff00000000000000ULL) != 0; in encodeAdvSIMDModImmType10()
615 uint8_t BitB = (Imm & 0x00ff000000000000ULL) != 0; in encodeAdvSIMDModImmType10()
616 uint8_t BitC = (Imm & 0x0000ff0000000000ULL) != 0; in encodeAdvSIMDModImmType10()
617 uint8_t BitD = (Imm & 0x000000ff00000000ULL) != 0; in encodeAdvSIMDModImmType10()
618 uint8_t BitE = (Imm & 0x00000000ff000000ULL) != 0; in encodeAdvSIMDModImmType10()
619 uint8_t BitF = (Imm & 0x0000000000ff0000ULL) != 0; in encodeAdvSIMDModImmType10()
620 uint8_t BitG = (Imm & 0x000000000000ff00ULL) != 0; in encodeAdvSIMDModImmType10()
621 uint8_t BitH = (Imm & 0x00000000000000ffULL) != 0; in encodeAdvSIMDModImmType10()
641 static inline uint64_t decodeAdvSIMDModImmType10(uint8_t Imm) { in decodeAdvSIMDModImmType10() argument
643 if (Imm & 0x80) EncVal |= 0xff00000000000000ULL; in decodeAdvSIMDModImmType10()
644 if (Imm & 0x40) EncVal |= 0x00ff000000000000ULL; in decodeAdvSIMDModImmType10()
645 if (Imm & 0x20) EncVal |= 0x0000ff0000000000ULL; in decodeAdvSIMDModImmType10()
646 if (Imm & 0x10) EncVal |= 0x000000ff00000000ULL; in decodeAdvSIMDModImmType10()
647 if (Imm & 0x08) EncVal |= 0x00000000ff000000ULL; in decodeAdvSIMDModImmType10()
648 if (Imm & 0x04) EncVal |= 0x0000000000ff0000ULL; in decodeAdvSIMDModImmType10()
649 if (Imm & 0x02) EncVal |= 0x000000000000ff00ULL; in decodeAdvSIMDModImmType10()
650 if (Imm & 0x01) EncVal |= 0x00000000000000ffULL; in decodeAdvSIMDModImmType10()
655 static inline bool isAdvSIMDModImmType11(uint64_t Imm) { in isAdvSIMDModImmType11() argument
656 uint64_t BString = (Imm & 0x7E000000ULL) >> 25; in isAdvSIMDModImmType11()
657 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType11()
659 ((Imm & 0x0007ffff0007ffffULL) == 0); in isAdvSIMDModImmType11()
662 static inline uint8_t encodeAdvSIMDModImmType11(uint64_t Imm) { in encodeAdvSIMDModImmType11() argument
663 uint8_t BitA = (Imm & 0x80000000ULL) != 0; in encodeAdvSIMDModImmType11()
664 uint8_t BitB = (Imm & 0x20000000ULL) != 0; in encodeAdvSIMDModImmType11()
665 uint8_t BitC = (Imm & 0x01000000ULL) != 0; in encodeAdvSIMDModImmType11()
666 uint8_t BitD = (Imm & 0x00800000ULL) != 0; in encodeAdvSIMDModImmType11()
667 uint8_t BitE = (Imm & 0x00400000ULL) != 0; in encodeAdvSIMDModImmType11()
668 uint8_t BitF = (Imm & 0x00200000ULL) != 0; in encodeAdvSIMDModImmType11()
669 uint8_t BitG = (Imm & 0x00100000ULL) != 0; in encodeAdvSIMDModImmType11()
670 uint8_t BitH = (Imm & 0x00080000ULL) != 0; in encodeAdvSIMDModImmType11()
690 static inline uint64_t decodeAdvSIMDModImmType11(uint8_t Imm) { in decodeAdvSIMDModImmType11() argument
692 if (Imm & 0x80) EncVal |= 0x80000000ULL; in decodeAdvSIMDModImmType11()
693 if (Imm & 0x40) EncVal |= 0x3e000000ULL; in decodeAdvSIMDModImmType11()
695 if (Imm & 0x20) EncVal |= 0x01000000ULL; in decodeAdvSIMDModImmType11()
696 if (Imm & 0x10) EncVal |= 0x00800000ULL; in decodeAdvSIMDModImmType11()
697 if (Imm & 0x08) EncVal |= 0x00400000ULL; in decodeAdvSIMDModImmType11()
698 if (Imm & 0x04) EncVal |= 0x00200000ULL; in decodeAdvSIMDModImmType11()
699 if (Imm & 0x02) EncVal |= 0x00100000ULL; in decodeAdvSIMDModImmType11()
700 if (Imm & 0x01) EncVal |= 0x00080000ULL; in decodeAdvSIMDModImmType11()
705 static inline bool isAdvSIMDModImmType12(uint64_t Imm) { in isAdvSIMDModImmType12() argument
706 uint64_t BString = (Imm & 0x7fc0000000000000ULL) >> 54; in isAdvSIMDModImmType12()
708 ((Imm & 0x0000ffffffffffffULL) == 0)); in isAdvSIMDModImmType12()
711 static inline uint8_t encodeAdvSIMDModImmType12(uint64_t Imm) { in encodeAdvSIMDModImmType12() argument
712 uint8_t BitA = (Imm & 0x8000000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
713 uint8_t BitB = (Imm & 0x0040000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
714 uint8_t BitC = (Imm & 0x0020000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
715 uint8_t BitD = (Imm & 0x0010000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
716 uint8_t BitE = (Imm & 0x0008000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
717 uint8_t BitF = (Imm & 0x0004000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
718 uint8_t BitG = (Imm & 0x0002000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
719 uint8_t BitH = (Imm & 0x0001000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
739 static inline uint64_t decodeAdvSIMDModImmType12(uint8_t Imm) { in decodeAdvSIMDModImmType12() argument
741 if (Imm & 0x80) EncVal |= 0x8000000000000000ULL; in decodeAdvSIMDModImmType12()
742 if (Imm & 0x40) EncVal |= 0x3fc0000000000000ULL; in decodeAdvSIMDModImmType12()
744 if (Imm & 0x20) EncVal |= 0x0020000000000000ULL; in decodeAdvSIMDModImmType12()
745 if (Imm & 0x10) EncVal |= 0x0010000000000000ULL; in decodeAdvSIMDModImmType12()
746 if (Imm & 0x08) EncVal |= 0x0008000000000000ULL; in decodeAdvSIMDModImmType12()
747 if (Imm & 0x04) EncVal |= 0x0004000000000000ULL; in decodeAdvSIMDModImmType12()
748 if (Imm & 0x02) EncVal |= 0x0002000000000000ULL; in decodeAdvSIMDModImmType12()
749 if (Imm & 0x01) EncVal |= 0x0001000000000000ULL; in decodeAdvSIMDModImmType12()
753 /// Returns true if Imm is the concatenation of a repeating pattern of type T.
755 static inline bool isSVEMaskOfIdenticalElements(int64_t Imm) { in isSVEMaskOfIdenticalElements() argument
756 auto Parts = bit_cast<std::array<T, sizeof(int64_t) / sizeof(T)>>(Imm); in isSVEMaskOfIdenticalElements()
760 /// Returns true if Imm is valid for CPY/DUP.
762 static inline bool isSVECpyImm(int64_t Imm) { in isSVECpyImm() argument
763 bool IsImm8 = int8_t(Imm) == Imm; in isSVECpyImm()
764 bool IsImm16 = int16_t(Imm & ~0xff) == Imm; in isSVECpyImm()
768 return IsImm8 || uint8_t(Imm) == Imm; in isSVECpyImm()
771 return IsImm8 || IsImm16 || uint16_t(Imm & ~0xff) == Imm; in isSVECpyImm()
776 /// Returns true if Imm is valid for ADD/SUB.
778 static inline bool isSVEAddSubImm(int64_t Imm) { in isSVEAddSubImm() argument
781 return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm); in isSVEAddSubImm()
784 /// Return true if Imm is valid for DUPM and has no single CPY/DUP equivalent.
785 static inline bool isSVEMoveMaskPreferredLogicalImmediate(int64_t Imm) { in isSVEMoveMaskPreferredLogicalImmediate() argument
786 if (isSVECpyImm<int64_t>(Imm)) in isSVEMoveMaskPreferredLogicalImmediate()
789 auto S = bit_cast<std::array<int32_t, 2>>(Imm); in isSVEMoveMaskPreferredLogicalImmediate()
790 auto H = bit_cast<std::array<int16_t, 4>>(Imm); in isSVEMoveMaskPreferredLogicalImmediate()
791 auto B = bit_cast<std::array<int8_t, 8>>(Imm); in isSVEMoveMaskPreferredLogicalImmediate()
793 if (isSVEMaskOfIdenticalElements<int32_t>(Imm) && isSVECpyImm<int32_t>(S[0])) in isSVEMoveMaskPreferredLogicalImmediate()
795 if (isSVEMaskOfIdenticalElements<int16_t>(Imm) && isSVECpyImm<int16_t>(H[0])) in isSVEMoveMaskPreferredLogicalImmediate()
797 if (isSVEMaskOfIdenticalElements<int8_t>(Imm) && isSVECpyImm<int8_t>(B[0])) in isSVEMoveMaskPreferredLogicalImmediate()
799 return isLogicalImmediate(Imm, 64); in isSVEMoveMaskPreferredLogicalImmediate()