[arm][simulator] Fix vmin implementation

vmin should return the default NaN if any input is a NaN (regardless of
the default NaN mode), so turn the default NaN mode, canonicalize, then
reset it.

Bug: v8:10835
Change-Id: Ia83c9fbcbc2070029f35bbd07cbb4abf857b594d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2416399
Reviewed-by: Bill Budge <bbudge@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70005}
This commit is contained in:
Ng Zhi An 2020-09-17 14:18:46 -07:00 committed by Commit Bot
parent e95e3f1252
commit 75b7db7470

View File

@ -4610,9 +4610,13 @@ void Simulator::DecodeSpecialCondition(Instruction* instr) {
} else {
// vmin/vmax.f32 Qd, Qm, Qn.
bool min = instr->Bit(21) == 1;
bool saved = FPSCR_default_NaN_mode_;
FPSCR_default_NaN_mode_ = true;
for (int i = 0; i < 4; i++) {
src1[i] = MinMax(src1[i], src2[i], min);
// vmin returns default NaN if any input is NaN.
src1[i] = canonicalizeNaN(MinMax(src1[i], src2[i], min));
}
FPSCR_default_NaN_mode_ = saved;
}
set_neon_register(Vd, src1);
} else {