I am tracking a bug, not sure whether it is a generic GCC bug or my porting 
goes wrong. 

To access the below structure, 

typedef struct {
  long int p_x, p_y;
} Point;
...
p1.p_x = -1;
...

It is expanded to follwing RTL
 ;; p1.p_x = -1;

(insn 19 18 20 
/projects/firepath/tools/work/bmei/gcc-head/src/gcc/testsuite/gcc.c-torture/execute/20000808-1.c:14
 (set (reg:DI 98)
        (ior:DI (reg/v:DI 87 [ p1 ])
            (const_int -1 [0xffffffff]))) -1 (nil))

(insn 20 19 0 
/projects/firepath/tools/work/bmei/gcc-head/src/gcc/testsuite/gcc.c-torture/execute/20000808-1.c:14
 (set (reg/v:DI 87 [ p1 ])
        (reg:DI 98)) -1 (nil))

According to your explaination, (reg:DI 98) will get -1 (0xffffffffffffffff) 
after insn 19, and is wrong. Am I right? 

Thanks,
Bingfeng

> -----Original Message-----
> From: Dave Korn [mailto:dave.korn.cyg...@googlemail.com] 
> Sent: 12 March 2009 17:53
> To: Bingfeng Mei
> Cc: gcc@gcc.gnu.org
> Subject: Re: Is const_int zero extended or sign-extended?
> 
> Bingfeng Mei wrote:
> > Hello, I am confused by one very basic concept :).  In the 
> following rtx
> > expression, if const_int is 32-bit and DImode is 64-bit, 
> will the const_int
> > sign-extended or zero-extended. In other word, is the 
> content of reg:DI 95
> > 0xffffffffffffffff9 or 0xffffffff9 after this instruction?
> > 
> > (set:DI (reg:DI 95) (const_int -7 [0xfffffff9]))
> > 
> > Thanks, Bingfeng Mei
> > 
> 
>   IIUC in the absence of any explicit extension operation, a 
> const_int is
> taken to be whatever size the object it is assigned to, with 
> the value given
> by the signed decimal interpretation.  That RTL sets reg 95 
> to a DImode -7.
> 
>   Is this part of a larger problem?
> 
>     cheers,
>       DaveK
> 
> 

Reply via email to