From patchwork Mon May 30 22:58:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaz Kojima X-Patchwork-Id: 97958 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 BDE3BB6F75 for ; Tue, 31 May 2011 08:59:43 +1000 (EST) Received: (qmail 23697 invoked by alias); 30 May 2011 22:59:42 -0000 Received: (qmail 23689 invoked by uid 22791); 30 May 2011 22:59:41 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mo11.iij4u.or.jp (HELO mo.iij4u.or.jp) (210.138.174.79) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 May 2011 22:59:27 +0000 Received: by mo.iij4u.or.jp (mo11) id p4UMxQ6A008255; Tue, 31 May 2011 07:59:26 +0900 Received: from localhost (238.152.138.210.bn.2iij.net [210.138.152.238]) by mbox.iij4u.or.jp (mbox11) id p4UMxPpM007359; Tue, 31 May 2011 07:59:25 +0900 Date: Tue, 31 May 2011 07:58:29 +0900 (JST) Message-Id: <20110531.075829.188252238.kkojima@rr.iij4u.or.jp> To: gcc-patches@gcc.gnu.org Subject: Fix PR target/49186 From: Kaz Kojima Mime-Version: 1.0 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 Hi, sh.c:expand_cbranchdi4 forgot to produce the code for comparing high 32-bit parts when the second operand is a constant of which high 32-bit part is zero. The attached patch is to fix it and adds a new test for this PR. Tested sh4-unknown-linux-gnu and i686-pc-linux-gnu with no new regressions. Applied on trunk. I'll backport this to the release branches because the issue is a regression on all release branches from 4.2. Regards, kaz --- 2011-05-30 Kaz Kojima PR target/49186 * config/sh/sh.c (expand_cbranchdi4): Set msw_skip when the high part of the second operand is 0. [testsuite] PR target/49186 * gcc.c-torture/execute/pr49186.c: New. diff -uprN ORIG/trunk/gcc/config/sh/sh.c trunk/gcc/config/sh/sh.c --- ORIG/trunk/gcc/config/sh/sh.c 2011-05-27 14:51:19.000000000 +0900 +++ trunk/gcc/config/sh/sh.c 2011-05-27 19:28:06.000000000 +0900 @@ -2143,7 +2143,10 @@ expand_cbranchdi4 (rtx *operands, enum r else if (op2h != CONST0_RTX (SImode)) msw_taken = LTU; else - break; + { + msw_skip = swap_condition (LTU); + break; + } msw_skip = swap_condition (msw_taken); } break; diff -uprN ORIG/trunk/gcc/testsuite/gcc.c-torture/execute/pr49186.c trunk/gcc/testsuite/gcc.c-torture/execute/pr49186.c --- ORIG/trunk/gcc/testsuite/gcc.c-torture/execute/pr49186.c 1970-01-01 09:00:00.000000000 +0900 +++ trunk/gcc/testsuite/gcc.c-torture/execute/pr49186.c 2011-05-29 22:32:08.000000000 +0900 @@ -0,0 +1,15 @@ +/* PR target/49186 */ +extern void abort (void); + +int +main () +{ + int x; + unsigned long long uv = 0x1000000001ULL; + + x = (uv < 0x80) ? 1 : ((uv < 0x800) ? 2 : 3); + if (x != 3) + abort (); + + return 0; +}