This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

MIPS/NEC VR4181 issues..



Hi!

I am developing for a Linux platform with a VR4181 CPU.

The standard distribution seems to be compiled using -mips1 (2?) to be
binary compatible with other MIPS platforms. The problem arises when I
want to use the VR4100-specific instruction 'madd16' (multiply&accumulate
in 1 cycle).

If I use 
$CC -Wa,-m4100 -o test test.c
assembly is OK but linking has problems:

/opt/snow-gcc/bin/../lib/gcc-lib/mipsel-linux/2.97/../../../../mipsel-linux/bin/ld:
/tmp/ccAnzuz3.o: ISA mismatch (-mips3) with previous modules (-mips1)
Bad value: failed to merge target specific data of file /tmp/ccAnzuz3.o
collect2: ld returned 1 exit status

---

If I ignore the mismatch:
$CC -Wa,-m4100 -Wl,-no-warn-mismatch -o test test.c
I get 

/mnt/algol/asm$ ./test
Illegal Instruction

when I run it in the target.

---

Here is my test.c:

#include <stdio.h>

main(void) {

  int in1,in2,out1,outhi,outlo,tmp;

  in1 = 1;
  in2 = 1;
  tmp = 0;

  out1 = in1 + in2; 

  asm(".set mips3"); 
  asm("mthi %0": :"ri" (tmp));
  asm("mtlo %0": :"ri" (tmp));
  asm("madd16 %0,%1": :"r" (in1), "r" (in2)); 
  asm("add %0,%1,%2" :"=r" (out1) :"r" (in1), "r" (in2) );
  asm("mfhi %0": "=r" (outhi));
  asm("mflo %0": "=r" (outlo));
  asm(".set mips1");

  printf("%d %d\n", outhi, outlo); 
  printf("%d\n", out1); 

}

Best regards,

Kaj
kaj.wiik@iki.fi

PS. I see 'move' instructions in the objdump -d, is that a macro, only
mips16 should have move...?





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]