mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
e132xs: Provide new helper functions for extracting signed 16-bit halves
* eminline.h: Remove mul_16x16 function
This commit is contained in:
parent
957cfaa53d
commit
edaa86db88
@ -337,6 +337,10 @@ private:
|
||||
|
||||
uint32_t get_global_register(uint8_t code);
|
||||
|
||||
// words interpreted as pairs of signed half-words (HS)
|
||||
static int get_lhs(uint32_t val) { return int16_t(val & 0xffff); }
|
||||
static int get_rhs(uint32_t val) { return int16_t(val >> 16); }
|
||||
|
||||
uint32_t get_emu_code_addr(uint8_t num);
|
||||
int32_t get_instruction_length(uint16_t op);
|
||||
|
||||
|
@ -2264,27 +2264,27 @@ void hyperstone_device::hyperstone_extend()
|
||||
|
||||
// signed half-word multiply/add, single word product sum
|
||||
case EHMAC:
|
||||
m_core->global_regs[15] = (int32_t)m_core->global_regs[15] + mul_16x16(vald >> 16, vals >> 16) + mul_16x16(vald & 0xffff, vals & 0xffff);
|
||||
m_core->global_regs[15] = m_core->global_regs[15] + get_lhs(vald) * get_lhs(vals) + get_rhs(vald) * get_rhs(vals);
|
||||
break;
|
||||
|
||||
// signed half-word multiply/add, double word product sum
|
||||
case EHMACD:
|
||||
{
|
||||
int64_t result = get_double_word<GLOBAL>(14, 15) + (int64_t)mul_16x16(vald >> 16, vals >> 16) + (int64_t)mul_16x16(vald & 0xffff, vals & 0xffff);
|
||||
int64_t result = get_double_word<GLOBAL>(14, 15) + int64_t(get_lhs(vald) * get_lhs(vals)) + int64_t(get_rhs(vald) * get_rhs(vals));
|
||||
set_double_word<GLOBAL>(14, 15, result);
|
||||
break;
|
||||
}
|
||||
|
||||
// half-word complex multiply
|
||||
case EHCMULD:
|
||||
m_core->global_regs[14] = mul_16x16(vald >> 16, vals >> 16 ) - mul_16x16(vald & 0xffff, vals & 0xffff);
|
||||
m_core->global_regs[15] = mul_16x16(vald >> 16, vals & 0xffff) + mul_16x16(vald & 0xffff, vals >> 16 );
|
||||
m_core->global_regs[14] = get_lhs(vald) * get_lhs(vals) - get_rhs(vald) * get_rhs(vals);
|
||||
m_core->global_regs[15] = get_lhs(vald) * get_rhs(vals) + get_rhs(vald) * get_lhs(vals);
|
||||
break;
|
||||
|
||||
// half-word complex multiply/add
|
||||
case EHCMACD:
|
||||
m_core->global_regs[14] += mul_16x16(vald >> 16, vals >> 16 ) - mul_16x16(vald & 0xffff, vals & 0xffff);
|
||||
m_core->global_regs[15] += mul_16x16(vald >> 16, vals & 0xffff) + mul_16x16(vald & 0xffff, vals >> 16 );
|
||||
m_core->global_regs[14] += get_lhs(vald) * get_lhs(vals) - get_rhs(vald) * get_rhs(vals);
|
||||
m_core->global_regs[15] += get_lhs(vald) * get_rhs(vals) + get_rhs(vald) * get_lhs(vals);
|
||||
break;
|
||||
|
||||
// half-word (complex) add/subtract
|
||||
|
@ -50,19 +50,6 @@
|
||||
INLINE MATH FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
mul_16x16 - perform a signed 16 bit x 16 bit
|
||||
multiply and return the full 32 bit result
|
||||
-------------------------------------------------*/
|
||||
|
||||
#ifndef mul_16x16
|
||||
constexpr int32_t mul_16x16(int16_t a, int16_t b)
|
||||
{
|
||||
return int32_t(a) * int32_t(b);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
mul_32x32 - perform a signed 32 bit x 32 bit
|
||||
multiply and return the full 64 bit result
|
||||
|
Loading…
Reference in New Issue
Block a user