2003-11-23 15:55:54 +01:00
|
|
|
/*
|
2005-07-02 22:59:34 +02:00
|
|
|
* PowerPC emulation micro-operations for qemu.
|
2007-09-16 23:08:06 +02:00
|
|
|
*
|
2007-03-07 09:32:30 +01:00
|
|
|
* Copyright (c) 2003-2007 Jocelyn Mayer
|
2003-11-23 15:55:54 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2004-04-12 22:39:29 +02:00
|
|
|
//#define DEBUG_OP
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
#include "config.h"
|
|
|
|
#include "exec.h"
|
2007-03-07 09:32:30 +01:00
|
|
|
#include "op_helper.h"
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2003-11-23 17:58:08 +01:00
|
|
|
#define REG 0
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 1
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 2
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 3
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 4
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 5
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 6
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 7
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 8
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 9
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 10
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 11
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 12
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 13
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 14
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 15
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 16
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 17
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 18
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 19
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 20
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 21
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 22
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 23
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 24
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 25
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 26
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 27
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 28
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 29
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 30
|
|
|
|
#include "op_template.h"
|
|
|
|
|
|
|
|
#define REG 31
|
|
|
|
#include "op_template.h"
|
|
|
|
|
2007-04-16 09:10:48 +02:00
|
|
|
|
|
|
|
void OPPROTO op_print_mem_EA (void)
|
|
|
|
{
|
|
|
|
do_print_mem_EA(T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2005-07-02 22:59:34 +02:00
|
|
|
/* PowerPC state maintenance operations */
|
2003-11-23 15:55:54 +01:00
|
|
|
/* set_Rc0 */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_set_Rc0 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 11:51:40 +02:00
|
|
|
env->crf[0] = T0 | xer_so;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 15:57:11 +01:00
|
|
|
/* Set Rc1 (for floating point arithmetic) */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_set_Rc1 (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->crf[1] = env->fpscr[7];
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* Constants load */
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_reset_T0 (void)
|
|
|
|
{
|
|
|
|
T0 = 0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_set_T0 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (uint32_t)PARAM1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_set_T0_64 (void)
|
|
|
|
{
|
|
|
|
T0 = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_set_T1 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T1 = (uint32_t)PARAM1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_set_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1 = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
#if 0 // unused
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_set_T2 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T2 = PARAM1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-07 09:32:30 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_move_T1_T0 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
T1 = T0;
|
|
|
|
RETURN();
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_move_T2_T0 (void)
|
|
|
|
{
|
|
|
|
T2 = T0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
/* Generate exceptions */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_raise_exception_err (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
do_raise_exception_err(PARAM1, PARAM2);
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_update_nip (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
env->nip = (uint32_t)PARAM1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_update_nip_64 (void)
|
|
|
|
{
|
|
|
|
env->nip = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_debug (void)
|
2006-05-22 23:50:20 +02:00
|
|
|
{
|
|
|
|
do_raise_exception(EXCP_DEBUG);
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_exit_tb (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
EXIT_TB();
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
/* Load/store special registers */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_cr (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
do_load_cr();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_cr (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
do_store_cr(PARAM1);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_load_cro (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
T0 = env->crf[PARAM1];
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_store_cro (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
env->crf[PARAM1] = T0;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_xer_cr (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 = (xer_so << 3) | (xer_ov << 2) | (xer_ca << 1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_clear_xer_ov (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
xer_so = 0;
|
|
|
|
xer_ov = 0;
|
2007-03-22 23:17:08 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_clear_xer_ca (void)
|
2007-03-22 23:17:08 +01:00
|
|
|
{
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_xer_bc (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
T1 = xer_bc;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_store_xer_bc (void)
|
|
|
|
{
|
|
|
|
xer_bc = T0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_xer (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
do_load_xer();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_xer (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
do_store_xer();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-30 03:18:26 +02:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_store_pri (void)
|
|
|
|
{
|
|
|
|
do_store_pri(PARAM1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
/* Segment registers load and store */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_sr (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = env->sr[T1];
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_sr (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
|
|
|
do_store_sr(env, T1, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_sdr1 (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = env->sdr1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_sdr1 (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
|
|
|
do_store_sdr1(env, T0);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
void OPPROTO op_load_asr (void)
|
|
|
|
{
|
|
|
|
T0 = env->asr;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_asr (void)
|
|
|
|
{
|
|
|
|
ppc_store_asr(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_msr (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-02 22:59:34 +02:00
|
|
|
T0 = do_load_msr(env);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_msr (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-02 22:59:34 +02:00
|
|
|
do_store_msr(env, T0);
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
|
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
void OPPROTO op_store_msr_32 (void)
|
|
|
|
{
|
|
|
|
ppc_store_msr_32(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
2007-03-07 09:32:30 +01:00
|
|
|
#endif
|
2004-01-04 23:58:38 +01:00
|
|
|
|
|
|
|
/* SPR */
|
2007-04-16 09:10:48 +02:00
|
|
|
void OPPROTO op_load_spr (void)
|
|
|
|
{
|
|
|
|
T0 = env->spr[PARAM1];
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_spr (void)
|
|
|
|
{
|
|
|
|
env->spr[PARAM1] = T0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_load_dump_spr (void)
|
|
|
|
{
|
|
|
|
T0 = ppc_load_dump_spr(PARAM1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_dump_spr (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-04-16 09:10:48 +02:00
|
|
|
ppc_store_dump_spr(PARAM1, T0);
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-04-16 09:10:48 +02:00
|
|
|
void OPPROTO op_mask_spr (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-04-16 09:10:48 +02:00
|
|
|
env->spr[PARAM1] &= ~T0;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_lr (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = env->lr;
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_lr (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->lr = T0;
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_ctr (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = env->ctr;
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_ctr (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->ctr = T0;
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_tbl (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = cpu_ppc_load_tbl(env);
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_tbu (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = cpu_ppc_load_tbu(env);
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-30 02:38:38 +02:00
|
|
|
void OPPROTO op_load_atbl (void)
|
|
|
|
{
|
|
|
|
T0 = cpu_ppc_load_atbl(env);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_load_atbu (void)
|
|
|
|
{
|
|
|
|
T0 = cpu_ppc_load_atbu(env);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_tbl (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
cpu_ppc_store_tbl(env, T0);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_tbu (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
cpu_ppc_store_tbu(env, T0);
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-30 02:38:38 +02:00
|
|
|
void OPPROTO op_store_atbl (void)
|
|
|
|
{
|
|
|
|
cpu_ppc_store_atbl(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_atbu (void)
|
|
|
|
{
|
|
|
|
cpu_ppc_store_atbu(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_decr (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = cpu_ppc_load_decr(env);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2004-05-21 14:59:32 +02:00
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_decr (void)
|
2004-05-21 14:59:32 +02:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
cpu_ppc_store_decr(env, T0);
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_ibat (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = env->IBAT[PARAM1][PARAM2];
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_store_ibatu (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2005-07-02 22:59:34 +02:00
|
|
|
do_store_ibatu(env, PARAM1, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_store_ibatl (void)
|
2005-07-02 22:59:34 +02:00
|
|
|
{
|
|
|
|
#if 1
|
|
|
|
env->IBAT[1][PARAM1] = T0;
|
|
|
|
#else
|
|
|
|
do_store_ibatl(env, PARAM1, T0);
|
|
|
|
#endif
|
|
|
|
RETURN();
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_dbat (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = env->DBAT[PARAM1][PARAM2];
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_store_dbatu (void)
|
2005-07-02 22:59:34 +02:00
|
|
|
{
|
|
|
|
do_store_dbatu(env, PARAM1, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_store_dbatl (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
2005-07-02 22:59:34 +02:00
|
|
|
#if 1
|
|
|
|
env->DBAT[1][PARAM1] = T0;
|
|
|
|
#else
|
|
|
|
do_store_dbatl(env, PARAM1, T0);
|
|
|
|
#endif
|
|
|
|
RETURN();
|
2004-01-04 23:58:38 +01:00
|
|
|
}
|
2007-03-07 09:32:30 +01:00
|
|
|
#endif /* !defined(CONFIG_USER_ONLY) */
|
2004-01-04 23:58:38 +01:00
|
|
|
|
2004-01-04 15:57:11 +01:00
|
|
|
/* FPSCR */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_load_fpscr (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
do_load_fpscr();
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_store_fpscr (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
do_store_fpscr(PARAM1);
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_reset_scrfx (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->fpscr[7] &= ~0x8;
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* crf operations */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_getbit_T0 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = (T0 >> PARAM1) & 1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_getbit_T1 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T1 = (T1 >> PARAM1) & 1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_setcrfbit (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T1 = (T1 & PARAM1) | (T0 << PARAM2);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Branch */
|
2007-09-17 10:21:54 +02:00
|
|
|
#define EIP env->nip
|
2004-01-04 23:58:38 +01:00
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_setlr (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->lr = (uint32_t)PARAM1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
void OPPROTO op_setlr_64 (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->lr = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_goto_tb0 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2005-10-30 22:39:19 +01:00
|
|
|
GOTO_TB(op_goto_tb0, PARAM1, 0);
|
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_goto_tb1 (void)
|
2005-10-30 22:39:19 +01:00
|
|
|
{
|
|
|
|
GOTO_TB(op_goto_tb1, PARAM1, 1);
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_b_T1 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->nip = (uint32_t)(T1 & ~3);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
void OPPROTO op_b_T1_64 (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->nip = (uint64_t)(T1 & ~3);
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_jz_T0 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2005-10-30 22:39:19 +01:00
|
|
|
if (!T0)
|
|
|
|
GOTO_LABEL_PARAM(1);
|
2004-02-21 16:35:00 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_btest_T1 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
|
|
|
if (T0) {
|
2007-09-17 10:21:54 +02:00
|
|
|
env->nip = (uint32_t)(T1 & ~3);
|
2004-02-21 16:35:00 +01:00
|
|
|
} else {
|
2007-09-17 10:21:54 +02:00
|
|
|
env->nip = (uint32_t)PARAM1;
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
void OPPROTO op_btest_T1_64 (void)
|
|
|
|
{
|
|
|
|
if (T0) {
|
2007-09-17 10:21:54 +02:00
|
|
|
env->nip = (uint64_t)(T1 & ~3);
|
2007-03-17 15:02:15 +01:00
|
|
|
} else {
|
2007-09-17 10:21:54 +02:00
|
|
|
env->nip = ((uint64_t)PARAM1 << 32) | (uint64_t)PARAM2;
|
2007-03-17 15:02:15 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_movl_T1_ctr (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T1 = env->ctr;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_movl_T1_lr (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T1 = env->lr;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tests with result in T0 */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_test_ctr (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = (uint32_t)env->ctr;
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2004-02-21 16:35:00 +01:00
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_test_ctr_64 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = (uint64_t)env->ctr;
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void OPPROTO op_test_ctr_true (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint32_t)env->ctr != 0 && (T0 & PARAM1) != 0);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_test_ctr_true_64 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint64_t)env->ctr != 0 && (T0 & PARAM1) != 0);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2004-02-21 16:35:00 +01:00
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_test_ctr_false (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint32_t)env->ctr != 0 && (T0 & PARAM1) == 0);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_test_ctr_false_64 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint64_t)env->ctr != 0 && (T0 & PARAM1) == 0);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void OPPROTO op_test_ctrz (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint32_t)env->ctr == 0);
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_test_ctrz_64 (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint64_t)env->ctr == 0);
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void OPPROTO op_test_ctrz_true (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint32_t)env->ctr == 0 && (T0 & PARAM1) != 0);
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_test_ctrz_true_64 (void)
|
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint64_t)env->ctr == 0 && (T0 & PARAM1) != 0);
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
2004-02-21 16:35:00 +01:00
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_test_ctrz_false (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint32_t)env->ctr == 0 && (T0 & PARAM1) == 0);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_test_ctrz_false_64 (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((uint64_t)env->ctr == 0 && (T0 & PARAM1) == 0);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2004-02-21 16:35:00 +01:00
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_test_true (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = (T0 & PARAM1);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
|
|
|
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_test_false (void)
|
2004-02-21 16:35:00 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 = ((T0 & PARAM1) == 0);
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2004-02-21 16:35:00 +01:00
|
|
|
}
|
2003-11-23 15:55:54 +01:00
|
|
|
|
|
|
|
/* CTR maintenance */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_dec_ctr (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
env->ctr--;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Integer arithmetic ***/
|
|
|
|
/* add */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_add (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 += T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_check_addo (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely(!(((uint32_t)T2 ^ (uint32_t)T1 ^ UINT32_MAX) &
|
|
|
|
((uint32_t)T2 ^ (uint32_t)T0) & (1UL << 31)))) {
|
|
|
|
xer_ov = 0;
|
|
|
|
} else {
|
|
|
|
xer_ov = 1;
|
2007-09-17 11:51:40 +02:00
|
|
|
xer_so = 1;
|
2007-03-17 15:02:15 +01:00
|
|
|
}
|
2007-03-22 23:17:08 +01:00
|
|
|
RETURN();
|
2003-11-23 15:55:54 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_check_addo_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely(!(((uint64_t)T2 ^ (uint64_t)T1 ^ UINT64_MAX) &
|
2007-03-21 09:21:02 +01:00
|
|
|
((uint64_t)T2 ^ (uint64_t)T0) & (1ULL << 63)))) {
|
2007-03-17 15:02:15 +01:00
|
|
|
xer_ov = 0;
|
2003-11-23 15:55:54 +01:00
|
|
|
} else {
|
2007-03-17 15:02:15 +01:00
|
|
|
xer_ov = 1;
|
2007-09-17 11:51:40 +02:00
|
|
|
xer_so = 1;
|
2007-03-17 15:02:15 +01:00
|
|
|
}
|
2007-03-22 23:17:08 +01:00
|
|
|
RETURN();
|
2007-03-17 15:02:15 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* add carrying */
|
|
|
|
void OPPROTO op_check_addc (void)
|
|
|
|
{
|
|
|
|
if (likely((uint32_t)T0 >= (uint32_t)T2)) {
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 0;
|
2007-03-17 15:02:15 +01:00
|
|
|
} else {
|
|
|
|
xer_ca = 1;
|
2003-11-23 15:55:54 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_check_addc_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely((uint64_t)T0 >= (uint64_t)T2)) {
|
|
|
|
xer_ca = 0;
|
|
|
|
} else {
|
|
|
|
xer_ca = 1;
|
|
|
|
}
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
|
|
|
/* add extended */
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_adde (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_adde();
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
2003-11-23 15:55:54 +01:00
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_adde_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
do_adde_64();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
|
|
|
/* add immediate */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_addi (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 += (int32_t)PARAM1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
/* add to minus one extended */
|
|
|
|
void OPPROTO op_add_me (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 += xer_ca + (-1);
|
|
|
|
if (likely((uint32_t)T1 != 0))
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_add_me_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 += xer_ca + (-1);
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely((uint64_t)T1 != 0))
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 1;
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_addmeo (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_addmeo();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_addmeo_64 (void)
|
|
|
|
{
|
|
|
|
do_addmeo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* add to zero extended */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_add_ze (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 += xer_ca;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
/* divide word */
|
|
|
|
void OPPROTO op_divw (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (unlikely(((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) ||
|
|
|
|
(int32_t)T1 == 0)) {
|
|
|
|
T0 = (int32_t)((-1) * ((uint32_t)T0 >> 31));
|
|
|
|
} else {
|
|
|
|
T0 = (int32_t)T0 / (int32_t)T1;
|
|
|
|
}
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_divd (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (unlikely(((int64_t)T0 == INT64_MIN && (int64_t)T1 == -1) ||
|
|
|
|
(int64_t)T1 == 0)) {
|
|
|
|
T0 = (int64_t)((-1ULL) * ((uint64_t)T0 >> 63));
|
2003-11-23 15:55:54 +01:00
|
|
|
} else {
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (int64_t)T0 / (int64_t)T1;
|
2003-11-23 15:55:54 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_divwo (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_divwo();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_divdo (void)
|
|
|
|
{
|
|
|
|
do_divdo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* divide word unsigned */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_divwu (void)
|
|
|
|
{
|
|
|
|
if (unlikely(T1 == 0)) {
|
|
|
|
T0 = 0;
|
|
|
|
} else {
|
|
|
|
T0 = (uint32_t)T0 / (uint32_t)T1;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_divdu (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (unlikely(T1 == 0)) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0;
|
|
|
|
} else {
|
|
|
|
T0 /= T1;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_divwuo (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_divwuo();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_divduo (void)
|
|
|
|
{
|
|
|
|
do_divduo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* multiply high word */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_mulhw (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = ((int64_t)((int32_t)T0) * (int64_t)((int32_t)T1)) >> 32;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_mulhd (void)
|
|
|
|
{
|
|
|
|
uint64_t tl, th;
|
|
|
|
|
|
|
|
do_imul64(&tl, &th);
|
|
|
|
T0 = th;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* multiply high word unsigned */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_mulhwu (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1) >> 32;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_mulhdu (void)
|
|
|
|
{
|
|
|
|
uint64_t tl, th;
|
|
|
|
|
|
|
|
do_mul64(&tl, &th);
|
|
|
|
T0 = th;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* multiply low immediate */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_mulli (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = ((int32_t)T0 * (int32_t)PARAM1);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* multiply low word */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_mullw (void)
|
2007-03-17 15:02:15 +01:00
|
|
|
{
|
|
|
|
T0 = (int32_t)(T0 * T1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_mulld (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 *= T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_mullwo (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_mullwo();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_mulldo (void)
|
|
|
|
{
|
|
|
|
do_mulldo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* negate */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_neg (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely(T0 != INT32_MIN)) {
|
|
|
|
T0 = -(int32_t)T0;
|
2003-11-23 15:55:54 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_neg_64 (void)
|
|
|
|
{
|
|
|
|
if (likely(T0 != INT64_MIN)) {
|
|
|
|
T0 = -(int64_t)T0;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_nego (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_nego();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_nego_64 (void)
|
|
|
|
{
|
|
|
|
do_nego_64();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-06-23 18:02:43 +02:00
|
|
|
/* subtract from */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_subf (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 = T1 - T0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_check_subfo (void)
|
|
|
|
{
|
|
|
|
if (likely(!(((uint32_t)(~T2) ^ (uint32_t)T1 ^ UINT32_MAX) &
|
|
|
|
((uint32_t)(~T2) ^ (uint32_t)T0) & (1UL << 31)))) {
|
|
|
|
xer_ov = 0;
|
|
|
|
} else {
|
|
|
|
xer_ov = 1;
|
2007-09-17 11:51:40 +02:00
|
|
|
xer_so = 1;
|
2007-03-17 15:02:15 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_check_subfo_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely(!(((uint64_t)(~T2) ^ (uint64_t)T1 ^ UINT64_MAX) &
|
|
|
|
((uint64_t)(~T2) ^ (uint64_t)T0) & (1ULL << 63)))) {
|
|
|
|
xer_ov = 0;
|
|
|
|
} else {
|
|
|
|
xer_ov = 1;
|
2007-09-17 11:51:40 +02:00
|
|
|
xer_so = 1;
|
2007-03-17 15:02:15 +01:00
|
|
|
}
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-06-23 18:02:43 +02:00
|
|
|
/* subtract from carrying */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_check_subfc (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely((uint32_t)T0 > (uint32_t)T1)) {
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 0;
|
2007-03-17 15:02:15 +01:00
|
|
|
} else {
|
|
|
|
xer_ca = 1;
|
2003-11-23 15:55:54 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_check_subfc_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely((uint64_t)T0 > (uint64_t)T1)) {
|
|
|
|
xer_ca = 0;
|
|
|
|
} else {
|
|
|
|
xer_ca = 1;
|
|
|
|
}
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-06-23 18:02:43 +02:00
|
|
|
/* subtract from extended */
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_subfe (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_subfe();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_subfe_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
do_subfe_64();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-06-23 18:02:43 +02:00
|
|
|
/* subtract from immediate carrying */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_subfic (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-04-07 13:48:04 +02:00
|
|
|
T0 = (int32_t)PARAM1 + ~T0 + 1;
|
2007-03-17 15:02:15 +01:00
|
|
|
if ((uint32_t)T0 <= (uint32_t)PARAM1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 1;
|
|
|
|
} else {
|
|
|
|
xer_ca = 0;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_subfic_64 (void)
|
|
|
|
{
|
|
|
|
T0 = PARAM1 + ~T0 + 1;
|
|
|
|
if ((uint64_t)T0 <= (uint64_t)PARAM1) {
|
|
|
|
xer_ca = 1;
|
|
|
|
} else {
|
|
|
|
xer_ca = 0;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-06-23 18:02:43 +02:00
|
|
|
/* subtract from minus one extended */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_subfme (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 = ~T0 + xer_ca - 1;
|
2007-03-17 15:02:15 +01:00
|
|
|
if (likely((uint32_t)T0 != (uint32_t)-1))
|
|
|
|
xer_ca = 1;
|
|
|
|
RETURN();
|
|
|
|
}
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_subfme_64 (void)
|
|
|
|
{
|
|
|
|
T0 = ~T0 + xer_ca - 1;
|
|
|
|
if (likely((uint64_t)T0 != (uint64_t)-1))
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 1;
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_subfmeo (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_subfmeo();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_subfmeo_64 (void)
|
|
|
|
{
|
|
|
|
do_subfmeo_64();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-06-23 18:02:43 +02:00
|
|
|
/* subtract from zero extended */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_subfze (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T1 = ~T0;
|
|
|
|
T0 = T1 + xer_ca;
|
2007-03-17 15:02:15 +01:00
|
|
|
if ((uint32_t)T0 < (uint32_t)T1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 1;
|
|
|
|
} else {
|
|
|
|
xer_ca = 0;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_subfze_64 (void)
|
|
|
|
{
|
|
|
|
T1 = ~T0;
|
|
|
|
T0 = T1 + xer_ca;
|
|
|
|
if ((uint64_t)T0 < (uint64_t)T1) {
|
|
|
|
xer_ca = 1;
|
|
|
|
} else {
|
|
|
|
xer_ca = 0;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_subfzeo (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_subfzeo();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_subfzeo_64 (void)
|
|
|
|
{
|
|
|
|
do_subfzeo_64();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/*** Integer comparison ***/
|
|
|
|
/* compare */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_cmp (void)
|
|
|
|
{
|
|
|
|
if ((int32_t)T0 < (int32_t)T1) {
|
|
|
|
T0 = 0x08;
|
|
|
|
} else if ((int32_t)T0 > (int32_t)T1) {
|
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_cmp_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if ((int64_t)T0 < (int64_t)T1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x08;
|
2007-03-17 15:02:15 +01:00
|
|
|
} else if ((int64_t)T0 > (int64_t)T1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
|
|
|
/* compare immediate */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_cmpi (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if ((int32_t)T0 < (int32_t)PARAM1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x08;
|
2007-03-17 15:02:15 +01:00
|
|
|
} else if ((int32_t)T0 > (int32_t)PARAM1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_cmpi_64 (void)
|
|
|
|
{
|
|
|
|
if ((int64_t)T0 < (int64_t)((int32_t)PARAM1)) {
|
|
|
|
T0 = 0x08;
|
|
|
|
} else if ((int64_t)T0 > (int64_t)((int32_t)PARAM1)) {
|
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* compare logical */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_cmpl (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if ((uint32_t)T0 < (uint32_t)T1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x08;
|
2007-03-17 15:02:15 +01:00
|
|
|
} else if ((uint32_t)T0 > (uint32_t)T1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_cmpl_64 (void)
|
|
|
|
{
|
|
|
|
if ((uint64_t)T0 < (uint64_t)T1) {
|
|
|
|
T0 = 0x08;
|
|
|
|
} else if ((uint64_t)T0 > (uint64_t)T1) {
|
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* compare logical immediate */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_cmpli (void)
|
|
|
|
{
|
|
|
|
if ((uint32_t)T0 < (uint32_t)PARAM1) {
|
|
|
|
T0 = 0x08;
|
|
|
|
} else if ((uint32_t)T0 > (uint32_t)PARAM1) {
|
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_cmpli_64 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if ((uint64_t)T0 < (uint64_t)PARAM1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x08;
|
2007-03-17 15:02:15 +01:00
|
|
|
} else if ((uint64_t)T0 > (uint64_t)PARAM1) {
|
2003-11-23 15:55:54 +01:00
|
|
|
T0 = 0x04;
|
|
|
|
} else {
|
|
|
|
T0 = 0x02;
|
|
|
|
}
|
2007-09-17 11:51:40 +02:00
|
|
|
T0 |= xer_so;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void OPPROTO op_isel (void)
|
|
|
|
{
|
|
|
|
if (T0)
|
|
|
|
T0 = T1;
|
|
|
|
else
|
|
|
|
T0 = T2;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_popcntb (void)
|
|
|
|
{
|
|
|
|
do_popcntb();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_popcntb_64 (void)
|
|
|
|
{
|
|
|
|
do_popcntb_64();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
|
|
|
/*** Integer logical ***/
|
|
|
|
/* and */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_and (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 &= T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* andc */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_andc (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 &= ~T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* andi. */
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_andi_T0 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 &= PARAM1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_andi_T1 (void)
|
|
|
|
{
|
|
|
|
T1 &= PARAM1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-27 03:32:19 +02:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_andi_T0_64 (void)
|
|
|
|
{
|
|
|
|
T0 &= ((uint64_t)PARAM1 << 32) | PARAM2;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_andi_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1 &= ((uint64_t)PARAM1 << 32) | PARAM2;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* count leading zero */
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_cntlzw (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-20 23:11:31 +01:00
|
|
|
T0 = _do_cntlzw(T0);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_cntlzd (void)
|
|
|
|
{
|
2007-03-20 23:11:31 +01:00
|
|
|
T0 = _do_cntlzd(T0);
|
2007-03-17 15:02:15 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* eqv */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_eqv (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 = ~(T0 ^ T1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* extend sign byte */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_extsb (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
T0 = (int64_t)((int8_t)T0);
|
|
|
|
#else
|
|
|
|
T0 = (int32_t)((int8_t)T0);
|
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* extend sign half word */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_extsh (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
T0 = (int64_t)((int16_t)T0);
|
|
|
|
#else
|
|
|
|
T0 = (int32_t)((int16_t)T0);
|
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined (TARGET_PPC64)
|
|
|
|
void OPPROTO op_extsw (void)
|
|
|
|
{
|
|
|
|
T0 = (int64_t)((int32_t)T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* nand */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_nand (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 = ~(T0 & T1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nor */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_nor (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 = ~(T0 | T1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* or */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_or (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 |= T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* orc */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_orc (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 |= ~T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ori */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_ori (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 |= PARAM1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* xor */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_xor (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
T0 ^= T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* xori */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_xori (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-09-17 10:21:54 +02:00
|
|
|
T0 ^= PARAM1;
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Integer rotate ***/
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_rotl32_T0_T1 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
T0 = rotl32(T0, T1 & 0x1F);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_rotli32_T0 (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
T0 = rotl32(T0, PARAM1);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-22 23:41:50 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_rotl64_T0_T1 (void)
|
|
|
|
{
|
|
|
|
T0 = rotl64(T0, T1 & 0x3F);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_rotli64_T0 (void)
|
|
|
|
{
|
|
|
|
T0 = rotl64(T0, PARAM1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/*** Integer shift ***/
|
|
|
|
/* shift left word */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_slw (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
if (T1 & 0x20) {
|
|
|
|
T0 = 0;
|
2007-03-17 15:02:15 +01:00
|
|
|
} else {
|
|
|
|
T0 = (uint32_t)(T0 << T1);
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_sld (void)
|
|
|
|
{
|
|
|
|
if (T1 & 0x40) {
|
|
|
|
T0 = 0;
|
2003-11-23 15:55:54 +01:00
|
|
|
} else {
|
|
|
|
T0 = T0 << T1;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
|
|
|
/* shift right algebraic word */
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_sraw (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_sraw();
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_srad (void)
|
|
|
|
{
|
|
|
|
do_srad();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* shift right algebraic word immediate */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_srawi (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
uint32_t mask = (uint32_t)PARAM2;
|
|
|
|
|
|
|
|
T0 = (int32_t)T0 >> PARAM1;
|
|
|
|
if ((int32_t)T1 < 0 && (T1 & mask) != 0) {
|
2003-11-23 15:55:54 +01:00
|
|
|
xer_ca = 1;
|
|
|
|
} else {
|
|
|
|
xer_ca = 0;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_sradi (void)
|
|
|
|
{
|
|
|
|
uint64_t mask = ((uint64_t)PARAM2 << 32) | (uint64_t)PARAM3;
|
|
|
|
|
|
|
|
T0 = (int64_t)T0 >> PARAM1;
|
|
|
|
if ((int64_t)T1 < 0 && ((uint64_t)T1 & mask) != 0) {
|
|
|
|
xer_ca = 1;
|
|
|
|
} else {
|
|
|
|
xer_ca = 0;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/* shift right word */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_srw (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
|
|
|
if (T1 & 0x20) {
|
|
|
|
T0 = 0;
|
|
|
|
} else {
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (uint32_t)T0 >> T1;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_srd (void)
|
|
|
|
{
|
|
|
|
if (T1 & 0x40) {
|
|
|
|
T0 = 0;
|
|
|
|
} else {
|
|
|
|
T0 = (uint64_t)T0 >> T1;
|
2003-11-23 15:55:54 +01:00
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2003-11-23 15:55:54 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_sl_T0_T1 (void)
|
|
|
|
{
|
|
|
|
T0 = T0 << T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_sli_T0 (void)
|
|
|
|
{
|
|
|
|
T0 = T0 << PARAM1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_srl_T0_T1 (void)
|
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (uint32_t)T0 >> T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_srl_T0_T1_64 (void)
|
|
|
|
{
|
|
|
|
T0 = (uint32_t)T0 >> T1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2007-03-07 09:32:30 +01:00
|
|
|
|
|
|
|
void OPPROTO op_srli_T0 (void)
|
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (uint32_t)T0 >> PARAM1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_srli_T0_64 (void)
|
|
|
|
{
|
|
|
|
T0 = (uint64_t)T0 >> PARAM1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_srli_T1 (void)
|
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
T1 = (uint32_t)T1 >> PARAM1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_srli_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1 = (uint64_t)T1 >> PARAM1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 15:55:54 +01:00
|
|
|
/*** Floating-Point arithmetic ***/
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fadd - fadd. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fadd (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
FT0 = float64_add(FT0, FT1, &env->fp_status);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fsub - fsub. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fsub (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
FT0 = float64_sub(FT0, FT1, &env->fp_status);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fmul - fmul. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fmul (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
FT0 = float64_mul(FT0, FT1, &env->fp_status);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fdiv - fdiv. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fdiv (void)
|
2003-11-23 15:55:54 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
FT0 = float64_div(FT0, FT1, &env->fp_status);
|
2003-11-23 15:55:54 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2003-11-23 17:58:08 +01:00
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fsqrt - fsqrt. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fsqrt (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_fsqrt();
|
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2007-09-30 03:11:48 +02:00
|
|
|
/* fre - fre. */
|
|
|
|
void OPPROTO op_fre (void)
|
|
|
|
{
|
|
|
|
do_fre();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fres - fres. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fres (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_fres();
|
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* frsqrte - frsqrte. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_frsqrte (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2005-03-13 18:01:22 +01:00
|
|
|
do_frsqrte();
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fsel - fsel. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fsel (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_fsel();
|
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/*** Floating-Point multiply-and-add ***/
|
|
|
|
/* fmadd - fmadd. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fmadd (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2007-03-22 23:17:08 +01:00
|
|
|
#if USE_PRECISE_EMULATION
|
|
|
|
do_fmadd();
|
|
|
|
#else
|
2007-03-07 09:32:30 +01:00
|
|
|
FT0 = float64_mul(FT0, FT1, &env->fp_status);
|
|
|
|
FT0 = float64_add(FT0, FT2, &env->fp_status);
|
2007-03-22 23:17:08 +01:00
|
|
|
#endif
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fmsub - fmsub. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fmsub (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2007-03-22 23:17:08 +01:00
|
|
|
#if USE_PRECISE_EMULATION
|
|
|
|
do_fmsub();
|
|
|
|
#else
|
2007-03-07 09:32:30 +01:00
|
|
|
FT0 = float64_mul(FT0, FT1, &env->fp_status);
|
|
|
|
FT0 = float64_sub(FT0, FT2, &env->fp_status);
|
2007-03-22 23:17:08 +01:00
|
|
|
#endif
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fnmadd - fnmadd. - fnmadds - fnmadds. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fnmadd (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-05-24 00:18:12 +02:00
|
|
|
do_fnmadd();
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fnmsub - fnmsub. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fnmsub (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-05-24 00:18:12 +02:00
|
|
|
do_fnmsub();
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/*** Floating-Point round & convert ***/
|
|
|
|
/* frsp - frsp. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_frsp (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
FT0 = float64_to_float32(FT0, &env->fp_status);
|
2004-01-04 23:58:38 +01:00
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fctiw - fctiw. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fctiw (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_fctiw();
|
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fctiwz - fctiwz. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fctiwz (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_fctiwz();
|
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2007-03-23 10:45:27 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* fcfid - fcfid. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fcfid (void)
|
2007-03-23 10:45:27 +01:00
|
|
|
{
|
|
|
|
do_fcfid();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fctid - fctid. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fctid (void)
|
2007-03-23 10:45:27 +01:00
|
|
|
{
|
|
|
|
do_fctid();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fctidz - fctidz. */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fctidz (void)
|
2007-03-23 10:45:27 +01:00
|
|
|
{
|
|
|
|
do_fctidz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-30 03:11:48 +02:00
|
|
|
void OPPROTO op_frin (void)
|
|
|
|
{
|
|
|
|
do_frin();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_friz (void)
|
|
|
|
{
|
|
|
|
do_friz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_frip (void)
|
|
|
|
{
|
|
|
|
do_frip();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_frim (void)
|
|
|
|
{
|
|
|
|
do_frim();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/*** Floating-Point compare ***/
|
|
|
|
/* fcmpu */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fcmpu (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_fcmpu();
|
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fcmpo */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fcmpo (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_fcmpo();
|
|
|
|
RETURN();
|
2004-01-04 15:57:11 +01:00
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/*** Floating-point move ***/
|
|
|
|
/* fabs */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fabs (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
FT0 = float64_abs(FT0);
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fnabs */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fnabs (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
FT0 = float64_abs(FT0);
|
|
|
|
FT0 = float64_chs(FT0);
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* fneg */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_fneg (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
FT0 = float64_chs(FT0);
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* Load and store */
|
|
|
|
#define MEMSUFFIX _raw
|
2007-03-07 09:32:30 +01:00
|
|
|
#include "op_helper.h"
|
2004-01-04 23:58:38 +01:00
|
|
|
#include "op_mem.h"
|
2004-04-12 22:39:29 +02:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2004-01-04 23:58:38 +01:00
|
|
|
#define MEMSUFFIX _user
|
2007-03-07 09:32:30 +01:00
|
|
|
#include "op_helper.h"
|
2004-01-04 23:58:38 +01:00
|
|
|
#include "op_mem.h"
|
|
|
|
#define MEMSUFFIX _kernel
|
2007-03-07 09:32:30 +01:00
|
|
|
#include "op_helper.h"
|
2004-01-04 23:58:38 +01:00
|
|
|
#include "op_mem.h"
|
|
|
|
#endif
|
|
|
|
|
2004-05-24 00:18:12 +02:00
|
|
|
/* Special op to check and maybe clear reservation */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_check_reservation (void)
|
2004-05-24 00:18:12 +02:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
if ((uint32_t)env->reserve == (uint32_t)(T0 & ~0x00000003))
|
|
|
|
env->reserve = -1;
|
2004-05-24 00:18:12 +02:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_check_reservation_64 (void)
|
|
|
|
{
|
|
|
|
if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003))
|
|
|
|
env->reserve = -1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* Return from interrupt */
|
2007-03-07 09:32:30 +01:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
void OPPROTO op_rfi (void)
|
2003-11-23 17:58:08 +01:00
|
|
|
{
|
2005-07-05 00:17:05 +02:00
|
|
|
do_rfi();
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
2007-03-23 10:45:27 +01:00
|
|
|
void OPPROTO op_rfid (void)
|
|
|
|
{
|
|
|
|
do_rfid();
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
#endif
|
2007-03-07 09:32:30 +01:00
|
|
|
#endif
|
2004-01-04 15:57:11 +01:00
|
|
|
|
2004-01-04 23:58:38 +01:00
|
|
|
/* Trap word */
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_tw (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2007-03-07 09:32:30 +01:00
|
|
|
do_tw(PARAM1);
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-17 15:02:15 +01:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_td (void)
|
|
|
|
{
|
|
|
|
do_td(PARAM1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2004-01-04 23:58:38 +01:00
|
|
|
/* tlbia */
|
2007-09-17 10:21:54 +02:00
|
|
|
void OPPROTO op_tlbia (void)
|
2004-01-04 15:57:11 +01:00
|
|
|
{
|
2004-01-04 23:58:38 +01:00
|
|
|
do_tlbia();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tlbie */
|
2007-03-17 15:02:15 +01:00
|
|
|
void OPPROTO op_tlbie (void)
|
2004-01-04 23:58:38 +01:00
|
|
|
{
|
|
|
|
do_tlbie();
|
2004-01-04 15:57:11 +01:00
|
|
|
RETURN();
|
2003-11-23 17:58:08 +01:00
|
|
|
}
|
2007-03-17 15:02:15 +01:00
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_tlbie_64 (void)
|
|
|
|
{
|
|
|
|
do_tlbie_64();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
void OPPROTO op_slbia (void)
|
|
|
|
{
|
|
|
|
do_slbia();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_slbie (void)
|
|
|
|
{
|
|
|
|
do_slbie();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
2007-03-07 09:32:30 +01:00
|
|
|
#endif
|
2005-07-02 22:59:34 +02:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
/* PowerPC 602/603/755 software TLB load instructions */
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
void OPPROTO op_6xx_tlbld (void)
|
|
|
|
{
|
|
|
|
do_load_6xx_tlb(0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_6xx_tlbli (void)
|
|
|
|
{
|
|
|
|
do_load_6xx_tlb(1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* 601 specific */
|
|
|
|
void OPPROTO op_load_601_rtcl (void)
|
|
|
|
{
|
|
|
|
T0 = cpu_ppc601_load_rtcl(env);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_load_601_rtcu (void)
|
|
|
|
{
|
|
|
|
T0 = cpu_ppc601_load_rtcu(env);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
void OPPROTO op_store_601_rtcl (void)
|
|
|
|
{
|
|
|
|
cpu_ppc601_store_rtcl(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_601_rtcu (void)
|
|
|
|
{
|
|
|
|
cpu_ppc601_store_rtcu(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_load_601_bat (void)
|
|
|
|
{
|
|
|
|
T0 = env->IBAT[PARAM1][PARAM2];
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif /* !defined(CONFIG_USER_ONLY) */
|
|
|
|
|
|
|
|
/* 601 unified BATs store.
|
|
|
|
* To avoid using specific MMU code for 601, we store BATs in
|
|
|
|
* IBAT and DBAT simultaneously, then emulate unified BATs.
|
|
|
|
*/
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
void OPPROTO op_store_601_batl (void)
|
|
|
|
{
|
|
|
|
int nr = PARAM1;
|
|
|
|
|
|
|
|
env->IBAT[1][nr] = T0;
|
|
|
|
env->DBAT[1][nr] = T0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_601_batu (void)
|
|
|
|
{
|
|
|
|
do_store_601_batu(PARAM1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif /* !defined(CONFIG_USER_ONLY) */
|
|
|
|
|
|
|
|
/* PowerPC 601 specific instructions (POWER bridge) */
|
|
|
|
/* XXX: those micro-ops need tests ! */
|
|
|
|
void OPPROTO op_POWER_abs (void)
|
|
|
|
{
|
|
|
|
if (T0 == INT32_MIN)
|
|
|
|
T0 = INT32_MAX;
|
|
|
|
else if (T0 < 0)
|
|
|
|
T0 = -T0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_abso (void)
|
|
|
|
{
|
|
|
|
do_POWER_abso();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_clcs (void)
|
|
|
|
{
|
|
|
|
do_POWER_clcs();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_div (void)
|
|
|
|
{
|
|
|
|
do_POWER_div();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_divo (void)
|
|
|
|
{
|
|
|
|
do_POWER_divo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_divs (void)
|
|
|
|
{
|
|
|
|
do_POWER_divs();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_divso (void)
|
|
|
|
{
|
|
|
|
do_POWER_divso();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_doz (void)
|
|
|
|
{
|
2007-03-17 15:02:15 +01:00
|
|
|
if ((int32_t)T1 > (int32_t)T0)
|
2007-03-07 09:32:30 +01:00
|
|
|
T0 = T1 - T0;
|
|
|
|
else
|
|
|
|
T0 = 0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_dozo (void)
|
|
|
|
{
|
|
|
|
do_POWER_dozo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_load_xer_cmp (void)
|
|
|
|
{
|
|
|
|
T2 = xer_cmp;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_maskg (void)
|
|
|
|
{
|
|
|
|
do_POWER_maskg();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_maskir (void)
|
|
|
|
{
|
|
|
|
T0 = (T0 & ~T2) | (T1 & T2);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_mul (void)
|
|
|
|
{
|
|
|
|
uint64_t tmp;
|
|
|
|
|
|
|
|
tmp = (uint64_t)T0 * (uint64_t)T1;
|
|
|
|
env->spr[SPR_MQ] = tmp >> 32;
|
|
|
|
T0 = tmp;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_mulo (void)
|
|
|
|
{
|
|
|
|
do_POWER_mulo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_nabs (void)
|
|
|
|
{
|
|
|
|
if (T0 > 0)
|
|
|
|
T0 = -T0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_nabso (void)
|
|
|
|
{
|
|
|
|
/* nabs never overflows */
|
|
|
|
if (T0 > 0)
|
|
|
|
T0 = -T0;
|
|
|
|
xer_ov = 0;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XXX: factorise POWER rotates... */
|
|
|
|
void OPPROTO op_POWER_rlmi (void)
|
|
|
|
{
|
|
|
|
T0 = rotl32(T0, T2) & PARAM1;
|
|
|
|
T0 |= T1 & PARAM2;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_rrib (void)
|
|
|
|
{
|
|
|
|
T2 &= 0x1FUL;
|
|
|
|
T0 = rotl32(T0 & INT32_MIN, T2);
|
|
|
|
T0 |= T1 & ~rotl32(INT32_MIN, T2);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_sle (void)
|
|
|
|
{
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
env->spr[SPR_MQ] = rotl32(T0, T1);
|
|
|
|
T0 = T0 << T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_sleq (void)
|
|
|
|
{
|
|
|
|
uint32_t tmp = env->spr[SPR_MQ];
|
|
|
|
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
env->spr[SPR_MQ] = rotl32(T0, T1);
|
|
|
|
T0 = T0 << T1;
|
|
|
|
T0 |= tmp >> (32 - T1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_sllq (void)
|
|
|
|
{
|
|
|
|
uint32_t msk = -1;
|
|
|
|
|
|
|
|
msk = msk << (T1 & 0x1FUL);
|
|
|
|
if (T1 & 0x20UL)
|
|
|
|
msk = ~msk;
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
T0 = (T0 << T1) & msk;
|
|
|
|
T0 |= env->spr[SPR_MQ] & ~msk;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_slq (void)
|
|
|
|
{
|
|
|
|
uint32_t msk = -1, tmp;
|
|
|
|
|
|
|
|
msk = msk << (T1 & 0x1FUL);
|
|
|
|
if (T1 & 0x20UL)
|
|
|
|
msk = ~msk;
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
tmp = rotl32(T0, T1);
|
|
|
|
T0 = tmp & msk;
|
|
|
|
env->spr[SPR_MQ] = tmp;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_sraq (void)
|
|
|
|
{
|
|
|
|
env->spr[SPR_MQ] = rotl32(T0, 32 - (T1 & 0x1FUL));
|
|
|
|
if (T1 & 0x20UL)
|
|
|
|
T0 = -1L;
|
|
|
|
else
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (int32_t)T0 >> T1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_sre (void)
|
|
|
|
{
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (int32_t)T0 >> T1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_srea (void)
|
|
|
|
{
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
env->spr[SPR_MQ] = T0 >> T1;
|
2007-03-17 15:02:15 +01:00
|
|
|
T0 = (int32_t)T0 >> T1;
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_sreq (void)
|
|
|
|
{
|
|
|
|
uint32_t tmp;
|
|
|
|
int32_t msk;
|
|
|
|
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
msk = INT32_MIN >> T1;
|
|
|
|
tmp = env->spr[SPR_MQ];
|
|
|
|
env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
|
|
|
|
T0 = T0 >> T1;
|
|
|
|
T0 |= tmp & msk;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_srlq (void)
|
|
|
|
{
|
|
|
|
uint32_t tmp;
|
|
|
|
int32_t msk;
|
|
|
|
|
|
|
|
msk = INT32_MIN >> (T1 & 0x1FUL);
|
|
|
|
if (T1 & 0x20UL)
|
|
|
|
msk = ~msk;
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
tmp = env->spr[SPR_MQ];
|
|
|
|
env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
|
|
|
|
T0 = T0 >> T1;
|
|
|
|
T0 &= msk;
|
|
|
|
T0 |= tmp & ~msk;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_srq (void)
|
|
|
|
{
|
|
|
|
T1 &= 0x1FUL;
|
|
|
|
env->spr[SPR_MQ] = rotl32(T0, 32 - T1);
|
|
|
|
T0 = T0 >> T1;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* POWER instructions not implemented in PowerPC 601 */
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
void OPPROTO op_POWER_mfsri (void)
|
|
|
|
{
|
|
|
|
T1 = T0 >> 28;
|
|
|
|
T0 = env->sr[T1];
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_rac (void)
|
|
|
|
{
|
|
|
|
do_POWER_rac();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_POWER_rfsvc (void)
|
|
|
|
{
|
|
|
|
do_POWER_rfsvc();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* PowerPC 602 specific instruction */
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
void OPPROTO op_602_mfrom (void)
|
|
|
|
{
|
|
|
|
do_op_602_mfrom();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* PowerPC 4xx specific micro-ops */
|
|
|
|
void OPPROTO op_405_add_T0_T2 (void)
|
|
|
|
{
|
|
|
|
T0 = (int32_t)T0 + (int32_t)T2;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_mulchw (void)
|
|
|
|
{
|
|
|
|
T0 = ((int16_t)T0) * ((int16_t)(T1 >> 16));
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_mulchwu (void)
|
|
|
|
{
|
|
|
|
T0 = ((uint16_t)T0) * ((uint16_t)(T1 >> 16));
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_mulhhw (void)
|
|
|
|
{
|
|
|
|
T0 = ((int16_t)(T0 >> 16)) * ((int16_t)(T1 >> 16));
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_mulhhwu (void)
|
|
|
|
{
|
|
|
|
T0 = ((uint16_t)(T0 >> 16)) * ((uint16_t)(T1 >> 16));
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_mullhw (void)
|
|
|
|
{
|
|
|
|
T0 = ((int16_t)T0) * ((int16_t)T1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_mullhwu (void)
|
|
|
|
{
|
|
|
|
T0 = ((uint16_t)T0) * ((uint16_t)T1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_check_ov (void)
|
|
|
|
{
|
|
|
|
do_405_check_ov();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_check_sat (void)
|
|
|
|
{
|
|
|
|
do_405_check_sat();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_check_ovu (void)
|
|
|
|
{
|
|
|
|
if (likely(T0 >= T2)) {
|
|
|
|
xer_ov = 0;
|
|
|
|
} else {
|
|
|
|
xer_ov = 1;
|
|
|
|
xer_so = 1;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_405_check_satu (void)
|
|
|
|
{
|
|
|
|
if (unlikely(T0 < T2)) {
|
|
|
|
/* Saturate result */
|
|
|
|
T0 = -1;
|
|
|
|
}
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-30 12:22:46 +02:00
|
|
|
void OPPROTO op_load_dcr (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
2007-03-30 12:22:46 +02:00
|
|
|
do_load_dcr();
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-30 12:22:46 +02:00
|
|
|
void OPPROTO op_store_dcr (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
2007-03-30 12:22:46 +02:00
|
|
|
do_store_dcr();
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 01:54:22 +02:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2007-03-07 09:32:30 +01:00
|
|
|
/* Return from critical interrupt :
|
|
|
|
* same as rfi, except nip & MSR are loaded from SRR2/3 instead of SRR0/1
|
|
|
|
*/
|
2007-03-30 12:22:46 +02:00
|
|
|
void OPPROTO op_40x_rfci (void)
|
|
|
|
{
|
|
|
|
do_40x_rfci();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_rfci (void)
|
|
|
|
{
|
|
|
|
do_rfci();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_rfdi (void)
|
|
|
|
{
|
|
|
|
do_rfdi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_rfmci (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
2007-03-30 12:22:46 +02:00
|
|
|
do_rfmci();
|
2007-03-07 09:32:30 +01:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-30 12:22:46 +02:00
|
|
|
void OPPROTO op_wrte (void)
|
2007-03-07 09:32:30 +01:00
|
|
|
{
|
|
|
|
msr_ee = T0 >> 16;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-21 07:28:33 +02:00
|
|
|
void OPPROTO op_440_tlbre (void)
|
2007-09-19 07:44:04 +02:00
|
|
|
{
|
2007-09-21 07:28:33 +02:00
|
|
|
do_440_tlbre(PARAM1);
|
2007-09-19 07:44:04 +02:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-21 07:28:33 +02:00
|
|
|
void OPPROTO op_440_tlbsx (void)
|
2007-09-19 07:44:04 +02:00
|
|
|
{
|
2007-09-21 07:28:33 +02:00
|
|
|
do_440_tlbsx();
|
2007-09-19 07:44:04 +02:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-21 07:28:33 +02:00
|
|
|
void OPPROTO op_440_tlbsx_ (void)
|
2007-09-19 07:44:04 +02:00
|
|
|
{
|
2007-09-21 07:28:33 +02:00
|
|
|
do_440_tlbsx_();
|
2007-09-19 07:44:04 +02:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-09-21 07:28:33 +02:00
|
|
|
void OPPROTO op_440_tlbwe (void)
|
2007-09-19 07:44:04 +02:00
|
|
|
{
|
2007-09-21 07:28:33 +02:00
|
|
|
do_440_tlbwe(PARAM1);
|
2007-09-19 07:44:04 +02:00
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_4xx_tlbre_lo (void)
|
|
|
|
{
|
|
|
|
do_4xx_tlbre_lo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_4xx_tlbre_hi (void)
|
|
|
|
{
|
|
|
|
do_4xx_tlbre_hi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_4xx_tlbsx (void)
|
|
|
|
{
|
|
|
|
do_4xx_tlbsx();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_4xx_tlbsx_ (void)
|
|
|
|
{
|
|
|
|
do_4xx_tlbsx_();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_4xx_tlbwe_lo (void)
|
|
|
|
{
|
|
|
|
do_4xx_tlbwe_lo();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_4xx_tlbwe_hi (void)
|
|
|
|
{
|
|
|
|
do_4xx_tlbwe_hi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* SPR micro-ops */
|
|
|
|
/* 440 specific */
|
|
|
|
void OPPROTO op_440_dlmzb (void)
|
|
|
|
{
|
|
|
|
do_440_dlmzb();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_440_dlmzb_update_Rc (void)
|
|
|
|
{
|
|
|
|
if (T0 == 8)
|
|
|
|
T0 = 0x2;
|
|
|
|
else if (T0 < 4)
|
|
|
|
T0 = 0x4;
|
|
|
|
else
|
|
|
|
T0 = 0x8;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
void OPPROTO op_store_pir (void)
|
2005-07-02 22:59:34 +02:00
|
|
|
{
|
|
|
|
env->spr[SPR_PIR] = T0 & 0x0000000FUL;
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-07 09:32:30 +01:00
|
|
|
|
|
|
|
void OPPROTO op_load_403_pb (void)
|
|
|
|
{
|
|
|
|
do_load_403_pb(PARAM1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_403_pb (void)
|
|
|
|
{
|
|
|
|
do_store_403_pb(PARAM1);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_load_40x_pit (void)
|
|
|
|
{
|
|
|
|
T0 = load_40x_pit(env);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_40x_pit (void)
|
|
|
|
{
|
|
|
|
store_40x_pit(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-04-16 22:09:45 +02:00
|
|
|
void OPPROTO op_store_40x_dbcr0 (void)
|
|
|
|
{
|
|
|
|
store_40x_dbcr0(env, T0);
|
|
|
|
}
|
|
|
|
|
2007-04-24 08:44:14 +02:00
|
|
|
void OPPROTO op_store_40x_sler (void)
|
|
|
|
{
|
|
|
|
store_40x_sler(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
void OPPROTO op_store_booke_tcr (void)
|
|
|
|
{
|
|
|
|
store_booke_tcr(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_store_booke_tsr (void)
|
|
|
|
{
|
|
|
|
store_booke_tsr(env, T0);
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-03-20 23:11:31 +01:00
|
|
|
|
2007-03-07 09:32:30 +01:00
|
|
|
#endif /* !defined(CONFIG_USER_ONLY) */
|
2007-03-20 23:11:31 +01:00
|
|
|
|
2007-04-24 08:50:21 +02:00
|
|
|
#if defined(TARGET_PPCEMB)
|
2007-03-20 23:11:31 +01:00
|
|
|
/* SPE extension */
|
|
|
|
void OPPROTO op_splatw_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1_64 = (T1_64 << 32) | (T1_64 & 0x00000000FFFFFFFFULL);
|
2007-03-22 23:17:08 +01:00
|
|
|
RETURN();
|
2007-03-20 23:11:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_splatwi_T0_64 (void)
|
|
|
|
{
|
|
|
|
uint64_t tmp = PARAM1;
|
|
|
|
|
|
|
|
T0_64 = (tmp << 32) | tmp;
|
2007-03-22 23:17:08 +01:00
|
|
|
RETURN();
|
2007-03-20 23:11:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_splatwi_T1_64 (void)
|
|
|
|
{
|
|
|
|
uint64_t tmp = PARAM1;
|
|
|
|
|
|
|
|
T1_64 = (tmp << 32) | tmp;
|
2007-03-22 23:17:08 +01:00
|
|
|
RETURN();
|
2007-03-20 23:11:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_extsh_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1_64 = (int32_t)((int16_t)T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_sli16_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1_64 = T1_64 << 16;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_sli32_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1_64 = T1_64 << 32;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_srli32_T1_64 (void)
|
|
|
|
{
|
|
|
|
T1_64 = T1_64 >> 32;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evsel (void)
|
|
|
|
{
|
|
|
|
do_evsel();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evaddw (void)
|
|
|
|
{
|
|
|
|
do_evaddw();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evsubfw (void)
|
|
|
|
{
|
|
|
|
do_evsubfw();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evneg (void)
|
|
|
|
{
|
|
|
|
do_evneg();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evabs (void)
|
|
|
|
{
|
|
|
|
do_evabs();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evextsh (void)
|
|
|
|
{
|
|
|
|
T0_64 = ((uint64_t)((int32_t)(int16_t)(T0_64 >> 32)) << 32) |
|
|
|
|
(uint64_t)((int32_t)(int16_t)T0_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evextsb (void)
|
|
|
|
{
|
|
|
|
T0_64 = ((uint64_t)((int32_t)(int8_t)(T0_64 >> 32)) << 32) |
|
|
|
|
(uint64_t)((int32_t)(int8_t)T0_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evcntlzw (void)
|
|
|
|
{
|
|
|
|
do_evcntlzw();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evrndw (void)
|
|
|
|
{
|
|
|
|
do_evrndw();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_brinc (void)
|
|
|
|
{
|
|
|
|
do_brinc();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evcntlsw (void)
|
|
|
|
{
|
|
|
|
do_evcntlsw();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evand (void)
|
|
|
|
{
|
|
|
|
T0_64 &= T1_64;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evandc (void)
|
|
|
|
{
|
|
|
|
T0_64 &= ~T1_64;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evor (void)
|
|
|
|
{
|
|
|
|
T0_64 |= T1_64;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evxor (void)
|
|
|
|
{
|
|
|
|
T0_64 ^= T1_64;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_eveqv (void)
|
|
|
|
{
|
|
|
|
T0_64 = ~(T0_64 ^ T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evnor (void)
|
|
|
|
{
|
|
|
|
T0_64 = ~(T0_64 | T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evorc (void)
|
|
|
|
{
|
|
|
|
T0_64 |= ~T1_64;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evnand (void)
|
|
|
|
{
|
|
|
|
T0_64 = ~(T0_64 & T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evsrws (void)
|
|
|
|
{
|
|
|
|
do_evsrws();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evsrwu (void)
|
|
|
|
{
|
|
|
|
do_evsrwu();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evslw (void)
|
|
|
|
{
|
|
|
|
do_evslw();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evrlw (void)
|
|
|
|
{
|
|
|
|
do_evrlw();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evmergelo (void)
|
|
|
|
{
|
|
|
|
T0_64 = (T0_64 << 32) | (T1_64 & 0x00000000FFFFFFFFULL);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evmergehi (void)
|
|
|
|
{
|
|
|
|
T0_64 = (T0_64 & 0xFFFFFFFF00000000ULL) | (T1_64 >> 32);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evmergelohi (void)
|
|
|
|
{
|
|
|
|
T0_64 = (T0_64 << 32) | (T1_64 >> 32);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evmergehilo (void)
|
|
|
|
{
|
|
|
|
T0_64 = (T0_64 & 0xFFFFFFFF00000000ULL) | (T1_64 & 0x00000000FFFFFFFFULL);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evcmpgts (void)
|
|
|
|
{
|
|
|
|
do_evcmpgts();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evcmpgtu (void)
|
|
|
|
{
|
|
|
|
do_evcmpgtu();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evcmplts (void)
|
|
|
|
{
|
|
|
|
do_evcmplts();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evcmpltu (void)
|
|
|
|
{
|
|
|
|
do_evcmpltu();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evcmpeq (void)
|
|
|
|
{
|
|
|
|
do_evcmpeq();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfssub (void)
|
|
|
|
{
|
|
|
|
do_evfssub();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsadd (void)
|
|
|
|
{
|
|
|
|
do_evfsadd();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsnabs (void)
|
|
|
|
{
|
|
|
|
do_evfsnabs();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsabs (void)
|
|
|
|
{
|
|
|
|
do_evfsabs();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsneg (void)
|
|
|
|
{
|
|
|
|
do_evfsneg();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsdiv (void)
|
|
|
|
{
|
|
|
|
do_evfsdiv();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsmul (void)
|
|
|
|
{
|
|
|
|
do_evfsmul();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfscmplt (void)
|
|
|
|
{
|
|
|
|
do_evfscmplt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfscmpgt (void)
|
|
|
|
{
|
|
|
|
do_evfscmpgt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfscmpeq (void)
|
|
|
|
{
|
|
|
|
do_evfscmpeq();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfscfsi (void)
|
|
|
|
{
|
|
|
|
do_evfscfsi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfscfui (void)
|
|
|
|
{
|
|
|
|
do_evfscfui();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfscfsf (void)
|
|
|
|
{
|
|
|
|
do_evfscfsf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfscfuf (void)
|
|
|
|
{
|
|
|
|
do_evfscfuf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsctsi (void)
|
|
|
|
{
|
|
|
|
do_evfsctsi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsctui (void)
|
|
|
|
{
|
|
|
|
do_evfsctui();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsctsf (void)
|
|
|
|
{
|
|
|
|
do_evfsctsf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsctuf (void)
|
|
|
|
{
|
|
|
|
do_evfsctuf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsctuiz (void)
|
|
|
|
{
|
|
|
|
do_evfsctuiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfsctsiz (void)
|
|
|
|
{
|
|
|
|
do_evfsctsiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfststlt (void)
|
|
|
|
{
|
|
|
|
do_evfststlt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfststgt (void)
|
|
|
|
{
|
|
|
|
do_evfststgt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_evfststeq (void)
|
|
|
|
{
|
|
|
|
do_evfststeq();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efssub (void)
|
|
|
|
{
|
|
|
|
T0_64 = _do_efssub(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsadd (void)
|
|
|
|
{
|
|
|
|
T0_64 = _do_efsadd(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsnabs (void)
|
|
|
|
{
|
|
|
|
T0_64 = _do_efsnabs(T0_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsabs (void)
|
|
|
|
{
|
|
|
|
T0_64 = _do_efsabs(T0_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsneg (void)
|
|
|
|
{
|
|
|
|
T0_64 = _do_efsneg(T0_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsdiv (void)
|
|
|
|
{
|
|
|
|
T0_64 = _do_efsdiv(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsmul (void)
|
|
|
|
{
|
|
|
|
T0_64 = _do_efsmul(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscmplt (void)
|
|
|
|
{
|
|
|
|
do_efscmplt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscmpgt (void)
|
|
|
|
{
|
|
|
|
do_efscmpgt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscfd (void)
|
|
|
|
{
|
|
|
|
do_efscfd();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscmpeq (void)
|
|
|
|
{
|
|
|
|
do_efscmpeq();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscfsi (void)
|
|
|
|
{
|
|
|
|
do_efscfsi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscfui (void)
|
|
|
|
{
|
|
|
|
do_efscfui();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscfsf (void)
|
|
|
|
{
|
|
|
|
do_efscfsf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efscfuf (void)
|
|
|
|
{
|
|
|
|
do_efscfuf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsctsi (void)
|
|
|
|
{
|
|
|
|
do_efsctsi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsctui (void)
|
|
|
|
{
|
|
|
|
do_efsctui();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsctsf (void)
|
|
|
|
{
|
|
|
|
do_efsctsf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsctuf (void)
|
|
|
|
{
|
|
|
|
do_efsctuf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsctsiz (void)
|
|
|
|
{
|
|
|
|
do_efsctsiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efsctuiz (void)
|
|
|
|
{
|
|
|
|
do_efsctuiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efststlt (void)
|
|
|
|
{
|
|
|
|
T0 = _do_efststlt(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efststgt (void)
|
|
|
|
{
|
|
|
|
T0 = _do_efststgt(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efststeq (void)
|
|
|
|
{
|
|
|
|
T0 = _do_efststeq(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdsub (void)
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
uint64_t u;
|
|
|
|
float64 f;
|
|
|
|
} u1, u2;
|
|
|
|
u1.u = T0_64;
|
|
|
|
u2.u = T1_64;
|
|
|
|
u1.f = float64_sub(u1.f, u2.f, &env->spe_status);
|
|
|
|
T0_64 = u1.u;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdadd (void)
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
uint64_t u;
|
|
|
|
float64 f;
|
|
|
|
} u1, u2;
|
|
|
|
u1.u = T0_64;
|
|
|
|
u2.u = T1_64;
|
|
|
|
u1.f = float64_add(u1.f, u2.f, &env->spe_status);
|
|
|
|
T0_64 = u1.u;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcfsid (void)
|
|
|
|
{
|
|
|
|
do_efdcfsi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcfuid (void)
|
|
|
|
{
|
|
|
|
do_efdcfui();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdnabs (void)
|
|
|
|
{
|
|
|
|
T0_64 |= 0x8000000000000000ULL;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdabs (void)
|
|
|
|
{
|
|
|
|
T0_64 &= ~0x8000000000000000ULL;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdneg (void)
|
|
|
|
{
|
|
|
|
T0_64 ^= 0x8000000000000000ULL;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efddiv (void)
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
uint64_t u;
|
|
|
|
float64 f;
|
|
|
|
} u1, u2;
|
|
|
|
u1.u = T0_64;
|
|
|
|
u2.u = T1_64;
|
|
|
|
u1.f = float64_div(u1.f, u2.f, &env->spe_status);
|
|
|
|
T0_64 = u1.u;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdmul (void)
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
uint64_t u;
|
|
|
|
float64 f;
|
|
|
|
} u1, u2;
|
|
|
|
u1.u = T0_64;
|
|
|
|
u2.u = T1_64;
|
|
|
|
u1.f = float64_mul(u1.f, u2.f, &env->spe_status);
|
|
|
|
T0_64 = u1.u;
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctsidz (void)
|
|
|
|
{
|
|
|
|
do_efdctsiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctuidz (void)
|
|
|
|
{
|
|
|
|
do_efdctuiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcmplt (void)
|
|
|
|
{
|
|
|
|
do_efdcmplt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcmpgt (void)
|
|
|
|
{
|
|
|
|
do_efdcmpgt();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcfs (void)
|
|
|
|
{
|
|
|
|
do_efdcfs();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcmpeq (void)
|
|
|
|
{
|
|
|
|
do_efdcmpeq();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcfsi (void)
|
|
|
|
{
|
|
|
|
do_efdcfsi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcfui (void)
|
|
|
|
{
|
|
|
|
do_efdcfui();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcfsf (void)
|
|
|
|
{
|
|
|
|
do_efdcfsf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdcfuf (void)
|
|
|
|
{
|
|
|
|
do_efdcfuf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctsi (void)
|
|
|
|
{
|
|
|
|
do_efdctsi();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctui (void)
|
|
|
|
{
|
|
|
|
do_efdctui();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctsf (void)
|
|
|
|
{
|
|
|
|
do_efdctsf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctuf (void)
|
|
|
|
{
|
|
|
|
do_efdctuf();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctuiz (void)
|
|
|
|
{
|
|
|
|
do_efdctuiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdctsiz (void)
|
|
|
|
{
|
|
|
|
do_efdctsiz();
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdtstlt (void)
|
|
|
|
{
|
|
|
|
T0 = _do_efdtstlt(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdtstgt (void)
|
|
|
|
{
|
|
|
|
T0 = _do_efdtstgt(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OPPROTO op_efdtsteq (void)
|
|
|
|
{
|
|
|
|
T0 = _do_efdtsteq(T0_64, T1_64);
|
|
|
|
RETURN();
|
|
|
|
}
|
2007-04-24 08:50:21 +02:00
|
|
|
#endif /* defined(TARGET_PPCEMB) */
|