public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel•crashing.org>
To: Thomas Huth <thuth@redhat•com>
Cc: slof@lists•ozlabs.org, nikunj@linux•vnet.ibm.com, aik@ozlabs•ru,
	linuxppc-dev@lists•ozlabs.org, gkurz@linux•vnet.ibm.com
Subject: Re: [SLOF PATCH 1/2] fbuffer: Improve invert-region helper
Date: Tue, 28 Jul 2015 12:04:16 -0500	[thread overview]
Message-ID: <20150728170416.GB28839@gate.crashing.org> (raw)
In-Reply-To: <1438078795-14360-2-git-send-email-thuth@redhat.com>

On Tue, Jul 28, 2015 at 12:19:54PM +0200, Thomas Huth wrote:
>  : invert-region ( addr len -- )
> -   0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP drop
> -;
> -
> -: invert-region-x ( addr len -- )
> -   /x / 0 ?DO dup dup rx@ -1 xor swap rx! xa1+ LOOP drop
> +   2dup or 7 and CASE
> +      0 OF 3 rshift 0 ?DO dup dup rx@ -1 xor swap rx! xa1+ LOOP ENDOF
> +      2 OF 1 rshift 0 ?DO dup dup rw@ -1 xor swap rw! wa1+ LOOP ENDOF
> +      4 OF 2 rshift 0 ?DO dup dup rl@ -1 xor swap rl! la1+ LOOP ENDOF
> +      6 OF 1 rshift 0 ?DO dup dup rw@ -1 xor swap rw! wa1+ LOOP ENDOF
> +      dup OF 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP ENDOF
> +   ENDCASE
> +   drop
>  ;

Can you access device memory as 64 bits for all supported devices?

You can get a bigger speedup by writing some of the core blitting
functions in C, btw.

A small simplification:

   2dup or 7 and CASE
      0 OF 3 rshift 0 ?DO dup dup rx@ -1 xor swap rx! xa1+ LOOP ENDOF
      4 OF 2 rshift 0 ?DO dup dup rl@ -1 xor swap rl! la1+ LOOP ENDOF
      3 and
      2 OF 1 rshift 0 ?DO dup dup rw@ -1 xor swap rw! wa1+ LOOP ENDOF
      dup OF 0 ?DO dup dup rb@ -1 xor swap rb! 1+ LOOP ENDOF
   ENDCASE


If this code is often called unaligned, it makes more sense to special-
case the begin and end probably.


Segher

  reply	other threads:[~2015-07-28 17:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 10:19 [SLOF PATCH 0/2] fbuffer: Improve the speed of the cursor drawing Thomas Huth
2015-07-28 10:19 ` [SLOF PATCH 1/2] fbuffer: Improve invert-region helper Thomas Huth
2015-07-28 17:04   ` Segher Boessenkool [this message]
2015-07-28 21:00     ` Thomas Huth
2015-07-28 10:19 ` [SLOF PATCH 2/2] fbuffer: Use a smaller cursor Thomas Huth
2015-07-29  3:05   ` Alexey Kardashevskiy
2015-07-29  3:42     ` [SLOF] " Segher Boessenkool
2015-07-29  6:03       ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150728170416.GB28839@gate.crashing.org \
    --to=segher@kernel$(echo .)crashing.org \
    --cc=aik@ozlabs$(echo .)ru \
    --cc=gkurz@linux$(echo .)vnet.ibm.com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=nikunj@linux$(echo .)vnet.ibm.com \
    --cc=slof@lists$(echo .)ozlabs.org \
    --cc=thuth@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox