Re: [llvm-commits] proposed patch: shift when shift amount >= bit width

2007-06-13 Thread Chris Lattner
On Jun 13, 2007, at 12:06 PM, Lauro Ramos Venancio wrote: >> I don't think this is appropriate Lauro. The program needs to be >> fixed, it's not just a codegen or optimizer issue, everything in the >> compiler assumes that these shifts are undefined. Programs cannot >> reliably expect a compile

Re: [llvm-commits] proposed patch: shift when shift amount >= bit width

2007-06-13 Thread Lauro Ramos Venancio
> I don't think this is appropriate Lauro. The program needs to be > fixed, it's not just a codegen or optimizer issue, everything in the > compiler assumes that these shifts are undefined. Programs cannot > reliably expect a compiler to do the right thing here, and your patch > isn't a fix. Now

Re: [llvm-commits] proposed patch: shift when shift amount >= bit width

2007-06-13 Thread Chris Lattner
On Jun 13, 2007, at 11:34 AM, Lauro Ramos Venancio wrote: >> >> This is not enough to make a compiler handle shifts by greater >> than the >> word size consistently; in both gcc and llvm-gcc, for example, the >> result of >> >> int y=32; >> x>>y >> >> depends on optimization level. > >

Re: [llvm-commits] proposed patch: shift when shift amount >= bit width

2007-06-13 Thread Lauro Ramos Venancio
> > This is not enough to make a compiler handle shifts by greater than the > word size consistently; in both gcc and llvm-gcc, for example, the > result of > > int y=32; > x>>y > > depends on optimization level. I know. On x86, the result of int n = 32; 1

Re: [llvm-commits] proposed patch: shift when shift amount >= bit width

2007-06-13 Thread Dale Johannesen
On Jun 12, 2007, at 1:19 PM, Lauro Ramos Venancio wrote: The attached patch unify the handle of shifts when the shift amount is greater or equal the bit width. Nowadays, LLVM evaluates shl(i32 X,32) to 0 in some places and to undef in other places. For compatibility purpose, this patch impleme

[llvm-commits] proposed patch: shift when shift amount >= bit width

2007-06-12 Thread Lauro Ramos Venancio
The attached patch unify the handle of shifts when the shift amount is greater or equal the bit width. Nowadays, LLVM evaluates shl(i32 X,32) to 0 in some places and to undef in other places. For compatibility purpose, this patch implements the gcc behavior. This fix the miscompilation of the fi