From patchwork Mon Jul 13 10:20:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 494488 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E3AE2140216 for ; Mon, 13 Jul 2015 20:20:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=WtoIwqrV; dkim-atps=neutral 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:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=d1868Fku0aYCuxRso WfdA8Fwc5mzEwZPY5rhyE7e5a63c/lsO2v0yuD1tXnue96m5pk1kizsePhwnZVU6 znMrahphF2P9LyHVVAO5JybkPubmMpGRilkecIXq7+g4UXW+X3pVKVaOaF+fHqPT OWQbBPxiC4V4I+Eh6WSQKoe5Ws= 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:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=RA//dI6ZMdR+wz/MDClEHM6 dI1M=; b=WtoIwqrVR6Z8614E9/4y7H25aeLO9FnlON1R3ss9mT+YBC8HXC9XAeD VV55Du+GYc4I0fGkmklVn2fvXQ/7Kr/Wa5eTCEqNuKdONXz3UXkPJPQJBDgxi84M odomu/oBZGyFt3yX3+jJ48sgEXboBOqWaZ3VAI0CRgxj/g1i6UQg= Received: (qmail 85635 invoked by alias); 13 Jul 2015 10:20:51 -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 85622 invoked by uid 89); 13 Jul 2015 10:20:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=no version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Jul 2015 10:20:45 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-15-tWHHo6paRpOwHBwHmGk2QQ-1; Mon, 13 Jul 2015 11:20:40 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 13 Jul 2015 11:20:39 +0100 Message-ID: <55A390F8.7060902@arm.com> Date: Mon, 13 Jul 2015 11:20:40 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: James Greenhalgh CC: GCC Patches , Marcus Shawcroft , Richard Earnshaw Subject: Re: [PATCH][AArch64][testsuite] Adjust some arith+compare tests for potentially more aggressive if-conversion References: <559FB8B1.4030905@arm.com> <20150710202119.GA942@arm.com> In-Reply-To: <20150710202119.GA942@arm.com> X-MC-Unique: tWHHo6paRpOwHBwHmGk2QQ-1 X-IsSubscribed: yes On 10/07/15 21:21, James Greenhalgh wrote: > On Fri, Jul 10, 2015 at 01:21:05PM +0100, Kyrill Tkachov wrote: >> Hi all, >> >> Some of the testcases in aarch64.exp can fail their scan-assembler patterns >> if if-conversion becomes more aggressive. >> >> This patch adjusts the testcases in case the branches are eliminated and >> further optimisations occur that may remove the scan-assembler patterns. >> >> With this patch the patterns are always generated and the expected execute >> values are updated. >> >> Tests still pass on aarch64. >> Ok for trunk? > This is OK. Please address my one comment below (looks like you left some > #if 0 kicking around in adds1.c) and fix the ChangeLog to include the > gcc.target/aarch64/adds1.c changes. Thanks for spotting that, I'm attaching the patch I committed with r225732 and the below ChangeLog entry. 2015-07-13 Kyrylo Tkachov * gcc.target/aarch64/adds3.c: Adjust for more aggressive if-conversion.. * gcc.target/aarch64/adds1.c: Likewise. * gcc.target/aarch64/ands_1.c: Likewise. * gcc.target/aarch64/bics_1.c: Likewise. * gcc.target/aarch64/subs1.c: Likewise. * gcc.target/aarch64/subs3.c: Likewise. Thanks, Kyrill > > Thanks, > James > > Index: gcc/testsuite/gcc.target/aarch64/ands_1.c =================================================================== --- gcc/testsuite/gcc.target/aarch64/ands_1.c (revision 225731) +++ gcc/testsuite/gcc.target/aarch64/ands_1.c (working copy) @@ -12,7 +12,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -24,7 +24,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -36,7 +36,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } typedef long long s64; @@ -50,7 +50,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } s64 @@ -62,7 +62,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } s64 @@ -74,7 +74,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -84,7 +84,7 @@ s64 y; x = ands_si_test1 (29, 4, 5); - if (x != 13) + if (x != (29 & 4)) abort (); x = ands_si_test1 (5, 2, 20); @@ -92,7 +92,7 @@ abort (); x = ands_si_test2 (29, 4, 5); - if (x != 38) + if (x != (29 & 0xff)) abort (); x = ands_si_test2 (1024, 2, 20); @@ -100,7 +100,7 @@ abort (); x = ands_si_test3 (35, 4, 5); - if (x != 41) + if (x != (35 & (4 << 3))) abort (); x = ands_si_test3 (5, 2, 20); @@ -111,7 +111,7 @@ 0x320000004ll, 0x505050505ll); - if (y != ((0x130000029ll & 0x320000004ll) + 0x320000004ll + 0x505050505ll)) + if (y != ((0x130000029ll & 0x320000004ll))) abort (); y = ands_di_test1 (0x5000500050005ll, @@ -123,7 +123,7 @@ y = ands_di_test2 (0x130000029ll, 0x320000004ll, 0x505050505ll); - if (y != ((0x130000029ll & 0xff) + 0x320000004ll + 0x505050505ll)) + if (y != ((0x130000029ll & 0xff))) abort (); y = ands_di_test2 (0x130002900ll, @@ -135,8 +135,7 @@ y = ands_di_test3 (0x130000029ll, 0x064000008ll, 0x505050505ll); - if (y != ((0x130000029ll & (0x064000008ll << 3)) - + 0x064000008ll + 0x505050505ll)) + if (y != ((0x130000029ll & (0x064000008ll << 3)))) abort (); y = ands_di_test3 (0x130002900ll, Index: gcc/testsuite/gcc.target/aarch64/subs3.c =================================================================== --- gcc/testsuite/gcc.target/aarch64/subs3.c (revision 225731) +++ gcc/testsuite/gcc.target/aarch64/subs3.c (working copy) @@ -12,7 +12,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -23,7 +23,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int main () @@ -32,27 +32,27 @@ s64 y; x = subs_ext (0x13000002ll, 41, 15); - if (x != 318767121) + if (x != (int)(0x13000002ll - 41)) abort (); - x = subs_ext (0x50505050ll, 29, 4); - if (x != 1347440724) + x = subs_ext (0x50505050ll, 0x50505050ll, 4); + if (x != (int)(0x50505050ll + 4)) abort (); x = subs_ext (0x12121212121ll, 2, 14); - if (x != 555819311) + if (x != (int)(0x12121212121ll - 2)) abort (); x = subs_shift_ext (0x123456789ll, 4, 12); - if (x != 591751033) + if (x != (int)(0x123456789ll - (4 << 3))) abort (); - x = subs_shift_ext (0x02020202ll, 9, 8); - if (x != 33685963) + x = subs_shift_ext (0x02020202ll << 3, 0x02020202ll, 8); + if (x != (int)(8 + (0x02020202ll << 3))) abort (); x = subs_shift_ext (0x987987987987ll, 23, 41); - if (x != -2020050673) + if (x != (int)(0x987987987987ll - (23 << 3))) abort (); return 0; Index: gcc/testsuite/gcc.target/aarch64/adds1.c =================================================================== --- gcc/testsuite/gcc.target/aarch64/adds1.c (revision 225731) +++ gcc/testsuite/gcc.target/aarch64/adds1.c (working copy) @@ -12,7 +12,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -24,7 +24,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -36,7 +36,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } typedef long long s64; @@ -50,7 +50,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } s64 @@ -62,7 +62,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } s64 @@ -74,7 +74,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int main () @@ -83,64 +83,64 @@ s64 y; x = adds_si_test1 (29, 4, 5); - if (x != 42) + if (x != (29 + 4)) abort (); - x = adds_si_test1 (5, 2, 20); - if (x != 29) + x = adds_si_test1 (5, 2, -5); + if (x != 7) abort (); x = adds_si_test2 (29, 4, 5); - if (x != 293) + if (x != (29 + 0xff)) abort (); - x = adds_si_test2 (1024, 2, 20); - if (x != 1301) + x = adds_si_test2 (-255, 2, 20); + if (x != -235) abort (); x = adds_si_test3 (35, 4, 5); - if (x != 76) + if (x != (35 + (4 << 3))) abort (); - x = adds_si_test3 (5, 2, 20); - if (x != 43) + x = adds_si_test3 (-(2 << 3), 2, 20); + if (x != (20 - (2 << 3))) abort (); y = adds_di_test1 (0x130000029ll, 0x320000004ll, 0x505050505ll); - if (y != 0xc75050536) + if (y != (0x130000029ll + 0x320000004ll)) abort (); y = adds_di_test1 (0x5000500050005ll, - 0x2111211121112ll, + -0x5000500050005ll, 0x0000000002020ll); - if (y != 0x9222922294249) + if (y != (0x5000500050005ll + 0x0000000002020ll)) abort (); y = adds_di_test2 (0x130000029ll, 0x320000004ll, 0x505050505ll); - if (y != 0x955050631) + if (y != (0x130000029ll + 0xff)) abort (); - y = adds_di_test2 (0x130002900ll, + y = adds_di_test2 (-0xff, 0x320000004ll, 0x505050505ll); - if (y != 0x955052f08) + if (y != (0x505050505ll - 0xff)) abort (); y = adds_di_test3 (0x130000029ll, 0x064000008ll, 0x505050505ll); - if (y != 0x9b9050576) + if (y != (0x130000029ll + (0x064000008ll << 3))) abort (); y = adds_di_test3 (0x130002900ll, - 0x088000008ll, + -(0x130002900ll >> 3), 0x505050505ll); - if (y != 0xafd052e4d) + if (y != (0x130002900ll + 0x505050505ll)) abort (); return 0; Index: gcc/testsuite/gcc.target/aarch64/bics_1.c =================================================================== --- gcc/testsuite/gcc.target/aarch64/bics_1.c (revision 225731) +++ gcc/testsuite/gcc.target/aarch64/bics_1.c (working copy) @@ -12,7 +12,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -24,7 +24,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } typedef long long s64; @@ -38,7 +38,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } s64 @@ -50,7 +50,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -60,7 +60,7 @@ s64 y; x = bics_si_test1 (29, ~4, 5); - if (x != ((29 & 4) + ~4 + 5)) + if (x != (29 & 4)) abort (); x = bics_si_test1 (5, ~2, 20); @@ -68,7 +68,7 @@ abort (); x = bics_si_test2 (35, ~4, 5); - if (x != ((35 & ~(~4 << 3)) + ~4 + 5)) + if (x != (35 & ~(~4 << 3))) abort (); x = bics_si_test2 (96, ~2, 20); @@ -79,7 +79,7 @@ ~0x320000004ll, 0x505050505ll); - if (y != ((0x130000029ll & 0x320000004ll) + ~0x320000004ll + 0x505050505ll)) + if (y != (0x130000029ll & 0x320000004ll)) abort (); y = bics_di_test1 (0x5000500050005ll, @@ -91,8 +91,7 @@ y = bics_di_test2 (0x130000029ll, ~0x064000008ll, 0x505050505ll); - if (y != ((0x130000029ll & ~(~0x064000008ll << 3)) - + ~0x064000008ll + 0x505050505ll)) + if (y != (0x130000029ll & ~(~0x064000008ll << 3))) abort (); y = bics_di_test2 (0x130002900ll, @@ -103,4 +102,3 @@ return 0; } - Index: gcc/testsuite/gcc.target/aarch64/adds3.c =================================================================== --- gcc/testsuite/gcc.target/aarch64/adds3.c (revision 225731) +++ gcc/testsuite/gcc.target/aarch64/adds3.c (working copy) @@ -12,7 +12,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -23,7 +23,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int main () @@ -32,27 +32,27 @@ s64 y; x = adds_ext (0x13000002ll, 41, 15); - if (x != 318767203) + if (x != (int)(0x13000002ll + 41)) abort (); - x = adds_ext (0x50505050ll, 29, 4); - if (x != 1347440782) + x = adds_ext (0x50505050ll, -0x50505050ll, 4); + if (x != (int)(0x50505050ll + 4)) abort (); x = adds_ext (0x12121212121ll, 2, 14); - if (x != 555819315) + if (x != (int)(0x12121212121ll + 2)) abort (); x = adds_shift_ext (0x123456789ll, 4, 12); - if (x != 591751097) + if (x != (int)(0x123456789ll + (4 << 3))) abort (); - x = adds_shift_ext (0x02020202ll, 9, 8); - if (x != 33686107) + x = adds_shift_ext (-(0x02020202ll << 3), 0x02020202ll, 8); + if (x != (int)(8 - (0x02020202ll << 3))) abort (); x = adds_shift_ext (0x987987987987ll, 23, 41); - if (x != -2020050305) + if (x != (int)(0x987987987987ll + (23 << 3))) abort (); return 0; Index: gcc/testsuite/gcc.target/aarch64/subs1.c =================================================================== --- gcc/testsuite/gcc.target/aarch64/subs1.c (revision 225731) +++ gcc/testsuite/gcc.target/aarch64/subs1.c (working copy) @@ -12,7 +12,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -24,7 +24,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int @@ -36,7 +36,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } typedef long long s64; @@ -50,7 +50,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } s64 @@ -62,7 +62,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } s64 @@ -74,7 +74,7 @@ if (d == 0) return a + c; else - return b + d + c; + return d; } int main () @@ -83,64 +83,64 @@ s64 y; x = subs_si_test1 (29, 4, 5); - if (x != 33) + if (x != 24) abort (); - x = subs_si_test1 (5, 2, 20); - if (x != 7) + x = subs_si_test1 (20, 2, 20); + if (x != 40) abort (); - x = subs_si_test2 (29, 4, 5); - if (x != -217) - abort (); + x = subs_si_test2 (0xff, 4, 5); + if (x != (0xff + 5)) + abort (); - x = subs_si_test2 (1024, 2, 20); - if (x != 791) - abort (); + x = subs_si_test2 (1024, 2, 20); + if (x != (1024 - 0xff)) + abort (); x = subs_si_test3 (35, 4, 5); - if (x != 12) + if (x != 35 - (4 << 3)) abort (); - x = subs_si_test3 (5, 2, 20); - if (x != 11) + x = subs_si_test3 (5 << 3, 5, 20); + if (x != (20 + (5 << 3))) abort (); y = subs_di_test1 (0x130000029ll, 0x320000004ll, 0x505050505ll); - if (y != 0x45000002d) + if (y != (0x130000029ll - 0x505050505ll)) abort (); y = subs_di_test1 (0x5000500050005ll, 0x2111211121112ll, - 0x0000000002020ll); - if (y != 0x7111711171117) + 0x5000500050005ll); + if (y != (0x5000500050005ll + 0x5000500050005ll)) abort (); y = subs_di_test2 (0x130000029ll, 0x320000004ll, 0x505050505ll); - if (y != 0x955050433) + if (y != (0x130000029ll - 0xff)) abort (); - y = subs_di_test2 (0x130002900ll, + y = subs_di_test2 (0xff, 0x320000004ll, 0x505050505ll); - if (y != 0x955052d0a) + if (y != (0xff + 0x505050505ll)) abort (); y = subs_di_test3 (0x130000029ll, 0x064000008ll, 0x505050505ll); - if (y != 0x3790504f6) + if (y != (0x130000029ll - (0x064000008ll << 3))) abort (); - y = subs_di_test3 (0x130002900ll, - 0x088000008ll, + y = subs_di_test3 (0x130002900ll << 3, + 0x130002900ll, 0x505050505ll); - if (y != 0x27d052dcd) + if (y != (0x505050505ll + (0x130002900ll << 3))) abort (); return 0; Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (revision 225731) +++ gcc/testsuite/ChangeLog (working copy) @@ -1,3 +1,13 @@ +2015-07-13 Kyrylo Tkachov + + * gcc.target/aarch64/adds3.c: Adjust for more aggressive + if-conversion.. + * gcc.target/aarch64/adds1.c: Likewise. + * gcc.target/aarch64/ands_1.c: Likewise. + * gcc.target/aarch64/bics_1.c: Likewise. + * gcc.target/aarch64/subs1.c: Likewise. + * gcc.target/aarch64/subs3.c: Likewise. + 2015-07-13 Andre Vehreschild PR fortran/64589