This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

MIPS -mgp64 tests (and flag) vs. 32-bit BFD.


So, while poking around some of the MIPS gas tests, i noticed that the
-mgp64 tests fail when used with configuration in which bfd_vma is
only 32 bits.

(Examples of that configuration are mips-ecoff and mips-irix5.  Most
of the ELF configurations explicitly include 64-bit ELF, and so are
OK.  But, really, there's no requirement for 64-bit ELF if you're
using any kind of ELF, and mips-irix5 is one example of that.)

In particular, you get things like:

../as-new  -march=8000 -EB -o dump.o /users/cgd/proj/gnu/write/binutils/src/gas/testsuite/gas/mips/mips-gp64-fp64.s
/users/cgd/proj/gnu/write/binutils/src/gas/testsuite/gas/mips/mips-gp64-fp64.s: Assembler messages:
/users/cgd/proj/gnu/write/binutils/src/gas/testsuite/gas/mips/mips-gp64-fp64.s:91: Warning: Branch bgtu is always true 
FAIL: MIPS -mgp64 -mfp64 

it's trying to do:

        bgtu    $4, 0xffffffff, end     # 0128 li       at,0x8000
                                        # 012c dsll     at,at,17
                                        # 0130 sltu     at,a0,at
                                        # 0134 beqz     at,end

and tripping over the code in gas/config/tc-mips.c:

    case M_BGTUL_I:
      likely = 1;
    case M_BGTU_I:
      if (sreg == 0
          || (HAVE_32BIT_GPRS
              && imm_expr.X_op == O_constant
              && imm_expr.X_add_number == 0xffffffff))
        goto do_false;
      if (imm_expr.X_op != O_constant)
        as_bad (_("Unsupported large constant"));
      imm_expr.X_add_number++;
      /* FALLTHROUGH */ 
    case M_BGEU_I:
    case M_BGEUL_I:
      if (mask == M_BGEUL_I)
        likely = 1;
      if (imm_expr.X_op == O_constant && imm_expr.X_add_number == 0)
        goto do_true;

it jumps off to do_true there, because X_add_number (32 bits for a
32-bit BFD) has wrapped to 0.


So, anyway, these tests happen to trip the problem, but I don't know
that it's not a more general problem...  When compiling for
architectures which have 64-bit GPRs (whether -mgp64 is set or not),
regardless of the object format, you really might want 64-bit
constants to work, I'd think.

So, that leads me to wonder, what should be done here:

* just punt, and say that if you want to write code that works right
w/ 64-bit GPRs you have to include a 64-bit BFD?

* punt differently, don't include try those tests unless it's a target
that uses a 64-bit BFD?

* punt still differently, and say that those old annoying targets
really aren't particularly supported any more.  (I mean, hey, if the
ECOFF test problems really are indicative of real problems, ECOFF
hasn't worked right for a while with at least some
previously-supported flags.)

* convince BFD to support 64-bits on all MIPS targets, regardless of
the selected vectors.


I'd be inclined towards the latter, but am afraid that it would break
... much.


chris


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