Hello,

  I think there is a bug in mips_pass_by_reference when the mips abi
is EABI to pass TImode parameters.

  The following code is from the mainline GCC "mips.c".
---------
mips_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
                        enum machine_mode mode, tree type,
                        bool named ATTRIBUTE_UNUSED)
{
  if (mips_abi == ABI_EABI)
    {
      int size;

      /* ??? How should SCmode be handled?  */
      if (type == NULL_TREE || mode == DImode || mode == DFmode)
        return 0;

      size = int_size_in_bytes (type);
      return size == -1 || size > UNITS_PER_WORD;
    }
  else
    {
      /* If we have a variable-sized parameter, we have no choice.  */
      return targetm.calls.must_pass_in_stack (mode, type);
    }
}
---------
  When "type" is NULL_TREE, this function returns "0".  But when "type" is not 
NULL and
the size of TImode is bigger than UNITS_PER_WORD, so it returns "1".
This causes inconsistency in the following test.

# cat timode.c
typedef int TItype __attribute__ ((mode (TI)));
TItype test1 (TItype a)
{
  return a*a;
}

# mipsisa64-elf-gcc -S timode.c -O3

### timiode.s  
test1:
        daddiu  $sp,$sp,-8
        sd      $31,0($sp)
        ld      $3,8($4) <----- Parameter in stack
        ld      $2,0($4) <----- Parameter in stack
        move    $7,$3  <---- Parameter in register
        move    $4,$2  <---- Parameter in register
        move    $5,$3  <---- Parameter in register
        jal     __multi3
        move    $6,$2  <---- Parameter in register

        ld      $31,0($sp)
        move    $4,$2
        move    $2,$4
        j       $31
        daddiu  $sp,$sp,8

  Does someone know how to pass TImode parameters in EABI?  Thanks!

Regards,
Chao-ying

Reply via email to