From patchwork Wed Apr 24 11:04:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 239161 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 97BDF2C00AC for ; Wed, 24 Apr 2013 21:04:55 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=fHqFmymXztLrMUKsCXlVsMRcnt0ASrhN3gO71Nf6MqG1s/hX9y kQ98jAwt5h/e+Ted1iSnssLPQZSIBAfU8z4THBmS3W/0djNjQ3/gz6FHpZE9K2v/ Ycn5oahKG0g5nvgxQmRTkWQbEURaG9lowaE+Uz1N4LToN6liMeNXVoNOQ= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=A/VmuY+jIbnQD08DeZ25Ep3WhZo=; b=t0mMH6S6IJxUrLrA7f7Z b5/iMFZ6OjPjBuIZ2L/42+5ZNwZEAIXAMXm8Hhpi7xzjh6b1lR9pt5kHv3cSpygb NxPLhbUDiAWnSy7WvGSIafx8YM7KFPaBdjYGLkMLw45lHmA1/pZjE6Oz6jd2YFh8 lcQdiWlj/YVxWAs3G6RsyoM= Received: (qmail 23962 invoked by alias); 24 Apr 2013 11:04:49 -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 23952 invoked by uid 89); 24 Apr 2013 11:04:49 -0000 X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS, TW_XF autolearn=ham version=3.3.1 Received: from mail-da0-f53.google.com (HELO mail-da0-f53.google.com) (209.85.210.53) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 24 Apr 2013 11:04:48 +0000 Received: by mail-da0-f53.google.com with SMTP id n34so828119dal.40 for ; Wed, 24 Apr 2013 04:04:47 -0700 (PDT) X-Received: by 10.66.52.76 with SMTP id r12mr18959317pao.217.1366801487102; Wed, 24 Apr 2013 04:04:47 -0700 (PDT) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id jw10sm2671131pbb.3.2013.04.24.04.04.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 04:04:46 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id C33B9EA0444; Wed, 24 Apr 2013 20:34:41 +0930 (CST) Date: Wed, 24 Apr 2013 20:34:41 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Subject: rs6000_emit_set_long_const tidy Message-ID: <20130424110441.GP22536@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) This just removes some unnecessary tests. It's easy to see that if the sign bit isn't set then xor 0x8000 followed by subtract 0x8000 leaves the value unchanged. Bootstrapped etc. powerpc-linux. OK for mainline? * config/rs6000/rs6000.c (rs6000_emit_set_long_const): Tidy. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 198174) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -7104,21 +7104,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN if ((ud4 == 0xffff && ud3 == 0xffff && ud2 == 0xffff && (ud1 & 0x8000)) || (ud4 == 0 && ud3 == 0 && ud2 == 0 && ! (ud1 & 0x8000))) - { - if (ud1 & 0x8000) - emit_move_insn (dest, GEN_INT (((ud1 ^ 0x8000) - 0x8000))); - else - emit_move_insn (dest, GEN_INT (ud1)); - } + emit_move_insn (dest, GEN_INT ((ud1 ^ 0x8000) - 0x8000)); else if ((ud4 == 0xffff && ud3 == 0xffff && (ud2 & 0x8000)) || (ud4 == 0 && ud3 == 0 && ! (ud2 & 0x8000))) { - if (ud2 & 0x8000) - emit_move_insn (dest, GEN_INT (((ud2 << 16) ^ 0x80000000) - - 0x80000000)); - else - emit_move_insn (dest, GEN_INT (ud2 << 16)); + emit_move_insn (dest, GEN_INT (((ud2 << 16) ^ 0x80000000) + - 0x80000000)); if (ud1 != 0) emit_move_insn (copy_rtx (dest), gen_rtx_IOR (DImode, copy_rtx (dest), @@ -7141,12 +7133,8 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN else if ((ud4 == 0xffff && (ud3 & 0x8000)) || (ud4 == 0 && ! (ud3 & 0x8000))) { - if (ud3 & 0x8000) - emit_move_insn (dest, GEN_INT (((ud3 << 16) ^ 0x80000000) - - 0x80000000)); - else - emit_move_insn (dest, GEN_INT (ud3 << 16)); - + emit_move_insn (dest, GEN_INT (((ud3 << 16) ^ 0x80000000) + - 0x80000000)); if (ud2 != 0) emit_move_insn (copy_rtx (dest), gen_rtx_IOR (DImode, copy_rtx (dest), @@ -7161,12 +7149,8 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN } else { - if (ud4 & 0x8000) - emit_move_insn (dest, GEN_INT (((ud4 << 16) ^ 0x80000000) - - 0x80000000)); - else - emit_move_insn (dest, GEN_INT (ud4 << 16)); - + emit_move_insn (dest, GEN_INT (((ud4 << 16) ^ 0x80000000) + - 0x80000000)); if (ud3 != 0) emit_move_insn (copy_rtx (dest), gen_rtx_IOR (DImode, copy_rtx (dest), @@ -7181,7 +7165,8 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_IN GEN_INT (ud2 << 16))); if (ud1 != 0) emit_move_insn (copy_rtx (dest), - gen_rtx_IOR (DImode, copy_rtx (dest), GEN_INT (ud1))); + gen_rtx_IOR (DImode, copy_rtx (dest), + GEN_INT (ud1))); } } return dest;