/*
 *  compiler/compemu_midfunc_arm2.h - Native MIDFUNCS for ARM (JIT v2)
 *
 * Copyright (c) 2014 Jens Heitmann of ARAnyM dev team (see AUTHORS)
 *
 * Inspired by Christian Bauer's Basilisk II
 *
 *  Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer
 *
 *  Adaptation for Basilisk II and improvements, copyright 2000-2002
 *    Gwenole Beauchesne
 *
 *  Basilisk II (C) 1997-2002 Christian Bauer
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  Note:
 *  	File is included by compemu.h
 *
 */

// Arm optimized midfunc
extern const uae_u32 ARM_CCR_MAP[];

// ADD
DECLARE_MIDFUNC(jnf_ADD_im8(W4 d, RR4 s, IM8 v));
DECLARE_MIDFUNC(jnf_ADD_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jnf_ADD_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jnf_ADD_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jnf_ADD_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jnf_ADD_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jnf_ADD_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_ADD_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jff_ADD_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jff_ADD_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jff_ADD_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jff_ADD_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jff_ADD_l(RW4 d, RR4 s));

// ADDA
DECLARE_MIDFUNC(jnf_ADDA_w(RW4 d, RR2 s));
DECLARE_MIDFUNC(jnf_ADDA_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jnf_ADDA_w_imm(RW4 d, IM16 v));
DECLARE_MIDFUNC(jnf_ADDA_l_imm(RW4 d, IM32 v));

// ADDX
DECLARE_MIDFUNC(jnf_ADDX_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jnf_ADDX_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jnf_ADDX_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_ADDX_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jff_ADDX_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jff_ADDX_l(RW4 d, RR4 s));

// ANDSR
DECLARE_MIDFUNC(jff_ANDSR(IM32 s, IM8 x));

// AND
DECLARE_MIDFUNC(jnf_AND_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jnf_AND_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jnf_AND_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jnf_AND_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jnf_AND_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jnf_AND_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_AND_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jff_AND_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jff_AND_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jff_AND_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jff_AND_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jff_AND_l(RW4 d, RR4 s));

