[4/5] armv7: Add in_reverse_8888_8888 fast path

Submitted by Ben Avison on April 21, 2015, 12:16 a.m.

Details

Message ID 1429575381-9879-4-git-send-email-bavison@riscosopen.org
State New
Headers show

Not browsing as part of any series.

Commit Message

Ben Avison April 21, 2015, 12:16 a.m.
This is tuned for Cortex-A7 (Raspberry Pi 2).
lowlevel-blt-bench results, compared to the ARMv6 fast path:

    Before          After
    Mean   StdDev   Mean   StdDev  Confidence  Change
L1  48.9   0.2      100.2  0.5     100.0%      +104.9%
L2  47.4   0.1      99.4   0.4     100.0%      +109.6%
M   30.4   0.1      59.2   0.3     100.0%      +94.6%
HT  27.5   0.1      43.4   0.2     100.0%      +57.7%
VT  23.7   0.1      41.6   0.2     100.0%      +75.3%
R   22.1   0.1      35.5   0.0     100.0%      +60.6%
RT  12.3   0.1      16.1   0.0     100.0%      +30.9%
---
 pixman/pixman-arm-neon-asm.S |   57 ++++++++++++++++++++++++++++++++++++++++++
 pixman/pixman-arm-neon.c     |    6 ++++
 2 files changed, 63 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/pixman/pixman-arm-neon-asm.S b/pixman/pixman-arm-neon-asm.S
index 8554e0c..93d680b 100644
--- a/pixman/pixman-arm-neon-asm.S
+++ b/pixman/pixman-arm-neon-asm.S
@@ -2856,6 +2856,63 @@  generate_composite_function \
 
 /******************************************************************************/
 
+.macro pixman_composite_in_reverse_8888_8888_process_pixblock_head
+    /* src is in d0-d3 (deinterleaved, though we only need alpha from d3) */
+    /* destination pixel data is in d4-d7 (deinterleaved) */
+    vmull.u8    q10, d6, d3
+    vmull.u8    q11, d7, d3
+    vmull.u8    q9, d5, d3
+    vmull.u8    q8, d4, d3
+    vrshr.u16   q15, q11, #8
+    vrshr.u16   q14, q10, #8
+    vrshr.u16   q13, q9, #8
+    vrshr.u16   q12, q8, #8
+    vraddhn.u16 d31, q11, q15
+    vraddhn.u16 d30, q10, q14
+    vraddhn.u16 d28, q8, q12
+    vraddhn.u16 d29, q9, q13
+.endm
+
+.macro pixman_composite_in_reverse_8888_8888_process_pixblock_tail
+    /* result is in d28-d31 */
+.endm
+
+.macro pixman_composite_in_reverse_8888_8888_process_pixblock_tail_head
+        vld4.8      {d0-d3}, [SRC]!
+    vzip.8      d28, d30
+        vld4.8      {d4-d7}, [DST_R :128]!
+            cache_preload 8, 8
+    vzip.8      d29, d31
+        vmull.u8    q10, d6, d3
+        vmull.u8    q11, d7, d3
+        vmull.u8    q9, d5, d3
+        vmull.u8    q8, d4, d3
+    vzip.8      d28, d29
+    vzip.8      d30, d31
+    vst1.8      {d28-d31}, [DST_W :128]!
+        vrshr.u16   q15, q11, #8
+        vrshr.u16   q14, q10, #8
+        vrshr.u16   q13, q9, #8
+        vrshr.u16   q12, q8, #8
+        vraddhn.u16 d31, q11, q15
+        vraddhn.u16 d30, q10, q14
+        vraddhn.u16 d28, q8, q12
+        vraddhn.u16 d29, q9, q13
+.endm
+
+generate_composite_function \
+    pixman_composite_in_reverse_8888_8888_asm_neon, 32, 0, 32, \
+    FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \
+    8, /* number of pixels, processed in a single block */ \
+    3, /* prefetch distance */ \
+    default_init, \
+    default_cleanup, \
+    pixman_composite_in_reverse_8888_8888_process_pixblock_head, \
+    pixman_composite_in_reverse_8888_8888_process_pixblock_tail, \
+    pixman_composite_in_reverse_8888_8888_process_pixblock_tail_head
+
+/******************************************************************************/
+
 generate_composite_function_nearest_scanline \
     pixman_scaled_nearest_scanline_8888_8888_OVER_asm_neon, 32, 0, 32, \
     FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \
diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c
index ab8a58c..532e903 100644
--- a/pixman/pixman-arm-neon.c
+++ b/pixman/pixman-arm-neon.c
@@ -68,6 +68,8 @@  PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, out_reverse_8_8888,
                                    uint8_t, 1, uint32_t, 1)
 PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, in_8888_8,
                                    uint32_t, 1, uint8_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (neon, in_reverse_8888_8888,
+                                   uint32_t, 1, uint32_t, 1)
 
 PIXMAN_ARM_BIND_FAST_PATH_N_DST (SKIP_ZERO_SRC, neon, over_n_0565,
                                  uint16_t, 1)
@@ -382,6 +384,10 @@  static const pixman_fast_path_t arm_neon_fast_paths[] =
     PIXMAN_STD_FAST_PATH (IN,   solid,    null,     a8b8g8r8, neon_composite_in_n_8888),
     PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8r8g8b8, neon_composite_over_reverse_n_8888),
     PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8b8g8r8, neon_composite_over_reverse_n_8888),
+    PIXMAN_STD_FAST_PATH (IN_REVERSE, a8r8g8b8, null, x8r8g8b8, neon_composite_in_reverse_8888_8888),
+    PIXMAN_STD_FAST_PATH (IN_REVERSE, a8b8g8r8, null, x8b8g8r8, neon_composite_in_reverse_8888_8888),
+    PIXMAN_STD_FAST_PATH (IN_REVERSE, a8r8g8b8, null, a8r8g8b8, neon_composite_in_reverse_8888_8888),
+    PIXMAN_STD_FAST_PATH (IN_REVERSE, a8b8g8r8, null, a8b8g8r8, neon_composite_in_reverse_8888_8888),
     PIXMAN_STD_FAST_PATH (OUT_REVERSE,  a8,    null, r5g6b5,   neon_composite_out_reverse_8_0565),
     PIXMAN_STD_FAST_PATH (OUT_REVERSE,  a8,    null, b5g6r5,   neon_composite_out_reverse_8_0565),
     PIXMAN_STD_FAST_PATH (OUT_REVERSE,  a8,    null, x8r8g8b8, neon_composite_out_reverse_8_8888),