From patchwork Fri Jan 19 20:58:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 863802 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-471691-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wflk0kWy"; 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 3zNY835NCnz9s74 for ; Sat, 20 Jan 2018 07:58:24 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=Ku2A/ OQcklmFyhqXH+P01Ny6ysAsIYlVKJJ6u+JxLllKU+ChPdQXPXltdZAOT070WW8Kj nr7C9CZ62nlXHvqbQ43P+3dTkDfR0XO4fwkNx8xBmFMU0Wqaf+PBnVFTaBSiVdoX vCyPYndROf6AAUPW9E5bXG2kmFYFPyEInuRW3I= 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:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=8VSklLftGpt Nx8RXliwPx1X9n8I=; b=wflk0kWyWVPOQ9rkY1w8hKZNRGJucPWxM9BrWb2+Uaj HY9dq76e2BS+upg6vc+Mg4Zyg4fTcDO41cg0DFRKUGB9VJAUw9SvK1QrIZC1CZDL NX4qVkosyDa6qxhQPL0Tb0/zzwMQGDbDNncRvrDWrAA4MuYSwg4Nf7I6m2wECa74 = Received: (qmail 3132 invoked by alias); 19 Jan 2018 20:58:17 -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 3117 invoked by uid 89); 19 Jan 2018 20:58:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=POWER, UD:safe-indirect-jump-3.c, UD:safe-indirect-jump-2.c 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; Fri, 19 Jan 2018 20:58:15 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0JKtnt2004692 for ; Fri, 19 Jan 2018 15:58:13 -0500 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fkkj0br80-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 19 Jan 2018 15:58:12 -0500 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 19 Jan 2018 13:58:12 -0700 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 19 Jan 2018 13:58:09 -0700 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0JKw8Mv10420726; Fri, 19 Jan 2018 13:58:08 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ACA83C6042; Fri, 19 Jan 2018 13:58:08 -0700 (MST) Received: from bigmac.rchland.ibm.com (unknown [9.10.86.45]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 6DD27C6037; Fri, 19 Jan 2018 13:58:08 -0700 (MST) To: GCC Patches Cc: Segher Boessenkool , David Edelsohn From: Bill Schmidt Subject: [PATCH, rs6000] Use $ instead of . for PC Date: Fri, 19 Jan 2018 14:58:07 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18011920-0020-0000-0000-00000D545461 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008406; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000247; SDB=6.00977442; UDB=6.00495572; IPR=6.00757335; BA=6.00005786; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019133; XFM=3.00000015; UTC=2018-01-19 20:58:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011920-0021-0000-0000-00005FC43B2C Message-Id: <43608c3f-c4ca-6fce-ea47-4cb2b6860ec5@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-19_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801190269 X-IsSubscribed: yes Hi, My recent patches to trunk and gcc-7-branch for avoiding speculation of indirect branches has a flaw, pointed out by David. Usage of "." to represent the program counter is not portable across all POWER assemblers, particularly not being accepted on AIX. "$" is the universally accepted alternative. So change the code and the test cases to use $ instead of . for this purpose. Regstrap is in progress on powerpc64-linux-gnu and powerpc64le-linux-gnu. Assuming no issues are found, is this okay for trunk and backport to 7? Thanks, Bill [gcc] 2018-01-19 Bill Schmidt * config/rs6000/rs6000.md (*sibcall_nonlocal_sysv): Change assembly output from . to $. (*sibcall_value_nonlocal_sysv): Likewise. (indirect_jump_nospec): Likewise. (*tablejump_internal1_nospec): Likewise. [gcc/testsuite] 2018-01-19 Bill Schmidt * gcc.target/powerpc/safe-indirect-jump-2.c: Change expected assembly output from . to $. * gcc.target/powerpc/safe-indirect-jump-3.c: Likewise. * gcc.target/powerpc/safe-indirect-jump-8.c: Likewise. Index: gcc/config/rs6000/rs6000.md =================================================================== --- gcc/config/rs6000/rs6000.md (revision 256894) +++ gcc/config/rs6000/rs6000.md (working copy) @@ -10987,7 +10987,7 @@ return \"b%T0\"; else /* Can use CR0 since it is volatile across sibcalls. */ - return \"crset eq\;beq%T0-\;b .\"; + return \"crset eq\;beq%T0-\;b $\"; } else if (DEFAULT_ABI == ABI_V4 && flag_pic) { @@ -11044,7 +11044,7 @@ return \"b%T1\"; else /* Can use CR0 since it is volatile across sibcalls. */ - return \"crset eq\;beq%T1-\;b .\"; + return \"crset eq\;beq%T1-\;b $\"; } else if (DEFAULT_ABI == ABI_V4 && flag_pic) { @@ -12566,7 +12566,7 @@ [(set (pc) (match_operand:P 0 "register_operand" "c,*l")) (clobber (match_operand:CC 1 "cc_reg_operand" "=y,y"))] "!rs6000_speculate_indirect_jumps" - "crset %E1\;beq%T0- %1\;b ." + "crset %E1\;beq%T0- %1\;b $" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) @@ -12672,7 +12672,7 @@ (use (label_ref (match_operand 1))) (clobber (match_operand:CC 2 "cc_reg_operand" "=y,y"))] "!rs6000_speculate_indirect_jumps" - "crset %E2\;beq%T0- %2\;b ." + "crset %E2\;beq%T0- %2\;b $" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c (revision 256894) +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c (working copy) @@ -30,4 +30,4 @@ int foo (int x) /* { dg-final { scan-assembler "crset 30" } } */ /* { dg-final { scan-assembler "beqctr- 7" } } */ -/* { dg-final { scan-assembler "b ." } } */ +/* { dg-final { scan-assembler "b $" } } */ Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c (revision 256894) +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c (working copy) @@ -49,4 +49,4 @@ int foo (int x) /* { dg-final { scan-assembler "crset 30" } } */ /* { dg-final { scan-assembler "beqctr- 7" } } */ -/* { dg-final { scan-assembler "b ." } } */ +/* { dg-final { scan-assembler "b $" } } */ Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c (revision 256894) +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c (working copy) @@ -12,4 +12,4 @@ int bar () /* { dg-final { scan-assembler "crset eq" } } */ /* { dg-final { scan-assembler "beqctr-" } } */ -/* { dg-final { scan-assembler "b ." } } */ +/* { dg-final { scan-assembler "b $" } } */ Index: gcc/config/rs6000/rs6000.md =================================================================== --- gcc/config/rs6000/rs6000.md (revision 256894) +++ gcc/config/rs6000/rs6000.md (working copy) @@ -10987,7 +10987,7 @@ return \"b%T0\"; else /* Can use CR0 since it is volatile across sibcalls. */ - return \"crset eq\;beq%T0-\;b .\"; + return \"crset eq\;beq%T0-\;b $\"; } else if (DEFAULT_ABI == ABI_V4 && flag_pic) { @@ -11044,7 +11044,7 @@ return \"b%T1\"; else /* Can use CR0 since it is volatile across sibcalls. */ - return \"crset eq\;beq%T1-\;b .\"; + return \"crset eq\;beq%T1-\;b $\"; } else if (DEFAULT_ABI == ABI_V4 && flag_pic) { @@ -12566,7 +12566,7 @@ [(set (pc) (match_operand:P 0 "register_operand" "c,*l")) (clobber (match_operand:CC 1 "cc_reg_operand" "=y,y"))] "!rs6000_speculate_indirect_jumps" - "crset %E1\;beq%T0- %1\;b ." + "crset %E1\;beq%T0- %1\;b $" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) @@ -12672,7 +12672,7 @@ (use (label_ref (match_operand 1))) (clobber (match_operand:CC 2 "cc_reg_operand" "=y,y"))] "!rs6000_speculate_indirect_jumps" - "crset %E2\;beq%T0- %2\;b ." + "crset %E2\;beq%T0- %2\;b $" [(set_attr "type" "jmpreg") (set_attr "length" "12")]) Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c (revision 256894) +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c (working copy) @@ -30,4 +30,4 @@ int foo (int x) /* { dg-final { scan-assembler "crset 30" } } */ /* { dg-final { scan-assembler "beqctr- 7" } } */ -/* { dg-final { scan-assembler "b ." } } */ +/* { dg-final { scan-assembler "b $" } } */ Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c (revision 256894) +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c (working copy) @@ -49,4 +49,4 @@ int foo (int x) /* { dg-final { scan-assembler "crset 30" } } */ /* { dg-final { scan-assembler "beqctr- 7" } } */ -/* { dg-final { scan-assembler "b ." } } */ +/* { dg-final { scan-assembler "b $" } } */ Index: gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c (revision 256894) +++ gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-8.c (working copy) @@ -12,4 +12,4 @@ int bar () /* { dg-final { scan-assembler "crset eq" } } */ /* { dg-final { scan-assembler "beqctr-" } } */ -/* { dg-final { scan-assembler "b ." } } */ +/* { dg-final { scan-assembler "b $" } } */