[Patch, microblaze]: Fix bswaphi2 implementation

Michael Eager eager@eagerm.com
Wed Jan 22 17:02:00 GMT 2014


On 01/22/14 07:43, Michael Eager wrote:
> On 01/22/14 02:55, David Holsgrove wrote:
>> Hi Michael,
>>
>> On 26 November 2013 17:48, David Holsgrove <david.holsgrove@xilinx.com> wrote:
>>> Hi Michael,
>>>
>>> Please find attached same patch based against latest from gcc master.
>>>
>>> Can this be applied and backported to gcc-4_8-branch when reviewed.
>>>
>>> thanks,
>>> David
>>>
>>> On 15 July 2013 14:49, David Holsgrove <david.holsgrove@xilinx.com> wrote:
>>>> MicroBlaze insn swaph swaps the contents of register rA as two
>>>> halfwords placing result in rD;
>>>>
>>>> (rD)[0:15]  <- (rA)[16:31]
>>>> (rD)[16:31] <- (rA)[0:15]
>>>>
>>>> gcc bswaphi2 is intended to reverse the order of the bytes in the
>>>> half integer in rA
>>>>
>>>> (rD)[8:15]  <- (rA)[0:7]
>>>> (rD)[7:0]   <- (rA)[8:15]
>>>> (rD)[24:31] <- (rA)[16:23]
>>>> (rD)[16:23] <- (rA)[24:31]
>>>>
>>>> Correct the microblaze bswaphi2 insn pattern to be a swapb followed
>>>> by swaph
>>>>
>>>> Changelog entry would be:
>>>>
>>>> 2013-07-15  David Holsgrove <david.holsgrove@xilinx.com>
>>>>
>>>>   * gcc/config/microblaze/microblaze.md: Fix bswaphi2
>>>>
>>>>
>>>> Can this also be backported to the gcc-4_8-branch?
>>>>
>>
>> Updated patch attached which includes a testcase to check that
>> bswaphi2 is using a swapb followed by swaph for MicroBlaze.
>>
>> Updated Changelogs are;
>>
>> gcc/Changelog
>>
>>      2014-01-22  David Holsgrove <david.holsgrove@xilinx.com>
>>
>>       * gcc/config/microblaze/microblaze.md: Correct bswaphi2 / bswapsi2 insn
>>
>> testsuite/ChangeLog
>>
>>      2014-01-22  David Holsgrove <david.holsgrove@xilinx.com>
>>
>>       * gcc/testsuite/gcc.target/microblaze/others/bswap16.c: New test.
>
> Thanks for the test case.
>
> I had verified that the code was correct by hand, but tests are always
> a good addition.

The test case only verifies that swapb and swaph instructions are
generated.  It doesn't confirm that the computation is correct.

This is a minor fix.  No test case is needed.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Gcc-patches mailing list