From patchwork Thu Oct 11 16:50:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 982616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-487370-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fuNaDSNT"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.b="lzQnUhYO"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42WH5N4NZqz9s8J for ; Fri, 12 Oct 2018 03:50:15 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=CLx 4tJihZGSQBV0ETDzHfIUi3lmgR2O+47IK/anpS55hTHxsOmrAQMtHaskSJQoH/I4 dpFeD8Oo+40zafZCeoNACnwnxCU1qwFivpvdqIWGip6T7NjpbOKi9agiqykYAKOo 5OaZ11Scovm3kqmNFN0xhxD5fLzbUzA7KlSO4Lnc= 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:from :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=ifjhrE8Fr DYkfV1yF/Fb9lJ07Ss=; b=fuNaDSNT66+VgtM8B+CdaesSfv+S2bpcrKuCzRnGx gQl9QGlj31b5Ec4NLYCJcWPw1Y8KscHsKlSVhtcB63d7m7RO70Qh0LYC8CsObeER t7CpUln7e/SEbtIfhmmzwuP9tJSaOW48jXKwrBKGb7+wgZRXQzKK/raRl6k0SrOR so= Received: (qmail 25278 invoked by alias); 11 Oct 2018 16:50:08 -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 24807 invoked by uid 89); 11 Oct 2018 16:50:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1657 X-HELO: EUR04-DB3-obe.outbound.protection.outlook.com Received: from mail-eopbgr60069.outbound.protection.outlook.com (HELO EUR04-DB3-obe.outbound.protection.outlook.com) (40.107.6.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Oct 2018 16:50:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5RVvrIcCtfzdj58/Q8nPGbXEdrRNHfpSOhg1OvhujQA=; b=lzQnUhYOY3HRO74+czk32uwCcSttNaviGc7mYIwSLFDTtNhDuadyL9FGilRFEYTKZLmdX6xuSVCY40na181XUea/jrZIRBOmytkeyDsCVoydvFlNyugaEt/SPH6EnzNoYwXuxsHf8QT5M18BiM96SL/4KJrbt3u8B+rvVug6FFE= Received: from DB5PR08MB1030.eurprd08.prod.outlook.com (10.166.14.15) by DB5PR08MB0998.eurprd08.prod.outlook.com (10.166.14.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Thu, 11 Oct 2018 16:50:02 +0000 Received: from DB5PR08MB1030.eurprd08.prod.outlook.com ([fe80::f8ba:6473:782c:1f26]) by DB5PR08MB1030.eurprd08.prod.outlook.com ([fe80::f8ba:6473:782c:1f26%3]) with mapi id 15.20.1228.020; Thu, 11 Oct 2018 16:50:02 +0000 From: Wilco Dijkstra To: GCC Patches CC: nd , James Greenhalgh , Richard Earnshaw , Richard Sandiford Subject: [PATCH][AArch64] Fix PR87511 Date: Thu, 11 Oct 2018 16:50:02 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) MIME-Version: 1.0 As mentioned in PR87511, the shift used in aarch64_mask_and_shift_for_ubfiz_p should be evaluated as a HOST_WIDE_INT rather than int. Passes bootstrap, OK for commit and backport? ChangeLog: 2018-10-11 Wilco Dijkstra gcc/ * config/aarch64/aarch64.c (aarch64_mask_and_shift_for_ubfiz_p): Use HOST_WIDE_INT_1U for shift. testsuite/ * gcc.target/aarch64/pr87511.c: Add new test. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 385272b8867317be4b2d10e56da25af306121214..86cfb92861eda652718b4e0be013688718d8f1b2 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -8549,7 +8549,8 @@ aarch64_mask_and_shift_for_ubfiz_p (scalar_int_mode mode, rtx mask, return CONST_INT_P (mask) && CONST_INT_P (shft_amnt) && INTVAL (shft_amnt) < GET_MODE_BITSIZE (mode) && exact_log2 ((INTVAL (mask) >> INTVAL (shft_amnt)) + 1) >= 0 - && (INTVAL (mask) & ((1 << INTVAL (shft_amnt)) - 1)) == 0; + && (INTVAL (mask) + & ((HOST_WIDE_INT_1U << INTVAL (shft_amnt)) - 1)) == 0; } /* Calculate the cost of calculating X, storing it in *COST. Result diff --git a/gcc/testsuite/gcc.target/aarch64/pr87511.c b/gcc/testsuite/gcc.target/aarch64/pr87511.c new file mode 100644 index 0000000000000000000000000000000000000000..98064701594caefa747c10d87924746f295ad8cd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr87511.c @@ -0,0 +1,16 @@ +/* { dg-do assemble } */ +/* { dg-options "-Os" } */ + +int a, d; +struct { + signed f5 : 26; + signed f6 : 12; +} b; +signed char c; +void fn1() { + signed char *e = &c; + d = a * 10; + *e = d; + b.f6 = c; + b.f5 = 8 <= 3; +}