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()
216 (RegSize != 64 && (Imm >> RegSize != 0 || Imm == ~0U))) in processLogicalImmediate()
226 if ((Imm & Mask) != ((Imm >> Size) & Mask)) { in processLogicalImmediate()
235 Imm &= Mask; in processLogicalImmediate()
237 if (isShiftedMask_64(Imm)) { in processLogicalImmediate()
238 I = countTrailingZeros(Imm); in processLogicalImmediate()
240 CTO = countTrailingOnes(Imm >> I); in processLogicalImmediate()
242 Imm |= ~Mask; in processLogicalImmediate()
243 if (!isShiftedMask_64(~Imm)) in processLogicalImmediate()
246 unsigned CLO = countLeadingOnes(Imm); in processLogicalImmediate()
248 CTO = CLO + countTrailingOnes(Imm) - (64 - Size); in processLogicalImmediate()
274 static inline bool isLogicalImmediate(uint64_t imm, unsigned regSize) { in isLogicalImmediate() argument
276 return processLogicalImmediate(imm, regSize, encoding); in isLogicalImmediate()
281 static inline uint64_t encodeLogicalImmediate(uint64_t imm, unsigned regSize) { in encodeLogicalImmediate() argument
283 bool res = processLogicalImmediate(imm, regSize, encoding); in encodeLogicalImmediate()
342 static inline float getFPImmFloat(unsigned Imm) { in getFPImmFloat() argument
349 uint8_t Sign = (Imm >> 7) & 0x1; in getFPImmFloat()
350 uint8_t Exp = (Imm >> 4) & 0x7; in getFPImmFloat()
351 uint8_t Mantissa = Imm & 0xf; in getFPImmFloat()
370 static inline int getFP16Imm(const APInt &Imm) { in getFP16Imm() argument
371 uint32_t Sign = Imm.lshr(15).getZExtValue() & 1; in getFP16Imm()
372 int32_t Exp = (Imm.lshr(10).getSExtValue() & 0x1f) - 15; // -14 to 15 in getFP16Imm()
373 int32_t Mantissa = Imm.getZExtValue() & 0x3ff; // 10 bits in getFP16Imm()
396 static inline int getFP32Imm(const APInt &Imm) { in getFP32Imm() argument
397 uint32_t Sign = Imm.lshr(31).getZExtValue() & 1; in getFP32Imm()
398 int32_t Exp = (Imm.lshr(23).getSExtValue() & 0xff) - 127; // -126 to 127 in getFP32Imm()
399 int64_t Mantissa = Imm.getZExtValue() & 0x7fffff; // 23 bits in getFP32Imm()
424 static inline int getFP64Imm(const APInt &Imm) { in getFP64Imm() argument
425 uint64_t Sign = Imm.lshr(63).getZExtValue() & 1; in getFP64Imm()
426 int64_t Exp = (Imm.lshr(52).getSExtValue() & 0x7ff) - 1023; // -1022 to 1023 in getFP64Imm()
427 uint64_t Mantissa = Imm.getZExtValue() & 0xfffffffffffffULL; in getFP64Imm()
454 static inline bool isAdvSIMDModImmType1(uint64_t Imm) { in isAdvSIMDModImmType1() argument
455 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType1()
456 ((Imm & 0xffffff00ffffff00ULL) == 0); in isAdvSIMDModImmType1()
459 static inline uint8_t encodeAdvSIMDModImmType1(uint64_t Imm) { in encodeAdvSIMDModImmType1() argument
460 return (Imm & 0xffULL); in encodeAdvSIMDModImmType1()
463 static inline uint64_t decodeAdvSIMDModImmType1(uint8_t Imm) { in decodeAdvSIMDModImmType1() argument
464 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType1()
469 static inline bool isAdvSIMDModImmType2(uint64_t Imm) { in isAdvSIMDModImmType2() argument
470 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType2()
471 ((Imm & 0xffff00ffffff00ffULL) == 0); in isAdvSIMDModImmType2()
474 static inline uint8_t encodeAdvSIMDModImmType2(uint64_t Imm) { in encodeAdvSIMDModImmType2() argument
475 return (Imm & 0xff00ULL) >> 8; in encodeAdvSIMDModImmType2()
478 static inline uint64_t decodeAdvSIMDModImmType2(uint8_t Imm) { in decodeAdvSIMDModImmType2() argument
479 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType2()
484 static inline bool isAdvSIMDModImmType3(uint64_t Imm) { in isAdvSIMDModImmType3() argument
485 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType3()
486 ((Imm & 0xff00ffffff00ffffULL) == 0); in isAdvSIMDModImmType3()
489 static inline uint8_t encodeAdvSIMDModImmType3(uint64_t Imm) { in encodeAdvSIMDModImmType3() argument
490 return (Imm & 0xff0000ULL) >> 16; in encodeAdvSIMDModImmType3()
493 static inline uint64_t decodeAdvSIMDModImmType3(uint8_t Imm) { in decodeAdvSIMDModImmType3() argument
494 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType3()
499 static inline bool isAdvSIMDModImmType4(uint64_t Imm) { in isAdvSIMDModImmType4() argument
500 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType4()
501 ((Imm & 0x00ffffff00ffffffULL) == 0); in isAdvSIMDModImmType4()
504 static inline uint8_t encodeAdvSIMDModImmType4(uint64_t Imm) { in encodeAdvSIMDModImmType4() argument
505 return (Imm & 0xff000000ULL) >> 24; in encodeAdvSIMDModImmType4()
508 static inline uint64_t decodeAdvSIMDModImmType4(uint8_t Imm) { in decodeAdvSIMDModImmType4() argument
509 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType4()
514 static inline bool isAdvSIMDModImmType5(uint64_t Imm) { in isAdvSIMDModImmType5() argument
515 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType5()
516 (((Imm & 0x00ff0000ULL) >> 16) == (Imm & 0x000000ffULL)) && in isAdvSIMDModImmType5()
517 ((Imm & 0xff00ff00ff00ff00ULL) == 0); in isAdvSIMDModImmType5()
520 static inline uint8_t encodeAdvSIMDModImmType5(uint64_t Imm) { in encodeAdvSIMDModImmType5() argument
521 return (Imm & 0xffULL); in encodeAdvSIMDModImmType5()
524 static inline uint64_t decodeAdvSIMDModImmType5(uint8_t Imm) { in decodeAdvSIMDModImmType5() argument
525 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType5()
530 static inline bool isAdvSIMDModImmType6(uint64_t Imm) { in isAdvSIMDModImmType6() argument
531 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType6()
532 (((Imm & 0xff000000ULL) >> 16) == (Imm & 0x0000ff00ULL)) && in isAdvSIMDModImmType6()
533 ((Imm & 0x00ff00ff00ff00ffULL) == 0); in isAdvSIMDModImmType6()
536 static inline uint8_t encodeAdvSIMDModImmType6(uint64_t Imm) { in encodeAdvSIMDModImmType6() argument
537 return (Imm & 0xff00ULL) >> 8; in encodeAdvSIMDModImmType6()
540 static inline uint64_t decodeAdvSIMDModImmType6(uint8_t Imm) { in decodeAdvSIMDModImmType6() argument
541 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType6()
546 static inline bool isAdvSIMDModImmType7(uint64_t Imm) { in isAdvSIMDModImmType7() argument
547 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType7()
548 ((Imm & 0xffff00ffffff00ffULL) == 0x000000ff000000ffULL); in isAdvSIMDModImmType7()
551 static inline uint8_t encodeAdvSIMDModImmType7(uint64_t Imm) { in encodeAdvSIMDModImmType7() argument
552 return (Imm & 0xff00ULL) >> 8; in encodeAdvSIMDModImmType7()
555 static inline uint64_t decodeAdvSIMDModImmType7(uint8_t Imm) { in decodeAdvSIMDModImmType7() argument
556 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType7()
561 static inline bool isAdvSIMDModImmType8(uint64_t Imm) { in isAdvSIMDModImmType8() argument
562 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType8()
563 ((Imm & 0xff00ffffff00ffffULL) == 0x0000ffff0000ffffULL); in isAdvSIMDModImmType8()
566 static inline uint64_t decodeAdvSIMDModImmType8(uint8_t Imm) { in decodeAdvSIMDModImmType8() argument
567 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType8()
571 static inline uint8_t encodeAdvSIMDModImmType8(uint64_t Imm) { in encodeAdvSIMDModImmType8() argument
572 return (Imm & 0x00ff0000ULL) >> 16; in encodeAdvSIMDModImmType8()
576 static inline bool isAdvSIMDModImmType9(uint64_t Imm) { in isAdvSIMDModImmType9() argument
577 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType9()
578 ((Imm >> 48) == (Imm & 0x0000ffffULL)) && in isAdvSIMDModImmType9()
579 ((Imm >> 56) == (Imm & 0x000000ffULL)); in isAdvSIMDModImmType9()
582 static inline uint8_t encodeAdvSIMDModImmType9(uint64_t Imm) { in encodeAdvSIMDModImmType9() argument
583 return (Imm & 0xffULL); in encodeAdvSIMDModImmType9()
586 static inline uint64_t decodeAdvSIMDModImmType9(uint8_t Imm) { in decodeAdvSIMDModImmType9() argument
587 uint64_t EncVal = Imm; in decodeAdvSIMDModImmType9()
596 static inline bool isAdvSIMDModImmType10(uint64_t Imm) { in isAdvSIMDModImmType10() argument
597 uint64_t ByteA = Imm & 0xff00000000000000ULL; in isAdvSIMDModImmType10()
598 uint64_t ByteB = Imm & 0x00ff000000000000ULL; in isAdvSIMDModImmType10()
599 uint64_t ByteC = Imm & 0x0000ff0000000000ULL; in isAdvSIMDModImmType10()
600 uint64_t ByteD = Imm & 0x000000ff00000000ULL; in isAdvSIMDModImmType10()
601 uint64_t ByteE = Imm & 0x00000000ff000000ULL; in isAdvSIMDModImmType10()
602 uint64_t ByteF = Imm & 0x0000000000ff0000ULL; in isAdvSIMDModImmType10()
603 uint64_t ByteG = Imm & 0x000000000000ff00ULL; in isAdvSIMDModImmType10()
604 uint64_t ByteH = Imm & 0x00000000000000ffULL; in isAdvSIMDModImmType10()
616 static inline uint8_t encodeAdvSIMDModImmType10(uint64_t Imm) { in encodeAdvSIMDModImmType10() argument
617 uint8_t BitA = (Imm & 0xff00000000000000ULL) != 0; in encodeAdvSIMDModImmType10()
618 uint8_t BitB = (Imm & 0x00ff000000000000ULL) != 0; in encodeAdvSIMDModImmType10()
619 uint8_t BitC = (Imm & 0x0000ff0000000000ULL) != 0; in encodeAdvSIMDModImmType10()
620 uint8_t BitD = (Imm & 0x000000ff00000000ULL) != 0; in encodeAdvSIMDModImmType10()
621 uint8_t BitE = (Imm & 0x00000000ff000000ULL) != 0; in encodeAdvSIMDModImmType10()
622 uint8_t BitF = (Imm & 0x0000000000ff0000ULL) != 0; in encodeAdvSIMDModImmType10()
623 uint8_t BitG = (Imm & 0x000000000000ff00ULL) != 0; in encodeAdvSIMDModImmType10()
624 uint8_t BitH = (Imm & 0x00000000000000ffULL) != 0; in encodeAdvSIMDModImmType10()
644 static inline uint64_t decodeAdvSIMDModImmType10(uint8_t Imm) { in decodeAdvSIMDModImmType10() argument
646 if (Imm & 0x80) EncVal |= 0xff00000000000000ULL; in decodeAdvSIMDModImmType10()
647 if (Imm & 0x40) EncVal |= 0x00ff000000000000ULL; in decodeAdvSIMDModImmType10()
648 if (Imm & 0x20) EncVal |= 0x0000ff0000000000ULL; in decodeAdvSIMDModImmType10()
649 if (Imm & 0x10) EncVal |= 0x000000ff00000000ULL; in decodeAdvSIMDModImmType10()
650 if (Imm & 0x08) EncVal |= 0x00000000ff000000ULL; in decodeAdvSIMDModImmType10()
651 if (Imm & 0x04) EncVal |= 0x0000000000ff0000ULL; in decodeAdvSIMDModImmType10()
652 if (Imm & 0x02) EncVal |= 0x000000000000ff00ULL; in decodeAdvSIMDModImmType10()
653 if (Imm & 0x01) EncVal |= 0x00000000000000ffULL; in decodeAdvSIMDModImmType10()
658 static inline bool isAdvSIMDModImmType11(uint64_t Imm) { in isAdvSIMDModImmType11() argument
659 uint64_t BString = (Imm & 0x7E000000ULL) >> 25; in isAdvSIMDModImmType11()
660 return ((Imm >> 32) == (Imm & 0xffffffffULL)) && in isAdvSIMDModImmType11()
662 ((Imm & 0x0007ffff0007ffffULL) == 0); in isAdvSIMDModImmType11()
665 static inline uint8_t encodeAdvSIMDModImmType11(uint64_t Imm) { in encodeAdvSIMDModImmType11() argument
666 uint8_t BitA = (Imm & 0x80000000ULL) != 0; in encodeAdvSIMDModImmType11()
667 uint8_t BitB = (Imm & 0x20000000ULL) != 0; in encodeAdvSIMDModImmType11()
668 uint8_t BitC = (Imm & 0x01000000ULL) != 0; in encodeAdvSIMDModImmType11()
669 uint8_t BitD = (Imm & 0x00800000ULL) != 0; in encodeAdvSIMDModImmType11()
670 uint8_t BitE = (Imm & 0x00400000ULL) != 0; in encodeAdvSIMDModImmType11()
671 uint8_t BitF = (Imm & 0x00200000ULL) != 0; in encodeAdvSIMDModImmType11()
672 uint8_t BitG = (Imm & 0x00100000ULL) != 0; in encodeAdvSIMDModImmType11()
673 uint8_t BitH = (Imm & 0x00080000ULL) != 0; in encodeAdvSIMDModImmType11()
693 static inline uint64_t decodeAdvSIMDModImmType11(uint8_t Imm) { in decodeAdvSIMDModImmType11() argument
695 if (Imm & 0x80) EncVal |= 0x80000000ULL; in decodeAdvSIMDModImmType11()
696 if (Imm & 0x40) EncVal |= 0x3e000000ULL; in decodeAdvSIMDModImmType11()
698 if (Imm & 0x20) EncVal |= 0x01000000ULL; in decodeAdvSIMDModImmType11()
699 if (Imm & 0x10) EncVal |= 0x00800000ULL; in decodeAdvSIMDModImmType11()
700 if (Imm & 0x08) EncVal |= 0x00400000ULL; in decodeAdvSIMDModImmType11()
701 if (Imm & 0x04) EncVal |= 0x00200000ULL; in decodeAdvSIMDModImmType11()
702 if (Imm & 0x02) EncVal |= 0x00100000ULL; in decodeAdvSIMDModImmType11()
703 if (Imm & 0x01) EncVal |= 0x00080000ULL; in decodeAdvSIMDModImmType11()
708 static inline bool isAdvSIMDModImmType12(uint64_t Imm) { in isAdvSIMDModImmType12() argument
709 uint64_t BString = (Imm & 0x7fc0000000000000ULL) >> 54; in isAdvSIMDModImmType12()
711 ((Imm & 0x0000ffffffffffffULL) == 0)); in isAdvSIMDModImmType12()
714 static inline uint8_t encodeAdvSIMDModImmType12(uint64_t Imm) { in encodeAdvSIMDModImmType12() argument
715 uint8_t BitA = (Imm & 0x8000000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
716 uint8_t BitB = (Imm & 0x0040000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
717 uint8_t BitC = (Imm & 0x0020000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
718 uint8_t BitD = (Imm & 0x0010000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
719 uint8_t BitE = (Imm & 0x0008000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
720 uint8_t BitF = (Imm & 0x0004000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
721 uint8_t BitG = (Imm & 0x0002000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
722 uint8_t BitH = (Imm & 0x0001000000000000ULL) != 0; in encodeAdvSIMDModImmType12()
742 static inline uint64_t decodeAdvSIMDModImmType12(uint8_t Imm) { in decodeAdvSIMDModImmType12() argument
744 if (Imm & 0x80) EncVal |= 0x8000000000000000ULL; in decodeAdvSIMDModImmType12()
745 if (Imm & 0x40) EncVal |= 0x3fc0000000000000ULL; in decodeAdvSIMDModImmType12()
747 if (Imm & 0x20) EncVal |= 0x0020000000000000ULL; in decodeAdvSIMDModImmType12()
748 if (Imm & 0x10) EncVal |= 0x0010000000000000ULL; in decodeAdvSIMDModImmType12()
749 if (Imm & 0x08) EncVal |= 0x0008000000000000ULL; in decodeAdvSIMDModImmType12()
750 if (Imm & 0x04) EncVal |= 0x0004000000000000ULL; in decodeAdvSIMDModImmType12()
751 if (Imm & 0x02) EncVal |= 0x0002000000000000ULL; in decodeAdvSIMDModImmType12()
752 if (Imm & 0x01) EncVal |= 0x0001000000000000ULL; in decodeAdvSIMDModImmType12()