[Bug middle-end/40122] missed optimization when using union of __m128i and int[4]

2009-05-21 Thread jamborm at gcc dot gnu dot org


--- Comment #3 from jamborm at gcc dot gnu dot org  2009-05-21 16:02 ---
With he new SRA, the optimized dump looks like:

  D.6886_10 = {1, 1, 1, 1};
  D.6887_11 = VIEW_CONVERT_EXPRvector long long int(D.6886_10);
  D.6893_12 = VIEW_CONVERT_EXPRvector int(D.6887_11);
  D.6891_14 = __builtin_ia32_pcmpeqd128 (D.6893_12, D.6893_12);
  D.6890_15 = VIEW_CONVERT_EXPRvector long long int(D.6891_14);
  D.6897_16 = VIEW_CONVERT_EXPRvector char(D.6890_15);
  D.6896_17 = __builtin_ia32_pmovmskb128 (D.6897_16);
  D.6933_21 = D.6896_17 != 65535;
  return D.6933_21;


x is completely gone.

The (relevant) assembly output is 

main:
movdqa  .LC0, %xmm0
pcmpeqd %xmm0, %xmm0
pmovmskb%xmm0, %eax
cmpl$65535, %eax
pushl   %ebp
setne   %al
movl%esp, %ebp
movzbl  %al, %eax
popl%ebp
ret

So  even though  I  don't  really understand  the  SSE instructions  I
believe the  new SRA does indeed  help.  I'll add  a testcase checking
that x vanishes to the patch series as I am finalizing the final patch
set now.


-- 


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



[Bug middle-end/40122] missed optimization when using union of __m128i and int[4]

2009-05-12 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2009-05-12 15:00 ---
The union copy confuses GCC:

  r.v = VIEW_CONVERT_EXPRvector long long int({1, 1, 1, 1});
  D.6990 = r;
  x = D.6990;
  D.6997 = VIEW_CONVERT_EXPRvector int(x.v);
  D.6994 = __builtin_ia32_pcmpeqd128 (D.6997, D.6997);
  D.7000 = __builtin_ia32_pmovmskb128 (VIEW_CONVERT_EXPRvector
char(VIEW_CONVERT_EXPRvector long long int(D.6994)));
  return D.7000 != 65535;

this will likely be fixed with the new SRA or is a duplicate of PR36327.

Martin, can you check this (and maybe add a testcase)?


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu dot
   ||org, mjambor at suse dot cz
   Severity|normal  |enhancement
   Keywords||missed-optimization


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



[Bug middle-end/40122] missed optimization when using union of __m128i and int[4]

2009-05-12 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2009-05-12 15:24 ---
This is a dup of bug 36327.

*** This bug has been marked as a duplicate of 36327 ***


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||DUPLICATE


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