From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26952 invoked by alias); 11 Dec 2011 11:52:59 -0000 Received: (qmail 26941 invoked by uid 22791); 11 Dec 2011 11:52:59 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_DD,TW_TM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Dec 2011 11:52:46 +0000 From: "fb.programming at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/51499] vectorizer missing simple case Date: Sun, 11 Dec 2011 12:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: fb.programming at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-12/txt/msg01144.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51499 --- Comment #4 from fb.programming at gmail dot com 2011-12-11 11:52:30 UTC --- Looks like there has been some great progress in gcc 4.7! Still I think it behaves slightly buggy. (1) In this case it should work without -funsafe-math-optimizations but it doesn't. gcc 4.7 requires -fno-signed-zeros -fno-trapping-math -fassociative-math to make it work. (2) The prediction: 7: not vectorized: vectorization not profitable. is just wrong. Forcing it with -fno-vect-cost-model shows it speeds up by factor of 2. (3) If I change all double's into float's in the code above it seems to work without forcing it (-fno-vect-cost-model): g++-4.7 -S -Wall -O2 -ftree-vectorize -ftree-vectorizer-verbose=2 \ -funsafe-math-optimizations test.cpp Analyzing loop at test.cpp:7 Vectorizing loop at test.cpp:7 7: vectorizing stmts using SLP. 7: LOOP VECTORIZED. test.cpp:4: note: vectorized 1 loops in function. However, it hasn't vectorized it at all as the assembly shows: .L11: addq $1, %rax addss %xmm0, %xmm3 cmpq %rax, %rdi addss %xmm0, %xmm4 addss %xmm0, %xmm7 addss %xmm0, %xmm6 addss %xmm0, %xmm5 addss %xmm0, %xmm1 ja .L11