Skip to content

[WIP] Better data sections, pool constants, print floating point values, improve diffable, CSE float constants #43453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6827,7 +6827,7 @@ void CodeGen::genSSE2BitwiseOp(GenTree* treeNode)
if (*maskFld == nullptr)
{
UINT64 maskPack[] = {mask, mask};
*maskFld = GetEmitter()->emitAnyConst(&maskPack, 16, 16);
*maskFld = GetEmitter()->emitBlkConst(&maskPack, 16, 16, treeNode->TypeGet());
}

GetEmitter()->emitIns_SIMD_R_R_C(ins, size, targetReg, operandReg, *maskFld, 0);
Expand Down
13 changes: 11 additions & 2 deletions src/coreclr/src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6469,6 +6469,7 @@ class Compiler
ValueNum csdConstDefVN; // When we CSE similar constants, this is the ValueNumber that we use for the LclVar
// assignment
unsigned csdIndex; // 1..optCSECandidateCount
bool csdIsSharedConst;
bool csdLiveAcrossCall;

unsigned short csdDefCount; // definition count
Expand Down Expand Up @@ -6555,9 +6556,17 @@ class Compiler
return ((key & TARGET_SIGN_BIT) != 0);
}

static size_t Decode_Shared_Const_CSE_Value(size_t key)
// returns the encoded key
static size_t Encode_Shared_Const_CSE_Value(size_t key)
{
return (key & ~TARGET_SIGN_BIT) << CSE_CONST_SHARED_LOW_BITS;
return TARGET_SIGN_BIT | (key >> CSE_CONST_SHARED_LOW_BITS);
}

// returns the orginal key
static size_t Decode_Shared_Const_CSE_Value(size_t enckey)
{
assert(Is_Shared_Const_CSE(enckey));
return (enckey & ~TARGET_SIGN_BIT) << CSE_CONST_SHARED_LOW_BITS;
}

#endif // FEATURE_ANYCSE
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/src/jit/ee_il_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1068,10 +1068,10 @@ bool Compiler::eeIsJitDataOffs(CORINFO_FIELD_HANDLE field)
unsigned value = static_cast<unsigned>(reinterpret_cast<uintptr_t>(field));
if (((CORINFO_FIELD_HANDLE)(size_t)value) != field)
{
return false; // upper bits were set, not a jit data offset
return false; // some bit?(s) in the upper 32 bits were set, not a jit data offset
}

// Data offsets are marked by the fact that the low two bits are 0b01 0x1
// Data offsets are marked by the fact that the low two bits are 0b01
return (value & iaut_MASK) == iaut_DATA_OFFSET;
}

Expand All @@ -1083,6 +1083,8 @@ int Compiler::eeGetJitDataOffs(CORINFO_FIELD_HANDLE field)
unsigned dataOffs = static_cast<unsigned>(reinterpret_cast<uintptr_t>(field));
assert(((CORINFO_FIELD_HANDLE)(size_t)dataOffs) == field);
assert(dataOffs < 0x40000000);

// Shift away the low two bits
return (static_cast<int>(reinterpret_cast<intptr_t>(field))) >> iaut_SHIFT;
}
else
Expand Down
Loading