// ASL
DECLARE_MIDFUNC(jff_ASL_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jff_ASL_w_imm(RW2 d, IM8 i));
DECLARE_MIDFUNC(jff_ASL_l_imm(RW4 d, IM8 i));
DECLARE_MIDFUNC(jff_ASL_b_reg(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_ASL_w_reg(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_ASL_l_reg(RW4 d, RR4 i));

// ASLW
DECLARE_MIDFUNC(jff_ASLW(RW2 d));
DECLARE_MIDFUNC(jnf_ASLW(RW2 d));

// ASR
DECLARE_MIDFUNC(jnf_ASR_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jnf_ASR_w_imm(RW2 d, IM8 i));
DECLARE_MIDFUNC(jnf_ASR_l_imm(RW4 d, IM8 i));
DECLARE_MIDFUNC(jff_ASR_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jff_ASR_w_imm(RW2 d, IM8 i));
DECLARE_MIDFUNC(jff_ASR_l_imm(RW4 d, IM8 i));
DECLARE_MIDFUNC(jnf_ASR_b_reg(RW1 d, RR4 i));
DECLARE_MIDFUNC(jnf_ASR_w_reg(RW2 d, RR4 i));
DECLARE_MIDFUNC(jnf_ASR_l_reg(RW4 d, RR4 i));
DECLARE_MIDFUNC(jff_ASR_b_reg(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_ASR_w_reg(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_ASR_l_reg(RW4 d, RR4 i));

// ASRW
DECLARE_MIDFUNC(jff_ASRW(RW2 d));
DECLARE_MIDFUNC(jnf_ASRW(RW2 d));

// BCHG
DECLARE_MIDFUNC(jnf_BCHG_b_imm(RW1 d, IM8 s));
DECLARE_MIDFUNC(jnf_BCHG_l_imm(RW4 d, IM8 s));
DECLARE_MIDFUNC(jff_BCHG_b_imm(RW1 d, IM8 s));
DECLARE_MIDFUNC(jff_BCHG_l_imm(RW4 d, IM8 s));
DECLARE_MIDFUNC(jnf_BCHG_b(RW1 d, RR4 s));
DECLARE_MIDFUNC(jnf_BCHG_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_BCHG_b(RW1 d, RR4 s));
DECLARE_MIDFUNC(jff_BCHG_l(RW4 d, RR4 s));

// BCLR
DECLARE_MIDFUNC(jnf_BCLR_b_imm(RW1 d, IM8 s));
DECLARE_MIDFUNC(jnf_BCLR_l_imm(RW4 d, IM8 s));
DECLARE_MIDFUNC(jnf_BCLR_b(RW1 d, RR4 s));
DECLARE_MIDFUNC(jnf_BCLR_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_BCLR_b_imm(RW1 d, IM8 s));
DECLARE_MIDFUNC(jff_BCLR_l_imm(RW4 d, IM8 s));
DECLARE_MIDFUNC(jff_BCLR_b(RW1 d, RR4 s));
DECLARE_MIDFUNC(jff_BCLR_l(RW4 d, RR4 s));

// BFINS
DECLARE_MIDFUNC(jnf_BFINS_ii(RW4 d, RR4 s, IM8 offs, IM8 width));
DECLARE_MIDFUNC(jff_BFINS_ii(RW4 d, RR4 s, IM8 offs, IM8 width));
DECLARE_MIDFUNC(jnf_BFINS2_ii(RW4 d, RW4 d2, RR4 s, IM8 offs, IM8 width));
DECLARE_MIDFUNC(jff_BFINS2_ii(RW4 d, RW4 d2, RR4 s, IM8 offs, IM8 width));
DECLARE_MIDFUNC(jnf_BFINS_di(RW4 d, RR4 s, RR4 offs, IM8 width));
DECLARE_MIDFUNC(jff_BFINS_di(RW4 d, RR4 s, RR4 offs, IM8 width));
DECLARE_MIDFUNC(jnf_BFINS2_di(RW4 d, RW4 d2, RR4 s, RR4 offs, IM8 width));
DECLARE_MIDFUNC(jff_BFINS2_di(RW4 d, RW4 d2, RR4 s, RR4 offs, IM8 width));
DECLARE_MIDFUNC(jnf_BFINS_id(RW4 d, RR4 s, IM8 offs, RR4 width));
DECLARE_MIDFUNC(jff_BFINS_id(RW4 d, RR4 s, IM8 offs, RR4 width));
DECLARE_MIDFUNC(jnf_BFINS2_id(RW4 d, RW4 d2, RR4 s, IM8 offs, RR4 width));
DECLARE_MIDFUNC(jff_BFINS2_id(RW4 d, RW4 d2, RR4 s, IM8 offs, RR4 width));
DECLARE_MIDFUNC(jnf_BFINS_dd(RW4 d, RR4 s, RR4 offs, RR4 width));
DECLARE_MIDFUNC(jff_BFINS_dd(RW4 d, RR4 s, RR4 offs, RR4 width));
DECLARE_MIDFUNC(jnf_BFINS2_dd(RW4 d, RW4 d2, RR4 s, RR4 offs, RR4 width));
DECLARE_MIDFUNC(jff_BFINS2_dd(RW4 d, RW4 d2, RR4 s, RR4 offs, RR4 width));

// BSET
DECLARE_MIDFUNC(jnf_BSET_b_imm(RW1 d, IM8 s));
DECLARE_MIDFUNC(jnf_BSET_l_imm(RW4 d, IM8 s));
DECLARE_MIDFUNC(jnf_BSET_b(RW1 d, RR4 s));
DECLARE_MIDFUNC(jnf_BSET_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_BSET_b_imm(RW1 d, IM8 s));
DECLARE_MIDFUNC(jff_BSET_l_imm(RW4 d, IM8 s));
DECLARE_MIDFUNC(jff_BSET_b(RW1 d, RR4 s));
DECLARE_MIDFUNC(jff_BSET_l(RW4 d, RR4 s));

// BTST
DECLARE_MIDFUNC(jff_BTST_b_imm(RR1 d, IM8 s));
DECLARE_MIDFUNC(jff_BTST_l_imm(RR4 d, IM8 s));
DECLARE_MIDFUNC(jff_BTST_b(RR1 d, RR4 s));
DECLARE_MIDFUNC(jff_BTST_l(RR4 d, RR4 s));

// CLR
DECLARE_MIDFUNC (jnf_CLR_b(W1 d));
DECLARE_MIDFUNC (jnf_CLR_w(W2 d));
DECLARE_MIDFUNC (jnf_CLR_l(W4 d));
DECLARE_MIDFUNC (jff_CLR_b(W1 d));
DECLARE_MIDFUNC (jff_CLR_w(W2 d));
DECLARE_MIDFUNC (jff_CLR_l(W4 d));

// CMP
DECLARE_MIDFUNC(jff_CMP_b_imm(RR1 d, IM8 v));
DECLARE_MIDFUNC(jff_CMP_w_imm(RR2 d, IM16 v));
DECLARE_MIDFUNC(jff_CMP_l_imm(RR4 d, IM32 v));
DECLARE_MIDFUNC(jff_CMP_b(RR1 d, RR1 s));
DECLARE_MIDFUNC(jff_CMP_w(RR2 d, RR2 s));
DECLARE_MIDFUNC(jff_CMP_l(RR4 d, RR4 s));

// CMPA
DECLARE_MIDFUNC(jff_CMPA_w_imm(RR2 d, IM16 v));
DECLARE_MIDFUNC(jff_CMPA_l_imm(RR4 d, IM32 v));
DECLARE_MIDFUNC(jff_CMPA_w(RR2 d, RR2 s));
DECLARE_MIDFUNC(jff_CMPA_l(RR4 d, RR4 s));

// DBCC
DECLARE_MIDFUNC(jff_DBCC(RW4 d, IM8 cc));

// DIVU
DECLARE_MIDFUNC(jnf_DIVU(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_DIVU(RW4 d, RR4 s));

// DIVS
DECLARE_MIDFUNC(jnf_DIVS(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_DIVS(RW4 d, RR4 s));

// DIVL
DECLARE_MIDFUNC(jnf_DIVLU32(RW4 d, RR4 s1, W4 rem));
DECLARE_MIDFUNC(jff_DIVLU32(RW4 d, RR4 s1, W4 rem));
DECLARE_MIDFUNC(jnf_DIVLS32(RW4 d, RR4 s1, W4 rem));
DECLARE_MIDFUNC(jff_DIVLS32(RW4 d, RR4 s1, W4 rem));

// EOR
DECLARE_MIDFUNC(jnf_EOR_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jnf_EOR_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jnf_EOR_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jnf_EOR_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jnf_EOR_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jnf_EOR_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_EOR_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jff_EOR_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jff_EOR_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jff_EOR_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jff_EOR_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jff_EOR_l(RW4 d, RR4 s));

// EORSR
DECLARE_MIDFUNC(jff_EORSR(IM32 s, IM8 x));

// EXT
DECLARE_MIDFUNC(jnf_EXT_b(RW4 d));
DECLARE_MIDFUNC(jnf_EXT_w(RW4 d));
DECLARE_MIDFUNC(jnf_EXT_l(RW4 d));
DECLARE_MIDFUNC(jff_EXT_b(RW4 d));
DECLARE_MIDFUNC(jff_EXT_w(RW4 d));
DECLARE_MIDFUNC(jff_EXT_l(RW4 d));

// LSL
DECLARE_MIDFUNC(jnf_LSL_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jnf_LSL_w_imm(RW2 d, IM8 i));
DECLARE_MIDFUNC(jnf_LSL_l_imm(RW4 d, IM8 i));
DECLARE_MIDFUNC(jnf_LSL_b_reg(RW1 d, RR4 i));
DECLARE_MIDFUNC(jnf_LSL_w_reg(RW2 d, RR4 i));
DECLARE_MIDFUNC(jnf_LSL_l_reg(RW4 d, RR4 i));
DECLARE_MIDFUNC(jff_LSL_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jff_LSL_w_imm(RW2 d, IM8 i));
DECLARE_MIDFUNC(jff_LSL_l_imm(RW4 d, IM8 i));
DECLARE_MIDFUNC(jff_LSL_b_reg(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_LSL_w_reg(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_LSL_l_reg(RW4 d, RR4 i));

// LSLW
DECLARE_MIDFUNC(jff_LSLW(RW2 d));
DECLARE_MIDFUNC(jnf_LSLW(RW2 d));

// LSR
DECLARE_MIDFUNC(jnf_LSR_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jnf_LSR_w_imm(RW2 d, IM8 i));
DECLARE_MIDFUNC(jnf_LSR_l_imm(RW4 d, IM8 i));
DECLARE_MIDFUNC(jff_LSR_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jff_LSR_w_imm(RW2 d, IM8 i));
DECLARE_MIDFUNC(jff_LSR_l_imm(RW4 d, IM8 i));
DECLARE_MIDFUNC(jnf_LSR_b_reg(RW1 d, RR4 i));
DECLARE_MIDFUNC(jnf_LSR_w_reg(RW2 d, RR4 i));
DECLARE_MIDFUNC(jnf_LSR_l_reg(RW4 d, RR4 i));
DECLARE_MIDFUNC(jff_LSR_b_reg(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_LSR_w_reg(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_LSR_l_reg(RW4 d, RR4 i));

// LSRW
DECLARE_MIDFUNC(jff_LSRW(RW2 d));
DECLARE_MIDFUNC(jnf_LSRW(RW2 d));

// MOVE
DECLARE_MIDFUNC(jnf_MOVE_b_imm(W4 d, IM8 i));
DECLARE_MIDFUNC(jnf_MOVE_w_imm(W4 d, IM16 i));
DECLARE_MIDFUNC(jnf_MOVE_b(W4 d, RR1 s));
DECLARE_MIDFUNC(jnf_MOVE_w(W4 d, RR2 s));
DECLARE_MIDFUNC(jnf_MOVE_l(W4 d, RR4 s));
DECLARE_MIDFUNC(jff_MOVE_b_imm(W4 d, IM8 i));
DECLARE_MIDFUNC(jff_MOVE_w_imm(W4 d, IM16 i));
DECLARE_MIDFUNC(jff_MOVE_l_imm(W4 d, IM32 i));
DECLARE_MIDFUNC(jff_MOVE_b(W4 d, RR1 s));
DECLARE_MIDFUNC(jff_MOVE_w(W4 d, RR2 s));
DECLARE_MIDFUNC(jff_MOVE_l(W4 d, RR4 s));

// MVMEL
DECLARE_MIDFUNC(jnf_MVMEL_w(W4 d, RR4 s, IM8 offset));
DECLARE_MIDFUNC(jnf_MVMEL_l(W4 d, RR4 s, IM8 offset));

// MVMLE
DECLARE_MIDFUNC(jnf_MVMLE_w(RR4 d, RR4 s, IM8 offset));
DECLARE_MIDFUNC(jnf_MVMLE_l(RR4 d, RR4 s, IM8 offset));

// MOVE16
DECLARE_MIDFUNC(jnf_MOVE16(RR4 d, RR4 s));

// MOVEA
DECLARE_MIDFUNC(jnf_MOVEA_w_imm(W4 d, IM16 v));
DECLARE_MIDFUNC(jnf_MOVEA_w(W4 d, RR2 s));
DECLARE_MIDFUNC(jnf_MOVEA_l(W4 d, RR4 s));

// MULS
DECLARE_MIDFUNC (jnf_MULS(RW4 d, RR4 s));
DECLARE_MIDFUNC (jff_MULS(RW4 d, RR4 s));
DECLARE_MIDFUNC (jnf_MULS32(RW4 d, RR4 s));
DECLARE_MIDFUNC (jff_MULS32(RW4 d, RR4 s));
DECLARE_MIDFUNC (jnf_MULS64(RW4 d, RW4 s));
DECLARE_MIDFUNC (jff_MULS64(RW4 d, RW4 s));

// MULU
DECLARE_MIDFUNC (jnf_MULU(RW4 d, RR4 s));
DECLARE_MIDFUNC (jff_MULU(RW4 d, RR4 s));
DECLARE_MIDFUNC (jnf_MULU32(RW4 d, RR4 s));
DECLARE_MIDFUNC (jff_MULU32(RW4 d, RR4 s));
DECLARE_MIDFUNC (jnf_MULU64(RW4 d, RW4 s));
DECLARE_MIDFUNC (jff_MULU64(RW4 d, RW4 s));

// NEG
DECLARE_MIDFUNC(jnf_NEG_b(RW1 d));
DECLARE_MIDFUNC(jnf_NEG_w(RW2 d));
DECLARE_MIDFUNC(jnf_NEG_l(RW4 d));
DECLARE_MIDFUNC(jff_NEG_b(RW1 d));
DECLARE_MIDFUNC(jff_NEG_w(RW2 d));
DECLARE_MIDFUNC(jff_NEG_l(RW4 d));

// NEGX
DECLARE_MIDFUNC(jnf_NEGX_b(RW1 d));
DECLARE_MIDFUNC(jnf_NEGX_w(RW2 d));
DECLARE_MIDFUNC(jnf_NEGX_l(RW4 d));
DECLARE_MIDFUNC(jff_NEGX_b(RW1 d));
DECLARE_MIDFUNC(jff_NEGX_w(RW2 d));
DECLARE_MIDFUNC(jff_NEGX_l(RW4 d));

// NOT
DECLARE_MIDFUNC(jnf_NOT_b(RW1 d));
DECLARE_MIDFUNC(jnf_NOT_w(RW2 d));
DECLARE_MIDFUNC(jnf_NOT_l(RW4 d));
DECLARE_MIDFUNC(jff_NOT_b(RW1 d));
DECLARE_MIDFUNC(jff_NOT_w(RW2 d));
DECLARE_MIDFUNC(jff_NOT_l(RW4 d));

// OR
DECLARE_MIDFUNC(jnf_OR_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jnf_OR_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jnf_OR_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jnf_OR_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jnf_OR_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jnf_OR_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_OR_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jff_OR_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jff_OR_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jff_OR_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jff_OR_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jff_OR_l(RW4 d, RR4 s));

// ORSR
DECLARE_MIDFUNC(jff_ORSR(IM32 s, IM8 x));

// ROL
DECLARE_MIDFUNC(jnf_ROL_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jnf_ROL_w_imm(RW2 d, IM16 i));
DECLARE_MIDFUNC(jnf_ROL_l_imm(RW4 d, IM32 i));
DECLARE_MIDFUNC(jnf_ROL_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROL_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROL_l(RW4 d, RR4 i));
DECLARE_MIDFUNC(jff_ROL_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jff_ROL_w_imm(RW2 d, IM16 i));
DECLARE_MIDFUNC(jff_ROL_l_imm(RW4 d, IM32 i));
DECLARE_MIDFUNC(jff_ROL_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_ROL_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_ROL_l(RW4 d, RR4 i));

// ROLW
DECLARE_MIDFUNC(jff_ROLW(RW2 d));
DECLARE_MIDFUNC(jnf_ROLW(RW2 d));

// RORW
DECLARE_MIDFUNC(jff_RORW(RW2 d));
DECLARE_MIDFUNC(jnf_RORW(RW2 d));

// ROXL
DECLARE_MIDFUNC(jnf_ROXL_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROXL_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROXL_l(RW4 d, RR4 i));
DECLARE_MIDFUNC(jff_ROXL_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_ROXL_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_ROXL_l(RW4 d, RR4 i));

// ROR
DECLARE_MIDFUNC(jnf_ROR_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jnf_ROR_w_imm(RW2 d, IM16 i));
DECLARE_MIDFUNC(jnf_ROR_l_imm(RW4 d, IM32 i));
DECLARE_MIDFUNC(jnf_ROR_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROR_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROR_l(RW4 d, RR4 i));
DECLARE_MIDFUNC(jff_ROR_b_imm(RW1 d, IM8 i));
DECLARE_MIDFUNC(jff_ROR_w_imm(RW2 d, IM16 i));
DECLARE_MIDFUNC(jff_ROR_l_imm(RW4 d, IM32 i));
DECLARE_MIDFUNC(jff_ROR_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_ROR_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_ROR_l(RW4 d, RR4 i));

// ROXR
DECLARE_MIDFUNC(jnf_ROXR_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROXR_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jnf_ROXR_l(RW4 d, RR4 i));
DECLARE_MIDFUNC(jff_ROXR_b(RW1 d, RR4 i));
DECLARE_MIDFUNC(jff_ROXR_w(RW2 d, RR4 i));
DECLARE_MIDFUNC(jff_ROXR_l(RW4 d, RR4 i));

// Scc
DECLARE_MIDFUNC(jnf_SCC(W1 d, IM8 cc));

// SUB
DECLARE_MIDFUNC(jnf_SUB_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jnf_SUB_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jnf_SUB_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jnf_SUB_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jnf_SUB_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jnf_SUB_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_SUB_b_imm(RW1 d, IM8 v));
DECLARE_MIDFUNC(jff_SUB_w_imm(RW2 d, IM16 v));
DECLARE_MIDFUNC(jff_SUB_l_imm(RW4 d, IM32 v));
DECLARE_MIDFUNC(jff_SUB_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jff_SUB_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jff_SUB_l(RW4 d, RR4 s));

// SUBA
DECLARE_MIDFUNC(jnf_SUBA_w(RW4 d, RR2 s));
DECLARE_MIDFUNC(jnf_SUBA_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jnf_SUBA_w_imm(RW4 d, IM16 v));
DECLARE_MIDFUNC(jnf_SUBA_l_imm(RW4 d, IM32 v));

// SUBX
DECLARE_MIDFUNC(jnf_SUBX_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jnf_SUBX_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jnf_SUBX_l(RW4 d, RR4 s));
DECLARE_MIDFUNC(jff_SUBX_b(RW1 d, RR1 s));
DECLARE_MIDFUNC(jff_SUBX_w(RW2 d, RR2 s));
DECLARE_MIDFUNC(jff_SUBX_l(RW4 d, RR4 s));

// SWAP
DECLARE_MIDFUNC (jnf_SWAP(RW4 d));
DECLARE_MIDFUNC (jff_SWAP(RW4 d));

// TST
DECLARE_MIDFUNC (jff_TST_b_imm(IM8 v));
DECLARE_MIDFUNC (jff_TST_w_imm(IM16 v));
DECLARE_MIDFUNC (jff_TST_l_imm(IM32 v));
DECLARE_MIDFUNC (jff_TST_b(RR1 s));
DECLARE_MIDFUNC (jff_TST_w(RR2 s));
DECLARE_MIDFUNC (jff_TST_l(RR4 s));

// Memory access functions
DECLARE_MIDFUNC(jnf_MEM_WRITE_OFF_b(RR4 adr, RR4 b));
DECLARE_MIDFUNC(jnf_MEM_WRITE_OFF_w(RR4 adr, RR4 w));
DECLARE_MIDFUNC(jnf_MEM_WRITE_OFF_l(RR4 adr, RR4 l));
DECLARE_MIDFUNC(jnf_MEM_WRITE24_OFF_b(RR4 adr, RR4 b));
DECLARE_MIDFUNC(jnf_MEM_WRITE24_OFF_w(RR4 adr, RR4 w));
DECLARE_MIDFUNC(jnf_MEM_WRITE24_OFF_l(RR4 adr, RR4 l));

DECLARE_MIDFUNC(jnf_MEM_READ_OFF_b(W4 d, RR4 adr));
DECLARE_MIDFUNC(jnf_MEM_READ_OFF_w(W4 d, RR4 adr));
DECLARE_MIDFUNC(jnf_MEM_READ_OFF_l(W4 d, RR4 adr));
DECLARE_MIDFUNC(jnf_MEM_READ24_OFF_b(W4 d, RR4 adr));
DECLARE_MIDFUNC(jnf_MEM_READ24_OFF_w(W4 d, RR4 adr));
DECLARE_MIDFUNC(jnf_MEM_READ24_OFF_l(W4 d, RR4 adr));

DECLARE_MIDFUNC(jnf_MEM_GETADR_OFF(W4 d, RR4 adr));
DECLARE_MIDFUNC(jnf_MEM_GETADR24_OFF(W4 d, RR4 adr));

DECLARE_MIDFUNC(jnf_MEM_READMEMBANK(W4 dest, RR4 adr, IM8 offset));
DECLARE_MIDFUNC(jnf_MEM_WRITEMEMBANK(RR4 adr, RR4 source, IM8 offset));
