Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Richard Henderson <rth@cygnus.com>
To: axp-list@redhat.com
Subject: Re: asm
Date: Tue, 5 Jan 1999 22:32:59 -0800	[thread overview]
Message-ID: <19990105223259.D29056@dot.cygnus.com> (raw)
In-Reply-To: <2786b60e.u10t12e.e8910-axp@amazing.ch>; from Christoph Dworzak on Wed, Jan 06, 1999 at 05:30:00AM +0000

On Wed, Jan 06, 1999 at 05:30:00AM +0000, Christoph Dworzak wrote:
  /*   M[0] = 0xaaaaaaaaaaaaaaaa; M[1] = 0xcccccccccccccccc;
       M[2] = 0xf0f0f0f0f0f0f0f0; M[3] = 0xff00ff00ff00ff00;
       M[4] = 0xffff0000ffff0000; M[5] = 0xffffffff00000000; */

        .align 4                pipe    cycle
>       lda $0,-1               e1      0
>       zap $0,0x0f,$6          e0      1
>       zap $0,0x33,$5          e0      2
>       zap $0,0x55,$4          e0      3

>       srl $4,4,$3             e0      4
>       stq $6,552($30)         e0      5
>       xor $4,$3,$3            e1      5
>       stq $5,544($30)         e0      6

>       srl $3,2,$2             e0      7
>       stq $4,536($30)         e0      8
>       xor $3,$2,$2            e1      8
>       stq $3,528($30)         e0      9

>       srl $2,1,$1             e0      10
>       stq $2,520($30)         e0      11
>       xor $2,$1,$1            e1      11
>       stq $1,512($30)         e0      12

> How would you optimize it?

It's just about as good as it can get.  I came up with one
sequence that executes in 11 cycles, but it's 4 insns longer.


r~


        lda     $0, -1                  e0      0
        lda     $2, 0xcccd($31)         e1      0
        zap     $0, 0x0f, $15           e0      1
        ldah    $2, 0xcccd($2)          e1      1

        sll     $2, 32, $3                      2
        addq    $2, $3, $2                      2
        zap     $0, 0x33, $14                   3
        subq    $2, 1, $11                      3

        zap     $0, 0x55, $13                   4
        addq    $11, $11, $4                    4
        srl     $13, 4, $1                      5
        xornot  $4, $11, $4                     5

        stq     $11, 8($30)                     6
        xor     $1, $13, $12                    6
        stq     $12, 16($30)                    7
        subq    $4, 1, $10                      7

        stq     $10, 0($30)                     8
        stq     $13, 24($30)                    9
        stq     $14, 32($30)                    10
        stq     $15, 40($30)                    11


      reply	other threads:[~1999-01-06  6:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-06  5:30 asm Christoph Dworzak
1999-01-06  6:32 ` Richard Henderson [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox