With GCC: (GNU) 4.4.0 20090116 (experimental) [trunk revision 143437]

Consider this program (bug1900.c):
-----------------------8<-------------------
unsigned long long bar()
{
  unsigned long long rv;
  asm volatile ("rdhwr %0, $30" : "=d" (rv));
  return rv;
}
-----------------------8<-------------------
$ mips64-linux-gcc -march=mips32r2 -mabi=32 -O2 -c bug1900.c
$ cat bug1900.s
        .file   1 "bug1900.c"
        .section .mdebug.abi32
        .previous
        .gnu_attribute 4, 1
        .abicalls
        .text
        .align  2
        .globl  bar
        .set    nomips16
        .ent    bar
        .type   bar, @function
bar:
        .frame  $sp,0,$31               # vars= 0, regs= 0/0, args= 0, gp= 0
        .mask   0x00000000,0
        .fmask  0x00000000,0
#APP
 # 7 "bug1900.c" 1
        rdhwr $4, $30
 # 0 "" 2
#NO_APP
        move    $2,$4
        .set    noreorder
        .set    nomacro
        j       $31
        move    $3,$5
        .set    macro
        .set    reorder

        .end    bar
        .size   bar, .-bar
        .ident  "GCC: (GNU) 4.4.0 20090116 (experimental) [trunk revision
143437]"


Register $3 (v1) returns with uninitialized garbage.  This is the high part of
the 64 bit return value.

I am not sure what should happen here.  Really the "d" asm constraint should
not match a 64 bit variable for the o32 ABI.


-- 
           Summary: MIPS: wrong-code with 64-bit values and register asm
                    constraints with o32 ABI.
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: daney at gcc dot gnu dot org
 GCC build triplet: mips64-unknown-linux-gnu
  GCC host triplet: mips64-unknown-linux-gnu
GCC target triplet: mips64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39090

Reply via email to