spu: add asm mixing code for ARMv5 too
authornotaz <notasas@gmail.com>
Fri, 28 Oct 2011 22:09:36 +0000 (01:09 +0300)
committernotaz <notasas@gmail.com>
Sun, 30 Oct 2011 21:48:09 +0000 (23:48 +0200)
Makefile
plugins/dfsound/arm_utils.s
plugins/dfsound/spu.c

index 22f6652..f636c16 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -81,7 +81,7 @@ OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
        plugins/dfsound/registers.o plugins/dfsound/spu.o
 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
        plugins/dfsound/xa.c
-ifeq "$(HAVE_NEON)" "1"
+ifeq "$(ARCH)" "arm"
 OBJS += plugins/dfsound/arm_utils.o
 endif
 ifeq "$(USE_OSS)" "1"
index 6d3c974..70ff24d 100644 (file)
@@ -12,6 +12,8 @@
 .text
 .align 2
 
+@ XXX: should be HAVE_NEON
+.if HAVE_ARMV7
 
 .global mix_chan @ (int start, int count, int lv, int rv)
 mix_chan:
@@ -95,4 +97,65 @@ mcr_finish:
     vstmiage    r3!, {d8}
     bx          lr
 
+.else
+
+.global mix_chan @ (int start, int count, int lv, int rv)
+mix_chan:
+    stmfd       sp!, {r4-r8,lr}
+    orr         r3, r2, r3, lsl #16
+    lsl         r3, #1                 @ packed multipliers << 1
+    mov         r12, r0
+    ldr         r0, =ChanBuf
+    ldr         r2, =SSumLR
+    add         r0, r12, lsl #2
+    add         r2, r12, lsl #3
+0:
+    ldmia       r0!, {r4,r5}
+    ldmia       r2, {r6-r8,lr}
+    lsl         r4, #1                 @ adjust for mul
+    lsl         r5, #1
+    smlawb      r6, r4, r3, r6
+    smlawt      r7, r4, r3, r7
+    smlawb      r8, r5, r3, r8
+    smlawt      lr, r5, r3, lr
+    subs        r1, #2
+    blt         mc_finish
+    stmia       r2!, {r6-r8,lr}
+    bgt         0b
+    ldmeqfd     sp!, {r4-r8,pc}
+
+mc_finish:
+    stmia       r2!, {r6,r7}
+    ldmfd       sp!, {r4-r8,pc}
+
+
+.global mix_chan_rvb @ (int start, int count, int lv, int rv)
+mix_chan_rvb:
+    stmfd       sp!, {r4-r8,lr}
+    orr         lr, r2, r3, lsl #16
+    lsl         lr, #1
+    ldr         r3, =sRVBStart
+    ldr         r2, =SSumLR
+    ldr         r4, =ChanBuf
+    ldr         r3, [r3]
+    add         r2, r2, r0, lsl #3
+    add         r3, r3, r0, lsl #3
+    add         r0, r4, r0, lsl #2
+0:
+    ldr         r4, [r0], #4
+    ldmia       r2, {r6,r7}
+    ldmia       r3, {r8,r12}
+    lsl         r4, #1
+    smlawb      r6, r4, lr, r6         @ supposedly takes single cycle?
+    smlawt      r7, r4, lr, r7
+    smlawb      r8, r4, lr, r8
+    smlawt      r12,r4, lr, r12
+    subs        r1, #1
+    stmia       r2!, {r6,r7}
+    stmia       r3!, {r8,r12}
+    bgt         0b
+    ldmfd       sp!, {r4-r8,pc}
+
+.endif
+
 @ vim:filetype=armasm
index ecc7ca0..d26fa96 100644 (file)
@@ -623,8 +623,8 @@ static int do_samples_noise(int ch, int ns, int ns_to)
  return -1;
 }
 
-#ifdef __ARM_ARCH_7A__
-// asm code
+#ifdef __arm__
+// asm code; lv and rv must be 0-3fff
 extern void mix_chan(int start, int count, int lv, int rv);
 extern void mix_chan_rvb(int start, int count, int lv, int rv);
 #else