English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 17 February 2017, 15:12   #121
buggs
Registered User

 
Join Date: May 2016
Location: Rostock/Germany
Posts: 43
Quote:
Originally Posted by meynaf View Post
Ok, as i wish to recruit, i must at least give something to do.
Code:
; a0=source, a1-a4=dest
 move.w #1999,d0
.loop
 movem.l (a0)+,d1-d4
 move.l d1,d5
 swap d5
 move.w d3,d5
 move.l d5,(a2)+
 move.l d1,d5
 swap d3
 move.w d3,d5
 move.l d5,(a1)+
 move.l d2,d5
 swap d5
 move.w d4,d5
 move.l d5,(a4)+
 move.l d2,d5
 swap d4
 move.w d4,d5
 move.l d5,(a3)+
 dbf d0,.loop
 rts
<snip> Or do it for ARM or whatever cpu. <snip>
With VASM out, I figured it might be time to post something for "whatever CPU".
Code:
 move #999,d0
.loop
 load (a0)+,E0          ;a0 b0 c0 d0 (.w)
 load (a0)+,E1          ;a1 b1 c1 d1
 load (a0)+,E2          ;a2 b2 c2 d2
 load (a0)+,E3          ;a3 b3 c3 d3
 transhi E0-E3,E4:E5    ;E4: a0 a1 a2 a3 E5: b0 b1 b2 b3
 translo E0-E3,E6:E7    ;E6: c0 c1 c2 c3 E7: d0 d1 d2 d3
                     ;TRANS has latency, 1 cyc lost in this example
 store E4,(a1)+         ;
 store E5,(a2)+         ;
 store E6,(a3)+         ;
 store E7,(a4)+         ;inner loop assembles to 10 * 32 Bit
 dbf   d0,.loop          ;plus move, dbf = 12 * 32 Bit
Code as shown will process 32 bytes per run in 11 cycles. Obviously, it won't be of much use in the original scenario as data keeps piling up in the write buffers (as long as A1-A4 are in Chip). But it'll perform quite nicely when A1-A4 point to a fast memory location.
buggs is offline  
AdSense AdSense  
Old 17 February 2017, 15:29   #122
meynaf
68k wisdom
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon (France)
Age: 44
Posts: 2,190
Unfortunately for you this thread is about code density. And your example shows no benefit at all in this area.

Last edited by prowler; 01 March 2017 at 22:11. Reason: Cleanup.
meynaf is offline  
Old 18 February 2017, 13:40   #123
DamienD
Global Moderator

DamienD's Avatar
 
Join Date: Aug 2005
Location: Sydney / London
Age: 40
Posts: 8,111
Why do all these threads keep going downhill; it's usually the same people arguing???

I really don't have time to be reading through 7 pages of bickering between you guys... I need to prepare for a new job over the weekend so...

Closed for now until another GM has time to review.
DamienD is offline  
Old 01 March 2017, 22:16   #124
prowler
Global Moderator

prowler's Avatar
 
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,127
Quote:
Originally Posted by DamienD View Post
Closed for now until another GM has time to review.
Done, thanks Damien!

Thread reopened. Now, let's try again, shall we, guys?

Last edited by prowler; 03 March 2017 at 22:24. Reason: typo.
prowler is offline  
Old 03 March 2017, 13:21   #125
meynaf
68k wisdom
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon (France)
Age: 44
Posts: 2,190
Ok, let's try again.

I have a new case to submit. It's a complicated one, of course to do in a minimal amount of code.
This is a real life case, but discussing details would probably lead to endless OT.

Here is pseudo-code as i guess an explanation wouldn't be clear enough :
Code:
flag=0
start:
struct = data           ; some rel(pc) array of structs with sizeof =8
loop:
x = struct[5] >>4       ; -- -- -- -- -- x-
v1=table[x*2]           ; attn: table too far for d8(pc,ix) but ok for d16(pc)
v2=table[x*2 +1]
if flag and v2>=0 goto skip  ; v2>=0 is bit #7 test
cc = (v2<0)                  ; set condition (passed to call func via some reg)
if flag then cc=0
var = (v1&128) + (v2&15)     ; but bits 6,5,4 of var are "don't care"
call func (struct,cc,var)
skip:                   ; value in var is unimportant if we skip
struct = struct +8      ; next item (sizeof =8)
if struct[0]<>0 or struct[1]<>0 or struct[2]<>0 or struct[3]<>0 goto loop
if flag goto error
flag = 1
goto start
error:
Function called here (actually unrelated inline code) will sometimes not return so we don't necessarily end up at error label.

Note : pseudo-code is of course not optimal.
Use as few registers as you can.

Last edited by meynaf; 03 March 2017 at 13:36. Reason: fixed two mistakes in pseudo code
meynaf is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generated code and CPU Instruction Cache Mrs Beanbag Coders. Asm / Hardware 11 23 May 2014 11:05
EAB Christmas Song-writing Contest mr_a500 project.EAB 64 24 May 2009 02:44
AmigaSYS Wallpaper Contest Calo Nord News 10 22 April 2005 09:33
Landover's Amiga Arcade Conversion Contest Frog News 1 28 January 2005 23:41
Battlechess Contest (EAB vs A500) Bloodwych Nostalgia & memories 67 14 August 2003 14:37

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:50.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.12678 seconds with 13 queries