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

            Bug ID: 91050
           Summary: -mdejagnu-cpu=<cpu> does not affect the -m<cpu>
                    assembler option
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bergner at gcc dot gnu.org
  Target Milestone: ---

The -mdejagnu-cpu=<cpu> option is supposed to behave exactly like -mcpu=<cpu>
except for that -mcpu=<cpu> option cannot override it.  We want/need that
behavior in some of our testsuite test cases.  However, with Alan's patch that
stopped gcc from always passing -many to the assembler for POWER, we are now
seeing problems like the following test case:

bergner@pike:~/gcc/BUGS/dejagnu-cpu$ cat bug.c 
unsigned long
foo (void)
{
  unsigned long addr;
  asm ("lnia %0" : "=r" (addr));  /* "lnia" is new in POWER9.  */
  return addr;
}
bergner@pike:~/gcc/BUGS/dejagnu-cpu$ gcc -O2 -c -mcpu=power8 bug.c
/tmp/ccSEBrVw.s: Assembler messages:
/tmp/ccSEBrVw.s:13: Error: unrecognized opcode: `lnia'
bergner@pike:~/gcc/BUGS/dejagnu-cpu$ gcc -O2 -c -mcpu=power9 bug.c
bergner@pike:~/gcc/BUGS/dejagnu-cpu$ gcc -O2 -c -mcpu=power9
-mdejagnu-cpu=power9 bug.c
bergner@pike:~/gcc/BUGS/dejagnu-cpu$ gcc -O2 -c -mcpu=power8
-mdejagnu-cpu=power9 bug.c
/tmp/ccKQFygo.s: Assembler messages:
/tmp/ccKQFygo.s:13: Error: unrecognized opcode: `lnia'
bergner@pike:~/gcc/BUGS/dejagnu-cpu$ gcc -O2 -c -mdejagnu-cpu=power9 bug.c
/tmp/ccKQFygo.s: Assembler messages:
/tmp/ccKQFygo.s:13: Error: unrecognized opcode: `lnia'

In this case, "lnia" is an instruction added in power9.  However, we can see
from above, that -mdejagnu-cpu=power9 alone is not enough to get the test case
to compile/assemle correctly.  It seems the -m<cpu> assembler option we use is
only affected by -mcpu= and not -mdejagnu-cpu= which is a bug.

Reply via email to