[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    Volatile memory move
From:       "Paulo J. Matos" <pocmatos () gmail ! com>
Date:       2011-04-15 16:04:36
Message-ID: io9qal$id7$1 () dough ! gmane ! org
[Download RAW message or body]

Hi,

I am running into trouble with a volatile memory move on my port of 
GCC4.4.4. The code is:
int main(void)
{
   register volatile float sc = 1E35;

   if(sc < 1.000050000e35)
     return 1;
   return 0;
}

The very first part of this code is being expanded as:

;; sc ={v} 1.0000000409184787596297531937521664e+35;

(insn 5 4 6 vol.c:3 (set (reg/f:QI 20)
         (symbol_ref/u:QI ("*?LC0") [flags 0x2])) -1 (nil))

(insn 6 5 7 vol.c:3 (set (reg:QI 1 AL)
         (mem/u/c/i:QI (plus:QI (reg/f:QI 20)
                 (const_int 1 [0x1])) [2 S1 A16])) -1 (nil))

(insn 7 6 8 vol.c:3 (set (reg:QI 0 AH)
         (mem/u/c/i:QI (reg/f:QI 20) [2 S1 A16])) -1 (nil))

(insn 8 7 9 vol.c:3 (set (mem/v/c/i:QI (plus:QI (reg/f:QI 14 
virtual-stack-vars)
                 (const_int 1 [0x1])) [2 sc+1 S1 A16])
         (reg:QI 1 AL)) -1 (nil))

(insn 9 8 0 vol.c:3 (set (subreg:QI (mem/v/c/i:HI (reg/f:QI 14 
virtual-stack-vars) [2 sc+0 S2 A16]) 0)
         (reg:QI 0 AH)) -1 (nil))


Now, the problem with this comes with insn 9 that has a subreg:QI of a 
mem:HI it seems. The raw move we are trying to do is:
(set (mem/v/c/i:HI (reg/f:QI 14 virtual-stack-vars) [2 sc+0 S2 A16])
      (mem/u/c/i:HI (reg/f:QI 20) [2 S2 A16]))

To do this we need to go through two QImode registers AL and AH and I 
have as part of my port:
         emit_move_insn(gen_rtx_REG(QImode, RAL), gen_lowpart(QImode, 
operands[1]));
         emit_move_insn(gen_rtx_REG(QImode, RAH), gen_highpart(QImode, 
operands[1]));
         emit_move_insn(gen_lowpart(QImode, operands[0]), 
gen_rtx_REG(QImode, RAL));
         emit_move_insn(gen_highpart(QImode, operands[0]), 
gen_rtx_REG(QImode, RAH));


The problem here comes with gen_lowpart and gen_highpart applied to:
(mem/v/c/i:HI (reg/f:QI 14 virtual-stack-vars) [2 sc+0 S2 A16])

gen_lowpart generates: (mem/v/c/i:QI (plus:QI (reg/f:QI 14 
virtual-stack-vars)(const_int 1 [0x1]))

but gen_highpart generates:
(subreg:QI (mem/v/c/i:HI (reg/f:QI 14 virtual-stack-vars) [2 sc+0 S2 
A16]) 0)


Why is that? Any suggestion on solving this situation?

Cheers,

Paulo Matos

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic