From patchwork Mon Jun 4 21:51:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 162875 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]) by ozlabs.org (Postfix) with SMTP id 33E41B6EEC for ; Tue, 5 Jun 2012 07:52:31 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1339451552; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Received:Date:From:To: Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=pRcLdObUOiNGlCRkYfyQxkyNsHM=; b=ES3VphRnEZDMD+o WqHJ2AcauaNM5FggxbgISOq2laMHRsZ5n9+/FYhRgGIF7getugPTCn5mxufi7G/6 Q5zLf4N5lNYYnywBeZ/gExcAU/6CVLF0nQFNtBSmAUHUMeu51WHi7y5T+qibxz0/ v8ff0kx3UPbqoLOFNqbuYTKDr4io= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-Content-Scanned:x-cbid:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=crLesqs5Pp9KTNQxMXjMBwYqk4T7WwSNwzwcQ3uZf8jrxqppGCUubDWedTN3uM umBHpOt1xRAo50fqEH5r1nGQMOZ8GGpTBbky6lRhDpQf7Xc0Eqn7fUrOeqoNt+Ph jd1A5rcyBPVKSpQwUZM+xyVP6v+kRRBlACEY1Nskw5f+k=; Received: (qmail 14938 invoked by alias); 4 Jun 2012 21:52:27 -0000 Received: (qmail 14921 invoked by uid 22791); 4 Jun 2012 21:52:26 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W X-Spam-Check-By: sourceware.org Received: from e5.ny.us.ibm.com (HELO e5.ny.us.ibm.com) (32.97.182.145) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jun 2012 21:51:59 +0000 Received: from /spool/local by e5.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Jun 2012 17:51:57 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e5.ny.us.ibm.com (192.168.1.105) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 4 Jun 2012 17:51:20 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 6D5836E804B; Mon, 4 Jun 2012 17:51:19 -0400 (EDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q54LpI7K110540; Mon, 4 Jun 2012 17:51:19 -0400 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q54LpIC7018847; Mon, 4 Jun 2012 15:51:18 -0600 Received: from ibm-tiger.the-meissners.org ([9.33.37.223]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q54LpIhS018757; Mon, 4 Jun 2012 15:51:18 -0600 Received: by ibm-tiger.the-meissners.org (Postfix, from userid 500) id 7001E41684; Mon, 4 Jun 2012 17:51:16 -0400 (EDT) Date: Mon, 4 Jun 2012 17:51:16 -0400 From: Michael Meissner To: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, bergner@vnet.ibm.com, wschmidt@gcc.gnu.org Subject: [PATCH] PR 53487 - Fix isel on powerpc to work again Message-ID: <20120604215116.GA28741@ibm-tiger.the-meissners.org> Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, bergner@vnet.ibm.com, wschmidt@gcc.gnu.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12060421-5930-0000-0000-0000088859D0 X-IsSubscribed: yes 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 This patch fixes PR 53487, so that -misel will no longer cause an unknown insn error. Andrew Pinksi's changes on May 4th, 2012, changed to use the movcc pattern instead of the cstore4 in some cases, when a target machine defines both patterns. The cstore4 pattern had checks in it to prevent ISELs involving floating point compares from being generated, but movcc did not. In addition, building Spec showed that going through movcc also needed to make sure a comparison against a negative integer constant like cstore4 also had. I have bootstrapped the compiler (using BOOT_CFLAGS='-g -O2 -mcpu=power7 -misel) and there were no regressions in the test suite against an unpatched compiler. I have also built the Spec 2006 suite with isel, and it generated no errors. Is this patch ok to apply? [gcc] 2012-06-04 Michael Meissner PR target/53487 * config/rs6000/rs6000.c (rs6000_generate_compare): If we are doing an unsigned compare, make sure the second argument is not a negative constant. (rs6000_emit_cmove): Don't allow floating point comparisons when generating ISEL moves. [gcc/testsuite] 2012-06-04 Michael Meissner * gcc.target/powerpc/pr53487.c: New test. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 188186) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -15361,6 +15361,16 @@ rs6000_generate_compare (rtx cmp, enum m else comp_mode = CCmode; + /* If we have an unsigned compare, make sure we don't have a signed value as + an immediate. */ + if (comp_mode == CCUNSmode && GET_CODE (op1) == CONST_INT + && INTVAL (op1) < 0) + { + op0 = copy_rtx_if_shared (op0); + op1 = force_reg (GET_MODE (op0), op1); + cmp = gen_rtx_fmt_ee (code, GET_MODE (cmp), op0, op1); + } + /* First, the compare. */ compare_result = gen_reg_rtx (comp_mode); @@ -16114,6 +16124,11 @@ rs6000_emit_cmove (rtx dest, rtx op, rtx if (GET_MODE (false_cond) != result_mode) return 0; + /* Don't allow using floating point comparisons for integer results for + now. */ + if (FLOAT_MODE_P (compare_mode) && !FLOAT_MODE_P (result_mode)) + return 0; + /* First, work out if the hardware can do this at all, or if it's too slow.... */ if (!FLOAT_MODE_P (compare_mode)) Index: gcc/testsuite/gcc.target/powerpc/pr53487.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr53487.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/pr53487.c (revision 0) @@ -0,0 +1,27 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O3 -mcpu=power7 -misel -ffast-math" } */ + +struct phylo_s { + int left; +}; + +int Cluster(float **dmx, int N, struct phylo_s *tree) +{ + float **mx; + int *coord; + int i; + int Np; + int row, col; + float min; + for (col = 0; col < N; Np--) + { + for (row = 0; row < Np; row++) + for (col = row+1; col < Np; col++) + if (mx[row][col] < min) + i = row; + tree[Np-2].left = coord[i]; + } + Free2DArray((void **) mx, N); +}