[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-21 Thread jamborm at gcc dot gnu dot org


--- Comment #27 from jamborm at gcc dot gnu dot org  2010-07-21 17:21 
---
Fixed.


-- 

jamborm at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-21 Thread jamborm at gcc dot gnu dot org


--- Comment #26 from jamborm at gcc dot gnu dot org  2010-07-21 14:17 
---
Subject: Bug 44900

Author: jamborm
Date: Wed Jul 21 14:17:11 2010
New Revision: 162375

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162375
Log:
2010-07-21  Martin Jambor  

PR tree-optimization/44900
* tree-sra.c (load_assign_lhs_subreplacements): Updated comments.
(sra_modify_assign): Move gsi to the next statmenent unconditionally.

* testsuite/g++.dg/torture/pr44900.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/torture/pr44900.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-sra.c


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-21 Thread jamborm at gcc dot gnu dot org


--- Comment #25 from jamborm at gcc dot gnu dot org  2010-07-21 13:57 
---
Subject: Bug 44900

Author: jamborm
Date: Wed Jul 21 13:57:12 2010
New Revision: 162374

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162374
Log:
2010-07-21  Martin Jambor  

PR tree-optimization/44900
* tree-sra.c (load_assign_lhs_subreplacements): Updated comments.
(sra_modify_assign): Move gsi to the next statmenent unconditionally.

* testsuite/g++.dg/torture/pr44900.C: New test.


Added:
branches/gcc-4_5-branch/gcc/testsuite/g++.dg/torture/pr44900.C
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
branches/gcc-4_5-branch/gcc/tree-sra.c


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-20 Thread jamborm at gcc dot gnu dot org


--- Comment #24 from jamborm at gcc dot gnu dot org  2010-07-20 13:34 
---
I posted a proposed fix to the mailing list:

http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01570.html


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-19 Thread jamborm at gcc dot gnu dot org


-- 

jamborm at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |jamborm at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2010-07-11 11:25:40 |2010-07-19 13:45:37
   date||


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread yottui at yahoo dot co dot jp


--- Comment #23 from yottui at yahoo dot co dot jp  2010-07-15 03:45 ---
(In reply to comment #22)
> Please file that as a different bug.
May I enter comment #15 as a new bug to Bugzilla?


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread pinskia at gcc dot gnu dot org


--- Comment #22 from pinskia at gcc dot gnu dot org  2010-07-14 16:50 
---
(In reply to comment #21)
> Even if it did not voilate aliasing rules, the IR looks good:

The expansion looks incorrect though:
(insn 39 38 40 t.cc:55 (set (reg:DI 107)
(vec_select:DI (reg:V2DI 79 [ D.4999 ])
(parallel [
(const_int 1 [0x1])
]))) -1 (nil))

(insn 40 39 41 t.cc:55 (set (reg:DI 108)
(vec_select:DI (reg:V2DI 79 [ D.4999 ])
(parallel [
(const_int 1 [0x1])
]))) -1 (nil))

(insn 41 40 42 t.cc:55 (set (reg:DI 109)
(vec_select:DI (reg:V2DI 79 [ D.4999 ])
(parallel [
(const_int 0 [0x0])
]))) -1 (nil))

(insn 42 41 43 t.cc:55 (set (reg:DI 110)
(vec_select:DI (reg:V2DI 79 [ D.4999 ])
(parallel [
(const_int 0 [0x0])
]))) -1 (nil))

(insn 43 42 44 t.cc:55 (set (reg:SI 37 r8)
(subreg:SI (reg:DI 107) 0)) -1 (nil))

(insn 44 43 45 t.cc:55 (set (reg:SI 2 cx)
(subreg:SI (reg:DI 108) 0)) -1 (nil))

(insn 45 44 46 t.cc:55 (set (reg:SI 1 dx)
(subreg:SI (reg:DI 109) 0)) -1 (nil))

(insn 46 45 47 t.cc:55 (set (reg:SI 4 si)
(subreg:SI (reg:DI 110) 0)) -1 (nil))

Please file that as a different bug.


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread pinskia at gcc dot gnu dot org


--- Comment #21 from pinskia at gcc dot gnu dot org  2010-07-14 16:44 
---
(In reply to comment #20)
> (In reply to comment #15)
> > I found the similar case with gcc 4.4.4 of MacPorts and gcc 4.4.0 of MinGW.
> I think the code in comment #15 is invalid and voilates C/C++ aliasing rules.

Even if it did not voilate aliasing rules, the IR looks good:

  D.4999_70 = VIEW_CONVERT_EXPR(D.4995_68).i;
  D.4863_25 = VIEW_CONVERT_EXPR(D.4999_70).e[3];
  D.4864_26 = VIEW_CONVERT_EXPR(D.4999_70).e[2];
  D.4865_27 = VIEW_CONVERT_EXPR(D.4999_70).e[1];
  D.4866_28 = VIEW_CONVERT_EXPR(D.4999_70).e[0];


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread pinskia at gcc dot gnu dot org


--- Comment #20 from pinskia at gcc dot gnu dot org  2010-07-14 16:41 
---
(In reply to comment #15)
> I found the similar case with gcc 4.4.4 of MacPorts and gcc 4.4.0 of MinGW.
I think the code in comment #15 is invalid and voilates C/C++ aliasing rules.


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread hjl dot tools at gmail dot com


--- Comment #19 from hjl dot tools at gmail dot com  2010-07-14 15:52 
---
(In reply to comment #15)
> I found the similar case with gcc 4.4.4 of MacPorts and gcc 4.4.0 of MinGW.
> 
> -- begin testcase --
> // g++ -O -msse2 test.cpp
> typedef long long __m128i __attribute__ ((__vector_size__ (16),
> __may_alias__));
> 
> struct vec
> {
> __m128i v;
> 
> static vec load(const int * p)
> { return (__m128i) __builtin_ia32_loaddqu((char const *)p); }
> 
> const int & operator [](int i) const
> {
> union u {
> __m128i v;
> int e[4];
> };
> 
> return ((const u &)v).e[i];
> }
> 
> vec() {}
> vec(const __m128i & a) : v(a) {}
> };
> 
> extern "C" {
> int  printf (const char*, ...);
> }
> 
> int main( int argc, char * argv[] )
> {
> __attribute__((aligned(16))) int data[] =
> { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 };
> 
> vec a = vec::load(data);
> 
> printf("v: %d, %d, %d, %d\n", a[0], a[1], a[2], a[3]);
> 
> return 0;
> }
> -- end testcase --
> 
> -- begin output --
> v: 16, 16, 14, 14
> -- end output --
> 

This is caused by revision 134947:

http://gcc.gnu.org/ml/gcc-cvs/2008-05/msg00107.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread sezeroz at gmail dot com


--- Comment #18 from sezeroz at gmail dot com  2010-07-14 14:05 ---
(In reply to comment #15)
> I found the similar case with gcc 4.4.4 of MacPorts and gcc 4.4.0 of MinGW.
> 

This case fails with 4.4 on i686-linux too, printing 16, 16, 14, 14 instead of
16, 15, 14, 13 which 4.3 does.


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread sezeroz at gmail dot com


--- Comment #17 from sezeroz at gmail dot com  2010-07-14 14:02 ---
(In reply to comment #16)
> This is also the wrong result with MinGW gcc 3.4.5.
> I'm expecting that all component of v will be 2500.
> 
> 4.4.4 of MacPorts, 4.5.0 of MacPorts, 4.4.0 of MinGW and 4.5.0-1 of MinGW were
> worked fine.
> 
> This time, I did not check 3.4.6 of MacPorts.
> I tried to install gcc34 of MacPorts, but failed.
> 
> -- begin testcase --
> // g++ -O -msse2 test.cpp
> #include 
> #include 
> 
> extern "C" int  printf (const char*, ...);
> 
> // There is no _mm_castps_si128() in gcc 3.4
> inline __m128i my_castps_si128(const __m128 & a)
> {
> //return *(const __m128i *)&a; // same result
> 
> union u {
> __m128  s;
> __m128i i;
> };
> const u & v = (const u &)a;
> 
> return v.i;
> }
> 
> inline __m128 my_castsi128_ps(const __m128i & a)
> {
> //return *(const __m128 *)&a; // same result
> 
> union u {
> __m128  s;
> __m128i i;
> };
> const u & v = (const u &)a;
> 
> return v.s;
> }
> 
> int main( int argc, char * argv[] )
> {
> 
> union u {
> __m128i v;
> int e[4];
> };
> __m128i a  = _mm_set1_epi32(1250);
> __m128i b  = _mm_set1_epi32(2);
> __m128i v0 = _mm_setzero_si128();
> __m128i al = _mm_unpacklo_epi32(a, v0);
> __m128i ah = _mm_unpackhi_epi32(a, v0);
> __m128i bl = _mm_unpacklo_epi32(b, v0);
> __m128i bh = _mm_unpackhi_epi32(b, v0);
> __m128i lo = _mm_mul_epu32(al, bl);
> __m128i hi = _mm_mul_epu32(ah, bh);
> __m128  sl = my_castsi128_ps(lo);
> __m128  sh = my_castsi128_ps(hi);
> __m128  s  = _mm_shuffle_ps(sl, sh, 0x88); // 2, 0, 2, 0
> __m128i r  = my_castps_si128(s);
> 
> u & v = (u &)r;
> printf("v: %d, %d, %d, %d\n", v.e[0], v.e[1], v.e[2], v.e[3]);
> 
> return 0;
> }
> -- end testcase --
> 
> -- begin output --
> v: 0, 0, 2500, 2500
> -- end output --
> 


-- 

sezeroz at gmail dot com changed:

   What|Removed |Added

 CC||sezeroz at gmail dot com


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread yottui at yahoo dot co dot jp


--- Comment #16 from yottui at yahoo dot co dot jp  2010-07-14 12:24 ---
This is also the wrong result with MinGW gcc 3.4.5.
I'm expecting that all component of v will be 2500.

4.4.4 of MacPorts, 4.5.0 of MacPorts, 4.4.0 of MinGW and 4.5.0-1 of MinGW were
worked fine.

This time, I did not check 3.4.6 of MacPorts.
I tried to install gcc34 of MacPorts, but failed.

-- begin testcase --
// g++ -O -msse2 test.cpp
#include 
#include 

extern "C" int  printf (const char*, ...);

// There is no _mm_castps_si128() in gcc 3.4
inline __m128i my_castps_si128(const __m128 & a)
{
//return *(const __m128i *)&a; // same result

union u {
__m128  s;
__m128i i;
};
const u & v = (const u &)a;

return v.i;
}

inline __m128 my_castsi128_ps(const __m128i & a)
{
//return *(const __m128 *)&a; // same result

union u {
__m128  s;
__m128i i;
};
const u & v = (const u &)a;

return v.s;
}

int main( int argc, char * argv[] )
{

union u {
__m128i v;
int e[4];
};
__m128i a  = _mm_set1_epi32(1250);
__m128i b  = _mm_set1_epi32(2);
__m128i v0 = _mm_setzero_si128();
__m128i al = _mm_unpacklo_epi32(a, v0);
__m128i ah = _mm_unpackhi_epi32(a, v0);
__m128i bl = _mm_unpacklo_epi32(b, v0);
__m128i bh = _mm_unpackhi_epi32(b, v0);
__m128i lo = _mm_mul_epu32(al, bl);
__m128i hi = _mm_mul_epu32(ah, bh);
__m128  sl = my_castsi128_ps(lo);
__m128  sh = my_castsi128_ps(hi);
__m128  s  = _mm_shuffle_ps(sl, sh, 0x88); // 2, 0, 2, 0
__m128i r  = my_castps_si128(s);

u & v = (u &)r;
printf("v: %d, %d, %d, %d\n", v.e[0], v.e[1], v.e[2], v.e[3]);

return 0;
}
-- end testcase --

-- begin output --
v: 0, 0, 2500, 2500
-- end output --


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-14 Thread yottui at yahoo dot co dot jp


--- Comment #15 from yottui at yahoo dot co dot jp  2010-07-14 09:22 ---
I found the similar case with gcc 4.4.4 of MacPorts and gcc 4.4.0 of MinGW.

-- begin testcase --
// g++ -O -msse2 test.cpp
typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));

struct vec
{
__m128i v;

static vec load(const int * p)
{ return (__m128i) __builtin_ia32_loaddqu((char const *)p); }

const int & operator [](int i) const
{
union u {
__m128i v;
int e[4];
};

return ((const u &)v).e[i];
}

vec() {}
vec(const __m128i & a) : v(a) {}
};

extern "C" {
int  printf (const char*, ...);
}

int main( int argc, char * argv[] )
{
__attribute__((aligned(16))) int data[] =
{ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 };

vec a = vec::load(data);

printf("v: %d, %d, %d, %d\n", a[0], a[1], a[2], a[3]);

return 0;
}
-- end testcase --

-- begin output --
v: 16, 16, 14, 14
-- end output --


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-12 Thread rguenth at gcc dot gnu dot org


--- Comment #14 from rguenth at gcc dot gnu dot org  2010-07-12 07:54 
---
It indeed works with the 4.5.0 release which makes it a blocker for 4.5.1.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P1


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread hjl dot tools at gmail dot com


--- Comment #13 from hjl dot tools at gmail dot com  2010-07-12 02:03 
---
If you replace

---
   vec2 a;
a = vec2::load(p);
---

with

---
vec2 a = vec2::load(p);
---

the testcase will pass.


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread hjl dot tools at gmail dot com


--- Comment #12 from hjl dot tools at gmail dot com  2010-07-12 01:05 
---
It is caused by revision 158826. On trunk, it
is fixed/hidden by revision 158732:

http://gcc.gnu.org/ml/gcc-cvs/2010-04/msg00839.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu dot
   ||org
  Known to fail||4.5.1
  Known to work|4.6.0 4.4.4 |4.6.0 4.4.4 4.5.0


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread hjl dot tools at gmail dot com


--- Comment #11 from hjl dot tools at gmail dot com  2010-07-11 23:35 
---
It is very likely caused by revision 158826:

http://gcc.gnu.org/ml/gcc-cvs/2010-04/msg00933.html

I will verify it and find out which checkin on trunk
fixes/hides this bug.


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread yottui at yahoo dot co dot jp


--- Comment #10 from yottui at yahoo dot co dot jp  2010-07-11 23:11 ---
Please use '-m32' if host is x64.


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread pinskia at gcc dot gnu dot org


--- Comment #9 from pinskia at gcc dot gnu dot org  2010-07-11 22:47 ---
Works with:
GNU C++ (GCC) version 4.5.0 20100401 (experimental) [trunk revision 157933]
(x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20100401 (experimental) [trunk revision
157933], GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1

Which is before the branch of 4.5.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

  Known to fail|4.5.1   |
  Known to work|4.6.0 4.4.4 4.5.0   |4.6.0 4.4.4


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread rguenth at gcc dot gnu dot org


--- Comment #8 from rguenth at gcc dot gnu dot org  2010-07-11 21:59 ---
Hm?  I checked 4.5.0 and it was broken as well, so someone should double-check
(I can't at the moment).


-- 


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread hjl dot tools at gmail dot com


--- Comment #7 from hjl dot tools at gmail dot com  2010-07-11 20:59 ---
It works with gcc 4.5.0.  It is a 4.5.1 regression.


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

  Known to fail|4.5.0 4.5.1 |4.5.1
  Known to work|4.6.0 4.4.4 |4.6.0 4.4.4 4.5.0


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



[Bug tree-optimization/44900] [4.5 Regression] The variable of SSE will be broken

2010-07-11 Thread rguenth at gcc dot gnu dot org


--- Comment #6 from rguenth at gcc dot gnu dot org  2010-07-11 12:48 ---
Confirmed, caused by SRA, maybe latent on the trunk.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||jamborm at gcc dot gnu dot
   ||org
  Component|target  |tree-optimization
   Keywords||wrong-code
  Known to fail|4.5.1   |4.5.0 4.5.1
   Target Milestone|--- |4.5.1


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