public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21997] New: vectorization inhibited by gcc's choice to view an integer as a boolean
@ 2005-06-10 13:15 stefaan dot deroeck at gmail dot com
  2005-06-10 13:31 ` [Bug tree-optimization/21997] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 4+ messages in thread
From: stefaan dot deroeck at gmail dot com @ 2005-06-10 13:15 UTC (permalink / raw)
  To: gcc-bugs

The following code contains two almost identical functions.  The first one is
vectorized, but the second isn't.  

typedef int __attribute ((aligned (16))) aint;
void test0(aint * __restrict a1) {
  for (int i=0; i<640; ++i)
		a1[i] = (a1[i] ? 2 : 1);
}
void test1(aint * __restrict a1) {
  for (int i=0; i<640; ++i)
		a1[i] = (a1[i] ? 0 : 1);
}

The most relevant part from the vectorization dump is probably:
vecttest.cpp:6: note: get vectype for scalar type:  int
vecttest.cpp:6: note: get vectype with 4 units of type int
vecttest.cpp:6: note: vectype: vector int
vecttest.cpp:6: note: vectype: vector int
vecttest.cpp:6: note: nunits = 4
vecttest.cpp:6: note: ==> examining statement: D.2034_13 = D.2033_12 == 0
vecttest.cpp:6: note: get vectype for scalar type:  bool
vecttest.cpp:6: note: get vectype with 16 units of type bool
vecttest.cpp:6: note: vectype: vector bool
vecttest.cpp:6: note: vectype: vector bool
vecttest.cpp:6: note: nunits = 16
vecttest.cpp:7: note: not vectorized: mixed data-types
vecttest.cpp:7: note: can't determine vectorization factor.
vecttest.cpp:6: note: vectorized 0 loops in function.
So probably an earlier optimization step prohibits vectorization in this case.

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /esat/alexandria1/sderoeck/src/gcc/main/configure
--prefix=/esat/olympia/install --program-suffix=-cvs --enable-languages=c,c++ :
(reconfigured) /esat/alexandria1/sderoeck/src/gcc/main/configure
--prefix=/esat/olympia/install --program-suffix=-cvs --enable-languages=c,c++ :
(reconfigured) /esat/alexandria1/sderoeck/src/gcc/main/configure
--prefix=/esat/olympia/install --program-suffix=-cvs --enable-languages=c,c++
--no-create --no-recursion : (reconfigured)
/esat/alexandria1/sderoeck/src/gcc/main/configure --prefix=/esat/olympia/install
--program-suffix=-cvs --enable-languages=c,c++ --no-create --no-recursion
Thread model: posix
gcc version 4.1.0 20050610 (experimental)
 /esat/olympia/install/libexec/gcc/i686-pc-linux-gnu/4.1.0/cc1plus -quiet -v
-D_GNU_SOURCE vecttest.cpp -quiet -dumpbase vecttest.cpp -march=pentium4
-auxbase-strip vecttest-gcc.s -O9 -version -fverbose-asm -ftree-vectorize
-fdump-tree-vect-details -fdump-tree-vect-stats -o vecttest-gcc.s
--cut--
GNU C++ version 4.1.0 20050610 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.4 (Gentoo 3.4.4, ssp-3.4.4-1.0, pie-8.7.8).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 3cb76b13917ca148a15d77c9a1fb678d

-- 
           Summary: vectorization inhibited by gcc's choice to view an
                    integer as a boolean
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stefaan dot deroeck at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/21997] vectorization inhibited by gcc's choice to view an integer as a boolean
  2005-06-10 13:15 [Bug tree-optimization/21997] New: vectorization inhibited by gcc's choice to view an integer as a boolean stefaan dot deroeck at gmail dot com
@ 2005-06-10 13:31 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-10 13:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-10 13:30 -------
Since "a == 0" is the canonical version of a?0:1, the vectorizer should recognize it.

Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-10 13:30:56
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/21997] vectorization inhibited by gcc's choice to view an integer as a boolean
       [not found] <bug-21997-3238@http.gcc.gnu.org/bugzilla/>
  2007-05-31 18:12 ` pinskia at gcc dot gnu dot org
@ 2009-04-22 22:41 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-22 22:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-04-22 22:41 -------
Hmm, I think there is a regression here in 4.3 and above (since
tuplicafication) in that we don't vectorize even the ?2:1 loop.


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/21997] vectorization inhibited by gcc's choice to view an integer as a boolean
       [not found] <bug-21997-3238@http.gcc.gnu.org/bugzilla/>
@ 2007-05-31 18:12 ` pinskia at gcc dot gnu dot org
  2009-04-22 22:41 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-31 18:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-05-31 18:11 -------
*** Bug 32168 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl at lucon dot org


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-22 22:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-10 13:15 [Bug tree-optimization/21997] New: vectorization inhibited by gcc's choice to view an integer as a boolean stefaan dot deroeck at gmail dot com
2005-06-10 13:31 ` [Bug tree-optimization/21997] " pinskia at gcc dot gnu dot org
     [not found] <bug-21997-3238@http.gcc.gnu.org/bugzilla/>
2007-05-31 18:12 ` pinskia at gcc dot gnu dot org
2009-04-22 22:41 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).