remove useless tag field from hir::Value
pack local_slot and constant in hir::Value Instead of loading membase at the start of every function, just load it in HostToGuestThunk vzeroupper in GuestToHostThunk before calling host function, and in HostToGuestThunk after calling function to prevent AVX dirty state slowdowns. In the future, check if CPU implements AVX as 128x2 and skip if so (https://john-h-k.github.io/VexTransitionPenalties.html) Remove useless save/restore of ctx pointer, nothing modifies it and it prevents cpus from doing cross-function memory renaming (https://www.agner.org/forum/viewtopic.php?t=41). Could not remove the space on stack because of alignment issues, instead turned it into GUEST_SCRATCH64 which is a temporary that sequences may use Reorder OpcodeInfo so that name is at offset 0, remove name and add GetOpcodeName function (name is only used for debug code, we are seperating frequently accessed data and rarely accessed data) Add VECTOR_DENORMFLUSH opcode for handling output to DOT_PRODUCT and other opcodes that implicitly force denormal inputs/outputs to zero, will eventually use for implementing NJM Rewrite sequences for LOAD_VECTOR_SHL/SHR. The mask with 0xf in it was pointless as all InstrEmit_ functions that create the load shift instructions do that in HIR. The tables are only used for nonzero constant inputs now, which are probably pretty rare. Instead of doing a shift and lookup, a base value is used for both in the constant table and adding/subtracting of the input is done Reuse result of LoadVectorShl/Shr in InstrEmit_stvlx_, InstrEmit_stvrx_. We were previously calculating it twice which was contributing to the final sequences' fatness. Use OPCODE_SELECT instead of the sequence of or, andnot, and that it was using for merging Add the proper unconditional denormal input flushing behavior to vfmadd, add it also to vfmsub (making the assumption it has the same behavior) Remove constant propagation for DOT_PRODUCT_3/4 DOT_PRODUCT_3/4 now returns a vector with all four elements set to the result. (what we were doing before, truncating to float32 and then splatting didnt make any sense) Add much more correct versions of DOT_PRODUCT_3/4, matching the Xb360's to 1 bit. Still needs work to be a perfect emulation. Add constant folding for OPCODE_SELECT, OPCODE_INSERT, OPCODE_PERMUTE, OPCODE_SWIZZLE Remove constant folding for DOT_PRODUCT Removed the multibyte nop code I committed earlier, it doesnt help us much because nops are only used for debug stuff and its ugly and wouldnt survive in a pr to main Check for AVX512BMI, use vpermb to shuffle if supported
This commit is contained in:
@@ -104,6 +104,9 @@ struct ValueMask {
|
||||
|
||||
class Value {
|
||||
public:
|
||||
/*
|
||||
todo : this should be intrusive and be part of Instr instead.
|
||||
*/
|
||||
typedef struct Use_s {
|
||||
Instr* instr;
|
||||
Use_s* prev;
|
||||
@@ -128,17 +131,16 @@ class Value {
|
||||
TypeName type;
|
||||
|
||||
uint32_t flags;
|
||||
RegAssignment reg;
|
||||
ConstantValue constant;
|
||||
|
||||
Instr* def;
|
||||
Use* use_head;
|
||||
// NOTE: for performance reasons this is not maintained during construction.
|
||||
Instr* last_use;
|
||||
Value* local_slot;
|
||||
|
||||
// TODO(benvanik): remove to shrink size.
|
||||
void* tag;
|
||||
RegAssignment reg;
|
||||
union {
|
||||
Value* local_slot;
|
||||
ConstantValue constant;
|
||||
};
|
||||
|
||||
Use* AddUse(Arena* arena, Instr* instr);
|
||||
void RemoveUse(Use* use);
|
||||
@@ -209,7 +211,20 @@ class Value {
|
||||
flags = other->flags;
|
||||
constant.v128 = other->constant.v128;
|
||||
}
|
||||
bool HasLocalSlot() const {
|
||||
return !(flags & VALUE_IS_CONSTANT) && local_slot;
|
||||
}
|
||||
void SetLocalSlot(Value* lslot) {
|
||||
assert(!(flags & VALUE_IS_CONSTANT));
|
||||
local_slot = lslot;
|
||||
}
|
||||
|
||||
Value* GetLocalSlot() {
|
||||
return (flags & VALUE_IS_CONSTANT) ? nullptr : local_slot;
|
||||
}
|
||||
const Value* GetLocalSlot() const {
|
||||
return (flags & VALUE_IS_CONSTANT) ? nullptr : local_slot;
|
||||
}
|
||||
inline bool IsConstant() const { return !!(flags & VALUE_IS_CONSTANT); }
|
||||
bool IsConstantTrue() const {
|
||||
if (type == VEC128_TYPE) {
|
||||
@@ -555,7 +570,10 @@ class Value {
|
||||
void Shr(Value* other);
|
||||
void Sha(Value* other);
|
||||
void RotateLeft(Value* other);
|
||||
void Insert(Value* index, Value* part, TypeName type);
|
||||
void Extract(Value* vec, Value* index);
|
||||
void Permute(Value* src1, Value* src2, TypeName type);
|
||||
void Swizzle(uint32_t mask, TypeName type);
|
||||
void Select(Value* other, Value* ctrl);
|
||||
void Splat(Value* other);
|
||||
void VectorCompareEQ(Value* other, TypeName type);
|
||||
@@ -575,6 +593,8 @@ class Value {
|
||||
void VectorAverage(Value* other, TypeName type, bool is_unsigned,
|
||||
bool saturate);
|
||||
void ByteSwap();
|
||||
void DenormalFlush();
|
||||
|
||||
void CountLeadingZeros(const Value* other);
|
||||
bool Compare(Opcode opcode, Value* other);
|
||||
hir::Instr* GetDefSkipAssigns();
|
||||
|
||||
Reference in New Issue
Block a user