platform gp2x, fix compilation with original toolchain (gcc 4.1)

This commit is contained in:
kub 2023-04-30 22:11:07 +00:00
parent 97232a47c9
commit 110a49ed2a
10 changed files with 59 additions and 53 deletions

View file

@ -53,7 +53,9 @@ ifeq ("$(PLATFORM)",$(filter "$(PLATFORM)","gp2x" "opendingux" "miyoo" "rpi1"))
# very small caches, avoid optimization options making the binary much bigger
CFLAGS += -finline-limit=42 -fno-unroll-loops -fno-ipa-cp -ffast-math
# this gets you about 20% better execution speed on 32bit arm/mips
CFLAGS += -fno-common -fno-stack-protector -fno-guess-branch-probability -fno-caller-saves -fno-tree-loop-if-convert -fno-regmove
CFLAGS += -fno-common -fno-stack-protector -fno-guess-branch-probability -fno-caller-saves -fno-regmove
# Ouf, very old gcc toolchains (pre 4.6) don't have this option:
CFLAGS += $(shell echo | $(CC) -ftree-loop-if-convert -x c -c -o /dev/null - 2>/dev/null && echo xfno-tree-loop-if-convert | tr x -)
endif
# default settings
@ -209,7 +211,6 @@ OBJS += platform/gp2x/vid_pollux.o
OBJS += platform/gp2x/warm.o
USE_FRONTEND = 1
PLATFORM_MP3 = 1
PLATFORM_ZLIB = 1
endif
ifeq "$(PLATFORM)" "psp"
CFLAGS += -DUSE_BGR565 -G8 # -DLPRINTF_STDIO -DFW15
@ -244,8 +245,6 @@ endif
ifeq "$(USE_LIBRETRO_VFS)" "1"
OBJS += platform/libretro/libretro-common/memmap/memmap.o
endif
PLATFORM_ZLIB ?= 1
endif
ifeq "$(USE_FRONTEND)" "1"
@ -425,12 +424,13 @@ pico/carthw_cfg.c: pico/carthw.cfg
# preprocessed asm files most probably include the offsets file
$(filter %.S,$(SRCS_COMMON)): pico/pico_int_offs.h
# random deps
# random deps - TODO remove this and compute dependcies automatically
pico/carthw/svp/compiler.o : cpu/drc/emit_arm.c
cpu/sh2/compiler.o : cpu/drc/emit_arm.c cpu/drc/emit_arm64.c cpu/drc/emit_ppc.c
cpu/sh2/compiler.o : cpu/drc/emit_x86.c cpu/drc/emit_mips.c cpu/drc/emit_riscv.c
cpu/sh2/mame/sh2pico.o : cpu/sh2/mame/sh2.c
pico/pico.o pico/cd/mcd.o pico/32x/32x.o : pico/pico_cmn.c pico/pico_int.h
pico/memory.o pico/cd/memory.o pico/32x/memory.o : pico/pico_int.h pico/memory.h
pico/pico.o pico/cd/mcd.o pico/32x/32x.o : pico/pico_cmn.c
pico/memory.o pico/cd/memory.o pico/32x/memory.o : pico/memory.h
$(shell grep -rl pico_int.h pico) : pico/pico_int.h
# pico/cart.o : pico/carthw_cfg.c
cpu/fame/famec.o: cpu/fame/famec.c cpu/fame/famec_opcodes.h

4
configure vendored
View file

@ -148,6 +148,7 @@ set_platform()
CFLAGS="$CFLAGS -D__PSP__"
MFLAGS="-march=allegrex"
ARCH=mipsel
need_zlib="yes"
;;
*)
fail "unsupported platform: $platform"
@ -168,6 +169,8 @@ for opt do
;;
--with-sdl-gles=*) have_gles="$optarg"
;;
--with-zlib=*) need_zlib="$optarg"
;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
@ -182,6 +185,7 @@ if [ "$show_help" = "yes" ]; then
echo " available: $sound_driver_list"
echo " --with-libavcodec=yes|no use libavcodec for mp3 decoding"
echo " --with-sdl-gles=yes|no enable GLES usage for SDL"
echo " --with-zlib=yes|no use internal zlib"
echo "influential environment variables:"
echo " CROSS_COMPILE CC CXX AS STRIP CFLAGS ASFLAGS LDFLAGS LDLIBS"
exit 1

View file

@ -201,7 +201,7 @@
mov r7, r7, ror #5
orr r7, r7, r7, ror #10+11
orr r7, r7, r12,lsl #1+16
lsr r7, #16
mov r7, r7, lsr #16
tst r7, #0x20 @ check for prio transfer
bne 9f @ bg_loop

View file

