From patchwork Fri Jul 1 14:31:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Vogt X-Patchwork-Id: 643045 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 3rgzQ45tsdz9t0Z for ; Sat, 2 Jul 2016 00:32:12 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=c//xu3nO; 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:date :from:to:cc:subject:reply-to:mime-version:content-type :message-id; q=dns; s=default; b=xuXJs5NaCWamrQicz+KSjGw7uj7QdQx 2G7a+cClM0V29wtdv20DTcR/weymT6fTc5RxJ3rZgdTLbE2LfIGZ2us0obcsrJ1P zKuiiKnNb7l2lv14fkEX0r869zgDoq0loUIZfsN7bBp1Cvxsrp2WqNonD7MUlROt laA2xWSFWYOI= 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:date :from:to:cc:subject:reply-to:mime-version:content-type :message-id; s=default; bh=v+yC2KcsfXCIY/QOJeVwsrZTPdE=; b=c//xu 3nOcqGcq4BuNK1Oa9eMajPAXKTTHE38HuIKO1Ztj5umWwVJ2dts24n5QleN2YA+G yH61QD4bEXY01IJ1Q4Y2MHrD0v7EDNgFZiAwCkG7ZaTJEb4QG7YIrd0UmCwbPzb4 TGhAa30yce9rec4Wh5jUoWj5apNW4I//3iJ8Ls= Received: (qmail 113453 invoked by alias); 1 Jul 2016 14:32:05 -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 113436 invoked by uid 89); 1 Jul 2016 14:32:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*r:4.76, ciao, operators X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 01 Jul 2016 14:31:54 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u61EIvRT120141 for ; Fri, 1 Jul 2016 10:31:52 -0400 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 23w62xxwsj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 01 Jul 2016 10:31:52 -0400 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Jul 2016 15:31:49 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 1 Jul 2016 15:31:38 +0100 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: vogt@linux.vnet.ibm.com X-IBM-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id E25322190068 for ; Fri, 1 Jul 2016 15:31:07 +0100 (BST) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u61EVcVE66978020 for ; Fri, 1 Jul 2016 14:31:38 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u61EVch3003506 for ; Fri, 1 Jul 2016 10:31:38 -0400 Received: from bl3ahm9f.de.ibm.com (sig-9-83-82-253.evts.uk.ibm.com [9.83.82.253]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u61EVb1K003489; Fri, 1 Jul 2016 10:31:37 -0400 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1bIzTh-00075T-QU; Fri, 01 Jul 2016 16:31:33 +0200 Date: Fri, 1 Jul 2016 15:31:33 +0100 From: Dominik Vogt To: gcc-patches@gcc.gnu.org Cc: Andreas Krebbel Subject: [PATCH] S/390: Add support for z13 instructions lochi and locghi. Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: vogt@linux.vnet.ibm.com, gcc-patches@gcc.gnu.org, Andreas Krebbel MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070114-0036-0000-0000-000001F92648 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070114-0037-0000-0000-0000118EC4C3 Message-Id: <20160701143133.GA26887@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-01_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607010144 The attached patch adds patterns to make use of the z13 LOCHI and LOCGHI instructions. Tested on s390x biarch and s390, regression tested on s390x. Ciao Dominik ^_^ ^_^ From 5136f74f61dc3df0229d43d5f13017280838a011 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Wed, 25 May 2016 11:47:00 +0100 Subject: [PATCH] S/390: Add support for z13 instructions lochi and locghi. --- gcc/config/s390/predicates.md | 7 +++++++ gcc/config/s390/s390.md | 24 ++++++++++++++-------- gcc/testsuite/gcc.target/s390/loc-1.c | 20 ++++++++++++++++++ gcc/testsuite/gcc.target/s390/loc-2.c | 20 ++++++++++++++++++ .../gcc.target/s390/vector/vec-scalar-cmp-1.c | 4 ++-- 5 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/loc-1.c create mode 100644 gcc/testsuite/gcc.target/s390/loc-2.c diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md index e66f4a4..75e4cb8 100644 --- a/gcc/config/s390/predicates.md +++ b/gcc/config/s390/predicates.md @@ -182,6 +182,13 @@ return s390_contiguous_bitmask_p (INTVAL (op), GET_MODE_BITSIZE (mode), NULL, NULL); }) +;; Return true if OP is ligitimate for any LOC instruction. + +(define_predicate "loc_operand" + (ior (match_operand 0 "nonimmediate_operand") + (and (match_code "const_int") + (match_test "INTVAL (op) <= 32767 && INTVAL (op) >= -32768")))) + ;; operators -------------------------------------------------------------- ;; Return nonzero if OP is a valid comparison operator diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index f8c61a8..6d8d041 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -483,7 +483,7 @@ (const (symbol_ref "s390_tune_attr"))) (define_attr "cpu_facility" - "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vec" + "standard,ieee,zarch,cpu_zarch,longdisp,extimm,dfp,z10,z196,zEC12,vec,z13" (const_string "standard")) (define_attr "enabled" "" @@ -528,7 +528,12 @@ (and (eq_attr "cpu_facility" "vec") (match_test "TARGET_VX")) - (const_int 1)] + (const_int 1) + + (and (eq_attr "cpu_facility" "z13") + (match_test "TARGET_Z13")) + (const_int 1) + ] (const_int 0))) ;; Pipeline description for z900. For lack of anything better, @@ -6309,21 +6314,23 @@ XEXP (operands[1], 1)); }) -; locr, loc, stoc, locgr, locg, stocg +; locr, loc, stoc, locgr, locg, stocg, lochi, locghi (define_insn_and_split "*movcc" - [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d,S,S,&d") + [(set (match_operand:GPR 0 "nonimmediate_operand" "=d,d,d,d,d,d,S,S,&d") (if_then_else:GPR (match_operator 1 "s390_comparison" - [(match_operand 2 "cc_reg_operand" " c,c,c,c,c,c,c") + [(match_operand 2 "cc_reg_operand" " c,c,c,c,c,c,c,c,c") (match_operand 5 "const_int_operand" "")]) - (match_operand:GPR 3 "nonimmediate_operand" " d,0,S,0,d,0,S") - (match_operand:GPR 4 "nonimmediate_operand" " 0,d,0,S,0,d,S")))] + (match_operand:GPR 3 "loc_operand" " d,0,S,0,K,0,d,0,S") + (match_operand:GPR 4 "loc_operand" " 0,d,0,S,0,K,0,d,S")))] "TARGET_Z196" "@ locr%C1\t%0,%3 locr%D1\t%0,%4 loc%C1\t%0,%3 loc%D1\t%0,%4 + lochi%C1\t%0,%h3 + lochi%D1\t%0,%h4 stoc%C1\t%3,%0 stoc%D1\t%4,%0 #" @@ -6340,7 +6347,8 @@ (match_dup 0) (match_dup 4)))] "" - [(set_attr "op_type" "RRF,RRF,RSY,RSY,RSY,RSY,*")]) + [(set_attr "op_type" "RRF,RRF,RSY,RSY,RIE,RIE,RSY,RSY,*") + (set_attr "cpu_facility" "*,*,*,*,z13,z13,*,*,*")]) ;; ;;- Multiply instructions. diff --git a/gcc/testsuite/gcc.target/s390/loc-1.c b/gcc/testsuite/gcc.target/s390/loc-1.c new file mode 100644 index 0000000..69f9c04 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/loc-1.c @@ -0,0 +1,20 @@ +/* Test load on condition patterns. */ + +/* { dg-do compile { target { lp64 } } } */ +/* { dg-options "-O3 -march=z13 -mzarch -fno-asynchronous-unwind-tables" } */ + +unsigned long locgr (unsigned long rc, unsigned long cond, unsigned long val) +{ + if (cond) + rc = val; + return rc; +} +/* { dg-final { scan-assembler "locgr:\n\tltgr\t%r3,%r3\n\tlocgrne\t%r2,%r4\n\tbr\t%r14\n" } } */ + +long locghi (long rc, long cond) +{ + if (cond) + rc = (long)-1; + return rc; +} +/* { dg-final { scan-assembler "locghi:\n\tltgr\t%r3,%r3\n\tlocghine\t%r2,-1\n\tbr\t%r14\n" } } */ diff --git a/gcc/testsuite/gcc.target/s390/loc-2.c b/gcc/testsuite/gcc.target/s390/loc-2.c new file mode 100644 index 0000000..ad4d23a --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/loc-2.c @@ -0,0 +1,20 @@ +/* Test load on condition patterns. */ + +/* { dg-do compile { target { ! lp64 } } } */ +/* { dg-options "-O3 -march=z13 -mzarch -fno-asynchronous-unwind-tables" } */ + +unsigned long locr (unsigned int rc, unsigned long cond, unsigned long val) +{ + if (cond) + rc = (unsigned int)val; + return rc; +} +/* { dg-final { scan-assembler "locr:\n\tltr\t%r3,%r3\n\tlocrne\t%r2,%r4\n\tbr\t%r14\n" } } */ + +long lochi (long rc, long cond) +{ + if (cond) + rc = (int)2; + return rc; +} +/* { dg-final { scan-assembler "lochi:\n\tltr\t%r3,%r3\n\tlochine\t%r2,2\n\tbr\t%r14\n" } } */ diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-scalar-cmp-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-scalar-cmp-1.c index b79120f..5f63eda 100644 --- a/gcc/testsuite/gcc.target/s390/vector/vec-scalar-cmp-1.c +++ b/gcc/testsuite/gcc.target/s390/vector/vec-scalar-cmp-1.c @@ -8,8 +8,8 @@ /* { dg-final { scan-assembler-times "wfchedbs\t%v\[0-9\]*,%v2,%v0" 1 } } */ /* { dg-final { scan-assembler-times "wfchdbs\t%v\[0-9\]*,%v2,%v0" 1 } } */ /* { dg-final { scan-assembler-times "wfchedbs\t%v\[0-9\]*,%v2,%v0" 1 } } */ -/* { dg-final { scan-assembler-times "locrne" 5 } } */ -/* { dg-final { scan-assembler-times "locrno" 1 } } */ +/* { dg-final { scan-assembler-times "lochine" 5 } } */ +/* { dg-final { scan-assembler-times "lochino" 1 } } */ int -- 2.3.0