Asm syntax of Mips m[tf]cX coprocessor instructions

Jeremy,

Could you send/attach a small test case that demonstrates the problem?

It doesn’t need to go past the stage that creates a .o.

Also, what version of gnu as are you using?

Unless it conflicts with a fundamental llvm/clang philosophy, we are trying to keep Mips assembly compatible with AS.

Also, keep in mind that the Mips llvm assembler is current development and is not considered “prime time” for production. Thus, a test case is always welcome.

Thanks,

Jack

On 02/08/2013 10:53 AM, Jeremy Fitzhardinge wrote:> Hi all,

Jeremy,

Could you send/attach a small test case that demonstrates the problem?

It doesn't need to go past the stage that creates a .o.

Also, what version of gnu as are you using?

Unless it conflicts with a fundamental llvm/clang philosophy, we are
trying to keep Mips assembly compatible with AS.

Also, keep in mind that the Mips llvm assembler is current development
and is not considered "prime time" for production. Thus, a test case
is always welcome.

Sure!

This file:

$ cat t.c
int foo()
{
  int c0;

  /* OK for clang */
  asm("dmfc2 %0,$1" : "=r" (c0));

  /* OK for gcc */
  asm("dmfc2 %0,1" : "=r" (c0));

  return c0;
}

produces:

$ mips64-octeon-linux-gnu-gcc -c t.c
t.s: Assembler messages:
t.s:19: Error: illegal operands `dmfc2 $1,$1'

$ clang -target mips64 -integrated-as -c t.c
t.c:9:6: error: invalid operand for instruction
        asm("dmfc2 %0,1" : "=r" (c0));
            ^
<inline asm>:1:11: note: instantiated into assembly here
        dmfc2 $1,1
                 ^

The assembler is from the Cavium Octeon SDK:

$ mips64-octeon-linux-gnu-as --version
GNU assembler (Cavium Networks Version: 2_2_0 build 113) 2.19
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `mips64-octeon-linux-gnu'.

I have not compared its behaviour with upstream gas (either the
equivalent version or a more recent one).

Thanks,

    J