Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* asm
@ 1999-01-06  5:30 Christoph Dworzak
  1999-01-06  6:32 ` asm Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Dworzak @ 1999-01-06  5:30 UTC (permalink / raw)
  To: axp-list

Hi

I have still some troubles to understand how the alpha-cpu
issues instructions.

Maybe some kind soul could help me with this example?

/*   M[0] = 0xaaaaaaaaaaaaaaaa; M[1] = 0xcccccccccccccccc; M[2] = 0xf0f0f0f0f0f0f0f0; */
/*   M[3] = 0xff00ff00ff00ff00; M[4] = 0xffff0000ffff0000; M[5] = 0xffffffff00000000; */

	lda $0,-1
	zap $0,0x0f,$6
	zap $0,0x33,$5
	zap $0,0x55,$4
	srl $4,4,$3
	stq $6,552($30)
	xor $4,$3,$3
	stq $5,544($30)
	srl $3,2,$2
	stq $4,536($30)
	xor $3,$2,$2
	stq $3,528($30)
	srl $2,1,$1
	stq $2,520($30)
	xor $2,$1,$1
	stq $1,512($30)

How many cycles would this take (on a 21164) and which instruction
do get paired together?

How would you optimize it?

Bye
 dworz


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: asm
  1999-01-06  5:30 asm Christoph Dworzak
@ 1999-01-06  6:32 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 1999-01-06  6:32 UTC (permalink / raw)
  To: axp-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-01-06  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-01-06  5:30 asm Christoph Dworzak
1999-01-06  6:32 ` asm Richard Henderson

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