https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103383

            Bug ID: 103383
           Summary: Microblaze bswaphi2
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rkujoth at motorolasolutions dot com
  Target Milestone: ---

Came across a weird issue in which GCC tried to stick a bswaphi2 operation in
the delay slot of a beqid. Since the bswaphi2 operation is actually two
Microblaze instructions, it only executed the first instruction when taking the
branch (the byte swap -- swapb).

I don't know anything about target configurations, but I found the target macro
here:
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/microblaze/microblaze.md?plain=1#L369-L375

Looks like support for swaphi2 was added in this commit:
https://github.com/gcc-mirror/gcc/commit/cb8a1637a9914fb25bfbc9604fc20ca5e6c0601e

But, there was an error...it mapped swaphi2 to the Microblaze swaph
instruction, which only performs a half-word swap. That was fixed in this
commit:
https://github.com/gcc-mirror/gcc/commit/e50f5f2e0d3396bd4ab2f799135309de39c96d58

But, I wonder if the "TARGET_REORDER" should have been removed, since the
implementation requires two Microblaze instructions?

Not really sure, but adding -fno-delayed-branch to my compile resolves the
issue for me.

I'm using mb-gcc from Vivado 2017.1, which is based on gcc 6.2.0.

Reply via email to