AnsweredAssumed Answered

BYTEREV.L Equivalent Instruction for ISA_B

Question asked by Jose Enriquez on Jul 11, 2018
Latest reply on Jul 19, 2018 by TomE

I am implementing some code from another vendor on a MCF5485 that has ISA_B. In one of the files it has the following line of code:

static inline asm U32 __declspec(register_abi) sharkssl_byteswap (U32 d) { byterev.l d0 }

 

When compiling, i get the warning: "Illegal instruction for this processor". When looking at the reference manual for MCF5485, i found a similar instruction 'swap' that i could use. But from my understanding, the 'swap' instruction only swaps most significant words (i.e. MSW of Dx ↔ LSW of Dx) where 'byterev.l' reverses the bytes.

 

using 'byterev.l':

new Dx[31:24] = old Dx[7:0]

new Dx[23:16] = old Dx[15:8]

new Dx[15:8] = old Dx[23:16]

new Dx[7:0] = old Dx[31:24]

 

using 'swap':

new Dx[31:24] = old Dx[15:8]

new Dx[23:16] = old Dx[7:0]

new Dx[15:8] = old Dx[31:24]

new Dx[7:0] = old Dx[23:16]

 

Is there a method that allows me to perform the same operation as 'byterev.l' using instructions included in ISA_B?

Outcomes