From patchwork Wed Aug 8 12:41:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 955033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-483380-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="KW8qFCUz"; dkim-atps=neutral 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 41lrcC0KwKz9s0n for ; Wed, 8 Aug 2018 22:41:45 +1000 (AEST) 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:subject:mime-version:content-type:message-id; q=dns; s= default; b=YCOCi57ke+OvvitDj8Czdl4wOF8CfEg2chVKcT7wuWWJlBB0pP5Zh QyOtdY/ce7t7UStplOD4KXEpcJBrpKuXNXZSwd694bghmee5opg9GLpvV0C0S+qz CQNAs2JSqfhDxKJOtKs6vfSGSZTyUTqdBTfwE0JlhWAaj8JmFNZoL8= 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:subject:mime-version:content-type:message-id; s= default; bh=+Pq5R7WuBJcwAuFAwriRfs7VNJc=; b=KW8qFCUztOtLmCa+NsjM e4gbkq7/mclJVpUr/4jEG0LrQgfAdj0X2bsQsWt983kl3WNScahBIuV+krvCj0tO /IGgm+MWAuCgcMFh643fL6VV+OAHQuqC6feWGcTuDDs92xTFPCBUIAzKdQ8hXTAY W8wd72pd8RyonPreY+wK5Xg= Received: (qmail 33407 invoked by alias); 8 Aug 2018 12:41:38 -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 33389 invoked by uid 89); 8 Aug 2018 12:41:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=do, hq, Multiple, enabling 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 ESMTP; Wed, 08 Aug 2018 12:41:36 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w78CdYgt108821 for ; Wed, 8 Aug 2018 08:41:34 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kqyb7upyp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 08 Aug 2018 08:41:34 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 8 Aug 2018 13:41:31 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 8 Aug 2018 13:41:29 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w78CfS7D32309442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 8 Aug 2018 12:41:28 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 466B35204E for ; Wed, 8 Aug 2018 15:41:35 +0100 (BST) Received: from bart (unknown [9.152.222.136]) by d06av21.portsmouth.uk.ibm.com (Postfix) with SMTP id 3A8935204F for ; Wed, 8 Aug 2018 15:41:34 +0100 (BST) Received: by bart (sSMTP sendmail emulation); Wed, 08 Aug 2018 14:41:26 +0200 Date: Wed, 8 Aug 2018 14:41:26 +0200 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [Committed] S/390: Fix PR85295 MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) x-cbid: 18080812-0012-0000-0000-00000296EBEE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080812-0013-0000-0000-000020C9F6B9 Message-Id: <20180808124126.GA29552@maggie> X-IsSubscribed: yes Bootstrapped and regression tested on s390x with z900 and z13 default. gcc/ChangeLog: 2018-08-08 Andreas Krebbel PR target/85295 * config/s390/constraints.md ("NxHD0", "NxSD0"): New constraint definitions. * config/s390/s390.md ("movti"): Add more alternatives for constant to GPR copies. gcc/testsuite/ChangeLog: 2018-08-08 Andreas Krebbel PR target/85295 * gcc.target/s390/TI-constants-lra.c: New testcase. * gcc.target/s390/TI-constants-nolra.c: New testcase. diff --git a/gcc/config/s390/constraints.md b/gcc/config/s390/constraints.md index b18622d8dac..b8ba8510096 100644 --- a/gcc/config/s390/constraints.md +++ b/gcc/config/s390/constraints.md @@ -51,7 +51,7 @@ ;; M -- Constant integer with a value of 0x7fffffff. ;; N -- Multiple letter constraint followed by 4 parameter letters. ;; 0..9,x: number of the part counting from most to least significant -;; H,Q: mode of the part +;; S,H,Q: mode of the part ;; D,S,H: mode of the containing operand ;; 0,F: value of the other parts (F - all bits set) ;; -- @@ -204,7 +204,7 @@ ;; N -- Multiple letter constraint followed by 4 parameter letters. ;; 0..9,x: number of the part counting from most to least significant -;; H,Q: mode of the part +;; S,H,Q: mode of the part ;; D,S,H: mode of the containing operand ;; 0,F: value of the other parts (F = all bits set) ;; @@ -226,6 +226,18 @@ (match_test "s390_N_constraint_str (\"xQS0\", ival)"))) +(define_constraint "NxHD0" + "@internal" + (and (match_code "const_int") + (match_test "s390_N_constraint_str (\"xHD0\", ival)"))) + + +(define_constraint "NxSD0" + "@internal" + (and (match_code "const_int") + (match_test "s390_N_constraint_str (\"xSD0\", ival)"))) + + (define_constraint "NxQD0" "@internal" (and (match_code "const_int") diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index c4d391bc9b5..1296e26e536 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -1516,8 +1516,8 @@ ; FIXME: More constants are possible by enabling jxx, jyy constraints ; for TImode (use double-int for the calculations) (define_insn "movti" - [(set (match_operand:TI 0 "nonimmediate_operand" "=d,S,v, v, v,v,d,v,R, d,o") - (match_operand:TI 1 "general_operand" " S,d,v,j00,jm1,d,v,R,v,dT,d"))] + [(set (match_operand:TI 0 "nonimmediate_operand" "=d,S,v, v, v,v,d,v,R,d, d, d, d, d,o") + (match_operand:TI 1 "general_operand" " S,d,v,j00,jm1,d,v,R,v,K,NxHD0,Os,NxSD0,dT,d"))] "TARGET_ZARCH" "@ lmg\t%0,%N0,%S1 @@ -1530,10 +1530,14 @@ vl\t%v0,%1 vst\t%v1,%0 # + # + # + # + # #" - [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*") - (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*") - (set_attr "cpu_facility" "*,*,vx,vx,vx,vx,vx,vx,vx,*,*")]) + [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*,*,*,*,*") + (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*,*,*,*,*") + (set_attr "cpu_facility" "*,*,vx,vx,vx,vx,vx,vx,vx,*,*,*,extimm,*,*")]) (define_split [(set (match_operand:TI 0 "nonimmediate_operand" "") diff --git a/gcc/testsuite/gcc.target/s390/TI-constants-lra.c b/gcc/testsuite/gcc.target/s390/TI-constants-lra.c new file mode 100644 index 00000000000..cc52a62182b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/TI-constants-lra.c @@ -0,0 +1,47 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O3" } */ + +/* 2x lghi */ +__int128 a() { + return 0; +} + +/* 2x lghi */ +__int128 b() { + return -1; +} + +/* 2x lghi */ +__int128 c() { + return -2; +} + +/* lghi + llilh */ +__int128 d() { + return 16000 << 16; +} + +/* lghi + llihf */ +__int128 e() { + return (unsigned long long)80000 << 32; +} + +/* lghi + llihf */ +__int128 f() { + return (unsigned __int128)80000 << 96; +} + +/* llihf + llihf - this is handled via movti_bigconst pattern */ +__int128 g() { + return ((unsigned __int128)80000 << 96) | ((unsigned __int128)80000 << 32); +} + +/* Literal pool */ +__int128 h() { + return ((unsigned __int128)80000 << 32) | 1; +} + +/* Literal pool */ +__int128 i() { + return (((unsigned __int128)80000 << 32) | 1) << 64; +} diff --git a/gcc/testsuite/gcc.target/s390/TI-constants-nolra.c b/gcc/testsuite/gcc.target/s390/TI-constants-nolra.c new file mode 100644 index 00000000000..b9948fc4aa5 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/TI-constants-nolra.c @@ -0,0 +1,47 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O3 -mno-lra" } */ + +/* 2x lghi */ +__int128 a() { + return 0; +} + +/* 2x lghi */ +__int128 b() { + return -1; +} + +/* 2x lghi */ +__int128 c() { + return -2; +} + +/* lghi + llilh */ +__int128 d() { + return 16000 << 16; +} + +/* lghi + llihf */ +__int128 e() { + return (unsigned long long)80000 << 32; +} + +/* lghi + llihf */ +__int128 f() { + return (unsigned __int128)80000 << 96; +} + +/* llihf + llihf - this is handled via movti_bigconst pattern */ +__int128 g() { + return ((unsigned __int128)80000 << 96) | ((unsigned __int128)80000 << 32); +} + +/* Literal pool */ +__int128 h() { + return ((unsigned __int128)80000 << 32) | 1; +} + +/* Literal pool */ +__int128 i() { + return (((unsigned __int128)80000 << 32) | 1) << 64; +}