target/ppc: 6xx: Machine Check exception cleanup
[qemu/kevin.git] / target / mips / msa.c
blob61f1a9a5936b09f35dcc0c263a07fc9564d88958
1 /*
2 * MIPS SIMD Architecture Module Instruction emulation helpers for QEMU.
4 * Copyright (c) 2014 Imagination Technologies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
21 #include "cpu.h"
22 #include "internal.h"
23 #include "fpu/softfloat.h"
24 #include "fpu_helper.h"
26 void msa_reset(CPUMIPSState *env)
28 if (!ase_msa_available(env)) {
29 return;
32 #ifdef CONFIG_USER_ONLY
33 /* MSA access enabled */
34 env->CP0_Config5 |= 1 << CP0C5_MSAEn;
35 env->CP0_Status |= (1 << CP0St_CU1) | (1 << CP0St_FR);
36 #endif
39 * MSA CSR:
40 * - non-signaling floating point exception mode off (NX bit is 0)
41 * - Cause, Enables, and Flags are all 0
42 * - round to nearest / ties to even (RM bits are 0)
44 env->active_tc.msacsr = 0;
46 restore_msa_fp_status(env);
48 /* tininess detected after rounding.*/
49 set_float_detect_tininess(float_tininess_after_rounding,
50 &env->active_tc.msa_fp_status);
52 /* clear float_status exception flags */
53 set_float_exception_flags(0, &env->active_tc.msa_fp_status);
55 /* clear float_status nan mode */
56 set_default_nan_mode(0, &env->active_tc.msa_fp_status);
58 /* set proper signanling bit meaning ("1" means "quiet") */
59 set_snan_bit_is_one(0, &env->active_tc.msa_fp_status);