From patchwork Mon Aug 26 16:18:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 269922 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 2AD142C0097 for ; Tue, 27 Aug 2013 02:18:54 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:to:cc:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=QI0t1JEd57cNahKf vO/mt4elpSQNCU7rPOI61QSWNyO2hv96FRmlfc/NdK9vNaMbt6nLp6JURQEVn6j+ +cu741K4I0/aw9dYmYspljjJ7XMZ5XOCGNHNRGqSvy3Xd5OwBgi0x2GHQ9QQMvC4 BitjbDnGBwuWJHHKY2tB/zKFbTA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:to:cc:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=NrGxJ8kqPSJElH1AAUU5eP 9MZvQ=; b=P4HvJEKtTMIxfGQmRMMTtPLqpXcXaIYc6C7acHZ1fDoAbSMf1VPVJ8 t4XpM8qcOnz6Bkct9YjrPsdME4hxdOkpFNsresHc79XtSuoLAxDyUjq4w/KrfFNc ZBexxe7sWmf4A5tycxeD5RyARH3Geq1gQOx5dS/skdSPVrmfWjGdA= Received: (qmail 23027 invoked by alias); 26 Aug 2013 16:18:47 -0000 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 Received: (qmail 23014 invoked by uid 89); 26 Aug 2013 16:18:47 -0000 Received: from c62.cesmail.net (HELO c62.cesmail.net) (216.154.195.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 26 Aug 2013 16:18:47 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: c62.cesmail.net Received: from unknown (HELO delta2) ([192.168.1.50]) by c62.cesmail.net with ESMTP; 26 Aug 2013 12:18:45 -0400 Received: from cust213-dsl91-135-11.idnet.net (cust213-dsl91-135-11.idnet.net [91.135.11.213]) by webmail.spamcop.net (Horde MIME library) with HTTP; Mon, 26 Aug 2013 12:18:45 -0400 Message-ID: <20130826121845.hp0ac9mlhc4ccwsw-nzlynne@webmail.spamcop.net> Date: Mon, 26 Aug 2013 12:18:45 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Cc: Joseph Myers , Richard Henderson Subject: RFA: Consider int and same-size short as equivalent vector components MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) avr currently shows the following failure: FAIL: c-c++-common/vector-scalar.c -Wc++-compat (test for excess errors) Excess errors: /home/amylaar/atmel/4.8/unisrc-mainline/gcc/testsuite/c-c++-common/vector-scalar .c:9:34: error: invalid operands to binary | (have '__vector(8) int' and 'veci') The issue is that when we compute the result of an operatiopn of a veci and an int, we get a __vector(8) int result (int is the same size as short), yet the typechecking later does not accept the vectors as compatible. Fixed by relaxing the latter for the case that int and short are the same size. bootstrapped / regtested on i686-pc-linux-gnu. OK to apply? 2013-07-17 Joern Rennecke * c-common.c (same_scalar_type_ignoring_signedness): Also accept short/int as equivalent if they have the same precision. Index: c-family/c-common.c =================================================================== --- c-family/c-common.c (revision 201992) +++ c-family/c-common.c (working copy) @@ -10700,10 +10700,22 @@ same_scalar_type_ignoring_signedness (tr && (c2 == INTEGER_TYPE || c2 == REAL_TYPE || c2 == FIXED_POINT_TYPE)); + t1 = c_common_signed_type (t1); + t2 = c_common_signed_type (t2); /* Equality works here because c_common_signed_type uses TYPE_MAIN_VARIANT. */ - return c_common_signed_type (t1) - == c_common_signed_type (t2); + if (t1 == t2) + return true; + if (TYPE_PRECISION (t1) != TYPE_PRECISION (t2)) + return false; + /* When short and int are the same size, we promote vectors of short + to vectors of int when doing arithmetic with scalars. Hence, + we also have to accept mixing short / int vectors in this case. + Example: c-c++-common/vector-scalar.c for target avr. */ + if ((t1 == integer_type_node && t2 == short_integer_type_node) + || (t2 == integer_type_node && t1 == short_integer_type_node)) + return true; + return false; } /* Check for missing format attributes on function pointers. LTYPE is