Multiple bit shifts of data in assembly
Wurlitzer
Posts: 237
My brain is stuck in a do loop with no exit.
I did this a few years ago in assembly and now for the life of me I cannot remember how I did it. Old age sucks. I can brute force it but I think there is a slick and efficient way to do this. It has to be done in assembly due to the speed required.
Starting with 2 longs I need to make multiple shifts into 3 destination word shown below:
·SourceData1 and SourceData2 shift 12 bits left and stored·into Destination1, Destination2, Destination3(12 bits in the least significant word =0)
SourceData1 and SourceData2 shift·24 bits left and stored·into Destination1, Destination2, Destination3
(24 bits in the least significant word =0)
SourceData1 and SourceData2 shift·36 bits left and stored·into Destination1, Destination2, Destination3 (the 4 highest order bits are simply discarded)
There are 3 more similar shifts just by a different amount.
The routine I described above needs to be done 6 times with different source data (2 longs). I can reuse the destination words as their result will be written to HUB RAM after each set of shifts.
Any thoughts would be greatly appreciated. If nothing else it may trigger my memory as to how I did it before.
I did this a few years ago in assembly and now for the life of me I cannot remember how I did it. Old age sucks. I can brute force it but I think there is a slick and efficient way to do this. It has to be done in assembly due to the speed required.
Starting with 2 longs I need to make multiple shifts into 3 destination word shown below:
·SourceData1 and SourceData2 shift 12 bits left and stored·into Destination1, Destination2, Destination3(12 bits in the least significant word =0)
SourceData1 and SourceData2 shift·24 bits left and stored·into Destination1, Destination2, Destination3
(24 bits in the least significant word =0)
SourceData1 and SourceData2 shift·36 bits left and stored·into Destination1, Destination2, Destination3 (the 4 highest order bits are simply discarded)
There are 3 more similar shifts just by a different amount.
The routine I described above needs to be done 6 times with different source data (2 longs). I can reuse the destination words as their result will be written to HUB RAM after each set of shifts.
Any thoughts would be greatly appreciated. If nothing else it may trigger my memory as to how I did it before.
Comments
move source1 dest1
and dest1 $FFF
move source1 dest2
and dest2 $FFFFF000
rotate left source2 12
move source2 source1
and source1 $0FFF
or source1 dest2
and source2 $FFFFF000
move source2 dest3