From patchwork Mon Apr 15 04:37:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hurugalawadi, Naveen" X-Patchwork-Id: 236492 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 006252C00C7 for ; Mon, 15 Apr 2013 14:37:40 +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=s5S8IdZ7SHgYG1Ko mVRrr4eLXg93NFedYj5H4TmNVIGWKKxi8zP9C46cu624sPckhJsqJxMQJMdn0+Ca X1gMdrGwT9pT1hwvlInCMsQsHsUuvB7heIlaRzEdJGW37fER2azBVoG/NseZhKy4 EhG9Rk9nccFgD1e6Ca0nV5jT2Vs= 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=przlCCpn8qZygqWUpa1yu9 hTt7Y=; b=NrC1Ss14QzPDOG6gAkxuN/vQRU087FTA0sLjKhAPnEwITyZmGqhMYp BT2dl4mPyD7iKBzLP28asvooltAPjci85aDXwagR4CSiL1f0eYvUKXwlizEhDpIY ZHEAnUyjewy9XfgQHuagZk+7NV34wP7CY+33SvZEpdMlesrYmbQ2o= Received: (qmail 10379 invoked by alias); 15 Apr 2013 04:37:35 -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 10368 invoked by uid 89); 15 Apr 2013 04:37:34 -0000 X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RCVD_IN_SEMBACKSCATTER autolearn=ham version=3.3.1 Received: from mail-db8lp0189.outbound.messaging.microsoft.com (HELO db8outboundpool.messaging.microsoft.com) (213.199.154.189) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 15 Apr 2013 04:37:33 +0000 Received: from mail86-db8-R.bigfish.com (10.174.8.235) by DB8EHSOBE017.bigfish.com (10.174.4.80) with Microsoft SMTP Server id 14.1.225.23; Mon, 15 Apr 2013 04:37:30 +0000 Received: from mail86-db8 (localhost [127.0.0.1]) by mail86-db8-R.bigfish.com (Postfix) with ESMTP id B39288C0604; Mon, 15 Apr 2013 04:37:30 +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 mail86-db8 (localhost.localdomain [127.0.0.1]) by mail86-db8 (MessageSwitch) id 1366000649236645_31276; Mon, 15 Apr 2013 04:37:29 +0000 (UTC) Received: from DB8EHSMHS003.bigfish.com (unknown [10.174.8.246]) by mail86-db8.bigfish.com (Postfix) with ESMTP id 377A730004F; Mon, 15 Apr 2013 04:37:29 +0000 (UTC) Received: from BL2PRD0710HT001.namprd07.prod.outlook.com (157.56.240.133) by DB8EHSMHS003.bigfish.com (10.174.4.13) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 15 Apr 2013 04:37:28 +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.293.5; Mon, 15 Apr 2013 04:37:27 +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, 15 Apr 2013 04:37:26 +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, 15 Apr 2013 04:37:25 +0000 From: "Hurugalawadi, Naveen" To: Richard Earnshaw CC: "gcc-patches@gcc.gnu.org" Subject: RE: [PATCH, AArch64] Compare instruction in shift_extend mode Date: Mon, 15 Apr 2013 04:37:24 +0000 Message-ID: References: <533cf85bfb7f48bca2fd6baeb2336147@SN2PR07MB029.namprd07.prod.outlook.com>, <5168081A.8000608@arm.com> In-Reply-To: <5168081A.8000608@arm.com> MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-Virus-Found: No Hi, >> Same issue as my previous reply applies here. 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-15 09:41:29.711014628 +0530 +++ gcc/config/aarch64/aarch64.md 2013-04-15 09:51:08.027015641 +0530 @@ -2205,6 +2205,18 @@ (set_attr "mode" "")] ) +(define_insn "*cmp_swp__shft_" + [(set (reg:CC_SWP CC_REGNUM) + (compare:CC_SWP (ashift:GPI + (ANY_EXTEND:GPI + (match_operand:ALLX 0 "register_operand" "r")) + (match_operand:QI 1 "aarch64_shift_imm_" "n")) + (match_operand:GPI 2 "register_operand" "r")))] + "" + "cmp\\t%2, %0, xt %1" + [(set_attr "v8type" "alus_ext") + (set_attr "mode" "")] +) ;; ------------------------------------------------------------------- ;; Store-flag and conditional select insns --- gcc/testsuite/gcc.target/aarch64/cmp.c 1970-01-01 05:30:00.000000000 +0530 +++ gcc/testsuite/gcc.target/aarch64/cmp.c 2013-04-15 09:54:29.471015995 +0530 @@ -0,0 +1,135 @@ +/* { dg-do run } */ +/* { dg-options "-O2 --save-temps" } */ + +extern void abort (void); + +int +cmp_si_test1 (int a, int b, int c) +{ + if (a > b) + return a + c; + else + return a + b + c; +} + +int +cmp_si_test2 (int a, int b, int c) +{ + if ((a >> 3) > b) + return a + c; + else + return a + b + c; +} + +typedef long long s64; + +s64 +cmp_di_test1 (s64 a, s64 b, s64 c) +{ + if (a > b) + return a + c; + else + return a + b + c; +} + +s64 +cmp_di_test2 (s64 a, s64 b, s64 c) +{ + if ((a >> 3) > b) + return a + c; + else + return a + b + c; +} + +int +cmp_di_test3 (int a, s64 b, s64 c) +{ + if (a > b) + return a + c; + else + return a + b + c; +} + +int +cmp_di_test4 (int a, s64 b, s64 c) +{ + if (((s64)a << 3) > b) + return a + c; + else + return a + b + c; +} + +int main () +{ + int x; + s64 y; + + x = cmp_si_test1 (2, 12, 5); + if (x != 19) + abort (); + + x = cmp_si_test1 (1, 2, 32); + if (x != 35) + abort (); + + x = cmp_si_test2 (7, 5, 15); + if (x != 27) + abort (); + + x = cmp_si_test2 (12, 1, 3); + if (x != 16) + abort (); + + y = cmp_di_test1 (0x20202020ll, + 0x65161611ll, + 0x42434243ll); + if (y != 0xc7797874ll) + abort (); + + y = cmp_di_test1 (0x1010101010101ll, + 0x123456789abcdll, + 0x5555555555555ll); + if (y != 0x7799bbde00223ll) + abort (); + + y = cmp_di_test2 (0x31313131ll, + 0x35466561ll, + 0x42434243ll); + if (y != 0xa8bad8d5ll) + abort (); + + y = cmp_di_test2 (0x101010101ll, + 0x123456789ll, + 0x555555555ll); + if (y != 0x7799bbddfll) + abort (); + + x = cmp_di_test3 (6252, + 0x64234978ll, + 0x12345123ll); + if (x != 1985458951) + abort (); + + x = cmp_di_test3 (7635, + 0x10101010ll, + 0x21212121ll); + if (x != 825315076) + abort (); + + x = cmp_di_test4 (202, + 0x984210421ll, + 0x18181818181ll); + if (x != 94537324) + abort (); + + x = cmp_di_test4 (167, + 0x987987987987ll, + 0x12312312ll); + if (x != -1714840256) + abort (); + + return 0; +} + +/* { dg-final { scan-assembler-times "cmp\tw\[0-9\]+, w\[0-9\]+" 2 } } */ +/* { dg-final { scan-assembler-times "cmp\tx\[0-9\]+, x\[0-9\]+" 4 } } */