From patchwork Tue Dec 7 19:32:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 74592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A252FB70A4 for ; Wed, 8 Dec 2010 06:32:23 +1100 (EST) Received: (qmail 10048 invoked by alias); 7 Dec 2010 19:32:19 -0000 Received: (qmail 10035 invoked by uid 22791); 7 Dec 2010 19:32:18 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Dec 2010 19:32:10 +0000 Received: from hpaq6.eem.corp.google.com (hpaq6.eem.corp.google.com [172.25.149.6]) by smtp-out.google.com with ESMTP id oB7JW8Nb007891 for ; Tue, 7 Dec 2010 11:32:08 -0800 Received: from pwj8 (pwj8.prod.google.com [10.241.219.72]) by hpaq6.eem.corp.google.com with ESMTP id oB7JW5eh007212 for ; Tue, 7 Dec 2010 11:32:06 -0800 Received: by pwj8 with SMTP id 8so105917pwj.36 for ; Tue, 07 Dec 2010 11:32:05 -0800 (PST) Received: by 10.142.143.21 with SMTP id q21mr1359653wfd.182.1291750325199; Tue, 07 Dec 2010 11:32:05 -0800 (PST) Received: from coign.google.com (dhcp-172-22-123-203.mtv.corp.google.com [172.22.123.203]) by mx.google.com with ESMTPS id p8sm9343059wff.16.2010.12.07.11.32.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Dec 2010 11:32:04 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org Subject: Go patch committed: Handle vector modes Date: Tue, 07 Dec 2010 11:32:02 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The tree vectorizer calls the type_for_mode langhook with vector modes. I'm not sure this makes sense. If a language doesn't have any vector types, then there is nothing sensible that the langhook can return. It seems to me that this should be done entirely in the middle-end, using middle-end types, rather than asking the language. Actually the whole idea of the type_for_mode langhook seems dubious to me, but I haven't looked into how it is used. In any case, since the middle-end does currently expect this to work, and since two bugs were reported about it, I have patched the Go frontend to handle vector types in the type_for_mode langhook. Bootstrapped on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2010-12-07 Ian Lance Taylor PR tree-optimization/46805 PR tree-optimization/46833 * go-lang.c (go_langhook_type_for_mode): Handle vector modes. Index: go-lang.c =================================================================== --- go-lang.c (revision 167562) +++ go-lang.c (working copy) @@ -285,6 +285,20 @@ go_langhook_type_for_size (unsigned int static tree go_langhook_type_for_mode (enum machine_mode mode, int unsignedp) { + /* Go has no vector types. Build them here. FIXME: It does not + make sense for the middle-end to ask the frontend for a type + which the frontend does not support. However, at least for now + it is required. See PR 46805. */ + if (VECTOR_MODE_P (mode)) + { + tree inner; + + inner = go_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp); + if (inner != NULL_TREE) + return build_vector_type_for_mode (inner, mode); + return NULL_TREE; + } + return go_type_for_mode (mode, unsignedp); }