From 0acebba1070415f5a54c4acd87fb88cfff183290 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 15 Jun 2022 07:12:09 -0400 Subject: osdcomm.h: Remove a few unimportant 64-bit functions --- src/devices/cpu/psx/psx.cpp | 8 ++++---- src/devices/cpu/scudsp/scudsp.cpp | 2 ++ src/devices/cpu/tms34010/34010ops.hxx | 13 ++++++------- src/osd/osdcomm.h | 5 ----- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp index 7e1ce6bd6a0..57ebf91e1da 100644 --- a/src/devices/cpu/psx/psx.cpp +++ b/src/devices/cpu/psx/psx.cpp @@ -1185,16 +1185,16 @@ void psxcpu_device::multiplier_update() case MULTIPLIER_OPERATION_MULT: { int64_t result = mul_32x32( (int32_t)m_multiplier_operand1, (int32_t)m_multiplier_operand2 ); - m_lo = extract_64lo( result ); - m_hi = extract_64hi( result ); + m_lo = result; + m_hi = result >> 32; } break; case MULTIPLIER_OPERATION_MULTU: { uint64_t result = mulu_32x32( m_multiplier_operand1, m_multiplier_operand2 ); - m_lo = extract_64lo( result ); - m_hi = extract_64hi( result ); + m_lo = result; + m_hi = result >> 32; } break; diff --git a/src/devices/cpu/scudsp/scudsp.cpp b/src/devices/cpu/scudsp/scudsp.cpp index 56b2a3cbc5b..517688c226b 100644 --- a/src/devices/cpu/scudsp/scudsp.cpp +++ b/src/devices/cpu/scudsp/scudsp.cpp @@ -128,6 +128,8 @@ DEFINE_DEVICE_TYPE(SCUDSP, scudsp_cpu_device, "scudsp", "Sega SCUDSP") #define scudsp_readmem(A,MD) m_data->read_dword(A | (MD << 6)) #define scudsp_writemem(A,MD,B) m_data->write_dword(A | (MD << 6), B) +constexpr uint64_t concat_64(uint32_t hi, uint32_t lo) { return (uint64_t(hi) << 32) | lo; } + uint32_t scudsp_cpu_device::scudsp_get_source_mem_reg_value( uint32_t mode ) { if ( mode < 0x8 ) diff --git a/src/devices/cpu/tms34010/34010ops.hxx b/src/devices/cpu/tms34010/34010ops.hxx index 27ef253ed6e..bb4791d9d76 100644 --- a/src/devices/cpu/tms34010/34010ops.hxx +++ b/src/devices/cpu/tms34010/34010ops.hxx @@ -525,8 +525,7 @@ void tms340x0_device::dint(uint16_t op) int64_t dividend = ((uint64_t)*rd1 << 32) | (uint32_t)*rd2; \ int64_t quotient = dividend / *rs; \ int32_t remainder = dividend % *rs; \ - uint32_t signbits = (int32_t)quotient >> 31; \ - if (extract_64hi(quotient) != signbits) \ + if ((int64_t)(int32_t)quotient != quotient) \ { \ SET_V_LOG(1); \ } \ @@ -573,7 +572,7 @@ void tms340x0_device::divs_b(uint16_t op) { DIVS(B); } uint64_t dividend = ((uint64_t)*rd1 << 32) | (uint32_t)*rd2; \ uint64_t quotient = dividend / (uint32_t)*rs; \ uint32_t remainder = dividend % (uint32_t)*rs; \ - if (extract_64hi(quotient) != 0) \ + if (quotient > 0xffffffff) \ { \ SET_V_LOG(1); \ } \ @@ -740,8 +739,8 @@ void tms340x0_device::modu_b(uint16_t op) { MODU(B); } SET_Z_LOG(product == 0); \ SET_N_BIT(product >> 32, 31); \ \ - *rd1 = extract_64hi(product); \ - R##REG(DSTREG(op)|1) = extract_64lo(product); \ + *rd1 = (int32_t)(product >> 32); \ + R##REG(DSTREG(op)|1) = product & 0xffffffff; \ \ COUNT_CYCLES(20); \ } @@ -759,8 +758,8 @@ void tms340x0_device::mpys_b(uint16_t op) { MPYS(B); } product = mulu_32x32(m1, *rd1); \ SET_Z_LOG(product == 0); \ \ - *rd1 = extract_64hi(product); \ - R##REG(DSTREG(op)|1) = extract_64lo(product); \ + *rd1 = (int32_t)(product >> 32); \ + R##REG(DSTREG(op)|1) = product & 0xffffffff; \ \ COUNT_CYCLES(21); \ } diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index 75370f1b81b..0b372e4e61e 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -75,11 +75,6 @@ using s64 = std::int64_t; FUNDAMENTAL MACROS ***************************************************************************/ -// Concatenate/extract 32-bit halves of 64-bit values -constexpr uint64_t concat_64(uint32_t hi, uint32_t lo) { return (uint64_t(hi) << 32) | uint32_t(lo); } -constexpr uint32_t extract_64hi(uint64_t val) { return uint32_t(val >> 32); } -constexpr uint32_t extract_64lo(uint64_t val) { return uint32_t(val); } - // Macros for normalizing data into big or little endian formats constexpr uint16_t swapendian_int16(uint16_t val) { return (val << 8) | (val >> 8); } -- cgit v1.2.3