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

            Bug ID: 91036
           Summary: GCC option -mno-dspr2 blocks the use of dsp r1
                    instructions
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: petrcvekcz at gmail dot com
  Target Milestone: ---

Setup:

GCC 8.3.0 crosscompiler from aarch64 debian sid to mipsel 24kec with DSP ASE

Simple testing code:

#ifdef __mips_dsp
    #warning "+++ DSP r1"
#endif

#ifdef __mips_dspr2
    #warning "+++ DSP r2"
#endif

#if (__mips_dsp_rev == 1)
    #warning "+++ DSP revision is: 1"
#elif (__mips_dsp_rev == 2)
    #warning "+++ DSP revision is: 2"
#endif

int main(void) {
    asm volatile ("lwx $5,$5($20)\n");
    return 0;
}

Tests:

1) No options (compiler built for arch/tune=24kec and -mdsp):
# mipsel-unknown-linux-gnu-gcc ./no_dspr2_bug.c 
./no_dspr2_bug.c:2:6: warning: #warning "+++ DSP r1" [-Wcpp]
     #warning "+++ DSP r1"
      ^~~~~~~
./no_dspr2_bug.c:10:6: warning: #warning "+++ DSP revision is: 1" [-Wcpp]
     #warning "+++ DSP revision is: 1"
      ^~~~~~~

2) With -mdsp option, still OK
# mipsel-unknown-linux-gnu-gcc ./no_dspr2_bug.c -mdsp
./no_dspr2_bug.c:2:6: warning: #warning "+++ DSP r1" [-Wcpp]
     #warning "+++ DSP r1"
      ^~~~~~~
./no_dspr2_bug.c:10:6: warning: #warning "+++ DSP revision is: 1" [-Wcpp]
     #warning "+++ DSP revision is: 1"
      ^~~~~~~

3) With -mdspr2 option, works OK, lwx _seems_ to be from DSPr1
# mipsel-unknown-linux-gnu-gcc ./no_dspr2_bug.c -mdspr2
./no_dspr2_bug.c:2:6: warning: #warning "+++ DSP r1" [-Wcpp]
     #warning "+++ DSP r1"
      ^~~~~~~
./no_dspr2_bug.c:6:6: warning: #warning "+++ DSP r2" [-Wcpp]
     #warning "+++ DSP r2"
      ^~~~~~~
./no_dspr2_bug.c:12:6: warning: #warning "+++ DSP revision is: 2" [-Wcpp]
     #warning "+++ DSP revision is: 2"
      ^~~~~~~

4) With -mno-dspr2 option, fails as no dsp was defined at all, but still the
DSP macros are available
# mipsel-unknown-linux-gnu-gcc ./no_dspr2_bug.c -mno-dspr2
./no_dspr2_bug.c:2:6: warning: #warning "+++ DSP r1" [-Wcpp]
     #warning "+++ DSP r1"
      ^~~~~~~
./no_dspr2_bug.c:10:6: warning: #warning "+++ DSP revision is: 1" [-Wcpp]
     #warning "+++ DSP revision is: 1"
      ^~~~~~~
/tmp/cceDi2vp.s: Assembler messages:
/tmp/cceDi2vp.s:24: Error: opcode not supported on this processor: mips32r2
(mips32r2) `lwx $5,$5($20)'

5) Options -mno-dspr2 and -mdsp, IMO useful for situations, when you want only
instructions from rev1 subset and not from rev2, fails too:
# mipsel-unknown-linux-gnu-gcc ./no_dspr2_bug.c -mno-dspr2 -mdsp
./no_dspr2_bug.c:2:6: warning: #warning "+++ DSP r1" [-Wcpp]
     #warning "+++ DSP r1"
      ^~~~~~~
./no_dspr2_bug.c:10:6: warning: #warning "+++ DSP revision is: 1" [-Wcpp]
     #warning "+++ DSP revision is: 1"
      ^~~~~~~
/tmp/ccNYI1Y8.s: Assembler messages:
/tmp/ccNYI1Y8.s:24: Error: opcode not supported on this processor: mips32r2
(mips32r2) `lwx $5,$5($20)'

6) Behavior for -mdspr2 and -mno-dsp (I don't know what it should do, maybe it
should use only new instructions which was added with revision 2?):
# mipsel-unknown-linux-gnu-gcc ./no_dspr2_bug.c -mno-dsp -mdspr2
./no_dspr2_bug.c:2:6: warning: #warning "+++ DSP r1" [-Wcpp]
     #warning "+++ DSP r1"
      ^~~~~~~
./no_dspr2_bug.c:6:6: warning: #warning "+++ DSP r2" [-Wcpp]
     #warning "+++ DSP r2"
      ^~~~~~~
./no_dspr2_bug.c:12:6: warning: #warning "+++ DSP revision is: 2" [-Wcpp]
     #warning "+++ DSP revision is: 2"
      ^~~~~~~

Reply via email to