From patchwork Mon Apr 22 07:15:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hurugalawadi, Naveen" X-Patchwork-Id: 238345 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 "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7559B2C0120 for ; Mon, 22 Apr 2013 17:15:32 +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:from :to:cc:subject:date:message-id:references:in-reply-to :content-type:mime-version; q=dns; s=default; b=yxpVNDdT3eIQgS79 MbgE2JVzOOKtDfSKAKIK607cpzITmxgoRNl/zqEIdNdOxb/aSo0VAuIv4w4RbBBz uK040bHZLCWBEtPsaDD16fSpO6123MGhiOJmwDDDwVHEUmXIeHX4qQqdlqxmbEkx sCxJppy7JqkV5hHcrr4Mv8fvLQM= 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:references:in-reply-to :content-type:mime-version; s=default; bh=HDApplolgK20pVinZzLYqu bbDc4=; b=X/pThrEh/8g13HRKMIRWGhQy7Hq/T3QuKVL7rYOxCsxe6mfaX40q2f xuYBchJRKnUjZmsKoTj+RFf6d9BvxRvk/A6Z55nbCmtYl/xpHRTt+rZV5+p2qzqB tGf4WeHF4QvKiY9OoWL4bsFC5k+FNYbyr4aN76gNixK0d8jCHRNHs= Received: (qmail 6269 invoked by alias); 22 Apr 2013 07:15:25 -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 6254 invoked by uid 89); 22 Apr 2013 07:15:24 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from co9ehsobe003.messaging.microsoft.com (HELO co9outboundpool.messaging.microsoft.com) (207.46.163.26) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 22 Apr 2013 07:15:22 +0000 Received: from mail50-co9-R.bigfish.com (10.236.132.241) by CO9EHSOBE001.bigfish.com (10.236.130.64) with Microsoft SMTP Server id 14.1.225.23; Mon, 22 Apr 2013 07:15:20 +0000 Received: from mail50-co9 (localhost [127.0.0.1]) by mail50-co9-R.bigfish.com (Postfix) with ESMTP id 88FE72C019C; Mon, 22 Apr 2013 07:15:20 +0000 (UTC) X-Forefront-Antispam-Report: CIP:157.56.240.133; KIP:(null); UIP:(null); IPV:NLI; H:BL2PRD0710HT001.namprd07.prod.outlook.com; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: PS0(zzc85fh4015I1447Izz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahzzz2dh2a8h668h839hd24hf0ah1288h12a5h12bdh137ah1441h1504h1537h153bh162dh1631h1758h18e1h1946h19b5h19ceh1ad9h1b0ah1bceh9a9j34h1155h) X-Forefront-Antispam-Report-Untrusted: SFV:SKI; SFS:; DIR:OUT; SFP:; SCL:-1; SRVR:SN2PR07MB032; H:SN2PR07MB029.namprd07.prod.outlook.com; LANG:en; Received: from mail50-co9 (localhost.localdomain [127.0.0.1]) by mail50-co9 (MessageSwitch) id 1366614918953428_2258; Mon, 22 Apr 2013 07:15:18 +0000 (UTC) Received: from CO9EHSMHS021.bigfish.com (unknown [10.236.132.244]) by mail50-co9.bigfish.com (Postfix) with ESMTP id E541548004F; Mon, 22 Apr 2013 07:15:18 +0000 (UTC) Received: from BL2PRD0710HT001.namprd07.prod.outlook.com (157.56.240.133) by CO9EHSMHS021.bigfish.com (10.236.130.31) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 22 Apr 2013 07:15:18 +0000 Received: from SN2PR07MB032.namprd07.prod.outlook.com (10.255.174.42) by BL2PRD0710HT001.namprd07.prod.outlook.com (10.255.102.36) with Microsoft SMTP Server (TLS) id 14.16.299.2; Mon, 22 Apr 2013 07:15:17 +0000 Received: from SN2PR07MB029.namprd07.prod.outlook.com (10.255.174.39) by SN2PR07MB032.namprd07.prod.outlook.com (10.255.174.42) with Microsoft SMTP Server (TLS) id 15.0.670.13; Mon, 22 Apr 2013 07:15:16 +0000 Received: from SN2PR07MB029.namprd07.prod.outlook.com ([169.254.2.115]) by SN2PR07MB029.namprd07.prod.outlook.com ([169.254.2.115]) with mapi id 15.00.0670.000; Mon, 22 Apr 2013 07:15:16 +0000 From: "Hurugalawadi, Naveen" To: Richard Earnshaw CC: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH, AArch64] Negate with Compare instruction Date: Mon, 22 Apr 2013 07:15:15 +0000 Message-ID: References: , <51714F69.9050401@arm.com> In-Reply-To: <51714F69.9050401@arm.com> MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-Virus-Found: No Hi, >> This and the preceding scan are the same pattern. So if either passes >> you'll fail to detect a failure in the other. Thanks for the suggestion. Please find attached the modified patch as per your suggestions. Please review the same and let me know if there should be any further modifications in it. Thanks, Naveen --- gcc/config/aarch64/aarch64.md 2013-04-17 11:18:29.453576713 +0530 +++ gcc/config/aarch64/aarch64.md 2013-04-22 11:33:58.355695801 +0530 @@ -1982,6 +1982,27 @@ (set_attr "mode" "SI")] ) +(define_insn "*ngc" + [(set (match_operand:GPI 0 "register_operand" "=r") + (minus:GPI (neg:GPI (ltu:GPI (reg:CC CC_REGNUM) (const_int 0))) + (match_operand:GPI 1 "register_operand" "r")))] + "" + "ngc\\t%0, %1" + [(set_attr "v8type" "adc") + (set_attr "mode" "")] +) + +(define_insn "*ngcsi_uxtw" + [(set (match_operand:DI 0 "register_operand" "=r") + (zero_extend:DI + (minus:SI (neg:SI (ltu:SI (reg:CC CC_REGNUM) (const_int 0))) + (match_operand:SI 1 "register_operand" "r"))))] + "" + "ngc\\t%w0, %w1" + [(set_attr "v8type" "adc") + (set_attr "mode" "SI")] +) + (define_insn "*neg2_compare0" [(set (reg:CC_NZ CC_REGNUM) (compare:CC_NZ (neg:GPI (match_operand:GPI 1 "register_operand" "r")) --- gcc/testsuite/gcc.target/aarch64/ngc.c 1970-01-01 05:30:00.000000000 +0530 +++ gcc/testsuite/gcc.target/aarch64/ngc.c 2013-04-22 11:34:44.163696831 +0530 @@ -0,0 +1,66 @@ +/* { dg-do run } */ +/* { dg-options "-O2 --save-temps -fno-inline" } */ + +extern void abort (void); +typedef unsigned int u32; + +u32 +ngc_si (u32 a, u32 b, u32 c, u32 d) +{ + a = -b - (c < d); + return a; +} + +typedef unsigned long long u64; + +u64 +ngc_si_tst (u64 a, u32 b, u32 c, u32 d) +{ + a = -b - (c < d); + return a; +} + +u64 +ngc_di (u64 a, u64 b, u64 c, u64 d) +{ + a = -b - (c < d); + return a; +} + +int +main () +{ + int x; + u64 y; + + x = ngc_si (29, 4, 5, 4); + if (x != -4) + abort (); + + x = ngc_si (1024, 2, 20, 13); + if (x != -2) + abort (); + + y = ngc_si_tst (0x130000029ll, 32, 50, 12); + if (y != 0xffffffe0) + abort (); + + y = ngc_si_tst (0x5000500050005ll, 21, 2, 14); + if (y != 0xffffffea) + abort (); + + y = ngc_di (0x130000029ll, 0x320000004ll, 0x505050505ll, 0x123123123ll); + if (y != 0xfffffffcdffffffc) + abort (); + + y = ngc_di (0x5000500050005ll, + 0x2111211121112ll, 0x0000000002020ll, 0x1414575046477ll); + if (y != 0xfffdeeedeeedeeed) + abort (); + + return 0; +} + +/* { dg-final { scan-assembler-times "ngc\tw\[0-9\]+, w\[0-9\]+" 2 } } */ +/* { dg-final { scan-assembler-times "ngc\tx\[0-9\]+, x\[0-9\]+" 1 } } */ +/* { dg-final { cleanup-saved-temps } } */