From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1702 invoked by alias); 16 Dec 2011 16:22:53 -0000 Received: (qmail 1690 invoked by uid 22791); 16 Dec 2011 16:22:50 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_IV 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; Fri, 16 Dec 2011 16:22:38 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/51581] New: Integer division by constant is not vectorized Date: Fri, 16 Dec 2011 16:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: 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/msg01829.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51581 Bug #: 51581 Summary: Integer division by constant is not vectorized Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: jakub@gcc.gnu.org CC: irar@gcc.gnu.org (Now in 4.7 with the exception of division by power of 2 constant). But as the following testcase shows, if target doesn't have a vector integer division instruction, we could reuse expmed.c choose_multiplier and parts of expand_divmod to pattern recognize it as multiplication by some constant and some shifts. All we need is a vectorized highpart signed/unsigned multiplication or widening multiplication for the vector mode in question (e.g. on i?86/x86_64 we have a highpart signed/unsigned multiplication for V*HImode vectors and widening multiplication (perhaps for AVX2 purposes we could come up with better optimized highpart V8SImode pattern) for V*SImode vectors.