Hi! I want to optimize some sha256 code, since I couldn't get the compiler to generate some optmized code to speed up the hash computation. So I'd like to unroll this loop: ========= /* Unpack the block into 64 32-bit words */ for(t = 0; t < 16; ++t) { datap = &data[t<<2]; W[t] = (((uint32)*datap) << 24) | (((uint32)*++datap) << 16) | (((uint32)*++datap) << 8) | ((uint32)*++datap); ========= and defined me a macro: ========= #define swapCopyULong(INDEX) \ __asm__( "lda _data+(" ## #INDEX ## "*16+3)\n" \ "sta _W+(" ## #INDEX ## "q*4)\n" \ "lda _data+(" ## #INDEX ## "*16+2)\n" \ "sta _W+"( ## #INDEX ## "*4+1)\n" \ "lda _data+(" ## #INDEX ## "*16+1)\n" \ "sta _W+( " ## #INDEX ## "*4+2)\n" \ "lda _data+(" ## #INDEX ## "*16)\n" \ "sta _W+(" ## #INDEX ## "*4+3)\n" ) ========= , that I call for each long: ========= swapCopyULong(0); swapCopyULong(1); ... ========= , but this doesn't work so far, because the macro parameter is not expanded and the linker complains about unresolved externals _data and _W . Could I split the macro into 1 asm statement per line and pass 2 arguments to it? (data and INDEX or W and index)? How do I access those vars? %v2, or so? I also tried to write a ca65 macro in the inline assembly, but I got complains, that it's not supported at this place? Or is there a way to expand macro parameters within a string, so I get something like sta _W+(3*4+3), which could be used as an absolute address? (_W is a local var, but static as I understand it). Thanks for any hint, 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 14:38:06 2012
This archive was generated by hypermail 2.1.8 : 2012-01-19 14:38:08 CET