13#ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMADDRESSINGMODES_H
14#define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMADDRESSINGMODES_H
99 return ShOp | (Imm << 3);
118 if ((Imm & ~255U) == 0)
return 0;
125 unsigned RotAmt = TZ & ~1;
128 if ((llvm::rotr<uint32_t>(Imm, RotAmt) & ~255U) == 0)
129 return (32-RotAmt)&31;
135 unsigned RotAmt2 = TZ2 & ~1;
136 if ((llvm::rotr<uint32_t>(Imm, RotAmt2) & ~255U) == 0)
137 return (32-RotAmt2)&31;
143 return (32-RotAmt)&31;
152 if ((Arg & ~255U) == 0)
return Arg;
157 if (llvm::rotr<uint32_t>(~255U, RotAmt) & Arg)
161 return llvm::rotl<uint32_t>(Arg, RotAmt) | ((RotAmt >> 1) << 8);
213 if ((Imm & ~255U) == 0)
return 0;
232 if ((Imm & ~65535U) == 0)
return 0;
265 if ((V & 0xffffff00) == 0)
269 Vs = ((V & 0xff) == 0) ? V >> 8 : V;
273 u = Imm | (Imm << 16);
277 return (((Vs == V) ? 1 : 2) << 8) | Imm;
280 if (Vs == (u | (u << 8)))
281 return (3 << 8) | Imm;
296 if ((llvm::rotr<uint32_t>(0xff000000U, RotAmt) & V) == V)
297 return (llvm::rotr<uint32_t>(V, 24 - RotAmt) & 0x7f) |
322 if ((V & ~255U) == 0)
return 0;
325 return (32 - RotAmt) & 31;
357 "Immedate cannot be encoded as two part immediate!");
365 return Imm & 0xff00ff00U;
369 return Imm & 0x00ff00ffU;
377 "Unable to encode second part of T2 two part SO immediate");
401 unsigned IdxMode = 0) {
402 assert(Imm12 < (1 << 12) &&
"Imm too large!");
403 bool isSub = Opc ==
sub;
404 return Imm12 | ((int)isSub << 12) | (SO << 13) | (IdxMode << 16) ;
407 return AM2Opc & ((1 << 12)-1);
410 return ((AM2Opc >> 12) & 1) ?
sub :
add;
413 return (
ShiftOpc)((AM2Opc >> 13) & 7);
433 unsigned IdxMode = 0) {
434 bool isSub = Opc ==
sub;
435 return ((
int)isSub << 8) |
Offset | (IdxMode << 9);
437 inline unsigned char getAM3Offset(
unsigned AM3Opc) {
return AM3Opc & 0xFF; }
439 return ((AM3Opc >> 8) & 1) ?
sub :
add;
477 bool isSub = Opc ==
sub;
478 return ((
int)isSub << 8) |
Offset;
480 inline unsigned char getAM5Offset(
unsigned AM5Opc) {
return AM5Opc & 0xFF; }
482 return ((AM5Opc >> 8) & 1) ?
sub :
add;
498 bool isSub = Opc ==
sub;
499 return ((
int)isSub << 8) |
Offset;
502 return AM5Opc & 0xFF;
505 return ((AM5Opc >> 8) & 1) ?
sub :
add;
534 return (OpCmode << 8) | Val;
537 return (ModImm >> 8) & 0x1f;
549 if (OpCmode == 0xe) {
553 }
else if ((OpCmode & 0xc) == 0x8) {
555 unsigned ByteNum = (OpCmode & 0x6) >> 1;
556 Val = Imm8 << (8 * ByteNum);
558 }
else if ((OpCmode & 0x8) == 0) {
560 unsigned ByteNum = (OpCmode & 0x6) >> 1;
561 Val = Imm8 << (8 * ByteNum);
563 }
else if ((OpCmode & 0xe) == 0xc) {
565 unsigned ByteNum = 1 + (OpCmode & 0x1);
566 Val = (Imm8 << (8 * ByteNum)) | (0xffff >> (8 * (2 - ByteNum)));
568 }
else if (OpCmode == 0x1e) {
570 for (
unsigned ByteNum = 0; ByteNum < 8; ++ByteNum) {
571 if ((ModImm >> ByteNum) & 1)
572 Val |= (
uint64_t)0xff << (8 * ByteNum);
585 for (
unsigned i = 0; i <
Size; ++i) {
623 else if (
Value > 0xffffff)
634 uint8_t Sign = (Imm >> 7) & 0x1;
635 uint8_t Exp = (Imm >> 4) & 0x7;
644 I |= ((Exp & 0x4) != 0 ? 0 : 1) << 30;
645 I |= ((Exp & 0x4) != 0 ? 0x1f : 0) << 25;
646 I |= (Exp & 0x3) << 23;
648 return bit_cast<float>(
I);
655 uint32_t Sign = Imm.lshr(15).getZExtValue() & 1;
656 int32_t Exp = (Imm.lshr(10).getSExtValue() & 0x1f) - 15;
657 int64_t Mantissa = Imm.getZExtValue() & 0x3ff;
666 if (Exp < -3 || Exp > 4)
668 Exp = ((Exp+3) & 0x7) ^ 4;
670 return ((
int)Sign << 7) | (Exp << 4) | Mantissa;
680 if (Imm.getActiveBits() > 16)
693 uint32_t Sign = Imm.lshr(31).getZExtValue() & 1;
694 int32_t Exp = (Imm.lshr(23).getSExtValue() & 0xff) - 127;
695 int64_t Mantissa = Imm.getZExtValue() & 0x7fffff;
699 if (Mantissa & 0x7ffff)
702 if ((Mantissa & 0xf) != Mantissa)
706 if (Exp < -3 || Exp > 4)
708 Exp = ((Exp+3) & 0x7) ^ 4;
710 return ((
int)Sign << 7) | (Exp << 4) | Mantissa;
721 uint64_t Sign = Imm.lshr(63).getZExtValue() & 1;
722 int64_t Exp = (Imm.lshr(52).getSExtValue() & 0x7ff) - 1023;
723 uint64_t Mantissa = Imm.getZExtValue() & 0xfffffffffffffULL;
727 if (Mantissa & 0xffffffffffffULL)
730 if ((Mantissa & 0xf) != Mantissa)
734 if (Exp < -3 || Exp > 4)
736 Exp = ((Exp+3) & 0x7) ^ 4;
738 return ((
int)Sign << 7) | (Exp << 4) | Mantissa;
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements the C++20 <bit> header.
APInt bitcastToAPInt() const
Class for arbitrary precision integers.
This class represents an Operation in the Expression.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned char getAM3Offset(unsigned AM3Opc)
unsigned char getAM5FP16Offset(unsigned AM5Opc)
unsigned getSORegOffset(unsigned Op)
int getSOImmVal(unsigned Arg)
getSOImmVal - Given a 32-bit immediate, if it is something that can fit into an shifter_operand immed...
ShiftOpc getAM2ShiftOpc(unsigned AM2Opc)
int getFP32Imm(const APInt &Imm)
getFP32Imm - Return an 8-bit floating-point version of the 32-bit floating-point value.
uint64_t decodeVMOVModImm(unsigned ModImm, unsigned &EltBits)
decodeVMOVModImm - Decode a NEON/MVE modified immediate value into the element value and the element ...
unsigned getAM2IdxMode(unsigned AM2Opc)
unsigned getT2SOImmValRotate(unsigned V)
unsigned encodeNEONi16splat(unsigned Value)
unsigned getAM3IdxMode(unsigned AM3Opc)
unsigned getAM2Offset(unsigned AM2Opc)
unsigned getThumbImmNonShiftedVal(unsigned V)
getThumbImmNonShiftedVal - If V is a value that satisfies isThumbImmShiftedVal, return the non-shiftd...
unsigned getSOImmValRotate(unsigned Imm)
getSOImmValRotate - Try to handle Imm with an immediate shifter operand, computing the rotate amount ...
bool isThumbImmShiftedVal(unsigned V)
isThumbImmShiftedVal - Return true if the specified value can be obtained by left shifting a 8-bit im...
const char * getAMSubModeStr(AMSubMode Mode)
unsigned getVMOVModImmVal(unsigned ModImm)
float getFPImmFloat(unsigned Imm)
int getT2SOImmVal(unsigned Arg)
getT2SOImmVal - Given a 32-bit immediate, if it is something that can fit into a Thumb-2 shifter_oper...
unsigned getAM2Opc(AddrOpc Opc, unsigned Imm12, ShiftOpc SO, unsigned IdxMode=0)
int getT2SOImmValRotateVal(unsigned V)
getT2SOImmValRotateVal - Return the 12-bit encoded representation if the specified value is a rotated...
unsigned getAM5Opc(AddrOpc Opc, unsigned char Offset)
getAM5Opc - This function encodes the addrmode5 opc field.
unsigned getSOImmValRot(unsigned Imm)
getSOImmValRot - Given an encoded imm field for the reg/imm form, return the rotate amount.
ShiftOpc getSORegShOp(unsigned Op)
AddrOpc getAM5Op(unsigned AM5Opc)
unsigned createVMOVModImm(unsigned OpCmode, unsigned Val)
int getFP64Imm(const APInt &Imm)
getFP64Imm - Return an 8-bit floating-point version of the 64-bit floating-point value.
bool isNEONi16splat(unsigned Value)
Checks if Value is a correct immediate for instructions like VBIC/VORR.
bool isSOImmTwoPartValNeg(unsigned V)
isSOImmTwoPartValNeg - Return true if the specified value can be obtained by two SOImmVal,...
unsigned getSOImmTwoPartSecond(unsigned V)
getSOImmTwoPartSecond - If V is a value that satisfies isSOImmTwoPartVal, return the second chunk of ...
unsigned getVMOVModImmOpCmode(unsigned ModImm)
unsigned getAM5FP16Opc(AddrOpc Opc, unsigned char Offset)
getAM5FP16Opc - This function encodes the addrmode5fp16 opc field.
bool isSOImmTwoPartVal(unsigned V)
isSOImmTwoPartVal - Return true if the specified value can be obtained by or'ing together two SOImmVa...
unsigned getAM3Opc(AddrOpc Opc, unsigned char Offset, unsigned IdxMode=0)
getAM3Opc - This function encodes the addrmode3 opc field.
AddrOpc getAM5FP16Op(unsigned AM5Opc)
unsigned getAM4ModeImm(AMSubMode SubMode)
unsigned getThumbImm16ValShift(unsigned Imm)
getThumbImm16ValShift - Try to handle Imm with a 16-bit immediate followed by a left shift.
bool isNEONi32splat(unsigned Value)
Checks if Value is a correct immediate for instructions like VBIC/VORR.
int getFP16Imm(const APInt &Imm)
getFP16Imm - Return an 8-bit floating-point version of the 16-bit floating-point value.
unsigned getSORegOpc(ShiftOpc ShOp, unsigned Imm)
unsigned getShiftOpcEncoding(ShiftOpc Op)
unsigned getT2SOImmTwoPartSecond(unsigned Imm)
int getT2SOImmValSplatVal(unsigned V)
getT2SOImmValSplat - Return the 12-bit encoded representation if the specified value can be obtained ...
const char * getAddrOpcStr(AddrOpc Op)
int getFP32FP16Imm(const APInt &Imm)
If this is a FP16Imm encoded as a fp32 value, return the 8-bit encoding for it.
unsigned getSOImmValImm(unsigned Imm)
getSOImmValImm - Given an encoded imm field for the reg/imm form, return the 8-bit imm value.
unsigned getT2SOImmTwoPartFirst(unsigned Imm)
unsigned encodeNEONi32splat(unsigned Value)
Encode NEON 32 bits Splat immediate for instructions like VBIC/VORR.
bool isT2SOImmTwoPartVal(unsigned Imm)
bool isNEONBytesplat(unsigned Value, unsigned Size)
unsigned char getAM5Offset(unsigned AM5Opc)
unsigned getSOImmTwoPartFirst(unsigned V)
getSOImmTwoPartFirst - If V is a value that satisfies isSOImmTwoPartVal, return the first chunk of it...
const StringRef getShiftOpcStr(ShiftOpc Op)
AddrOpc getAM2Op(unsigned AM2Opc)
AddrOpc getAM3Op(unsigned AM3Opc)
AMSubMode getAM4SubMode(unsigned Mode)
unsigned getThumbImmValShift(unsigned Imm)
getThumbImmValShift - Try to handle Imm with a 8-bit immediate followed by a left shift.
bool isThumbImm16ShiftedVal(unsigned V)
isThumbImm16ShiftedVal - Return true if the specified value can be obtained by left shifting a 16-bit...
This is an optimization pass for GlobalISel generic memory operations.
int countr_zero(T Val)
Count number of 0's from the least significant bit to the most stopping at the first 1.
int countl_zero(T Val)
Count number of 0's from the most significant bit to the least stopping at the first 1.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...