Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #13792

Re: Permutation Tensor

From mhx@iae.nl (Marcel Hendrix)
Subject Re: Permutation Tensor
Newsgroups comp.lang.forth
Message-ID <62661493968435@frunobulax.edu> (permalink)
Date 2012-07-10 21:37 +0200
References <2012Jul10.121108@mips.complang.tuwien.ac.at>
Organization Wanadoo

Show all headers | View raw


anton@mips.complang.tuwien.ac.at (Anton Ertl) writes Re: Permutation Tensor

> m.a.m.hendrix@tue.nl writes:
[..]
>>It is possible to see that branching is indeed slow by swapping the test cases in lcsymbol2:
[..]
> Hmm, sounds like perfectly predictable branches.  Then it's probably
> something else.  You can check the number of mispredictions with
> performance counters.

>>This makes the jumptable approach a clear favorite.

[ Krishna: should have been lookup table ]

> Can you post the machine code for the second LCSYMBOL2?


4 BASE !
: lcsymbl2a ( i j k -- n )
    swap 2 lshift or swap 10 lshift or  	
    case 
\      123 of  1 endof
       231 of  1 endof
       312 of  1 endof
       132 of -1 endof
       213 of -1 endof
       321 of -1 endof
       123 of  1 endof
      0 swap
    endcase ;
DECIMAL

1 VALUE a 
2 VALUE b 
3 VALUE c 

: TEST2a  ( n -- ) 
	0 SWAP 0 DO  	a b c lcsymbl2a + 
			a b c lcsymbl2a + 
			a b c lcsymbl2a + 
			a b c lcsymbl2a +  
	       LOOP  	drop ;

FORTH> ' test2a idis
$0124B540  : [trashed]
$0124B54A  pop           rbx
$0124B54B  push          0 b#
$0124B54D  push          rbx
$0124B54E  xor           rbx, rbx
$0124B551  pop           rcx
$0124B552  call          (DO) offset NEAR
$0124B55C  lea           rax, [rax 0 +] qword

$0124B560  mov           rdi, $012497A0 qword-offset
$0124B567  lea           rdi, [rdi*4 0 +] qword
$0124B56F  or            rdi, $012497C0 qword-offset
$0124B576  mov           rax, $01249780 qword-offset
$0124B57D  shl           rax, 4 b#
$0124B581  or            rdi, rax
$0124B584  cmp           rdi, #45 b#
$0124B588  push          rbx
$0124B589  mov           rbx, rcx
$0124B58C  mov           rcx, rdi
$0124B58F  mov           rbx, rcx
$0124B592  jne           $0124B5A4 offset NEAR
$0124B598  mov           rbx, 1 d#
$0124B59F  jmp           $0124B615 offset NEAR
$0124B5A4  cmp           rbx, #54 b#
$0124B5A8  jne           $0124B5BA offset NEAR
$0124B5AE  mov           rbx, 1 d#
$0124B5B5  jmp           $0124B615 offset NEAR
$0124B5BA  cmp           rbx, #30 b#
$0124B5BE  jne           $0124B5D0 offset NEAR
$0124B5C4  mov           rbx, -1 d#
$0124B5CB  jmp           $0124B615 offset NEAR
$0124B5D0  cmp           rbx, #39 b#
$0124B5D4  jne           $0124B5E6 offset NEAR
$0124B5DA  mov           rbx, -1 d#
$0124B5E1  jmp           $0124B615 offset NEAR
$0124B5E6  cmp           rbx, #57 b#
$0124B5EA  jne           $0124B5FC offset NEAR
$0124B5F0  mov           rbx, -1 d#
$0124B5F7  jmp           $0124B615 offset NEAR
$0124B5FC  cmp           rbx, #27 b#
$0124B600  jne           $0124B612 offset NEAR
$0124B606  mov           rbx, 1 d#
$0124B60D  jmp           $0124B615 offset NEAR
$0124B612  push          0 b#
$0124B614  pop           rbx
$0124B615  pop           rdi
$0124B616  mov           rax, $012497A0 qword-offset
$0124B61D  lea           rax, [rax*4 0 +] qword
$0124B625  or            rax, $012497C0 qword-offset
$0124B62C  mov           rdx, $01249780 qword-offset
$0124B633  shl           rdx, 4 b#
$0124B637  or            rax, rdx
$0124B63A  lea           rdx, [rdi rbx*1] qword

[ etc. ]

$0124B837  push          0 b#
$0124B839  pop           rbx
$0124B83A  pop           rdi
$0124B83B  lea           rbx, [rdi rbx*1] qword
$0124B83F  add           [rbp 0 +] qword, 1 b#
$0124B844  add           [rbp 8 +] qword, 1 b#
$0124B849  jno           $0124B560 offset NEAR
$0124B84F  add           rbp, #24 b#
$0124B853  ;

-marcel

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-05 07:13 +0000
  Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-05 09:25 +0200
    Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-05 08:42 +0000
      Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-05 11:25 +0200
        Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:49 -0700
          Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 08:32 +0200
            Re: Permutation Tensor "A. K." <akk@nospam.org> - 2012-07-07 09:49 +0200
            Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 05:35 -0700
               Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 15:45 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 07:32 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 17:53 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 09:10 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 18:41 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 12:24 -0700
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 07:48 +0100
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 08:09 +0100
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-08 09:23 +0200
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 05:55 -0700
                Re: Permutation Tensor Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-07-08 20:14 +0100
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 13:49 -0700
                Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-07 13:03 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-07 23:54 +0200
                Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-07 16:43 -0700
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-08 09:07 +0200
                Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-08 13:03 +0000
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-09 14:50 +0000
                Re: Permutation Tensor m.a.m.hendrix@tue.nl - 2012-07-10 00:28 -0700
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-10 10:11 +0000
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-10 21:37 +0200
                Re: Permutation Tensor anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-11 13:50 +0000
                Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-10 05:10 -0700
        Re: Permutation Tensor Paul Rubin <no.email@nospam.invalid> - 2012-07-06 20:46 -0700
          Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 05:36 -0700
  Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:18 -0700
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-06 18:33 -0700
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 07:28 -0700
      Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-07 08:02 -0700
  Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-07 19:58 +0000
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-08 05:45 -0700
      Re: Permutation Tensor Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-08 20:05 +0000
  Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-08 14:24 +0200
    Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 07:09 +0200
      Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 18:42 +0200
        Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-11 20:18 +0200
          Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-12 12:43 +0200
            Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-25 14:07 +0000
              Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-27 13:42 +0200
                Re: Permutation Tensor mhx@iae.nl (Marcel Hendrix) - 2012-07-27 15:39 +0200
                Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-30 04:52 +0000
  Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-08 23:44 +0200
    Re: Permutation Tensor Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-07-10 17:06 -0700
      Re: Permutation Tensor awegel@arcor.de (Alex Wegel) - 2012-07-11 07:09 +0200
  Re: Permutation Tensor Arnold Doray <invalid@invalid.com> - 2012-07-25 14:08 +0000

csiph-web