Made PTR64 a makefile-only thing - it isn't necessary in the code.

This commit is contained in:
Vas Crabb 2025-04-20 06:10:25 +10:00
parent 8ab7404eac
commit e3f386c2a9
8 changed files with 26 additions and 67 deletions

View File

@ -1623,7 +1623,6 @@ CPPCHECK_PARAMS += -I3rdparty/bx/include
CPPCHECK_PARAMS += -I$(BUILDDIR)/generated/emu
CPPCHECK_PARAMS += -I$(BUILDDIR)/generated/emu/layout
CPPCHECK_PARAMS += -I$(BUILDDIR)/generated/mame/layout
CPPCHECK_PARAMS += -DPTR64=1
CPPCHECK_PARAMS += -DMAME_DEBUG
CPPCHECK_PARAMS += -DMAME_PROFILER
CPPCHECK_PARAMS += -DCRLF=3

View File

@ -563,10 +563,6 @@ dofile ("toolchain.lua")
-- Avoid error when invoking genie --help.
if (_ACTION == nil) then return false end
-- define PTR64 if we are a 64-bit target
configuration { "x64 or android-*64"}
defines { "PTR64=1" }
-- define MAME_DEBUG if we are a debugging build
configuration { "Debug" }
defines {
@ -1084,12 +1080,6 @@ end
end
end
if (_OPTIONS["PLATFORM"]=="alpha") then
defines {
"PTR64=1",
}
end
if (_OPTIONS["PLATFORM"]=="arm") then
buildoptions {
"-Wno-cast-align",
@ -1100,21 +1090,6 @@ if (_OPTIONS["PLATFORM"]=="arm64") then
buildoptions {
"-Wno-cast-align",
}
defines {
"PTR64=1",
}
end
if (_OPTIONS["PLATFORM"]=="riscv64") then
defines {
"PTR64=1",
}
end
if (_OPTIONS["PLATFORM"]=="mips64") then
defines {
"PTR64=1",
}
end
local subdir

View File

@ -175,13 +175,6 @@ void validate_integer_semantics()
if (a32 >> 1 != -2) osd_printf_error("s32 right shift must be arithmetic\n");
if (a64 >> 1 != -2) osd_printf_error("s64 right shift must be arithmetic\n");
// check pointer size
#ifdef PTR64
static_assert(sizeof(void *) == 8, "PTR64 flag enabled, but was compiled for 32-bit target\n");
#else
static_assert(sizeof(void *) == 4, "PTR64 flag not enabled, but was compiled for 64-bit target\n");
#endif
// TODO: check if this is actually working
// check endianness definition
u16 lsbtest = 0;

View File

@ -3490,11 +3490,7 @@ void n64_rdp::span_draw_1cycle(int32_t scanline, const extent_t &extent, const r
const uint32_t zb = object.m_misc_state.m_zb_address >> 1;
const uint32_t zhb = object.m_misc_state.m_zb_address;
#ifdef PTR64
assert(extent.userdata != (const void *)0xcccccccccccccccc);
#else
assert(extent.userdata != (const void *)0xcccccccc);
#endif
assert(uintptr_t(extent.userdata) != uintptr_t(uint64_t(0xcccccccc'cccccccc)));
rdp_span_aux* userdata = (rdp_span_aux*)extent.userdata;
m_tex_pipe.calculate_clamp_diffs(tilenum, userdata, object);
@ -3813,11 +3809,7 @@ void n64_rdp::span_draw_2cycle(int32_t scanline, const extent_t &extent, const r
int32_t news = 0;
int32_t newt = 0;
#ifdef PTR64
assert(extent.userdata != (const void *)0xcccccccccccccccc);
#else
assert(extent.userdata != (const void *)0xcccccccc);
#endif
assert(uintptr_t(extent.userdata) != uintptr_t(uint64_t(0xcccccccc'cccccccc)));
rdp_span_aux* userdata = (rdp_span_aux*)extent.userdata;
m_tex_pipe.calculate_clamp_diffs(tile1, userdata, object);

View File

@ -15,8 +15,10 @@
#include <intrin.h>
#include <stdlib.h>
#pragma intrinsic(_BitScanReverse)
#ifdef PTR64
#if defined(_M_X64) || defined(_M_ARM64)
#pragma intrinsic(_BitScanReverse64)
#endif
@ -65,7 +67,7 @@ __forceinline uint8_t _count_leading_ones_32(uint32_t value)
__forceinline uint8_t _count_leading_zeros_64(uint64_t value)
{
unsigned long index;
#ifdef PTR64
#if defined(_M_X64) || defined(_M_ARM64)
return _BitScanReverse64(&index, value) ? (63U - index) : 64U;
#else
return _BitScanReverse(&index, uint32_t(value >> 32)) ? (31U - index) : _BitScanReverse(&index, uint32_t(value)) ? (63U - index) : 64U;
@ -84,7 +86,7 @@ __forceinline uint8_t _count_leading_zeros_64(uint64_t value)
__forceinline uint8_t _count_leading_ones_64(uint64_t value)
{
unsigned long index;
#ifdef PTR64
#if defined(_M_X64) || defined(_M_ARM64)
return _BitScanReverse64(&index, ~value) ? (63U - index) : 64U;
#else
return _BitScanReverse(&index, ~uint32_t(value >> 32)) ? (31U - index) : _BitScanReverse(&index, ~uint32_t(value)) ? (63U - index) : 64U;

View File

@ -13,7 +13,7 @@
#pragma once
#ifdef PTR64
#if defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
#include <emmintrin.h>
#endif
@ -29,7 +29,7 @@
multiply and return the full 64 bit result
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define mul_32x32 _mul_32x32
inline int64_t _mul_32x32(int32_t a, int32_t b)
{
@ -50,7 +50,7 @@ inline int64_t _mul_32x32(int32_t a, int32_t b)
result
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define mulu_32x32 _mulu_32x32
inline uint64_t _mulu_32x32(uint32_t a, uint32_t b)
{
@ -71,7 +71,7 @@ inline uint64_t _mulu_32x32(uint32_t a, uint32_t b)
result
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define mul_32x32_hi _mul_32x32_hi
inline int32_t _mul_32x32_hi(int32_t a, int32_t b)
{
@ -95,7 +95,7 @@ inline int32_t _mul_32x32_hi(int32_t a, int32_t b)
of the result
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define mulu_32x32_hi _mulu_32x32_hi
inline uint32_t _mulu_32x32_hi(uint32_t a, uint32_t b)
{
@ -120,7 +120,7 @@ inline uint32_t _mulu_32x32_hi(uint32_t a, uint32_t b)
result to 32 bits
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define mul_32x32_shift _mul_32x32_shift
static inline int32_t _mul_32x32_shift(int32_t a, int32_t b, uint8_t shift)
{
@ -147,7 +147,7 @@ static inline int32_t _mul_32x32_shift(int32_t a, int32_t b, uint8_t shift)
result to 32 bits
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define mulu_32x32_shift _mulu_32x32_shift
inline uint32_t _mulu_32x32_shift(uint32_t a, uint32_t b, uint8_t shift)
{
@ -172,7 +172,7 @@ inline uint32_t _mulu_32x32_shift(uint32_t a, uint32_t b, uint8_t shift)
divide and return the 32 bit quotient
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define div_64x32 _div_64x32
inline int32_t _div_64x32(int64_t a, int32_t b)
{
@ -198,7 +198,7 @@ inline int32_t _div_64x32(int64_t a, int32_t b)
divide and return the 32 bit quotient
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define divu_64x32 _divu_64x32
inline uint32_t _divu_64x32(uint64_t a, uint32_t b)
{
@ -225,7 +225,7 @@ inline uint32_t _divu_64x32(uint64_t a, uint32_t b)
32 bit remainder
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define div_64x32_rem _div_64x32_rem
inline int32_t _div_64x32_rem(int64_t a, int32_t b, int32_t &remainder)
{
@ -255,7 +255,7 @@ inline int32_t _div_64x32_rem(int64_t a, int32_t b, int32_t &remainder)
and 32 bit remainder
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define divu_64x32_rem _divu_64x32_rem
inline uint32_t _divu_64x32_rem(uint64_t a, uint32_t b, uint32_t &remainder)
{
@ -285,7 +285,7 @@ inline uint32_t _divu_64x32_rem(uint64_t a, uint32_t b, uint32_t &remainder)
division, and returning the 32 bit quotient
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define div_32x32_shift _div_32x32_shift
inline int32_t _div_32x32_shift(int32_t a, int32_t b, uint8_t shift)
{
@ -313,7 +313,7 @@ inline int32_t _div_32x32_shift(int32_t a, int32_t b, uint8_t shift)
division, and returning the 32 bit quotient
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define divu_32x32_shift _divu_32x32_shift
inline uint32_t _divu_32x32_shift(uint32_t a, uint32_t b, uint8_t shift)
{
@ -340,7 +340,7 @@ inline uint32_t _divu_32x32_shift(uint32_t a, uint32_t b, uint8_t shift)
divide and return the 32 bit remainder
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define mod_64x32 _mod_64x32
static inline int32_t _mod_64x32(int64_t a, int32_t b)
{
@ -366,7 +366,7 @@ static inline int32_t _mod_64x32(int64_t a, int32_t b)
divide and return the 32 bit remainder
-------------------------------------------------*/
#ifndef PTR64
#ifndef _M_X64
#define modu_64x32 _modu_64x32
inline uint32_t _modu_64x32(uint64_t a, uint32_t b)
{
@ -392,7 +392,7 @@ inline uint32_t _modu_64x32(uint64_t a, uint32_t b)
point reciprocal
-------------------------------------------------*/
#ifdef PTR64
#if defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
#define recip_approx _recip_approx
inline float _recip_approx(float z)
{
@ -410,7 +410,7 @@ inline float _recip_approx(float z)
multiply and return the full 128 bit result
-------------------------------------------------*/
#ifdef PTR64
#ifdef _M_X64
#define mul_64x64 _mul_64x64
__forceinline int64_t _mul_64x64(int64_t a, int64_t b, int64_t &hi)
{
@ -424,7 +424,7 @@ __forceinline int64_t _mul_64x64(int64_t a, int64_t b, int64_t &hi)
bit multiply and return the full 128 bit result
-------------------------------------------------*/
#ifdef PTR64
#ifdef _M_X64
#define mulu_64x64 _mulu_64x64
__forceinline int64_t _mulu_64x64(uint64_t a, uint64_t b, uint64_t &hi)
{
@ -455,7 +455,7 @@ __forceinline bool _addu_32x32_co(uint32_t a, uint32_t b, uint32_t &sum)
#define addu_64x64_co _addu_64x64_co
__forceinline bool _addu_64x64_co(uint64_t a, uint64_t b, uint64_t &sum)
{
#ifdef PTR64
#ifdef _M_X64
return _addcarry_u64(0, a, b, &sum);
#else
uint32_t l, h;

View File

@ -147,7 +147,6 @@ static void defines_verbose(void)
osd_printf_verbose("\n");
osd_printf_verbose("Build defines 1: ");
MACRO_VERBOSE(LSB_FIRST);
MACRO_VERBOSE(PTR64);
MACRO_VERBOSE(MAME_NOASM);
MACRO_VERBOSE(MAME_DEBUG);
MACRO_VERBOSE(BIGENDIAN);

View File

@ -55,7 +55,6 @@ void defines_verbose()
osd_printf_verbose("\n");
osd_printf_verbose("Build defines 1: ");
MACRO_VERBOSE(LSB_FIRST);
MACRO_VERBOSE(PTR64);
MACRO_VERBOSE(MAME_NOASM);
MACRO_VERBOSE(MAME_DEBUG);
MACRO_VERBOSE(BIGENDIAN);