Merge pull request #462 from lioncash/undef
{common/fp, backend/x64}: Prevent undefined left shifts where applicable
This commit is contained in:
commit
0de471fc1a
2 changed files with 4 additions and 3 deletions
|
@ -3838,7 +3838,7 @@ static bool VectorSignedSaturatedShiftLeft(VectorArray<T>& dst, const VectorArra
|
|||
dst[i] = saturate(element);
|
||||
qc_flag = true;
|
||||
} else {
|
||||
const T shifted = element << shift;
|
||||
const T shifted = T(U(element) << shift);
|
||||
|
||||
if ((shifted >> shift) != element) {
|
||||
dst[i] = saturate(element);
|
||||
|
|
|
@ -48,8 +48,9 @@ FPT FPRecipExponent(FPT op, FPCR fpcr, FPSR& fpsr) {
|
|||
}
|
||||
|
||||
// Infinities and normals
|
||||
const auto negated_exponent = (~exponent << FPInfo<FPT>::explicit_mantissa_width) & FPInfo<FPT>::exponent_mask;
|
||||
return FPT(sign_bits | negated_exponent);
|
||||
const FPT negated_exponent = FPT(~exponent);
|
||||
const FPT adjusted_exponent = FPT(negated_exponent << FPInfo<FPT>::explicit_mantissa_width) & FPInfo<FPT>::exponent_mask;
|
||||
return FPT(sign_bits | adjusted_exponent);
|
||||
}
|
||||
|
||||
template u16 FPRecipExponent<u16>(u16 op, FPCR fpcr, FPSR& fpsr);
|
||||
|
|
Loading…
Reference in a new issue