From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94915 invoked by alias); 3 Aug 2015 19:39:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 94902 invoked by uid 89); 3 Aug 2015 19:39:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: e19.ny.us.ibm.com Received: from e19.ny.us.ibm.com (HELO e19.ny.us.ibm.com) (129.33.205.209) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 03 Aug 2015 19:39:34 +0000 Received: from /spool/local by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 3 Aug 2015 15:39:32 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 3 Aug 2015 15:39:30 -0400 X-MailFrom: bergner@vnet.ibm.com X-RcptTo: gcc-patches@gcc.gnu.org Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id DB308C90045 for ; Mon, 3 Aug 2015 15:30:35 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t73JdUu351249278 for ; Mon, 3 Aug 2015 19:39:30 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t73JdU4U019111 for ; Mon, 3 Aug 2015 15:39:30 -0400 Received: from [9.76.155.199] (sig-9-76-155-199.ibm.com [9.76.155.199]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t73JdSNQ019063; Mon, 3 Aug 2015 15:39:29 -0400 Subject: [PATCH, rs6000] Fix source operand contraints for tabort. pattern From: Peter Bergner To: GCC Patches Cc: David Edelsohn , Tulio Magno Quites Machado Filho , "Paul E. Murphy" Content-Type: text/plain; charset="UTF-8" Date: Mon, 03 Aug 2015 19:39:00 -0000 Message-ID: <1438630768.5030.8.camel@otta> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15080319-0057-0000-0000-000000EED9EC X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00118.txt.bz2 This patch fixes an oversight in the tabort. pattern (only generated via the __builtin_tabort (cause) builtin), which currently allows using r0. The problem is that if r0 is used, the "cause" argument value passed in by the user will be ignored, since using r0 means the value zero and not the contents of r0 (similar to base registers in loads/stores, addi, etc.). This patch restricts the tabort. pattern to only use base registers. This has passed bootstrapping and regtesting on trunk. Ok for mainline? I'd like to also backport this to the release branches. Is this ok for them once bootstrapping and regtesting are complete on them? Peter gcc/ * config/rs6000/htm.md (tabort.): Restrict the source operand to using a base register. gcc/testsuite/ * gcc.target/powerpc/htm-tabort-no-r0.c: New test. Index: gcc/config/rs6000/htm.md =================================================================== --- gcc/config/rs6000/htm.md (revision 226516) +++ gcc/config/rs6000/htm.md (working copy) @@ -48,7 +48,7 @@ (define_insn "tabort" [(set (match_operand:CC 1 "cc_reg_operand" "=x") - (unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")] + (unspec_volatile:CC [(match_operand:SI 0 "base_reg_operand" "b")] UNSPECV_HTM_TABORT))] "TARGET_HTM" "tabort. %0" Index: gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c (working copy) @@ -0,0 +1,12 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_htm_ok } */ +/* { dg-options "-O2 -mhtm -ffixed-r3 -ffixed-r4 -ffixed-r5 -ffixed-r6 -ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12" } */ + +/* { dg-final { scan-assembler-not "tabort\\.\[ \t\]0" } } */ + +int +foo (void) +{ + return __builtin_tabort (10); +}