Diab PPC Assy. macro question

I'm trying to swap an 8 byte quantity via a Diab macro but I am unable to figure out how to get access to the second word of the unsigned long long. Here's what I have:

asm uint64 swap8Bytes(uint64 eightBytes) { % reg eightBytes; ! "r0", "r12"

mr r12,eightBytes /* LSW */ rlwinm r0,r12, 8, 8,31 rlwimi r0,r12,24,16,23 rlwimi r0,r12,24, 0, 8 mr r4,r0

mr r12,eightBytes /* MSW? How? */ rlwinm r0,r12, 8, 8,31 rlwimi r0,r12,24,16,23 rlwimi r0,r12,24, 0, 8 mr r3,r0 }

--
- Mark ->
--
Reply to
Mark A. Odell
Loading thread data ...

Have you considered writing this in C, then looking at the assembly output Diab creates for a hint?

--Gene

Reply to
Gene S. Berkowitz

Gene S. Berkowitz wrote in news: snipped-for-privacy@news.comcast.giganews.com:

[snip]

Uh, yes and it is atrocious code. The compiler doesn't recognized the idiom of a 64-bit integer swap. Thus, we PowerPC developers tend to use this handy sequence of rlwiXX instruction for swapping bytes in a word. What I am trying to discern is the Diab assembler mnemonic that allows the human assembler writer to specify the MS word and LS word in a 64-bit integer. The Diab manuals do not specify how to do this.

Thanks.

--
- Mark ->
--
Reply to
Mark A. Odell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.