@ -77,7 +77,7 @@
beq 0f
cmp r4, #0xe
orr r4, r3, r4
biceq r4, #0x80
biceq r4, r4, #0x80
strb r4, [r1,#\offs]
0:
.endm
@ -385,8 +385,8 @@ DrawLayer:
beq 0f
cmp r3, #2
mov r3, r2, lsl #2 @ htab+=DrawScanline<<1; // Offset by line
biceq r3, #0x1f @ htab&=~0xf; // Offset by tile
andlt r3, #0x1f
biceq r3, r3, #0x1f @ htab&=~0xf; // Offset by tile
andlt r3, r3, #0x1f
add r4, r4, r3
0: add r4, r4, r0, lsl #1 @ htab+=plane
bic r4, r4, #0x00ff0000 @ just in case
@ -611,7 +611,7 @@ DrawLayer:
@ r4 & r7 are scratch in this loop
@ need to calc new ty?
lsls r7, r10, #7 @ (cell&1)?
movs r7, r10, lsl #7 @ (cell&1)?
bmi .dsloop_vs_subr1
@ calc offset and read tileline code to r7, also calc ty
@ -644,7 +644,7 @@ DrawLayer:
ble .dsloop_vs_exit
@ need to calc new ty?
lsls r7, r10, #7 @ (cell&1)?
movs r7, r10, lsl #7 @ (cell&1)?
bmi 0f
@ calc offset and read tileline code to r7, also calc ty
@ -2059,7 +2059,7 @@ FinalizeLine555:
and r8, lr, r8, lsl #1
ldrh r8, [r3, r8]
and r8, r8, r9
lsl r8, r8, #16
mov r8, r8, lsl #16
.fl_20loop_bl2:
ldr r12, [r1], #4

View file

@ -164,10 +164,10 @@ mix_16h_to_32_resample_stereo:
m16_32_rss_loop:
ldmia r0, {r5-r8}
lsr r9, r4, #16
mov r9, r4, lsr #16
ldr r12,[r1, r9, lsl #2]
add r4, r4, r3
lsr r9, r4, #16
mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
add r4, r4, r3
subs r2, r2, #2
@ -183,7 +183,7 @@ m16_32_rss_loop:
m16_32_rss_end:
tst r2, #1
ldmeqfd sp!, {r4-r9,pc}
lsr r9, r4, #16
mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
ldmia r0, {r5,r6}
mov r12,lr, lsl #16
@ -207,10 +207,10 @@ mix_16h_to_32_resample_mono:
m16_32_rsm_loop:
ldmia r0, {r5-r6}
lsr r9, r4, #16
mov r9, r4, lsr #16
ldr r12,[r1, r9, lsl #2]
add r4, r4, r3
lsr r9, r4, #16
mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
add r4, r4, r3
subs r2, r2, #2
@ -226,7 +226,7 @@ m16_32_rsm_loop:
m16_32_rsm_end:
tst r2, #1
ldmeqfd sp!, {r4-r6,r9,pc}
lsr r9, r4, #16
mov r9, r4, lsr #16
ldr lr ,[r1, r9, lsl #2]
ldr r5, [r0]
mov r12,lr, lsl #16
@ -272,11 +272,11 @@ m16_32_rsm_end:
@ lowpass filter
@ in=int_sample (max 20 bit), y=filter memory, r12=alpha(Q8), r8=tmp
.macro LPfilt in y
@ asr r8, \y, #8
@ mov r8, \y, asr #8
@ rsb r8, r8, \in, lsl #4 @ fixpoint 20.12
sub r8, \in, \y, asr #12 @ fixpoint 20.12
mla \y, r8, r12, \y
asr \in, \y, #12
mov \in, \y, asr #12
.endm
@ -551,8 +551,8 @@ m32_16l_st_l_no_unal2:
mix_reset:
ldr r2, =filter
rsb r0, r0, #0x10000
@ asr r0, r0, #8
asr r0, r0, #4
@ mov r0, r0, asr #8
mov r0, r0, asr #4
str r0, [r2], #4
mov r1, #0
str r1, [r2], #4

View file

@ -8,12 +8,12 @@
*/
#include <string.h>
#include "../pico_int.h"
#include "ym2612.h"
#include "sn76496.h"
#include "../pico_int.h"
#include "mix.h"
#include "emu2413/emu2413.h"
#include "resampler.h"
#include "mix.h"
void (*PsndMix_32_to_16l)(s16 *dest, s32 *src, int count) = mix_32_to_16l_stereo;
@ -89,7 +89,7 @@ static void YM2612Update(s32 *buffer, int length, int stereo)
ymchans = YM2612UpdateOne(buffer, length, stereo, 1);
}
int YM2612UpdateFIR(s32 *buffer, int length, int stereo, int is_buf_empty)
static int YM2612UpdateFIR(s32 *buffer, int length, int stereo, int is_buf_empty)
{
resampler_update(fmresampler, buffer, length, YM2612Update);
return ymchans;

View file

@ -114,6 +114,7 @@
#include <string.h>
#include <math.h>
#include "../pico_int.h"
#include "ym2612.h"
#ifndef EXTERNAL_YM2612

View file

@ -187,22 +187,23 @@ int YM2612PicoStateLoad2(int *tat, int *tbt);
#else
/* GP2X specific */
#include <platform/gp2x/940ctl.h>
#define YM2612Init(baseclock,rate,flags) do { \
if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, flags); \
else YM2612Init_(baseclock, rate, flags); \
} while (0)
#define YM2612ResetChip() do { \
if (PicoIn.opt&POPT_EXT_FM) YM2612ResetChip_940(); \
else YM2612ResetChip_(); \
} while (0)
#define YM2612UpdateOne(buffer,length,stereo,is_buf_empty) do { \
(PicoIn.opt&POPT_EXT_FM) ? YM2612UpdateOne_940(buffer, length, stereo, is_buf_empty) : \
YM2612UpdateOne_(buffer, length, stereo, is_buf_empty); \
} while (0)
#define YM2612PicoStateLoad() do { \
if (PicoIn.opt&POPT_EXT_FM) YM2612PicoStateLoad_940(); \
else YM2612PicoStateLoad_(); \
} while (0)
static inline void YM2612Init(int baseclock, int rate, int flags) {
if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, flags);
else YM2612Init_(baseclock, rate, flags);
}
static inline void YM2612ResetChip(void) {
if (PicoIn.opt&POPT_EXT_FM) YM2612ResetChip_940();
else YM2612ResetChip_();
}
static inline int YM2612UpdateOne(s32 *buffer, int length, int stereo, int is_buf_empty) {
return (PicoIn.opt&POPT_EXT_FM) ? YM2612UpdateOne_940(buffer, length, stereo, is_buf_empty) :
YM2612UpdateOne_(buffer, length, stereo, is_buf_empty);
}
static inline void YM2612PicoStateLoad(void) {
if (PicoIn.opt&POPT_EXT_FM) YM2612PicoStateLoad_940();
else YM2612PicoStateLoad_();
}
#endif /* __GP2X__ */

