From patchwork Wed Jul 15 15:53:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schulze Frielinghaus X-Patchwork-Id: 1329655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=mLAIaym/; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B6MPl0qHnz9sRK for ; Thu, 16 Jul 2020 01:54:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D4E73875415; Wed, 15 Jul 2020 15:54:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D4E73875415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594828440; bh=zEkq6X0l2mZ6GhpOrlDGpR9lrJpJdRKZJOd8gujfhiQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=mLAIaym/ebhpgrjTXyHGfIF/S6LdIuElgP8BoQdufqVrUfpsyUrG58LZtkJHi34VD pgrXnNZ7vuFtEMJUkjBWUH6HyP5MLw55nwAGHNhUj6LdHiYMZ25z/Hp6Z0dFaY/oBj uI9M6liZnUH05+JUPiJwQC/vBBQpDbWc/ps66c/U= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 57E843870865 for ; Wed, 15 Jul 2020 15:53:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 57E843870865 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06FFXNwY192582 for ; Wed, 15 Jul 2020 11:53:56 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com with ESMTP id 329xq7vtmg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Jul 2020 11:53:55 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06FFjaET020016 for ; Wed, 15 Jul 2020 15:53:54 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma02fra.de.ibm.com with ESMTP id 327527vq8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Jul 2020 15:53:54 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06FFrp6926935738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Jul 2020 15:53:51 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C9E24C058; Wed, 15 Jul 2020 15:53:51 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0CA364C04E; Wed, 15 Jul 2020 15:53:51 +0000 (GMT) Received: from m8345017.lnxne.boe (unknown [9.152.108.100]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 15 Jul 2020 15:53:50 +0000 (GMT) To: gcc-patches@gcc.gnu.org, krebbel@linux.ibm.com Subject: [PATCH 1/2] S/390: Support vector load/store alignment hints Date: Wed, 15 Jul 2020 17:53:26 +0200 Message-Id: <20200715155327.3911845-2-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200715155327.3911845-1-stefansf@linux.ibm.com> References: <20200715155327.3911845-1-stefansf@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-15_12:2020-07-15, 2020-07-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 spamscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007150124 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stefan Schulze Frielinghaus via Gcc-patches From: Stefan Schulze Frielinghaus Reply-To: Stefan Schulze Frielinghaus Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" From: Andreas Krebbel The IBM z14 POP adds an optional alignment operand to the vl, vst, vlm, and vstm instruction (vector loads and stores). Vectors residing on 8 or 16 byte boundaries might get loaded or stored faster on some models given the instruction uses the proper hint operand. A wrong hint will hurt performance though. The attached testcase align-1 currently fails due to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88085 gcc/ChangeLog: 2018-11-21 Andreas Krebbel * configure.ac: Add check for Binutils to determine whether vector load/store alignments hints are being supported. * config.in: Regenerate. * configure: Regenerate. * config/s390/s390.c (print_operand): Support new output modifier A. * config/s390/s390.md ("movti"): Append alignment hint output using the new output modifier 'A'. * config/s390/vector.md ("mov", "*vec_tf_to_v1tf") ("*vec_ti_to_v1ti"): Likewise. gcc/testsuite/ChangeLog: 2018-11-21 Andreas Krebbel * gcc.target/s390/vector/align-1.c: New test. * gcc.target/s390/vector/align-2.c: New test. From-SVN: r266336 (cherry picked from commit b8923037ef1b229326b7f238580d91bbbb76b8ff) --- gcc/config.in | 7 ++++ gcc/config/s390/s390.c | 13 +++++++ gcc/config/s390/s390.md | 4 +-- gcc/config/s390/vector.md | 12 +++---- gcc/configure | 36 +++++++++++++++++++ gcc/configure.ac | 6 ++++ .../gcc.target/s390/vector/align-1.c | 30 ++++++++++++++++ .../gcc.target/s390/vector/align-2.c | 29 +++++++++++++++ 8 files changed, 129 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/vector/align-1.c create mode 100644 gcc/testsuite/gcc.target/s390/vector/align-2.c diff --git a/gcc/config.in b/gcc/config.in index 5bccb408016..4924b8a0c32 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -717,6 +717,13 @@ #endif +/* Define if your assembler supports vl/vst/vlm/vstm with an optional + alignment hint argument. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS +#endif + + /* Define if your assembler supports VSX instructions. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_VSX diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 9e7fd2b04dd..5aff2084e1b 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -7697,6 +7697,8 @@ print_operand_address (FILE *file, rtx addr) CODE specified the format flag. The following format flags are recognized: + 'A': On z14 or higher: If operand is a mem print the alignment + hint usable with vl/vst prefixed by a comma. 'C': print opcode suffix for branch condition. 'D': print opcode suffix for inverse branch condition. 'E': print opcode suffix for branch on index instruction. @@ -7734,6 +7736,17 @@ print_operand (FILE *file, rtx x, int code) switch (code) { + case 'A': +#ifdef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS + if (TARGET_ARCH12 && MEM_P (x)) + { + if (MEM_ALIGN (x) >= 128) + fprintf (file, ",4"); + else if (MEM_ALIGN (x) == 64) + fprintf (file, ",3"); + } +#endif + return; case 'C': fprintf (file, s390_branch_condition_mnemonic (x, FALSE)); return; diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 93b1ff0b8db..7114609b676 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -1516,8 +1516,8 @@ vone\t%v0 vlvgp\t%v0,%1,%N1 # - vl\t%v0,%1 - vst\t%v1,%0 + vl\t%v0,%1%A1 + vst\t%v1,%0%A0 # #" [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*") diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index 24b200e0c57..0fcb8d2e158 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -198,8 +198,8 @@ "" "@ vlr\t%v0,%v1 - vl\t%v0,%1 - vst\t%v1,%0 + vl\t%v0,%1%A1 + vst\t%v1,%0%A0 vzero\t%v0 vone\t%v0 vgbm\t%v0,%t1 @@ -549,8 +549,8 @@ "TARGET_VX" "@ vmrhg\t%v0,%1,%N1 - vl\t%v0,%1 - vst\t%v1,%0 + vl\t%v0,%1%A1 + vst\t%v1,%0%A0 vzero\t%v0 vlvgp\t%v0,%1,%N1" [(set_attr "op_type" "VRR,VRX,VRX,VRI,VRR")]) @@ -561,8 +561,8 @@ "TARGET_VX" "@ vlr\t%v0,%v1 - vl\t%v0,%1 - vst\t%v1,%0 + vl\t%v0,%1%A1 + vst\t%v1,%0%A0 vzero\t%v0 vone\t%v0 vlvgp\t%v0,%1,%N1" diff --git a/gcc/configure b/gcc/configure index 97ba7d7d69c..4dd81d24241 100755 --- a/gcc/configure +++ b/gcc/configure @@ -27753,6 +27753,42 @@ $as_echo "#define HAVE_AS_ARCHITECTURE_MODIFIERS 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for vector load/store alignment hints" >&5 +$as_echo_n "checking assembler for vector load/store alignment hints... " >&6; } +if ${gcc_cv_as_s390_vector_loadstore_alignment_hints+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_s390_vector_loadstore_alignment_hints=no + if test $in_tree_gas = yes; then + if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 31 \) \* 1000 + 0` + then gcc_cv_as_s390_vector_loadstore_alignment_hints=yes +fi + elif test x$gcc_cv_as != x; then + $as_echo ' vl %v24,0(%r15),3 ' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_s390_vector_loadstore_alignment_hints=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_s390_vector_loadstore_alignment_hints" >&5 +$as_echo "$gcc_cv_as_s390_vector_loadstore_alignment_hints" >&6; } +if test $gcc_cv_as_s390_vector_loadstore_alignment_hints = yes; then + +$as_echo "#define HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS 1" >>confdefs.h + +fi + + ;; esac diff --git a/gcc/configure.ac b/gcc/configure.ac index d6f2d5b2ed0..6173a1c4f23 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4878,6 +4878,12 @@ pointers into PC-relative form.]) [ .machine z13+vx ],, [AC_DEFINE(HAVE_AS_ARCHITECTURE_MODIFIERS, 1, [Define if your assembler supports architecture modifiers.])]) + gcc_GAS_CHECK_FEATURE([vector load/store alignment hints], + gcc_cv_as_s390_vector_loadstore_alignment_hints, [2,31,0],, + [ vl %v24,0(%r15),3 ],, + [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS, 1, + [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument.])]) + ;; esac diff --git a/gcc/testsuite/gcc.target/s390/vector/align-1.c b/gcc/testsuite/gcc.target/s390/vector/align-1.c new file mode 100644 index 00000000000..cc7777ad22a --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/align-1.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -march=z14" } */ + +/* The user alignment ends up in DECL_ALIGN of the VAR_DECL and is + currently ignored if it is smaller than the alignment of the type. + In this testcase an alignment hint ",3" is emitted also for + accessing a4 which is wrong. + Hence this testcase currently fails: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88085 */ + +typedef int __attribute__((vector_size(16))) v4si; + +v4si a4 __attribute__((aligned(4))); +v4si a8 __attribute__((aligned(8))); +v4si a16 __attribute__((aligned(16))); +v4si a32 __attribute__((aligned(32))); + +void +foo (v4si a) +{ + a4 += a; /* vl ... vst ... */ + a8 += a; /* vl ...,3 vst ...,3 */ + a16 += a; /* vl ...,4 vst ...,4 */ + a32 += a; /* vl ...,4 vst ...,4 */ +} + +/* { dg-final { scan-assembler-times "vl\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),3\n" 1 } } */ +/* { dg-final { scan-assembler-times "vl\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),4\n" 2 } } */ +/* { dg-final { scan-assembler-times "vst\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),3\n" 1 } } */ +/* { dg-final { scan-assembler-times "vst\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),4" 2 } } */ diff --git a/gcc/testsuite/gcc.target/s390/vector/align-2.c b/gcc/testsuite/gcc.target/s390/vector/align-2.c new file mode 100644 index 00000000000..e4e2fba6a58 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/align-2.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -march=z14" } */ + +/* The user alignment ends up in TYPE_ALIGN of the type of the + VAR_DECL. */ + +typedef int __attribute__((vector_size(16),aligned(4))) v4si_4; +typedef int __attribute__((vector_size(16),aligned(8))) v4si_8; +typedef int __attribute__((vector_size(16),aligned(16))) v4si_16; +typedef int __attribute__((vector_size(16),aligned(32))) v4si_32; + +v4si_4 a4; +v4si_8 a8; +v4si_16 a16; +v4si_32 a32; + +void +foo (v4si_8 a) +{ + a4 += a; /* vl ... vst ... */ + a8 += a; /* vl ...,3 vst ...,3 */ + a16 += a; /* vl ...,4 vst ...,4 */ + a32 += a; /* vl ...,4 vst ...,4 */ +} + +/* { dg-final { scan-assembler-times "vl\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),3\n" 1 } } */ +/* { dg-final { scan-assembler-times "vl\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),4\n" 2 } } */ +/* { dg-final { scan-assembler-times "vst\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),3\n" 1 } } */ +/* { dg-final { scan-assembler-times "vst\t%v\[0-9\]*,\[0-9\]*\\(%r\[0-9\]*\\),4" 2 } } */ From patchwork Wed Jul 15 15:53:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schulze Frielinghaus X-Patchwork-Id: 1329656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=x/CYkYzZ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B6MPp5KMbz9sRK for ; Thu, 16 Jul 2020 01:54:06 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CA2DA38754A7; Wed, 15 Jul 2020 15:54:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA2DA38754A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594828442; bh=CtHVknwXVRWibOQH7u9SMya4F5HhH0kxkfyGmTowVAA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=x/CYkYzZtZKbjRBl+Yd3c2OnSjfJSbMZ8L/fTsVXFLRXIBaAiZ4UVKB4O9Ntciq6/ CY9S9rrGsOsW3PDP8eSw0HIpfeOq/RVFn3zo0E04N7AsDnzQ0Poxko4sVoURVRzAvq vVzoZh43VLL0EnzWClMD8SOZkUTNEYYG846dKDQw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 76ED7387090F for ; Wed, 15 Jul 2020 15:53:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 76ED7387090F Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06FFWW2e018540 for ; Wed, 15 Jul 2020 11:53:58 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 32a45ahbj2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Jul 2020 11:53:58 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06FFivsI020975 for ; Wed, 15 Jul 2020 15:53:56 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 327527vky9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Jul 2020 15:53:56 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06FFrrvp19464362 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Jul 2020 15:53:53 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E9124C04E; Wed, 15 Jul 2020 15:53:53 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35DC04C058; Wed, 15 Jul 2020 15:53:53 +0000 (GMT) Received: from m8345017.lnxne.boe (unknown [9.152.108.100]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 15 Jul 2020 15:53:53 +0000 (GMT) To: gcc-patches@gcc.gnu.org, krebbel@linux.ibm.com Subject: [PATCH 2/2] S/390: Emit vector alignment hints for z13 if AS accepts them Date: Wed, 15 Jul 2020 17:53:27 +0200 Message-Id: <20200715155327.3911845-3-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200715155327.3911845-1-stefansf@linux.ibm.com> References: <20200715155327.3911845-1-stefansf@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-15_12:2020-07-15, 2020-07-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=9 impostorscore=0 mlxscore=0 bulkscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007150124 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stefan Schulze Frielinghaus via Gcc-patches From: Stefan Schulze Frielinghaus Reply-To: Stefan Schulze Frielinghaus Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: * config.in: Regenerate. * config/s390/s390.c (print_operand): Emit vector alignment hints for target z13, if AS accepts them. For other targets the logic stays the same. * config/s390/s390.h (TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS): Define macro. * configure: Regenerate. * configure.ac: Check HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13. gcc/testsuite/ChangeLog: * gcc.target/s390/vector/align-1.c: Change target architecture to z13. * gcc.target/s390/vector/align-2.c: Change target architecture to z13. (cherry picked from commit 929fd91ba975eebf9e57f7f092041271dcaf0c34) (squashed with commit 87cb9423add08743d8bb3368f0af61ddc9572837) --- gcc/config.in | 7 +++++ gcc/config/s390/s390.c | 4 +-- gcc/config/s390/s390.h | 7 +++++ gcc/configure | 31 +++++++++++++++++++ gcc/configure.ac | 5 +++ .../gcc.target/s390/vector/align-1.c | 2 +- .../gcc.target/s390/vector/align-2.c | 2 +- 7 files changed, 53 insertions(+), 5 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index 4924b8a0c32..051e6afb097 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -724,6 +724,13 @@ #endif +/* Define if your assembler supports vl/vst/vlm/vstm with an optional + alignment hint argument on z13. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13 +#endif + + /* Define if your assembler supports VSX instructions. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_VSX diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 5aff2084e1b..9057154be07 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -7737,15 +7737,13 @@ print_operand (FILE *file, rtx x, int code) switch (code) { case 'A': -#ifdef HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS - if (TARGET_ARCH12 && MEM_P (x)) + if (TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS && MEM_P (x)) { if (MEM_ALIGN (x) >= 128) fprintf (file, ",4"); else if (MEM_ALIGN (x) == 64) fprintf (file, ",3"); } -#endif return; case 'C': fprintf (file, s390_branch_condition_mnemonic (x, FALSE)); diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 71a12b8c92e..c5307755aa1 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -154,6 +154,13 @@ enum processor_flags (TARGET_VX && TARGET_CPU_VXE) #define TARGET_VXE_P(opts) \ (TARGET_VX_P (opts) && TARGET_CPU_VXE_P (opts)) +#if defined(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13) +#define TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS TARGET_Z13 +#elif defined(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS) +#define TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS TARGET_ARCH12 +#else +#define TARGET_VECTOR_LOADSTORE_ALIGNMENT_HINTS 0 +#endif #ifdef HAVE_AS_MACHINE_MACHINEMODE #define S390_USE_TARGET_ATTRIBUTE 1 diff --git a/gcc/configure b/gcc/configure index 4dd81d24241..aa37763d6d4 100755 --- a/gcc/configure +++ b/gcc/configure @@ -27786,6 +27786,37 @@ if test $gcc_cv_as_s390_vector_loadstore_alignment_hints = yes; then $as_echo "#define HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS 1" >>confdefs.h +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for vector load/store alignment hints on z13" >&5 +$as_echo_n "checking assembler for vector load/store alignment hints on z13... " >&6; } +if ${gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13=no + if test x$gcc_cv_as != x; then + $as_echo ' vl %v24,0(%r15),3 ' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mzarch -march=z13 -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13" >&5 +$as_echo "$gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13" >&6; } +if test $gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13 = yes; then + +$as_echo "#define HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13 1" >>confdefs.h + fi diff --git a/gcc/configure.ac b/gcc/configure.ac index 6173a1c4f23..a3211db36c0 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4883,6 +4883,11 @@ pointers into PC-relative form.]) [ vl %v24,0(%r15),3 ],, [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS, 1, [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument.])]) + gcc_GAS_CHECK_FEATURE([vector load/store alignment hints on z13], + gcc_cv_as_s390_vector_loadstore_alignment_hints_on_z13,, [-mzarch -march=z13], + [ vl %v24,0(%r15),3 ],, + [AC_DEFINE(HAVE_AS_VECTOR_LOADSTORE_ALIGNMENT_HINTS_ON_Z13, 1, + [Define if your assembler supports vl/vst/vlm/vstm with an optional alignment hint argument on z13.])]) ;; esac diff --git a/gcc/testsuite/gcc.target/s390/vector/align-1.c b/gcc/testsuite/gcc.target/s390/vector/align-1.c index cc7777ad22a..6997af2ddcd 100644 --- a/gcc/testsuite/gcc.target/s390/vector/align-1.c +++ b/gcc/testsuite/gcc.target/s390/vector/align-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -march=z14" } */ +/* { dg-options "-O3 -mzarch -march=z13" } */ /* The user alignment ends up in DECL_ALIGN of the VAR_DECL and is currently ignored if it is smaller than the alignment of the type. diff --git a/gcc/testsuite/gcc.target/s390/vector/align-2.c b/gcc/testsuite/gcc.target/s390/vector/align-2.c index e4e2fba6a58..00e09d3eadb 100644 --- a/gcc/testsuite/gcc.target/s390/vector/align-2.c +++ b/gcc/testsuite/gcc.target/s390/vector/align-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -march=z14" } */ +/* { dg-options "-O3 -mzarch -march=z13" } */ /* The user alignment ends up in TYPE_ALIGN of the type of the VAR_DECL. */