Diab PPC Assy. macro question

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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 ->
--

Re: Diab PPC Assy. macro question
snipped-for-privacy@hotmail.com says...
Quoted text here. Click to load it

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

--Gene

Re: Diab PPC Assy. macro question

Quoted text here. Click to load it
[snip]
Quoted text here. Click to load it

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 ->
--

Site Timeline