View file

@ -168,7 +168,7 @@
1: @ EG_REL
cmp r0, #0x200 @ if ( volume >= 0x200 )
movge r0, #1024
subge r0, #1
subge r0, r0, #1
movge r3, #EG_OFF
strgeb r3, [r5,#0x17] @ state
@ -180,8 +180,8 @@
cmpge r3, #EG_REL+1
ldrh r3, [r5,#0x18] @ tl
rsbge r0, r0, #0x200 @ volume = (0x200-volume) & MAX_ATT
lslge r0, r0, #22
lsrge r0, r0, #22
movge r0, r0, lsl #22
movge r0, r0, lsr #22
11:
#endif
@ -207,7 +207,7 @@
beq 1f
tst r0, #0x02
eorne r0, r0, lsr #8 @ ssg ^= ssgn ^ 4
eorne r0, r0, r0, lsr #8 @ ssg ^= ssgn ^ 4
eorne r0, r0, #0x4
orrne r0, r0, #0x400 @ ssgn = 4
strneh r0, [r5,#0x30]
@ -258,8 +258,8 @@
cmpge r3, #EG_REL+1
ldrh r3, [r5,#0x18] @ tl
rsbge r0, r0, #0x200 @ volume = (0x200-volume) & MAX_ATT
lslge r0, r0, #22
lsrge r0, r0, #22
movge r0, r0, lsl #22
movge r0, r0, lsr #22
add r0, r0, r3 @ volume += tl
strh r0, [r5,#0x34] @ vol_out
@ -857,10 +857,10 @@ crl_smp_loop_end:
tst r0, r0
beq ctl_sample_skip
orr r4, r4, #8 @ have_output
lsr r1, r0, #31 @ clip (saturate) sample to 14 bit
mov r1, r0, lsr #31 @ clip (saturate) sample to 14 bit
cmn r1, r0, asr #13
subne r0, r1, #0x80000001
asrne r0, r0, #18
movne r0, r0, asr #18
tst r4, r1, lsl #7 @ (sample < 0) && dac?
bicne r0, r0, #0x1f
subne r0, r0, #7<<5

View file

@ -144,7 +144,7 @@ vidcpy_8bit:
mov r12, r3, lsl #16 @ h
vidCpy8bit_loop_out:
lsrs r6, lr, #5
movs r6, lr, lsr #5
@ beq vidCpy8bit_loop_end
vidCpy8bit_loop:
subs r6, r6, #1
@ -199,7 +199,7 @@ vidcpy_8bit_rot:
mov r8, #328
vidCpy8bitrot_loop_out:
mov r10, r0
lsrs r9, lr, #2
movs r9, lr, lsr #2
@ beq vidCpy8bitrot_loop_end
vidCpy8bitrot_loop:
mov r6, r1