bool GlobOpt::Simd128DoTypeSpecLoadStore(IR::Instr *instr, const Value *src1Val, const Value *src2Val, const Value *dstVal, const ThreadContext::SimdFuncSignature *simdFuncSignature) { IR::Opnd *baseOpnd = nullptr, *indexOpnd = nullptr, *valueOpnd = nullptr; IR::Opnd *src, *dst; bool doTypeSpec = true; // value = Ld [arr + index] // [arr + index] = St value src = instr->GetSrc1(); dst = instr->GetDst(); Assert(dst && src && !instr->GetSrc2()); if (Js::IsSimd128Load(instr->m_opcode)) { Assert(src->IsIndirOpnd()); baseOpnd = instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd(); indexOpnd = instr->GetSrc1()->AsIndirOpnd()->GetIndexOpnd(); valueOpnd = instr->GetDst(); } else if (Js::IsSimd128Store(instr->m_opcode)) { Assert(dst->IsIndirOpnd()); baseOpnd = instr->GetDst()->AsIndirOpnd()->GetBaseOpnd(); indexOpnd = instr->GetDst()->AsIndirOpnd()->GetIndexOpnd(); valueOpnd = instr->GetSrc1(); // St(arr, index, value). Make sure value can be Simd128 type-spec'd doTypeSpec = doTypeSpec && Simd128CanTypeSpecOpnd(FindValue(valueOpnd->AsRegOpnd()->m_sym)->GetValueInfo()->Type(), simdFuncSignature->args[2]); } else { Assert(UNREACHED); } // array and index operands should have been type-specialized in OptArraySrc: ValueTypes should be definite at this point. If not, don't type-spec. // We can be in a loop prepass, where opnd ValueInfo is not set yet. Get the ValueInfo from the Value Table instead. ValueType baseOpndType = FindValue(baseOpnd->AsRegOpnd()->m_sym)->GetValueInfo()->Type(); if (IsLoopPrePass()) { doTypeSpec = doTypeSpec && (baseOpndType.IsObject() && baseOpndType.IsTypedArray()); // indexOpnd might be missing if loading from [0] if (indexOpnd != nullptr) { ValueType indexOpndType = FindValue(indexOpnd->AsRegOpnd()->m_sym)->GetValueInfo()->Type(); doTypeSpec = doTypeSpec && indexOpndType.IsLikelyInt(); } } else { doTypeSpec = doTypeSpec && (baseOpndType.IsObject() && baseOpndType.IsTypedArray()); if (indexOpnd != nullptr) { ValueType indexOpndType = FindValue(indexOpnd->AsRegOpnd()->m_sym)->GetValueInfo()->Type(); doTypeSpec = doTypeSpec && indexOpndType.IsInt(); } } return doTypeSpec; }
bool IntBounds::RequiresIntBoundedValueInfo(const ValueType valueType) const { Assert(valueType.IsLikelyInt()); return !valueType.IsInt() || RequiresIntBoundedValueInfo(); }