why GCC does implicit promotion to unsigned char?

2012-01-26 Thread Konstantin Vladimirov
Hi, Consider code: char A; char B; char sum_A_B ( void ) { char sum = A + B; return sum; } Compile it on any backend (for example x86): gcc (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch revision 160292] gcc -m32 -O2 -S repro.c -fdump-tree-all-lineno-details Now look at repro.c.004t.gimple

Re: why GCC does implicit promotion to unsigned char?

2012-01-26 Thread Miles Bader
Konstantin Vladimirov writes: > It looks really weird. Why gcc promotes char to unsigned char internally? Hmm, maybe not useful, but if you used "unsigned char" as the variable types or the -funsigned-char command-line option, it won't ('cause the variables will already be unsigned)... -miles -

Re: why GCC does implicit promotion to unsigned char?

2012-01-26 Thread Jakub Jelinek
On Thu, Jan 26, 2012 at 02:27:45PM +0400, Konstantin Vladimirov wrote: > Consider code: > > char A; > char B; > > char sum_A_B ( void ) > { > char sum = A + B; > > return sum; > } > [repro.c : 6:8] A.0 = A; > [repro.c : 6:8] A.1 = (unsigned char) A.0; > [repro.c : 6:8] B.2 = B; > [re

Re: why GCC does implicit promotion to unsigned char?

2012-01-26 Thread Konstantin Vladimirov
Hi, If I know what I am doing, and my code itself guarantees, that there will be no overflows and UB here, can I switch off this signed char to unsigned char expansion in favor of signed char to signed int expansion? --- With best regards, Konstantin On Thu, Jan 26, 2012 at 3:04 PM, Jakub Jeline

Re: why GCC does implicit promotion to unsigned char?

2012-01-26 Thread Richard Guenther
On Thu, Jan 26, 2012 at 12:53 PM, Konstantin Vladimirov wrote: > Hi, > > If I know what I am doing, and my code itself guarantees, that there > will be no overflows and UB here, can I switch off this signed char to > unsigned char expansion in favor of signed char to signed int > expansion? No, y

Re: why GCC does implicit promotion to unsigned char?

2012-01-26 Thread Jakub Jelinek
On Thu, Jan 26, 2012 at 03:53:59PM +0400, Konstantin Vladimirov wrote: > If I know what I am doing, and my code itself guarantees, that there > will be no overflows and UB here, can I switch off this signed char to > unsigned char expansion in favor of signed char to signed int > expansion? Obviou

-mavx option

2012-01-26 Thread Ulrich Drepper
I think gcc is missing an option since -mavx controls two different things. First, the generation of VEX-encoded instructions. Second, the use of ymm registers. The latter is not always available when the former is and using VEX-encoded instructions by themselves can have an advantage. Currentl

Re: fixed_scalar_and_varying_struct_p and varies_p

2012-01-26 Thread Richard Guenther
On Wed, Jan 25, 2012 at 8:20 PM, Richard Sandiford wrote: > Richard Guenther writes: >> I'd say open a missed optimization bug with the testcase and go ahead >> with both patches. > > OK, I committed the patches yesterday and I've just opened PR 52000 > for the missed optimisation. Btw, looking

Re: why GCC does implicit promotion to unsigned char?

2012-01-26 Thread David Brown
On 26/01/2012 12:53, Konstantin Vladimirov wrote: Hi, If I know what I am doing, and my code itself guarantees, that there will be no overflows and UB here, can I switch off this signed char to unsigned char expansion in favor of signed char to signed int expansion? The big question here is w

Re: -mavx option

2012-01-26 Thread Paweł Sikora
On Thursday 26 of January 2012 09:52:22 Ulrich Drepper wrote: > I think gcc is missing an option since -mavx controls two different > things. First, the generation of VEX-encoded instructions. Second, > the use of ymm registers. The latter is not always available when the > former is and using V

gcc-4.5-20120126 is now available

2012-01-26 Thread gccadmin
Snapshot gcc-4.5-20120126 is now available on ftp://gcc.gnu.org/pub/gcc/snapshots/4.5-20120126/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 4.5 SVN branch with the following options: svn://gcc.gnu.org/svn/gcc/branches