From patchwork Tue Jun 14 23:38:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 635644 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 3rTmLd2D7zz9t1B for ; Wed, 15 Jun 2016 09:38:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=PiaJX25L; 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:from :to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; q=dns; s=default; b=Sql8vu/cO5tZf+uCqYR seqCXaKmaIGLBUM7ROBaVXKZCyHO2zOyY5cYRm+tOAODdb9a/NMm5Qa2NH8NzyjS p6r9DS1yrQdSTpUs/683nAeH2488cMoxBCM50cdi8DEMOoKL80VmT40ql3sr9iwt oskWoaxPKswF7NE+IWKvdLlk= 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:in-reply-to:references :in-reply-to:references; s=default; bh=gFGhupNgT2lto4p1vZR3q3Xbz KE=; b=PiaJX25LJq5w/oSAf1YyjGM9UHkv1IiLSlNgjHW/qx97xFtlU6nWMXG4A wSDXyMtm1qzw/jupdm778Toj67ZzRQuJoX7jrkAySvsu61NBaAacF2S3n2dYhDq5 zO9sxYcJo4qWUdVdcb+bjRMqPomaMLUUd/21YLlciG1omwTy98= Received: (qmail 79409 invoked by alias); 14 Jun 2016 23:38:28 -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 79279 invoked by uid 89); 14 Jun 2016 23:38:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=match_dup, sk:const_i, *23, optimisation X-HELO: mail-wm0-f52.google.com Received: from mail-wm0-f52.google.com (HELO mail-wm0-f52.google.com) (74.125.82.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 14 Jun 2016 23:38:17 +0000 Received: by mail-wm0-f52.google.com with SMTP id n184so141903293wmn.1 for ; Tue, 14 Jun 2016 16:38:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=7aaVrHwZAsPawGj5uqH5r3QOVX55DM48lDHda8U4v9s=; b=JM2ZnncwiIvqumFKoNgPi1PNbrHFp+zTVWj2mHkOdiz0dX1gcKTTfnz+F3/1oosTzF cm6K4kNFC2krXn3Qk8o/I8cA7qngVndHdKYBAbruFW0IEph+b4On69sbV3pVE9x+0nG2 0Frx2A/uT790HPIPt8SZtLvKXhd3NnGQhNUALWsNkYtj+dcTZNDzkHze1KWvTOBcrset poQ4FZ6Zbl1dPMYAJmNzXx3Wg/U+HFlfEoocHTG2M4iV/Farg5nDRypsD3AVjrtSk4Va pOyf/WW+vY7Zp9SmD4gSDD1D9/v3vr3TjndfufH1IX34sGdySGDFDcR16RS0/f23jiUU gpQg== X-Gm-Message-State: ALyK8tLxAonGUiwwORTGyFvwM7UEhBPMFl1t4rtDalqBBiRHDVg3NsKVVKB1Bj1FAaFDFg== X-Received: by 10.28.57.212 with SMTP id g203mr8289548wma.7.1465947494893; Tue, 14 Jun 2016 16:38:14 -0700 (PDT) Received: from localhost (host86-156-236-89.range86-156.btcentralplus.com. [86.156.236.89]) by smtp.gmail.com with ESMTPSA id x10sm21679484wjj.14.2016.06.14.16.38.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jun 2016 16:38:14 -0700 (PDT) From: Andrew Burgess To: gcc-patches@gcc.gnu.org Cc: Joern Wolfgang Rennecke , Andrew Burgess Subject: [PATCH 1/2] gcc/arc: New peephole2 and little endian arc test fixes Date: Wed, 15 Jun 2016 00:38:09 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: <57605105.7050507@amylaar.uk> X-IsSubscribed: yes Resolve some test failures introduced for little endian arc as a result of the recent arc/nps400 additions. There's a new peephole2 optimisation to merge together two zero_extracts in order that the movb instruction can be used. Source operand mode filled in for a peephole2 optimisation, to silence a build warning. One of the test cases is extended so that the test does something meaningful in both big and little endian arc mode. Other tests have their expected results updated to reflect improvements in other areas of GCC. gcc/ChangeLog: * config/arc/arc.md (movb peephole2): New peephole2 to merge two zero_extract operations to allow a movb to occur. (bitops peephole2): Add mode to source operand. gcc/testsuite/ChangeLog: * gcc.target/arc/movb-1.c: Update little endian arc results. * gcc.target/arc/movb-2.c: Likewise. * gcc.target/arc/movb-5.c: Likewise. * gcc.target/arc/movh_cl-1.c: Extend test to cover little endian arc. --- gcc/ChangeLog | 6 ++++++ gcc/config/arc/arc.md | 16 +++++++++++++++- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/arc/movb-1.c | 2 +- gcc/testsuite/gcc.target/arc/movb-2.c | 2 +- gcc/testsuite/gcc.target/arc/movb-5.c | 2 +- gcc/testsuite/gcc.target/arc/movh_cl-1.c | 11 +++++++++++ 7 files changed, 43 insertions(+), 4 deletions(-) diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index a4ee084..dc57e9b 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -6157,7 +6157,7 @@ (zero_extract:SI (match_dup 1) (match_dup 2) (match_operand:SI 4 "const_int_operand" ""))) - (set (match_dup 1) (match_operand 8)) + (set (match_dup 1) (match_operand:SI 8)) (set (zero_extract:SI (match_dup 0) (match_operand:SI 5 "const_int_operand" "") (match_operand:SI 6 "const_int_operand" "")) @@ -6173,6 +6173,20 @@ (zero_extract:SI (match_dup 1) (match_dup 5) (match_dup 7)))]) (match_dup 1)]) +(define_peephole2 + [(set (match_operand:SI 0 "register_operand" "") + (zero_extract:SI (match_dup 0) + (match_operand:SI 1 "const_int_operand" "") + (match_operand:SI 2 "const_int_operand" ""))) + (set (zero_extract:SI (match_operand:SI 3 "register_operand" "") + (match_dup 1) + (match_dup 2)) + (match_dup 0))] + "TARGET_NPS_BITOPS + && !reg_overlap_mentioned_p (operands[0], operands[3])" + [(set (zero_extract:SI (match_dup 3) (match_dup 1) (match_dup 2)) + (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2)))]) + ;; include the arc-FPX instructions (include "fpx.md") diff --git a/gcc/testsuite/gcc.target/arc/movb-1.c b/gcc/testsuite/gcc.target/arc/movb-1.c index 65d4ba4..94d9f5f 100644 --- a/gcc/testsuite/gcc.target/arc/movb-1.c +++ b/gcc/testsuite/gcc.target/arc/movb-1.c @@ -10,4 +10,4 @@ f (void) bar.b = foo.b; } /* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *5, *3, *8" { target arceb-*-* } } } */ -/* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *19, *21, *8" { target arc-*-* } } } */ +/* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *3, *5, *8" { target arc-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/arc/movb-2.c b/gcc/testsuite/gcc.target/arc/movb-2.c index 1ba9976..708f393 100644 --- a/gcc/testsuite/gcc.target/arc/movb-2.c +++ b/gcc/testsuite/gcc.target/arc/movb-2.c @@ -9,5 +9,5 @@ f (void) { bar.b = foo.b; } -/* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *23, *23, *9" { target arc-*-* } } } */ +/* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *7, *7, *9" { target arc-*-* } } } */ /* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *0, *0, *9" { target arceb-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/arc/movb-5.c b/gcc/testsuite/gcc.target/arc/movb-5.c index 9dbe8a1..d285888 100644 --- a/gcc/testsuite/gcc.target/arc/movb-5.c +++ b/gcc/testsuite/gcc.target/arc/movb-5.c @@ -9,5 +9,5 @@ f (void) { bar.b = foo.b; } -/* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *23, *(23|7), *9" { target arc-*-* } } } */ +/* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *7, *7, *9" { target arc-*-* } } } */ /* { dg-final { scan-assembler "movb\[ \t\]+r\[0-5\]+, *r\[0-5\]+, *r\[0-5\]+, *0, *0, *9" { target arceb-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/arc/movh_cl-1.c b/gcc/testsuite/gcc.target/arc/movh_cl-1.c index 220cd9d..c643481 100644 --- a/gcc/testsuite/gcc.target/arc/movh_cl-1.c +++ b/gcc/testsuite/gcc.target/arc/movh_cl-1.c @@ -10,6 +10,9 @@ struct thing { unsigned a : 1; unsigned b : 1; + unsigned c : 28; + unsigned d : 1; + unsigned e : 1; }; }; }; @@ -24,4 +27,12 @@ blah () func (xx.raw); } +void +woof () +{ + struct thing xx; + xx.d = xx.e = 1; + func (xx.raw); +} + /* { dg-final { scan-assembler "movh\.cl r\[0-9\]+,0xc0000000>>16" } } */