Re: [cc65] Macros in inline assembler

From: Andreas Rückert <a_rueckert1gmx.net>
Date: 2012-01-19 17:33:47
Hi!

-------- Original-Nachricht --------
> Datum: Thu, 19 Jan 2012 16:55:40 +0100
> Von: Oliver Schmidt <ol.sc@web.de>
> An: cc65@musoftware.de
> Betreff: Re: [cc65] Macros in inline assembler

> Hi Andreas,
> 
> Maybe no usefull question, but is there as specific reason for using
> inline assembler and not the "ordinary" macro assembler ca65?

That's a good question...

> The only good reason I could imagine for the inline assembler would be
> to really mix C and asm inside a single function to avoid any
> subroutine overhead.

That's exactly the case...

> However to work with the inline assembler you
> have to turn off the C compiler optimizations which in all usecases I
> can imagine conteracts to what you want to archieve so that at least
> in my experience there's basically no good reason at all for using the
> inline assembler.

All the optimizations are on of course, since the c64 is quite slow
anyway. And since I want to compute 256-bit hashes I need all
the computing power I can get from the little breadbox... :-)
I checked the generated assembler code, and I could not find any
inline assembler, that was optimized away so far, so maybe I'm just
lucky at the moment...

We are talking about a modified version of this code:

http://www.koders.com/c/fid0D6D481A7D85CEB963C3F4258F30CF903DA541F3.aspx

or precisely about the unpacking starting in line 103. 
I want to run this code on several platforms, including PCs with
optional GPUs, so rewriting everything in assembler is not really
an option. Maybe some part with conditional compilation. But the
later sha256 rounds are too complex to unloop them by hand. So I'll
keep them as C for now.

Just to give you an idea about the current performance: 
the c64 as emulated in vice checks 100 nonces in 261 seconds. That
includes 2 rounds of sha256 and a context comparison for each
nonce. So we are talking about 1 sha256 computation per second, or so.

But it's very interesting to learn about potential optimizations and
such, so I think the c64 version is worth the work.

Ciao,
Andreas

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Jan 19 17:34:00 2012

This archive was generated by hypermail 2.1.8 : 2012-01-19 17:34:03 CET