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


Groups > comp.lang.forth > #59432

Re: Forth-94 vs. Forth-2012 FP data (long)

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Forth-94 vs. Forth-2012 FP data (long)
Date 2017-05-17 15:54 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2017May17.175419@mips.complang.tuwien.ac.at> (permalink)
References <2017May13.093451@mips.complang.tuwien.ac.at> <047bed2a-b743-40dc-b978-aa592d3797f9@googlegroups.com>

Show all headers | View raw


pahihu <pahihu@gmail.com> writes:
>You can even write a PICK-less variant in ANS-94, which does not depend
>on the FP cell width. Testing on SwiftForth, iForth, VFX, gforth I don't
>see clear performance advantage of the separate FP stack version either.
>
>pahihu
>
>fvariable faxpy-ra \ should be a user variable
>: faxpy-nostride941 ( ra f_x f_y ucount -- )
>    \ vy=ra*vx+vy
>    >r 2>r faxpy-ra f! 2r> r>
>    0 ?DO ( f_x1 f_y1 )
>        >R
>        dup float+ swap f@
>        faxpy-ra f@ f*
>        R@ f@ f+ R@ f!
>        R> float+
>  LOOP
>  2drop ;

Looks better than the PICK-heavy variant, but still cumbersome
compared to the Forth-2012 version.

Performance: On a Core i7-4690K (no SwiftForth or iForth installed),
with the unrolled versions:

cycles
Forth-2012 Forth-94  Forth-94
           Rees/Ertl pahihu
2929M      3691M     3480M  gforth-fast
1289M      1414M     1574M  vfxlin Ndp387

Looks like a win for the Forth-2012 code to me.

The inner loop for the non-unrolled variants are on VFX:

Forth-2012             Forth-94 Rees/Ertl        Forth-94 pahihu
FLD   ST               MOV   EDX, [EBP]          PUSH  EBX             
MOV   EDX, [EBP]       FLD   TBYTE 0 [EDX]       MOV   EBX, [EBP]      
FLD   TBYTE 0 [EDX]    FLD   TBYTE [080A3460]    MOV   EDX, EBX        
FMULP ST(1), ST        FMULP ST(1), ST           ADD   EBX, 0A         
FLD   TBYTE 0 [EBX]    FLD   TBYTE 0 [EBX]       FLD   TBYTE 0 [EDX]   
FADDP ST(1), ST        FADDP ST(1), ST           FLD   TBYTE [080A3460]
FSTP  TBYTE 0 [EBX]    FSTP  TBYTE 0 [EBX]       FMULP ST(1), ST       
ADD   EBX, 0A          ADD   EBX, 0A             MOV   EDX, [ESP]      
MOV   EDX, [EBP]       MOV   EDX, [EBP]          FLD   TBYTE 0 [EDX]   
ADD   EDX, 0A          ADD   EDX, 0A             FADDP ST(1), ST       
ADD   [ESP], 01        ADD   [ESP], 01           MOV   EDX, [ESP]      
ADD   [ESP+04], 01     ADD   [ESP+04], 01        FSTP  TBYTE 0 [EDX]   
MOV   [EBP], EDX       MOV   [EBP], EDX          POP   EDX             
JNO   080C6D78         JNO   080C6DB8            ADD   EDX, 0A         
                                                 ADD   [ESP], 01       
                                                 ADD   [ESP+04], 01    
                                                 MOV   [EBP], EBX      
                                                 MOV   EBX, EDX        
                                                 JNO   080C6A88        

VFX does not (yet?) analyse and optimize the return stack; or, if you
feel nasty, you could say: it optimizes PICK better than >R R> and R@.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2017: http://www.euroforth.org/ef17/

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


Thread

Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-13 07:34 +0000
  Re: Forth-94 vs. Forth-2012 FP data (long) pahihu <pahihu@gmail.com> - 2017-05-13 11:16 -0700
    Re: Forth-94 vs. Forth-2012 FP data (long) pahihu <pahihu@gmail.com> - 2017-05-13 11:49 -0700
      Re: Forth-94 vs. Forth-2012 FP data (long) pahihu <pahihu@gmail.com> - 2017-05-13 13:38 -0700
        Re: Forth-94 vs. Forth-2012 FP data (long) mhx@iae.nl - 2017-05-13 15:08 -0700
          Re: Forth-94 vs. Forth-2012 FP data (long) pahihu <pahihu@gmail.com> - 2017-05-14 00:51 -0700
          Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-14 07:32 +0000
            Re: Forth-94 vs. Forth-2012 FP data (long) mhx@iae.nl - 2017-05-14 02:46 -0700
              Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-14 14:57 +0000
                Re: Forth-94 vs. Forth-2012 FP data (long) krishna.myneni@ccreweb.org - 2017-05-15 19:11 -0700
    Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-14 08:14 +0000
  Re: Forth-94 vs. Forth-2012 FP data (long) Paul Rubin <no.email@nospam.invalid> - 2017-05-13 15:58 -0700
    Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-14 07:01 +0000
  Re: Forth-94 vs. Forth-2012 FP data (long) krishna.myneni@ccreweb.org - 2017-05-14 19:04 -0700
    Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-15 06:10 +0000
      Re: Forth-94 vs. Forth-2012 FP data (long) krishna.myneni@ccreweb.org - 2017-05-15 01:49 -0700
        Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-15 14:33 +0000
  Re: Forth-94 vs. Forth-2012 FP data (long) "HAA" <someone@microsoft.com> - 2017-05-15 13:44 +1000
    Re: Forth-94 vs. Forth-2012 FP data (long) Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-05-15 04:43 -0500
    Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-15 15:03 +0000
      Re: Forth-94 vs. Forth-2012 FP data (long) "HAA" <someone@microsoft.com> - 2017-05-17 00:10 +1000
  Re: Forth-94 vs. Forth-2012 FP data (long) pahihu <pahihu@gmail.com> - 2017-05-16 09:04 -0700
    Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-17 15:54 +0000
      Re: Forth-94 vs. Forth-2012 FP data (long) mhx@iae.nl - 2017-05-17 10:29 -0700
      Re: Forth-94 vs. Forth-2012 FP data (long) pahihu <pahihu@gmail.com> - 2017-05-17 23:53 -0700
        Re: Forth-94 vs. Forth-2012 FP data (long) pahihu <pahihu@gmail.com> - 2017-05-19 02:34 -0700
  Re: Forth-94 vs. Forth-2012 FP data (long) Joel Rees <joel.rees@gmail.com> - 2017-05-16 22:48 -0700
    Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-17 06:51 +0000
      Re: Forth-94 vs. Forth-2012 FP data (long) Joel Rees <joel.rees@gmail.com> - 2017-05-17 09:29 -0700
    Re: Forth-94 vs. Forth-2012 FP data (long) stephen@mpeforth.com (Stephen Pelc) - 2017-05-17 11:07 +0000
      Re: Forth-94 vs. Forth-2012 FP data (long) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-17 15:02 +0000

csiph-web