From patchwork Tue Sep 21 11:44:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 65300 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 13D1AB6EE9 for ; Tue, 21 Sep 2010 21:45:20 +1000 (EST) Received: (qmail 3701 invoked by alias); 21 Sep 2010 11:45:16 -0000 Received: (qmail 3629 invoked by uid 22791); 21 Sep 2010 11:45:14 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_ZJ, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Sep 2010 11:44:15 +0000 Received: by qyk31 with SMTP id 31so4370924qyk.20 for ; Tue, 21 Sep 2010 04:44:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.102.146 with SMTP id g18mr6768565qao.200.1285069452791; Tue, 21 Sep 2010 04:44:12 -0700 (PDT) Received: by 10.229.182.15 with HTTP; Tue, 21 Sep 2010 04:44:12 -0700 (PDT) Date: Tue, 21 Sep 2010 13:44:12 +0200 Message-ID: Subject: [PATCH, i386]: Use GET_MODE_BITSIZE in shift splitters From: Uros Bizjak To: gcc-patches@gcc.gnu.org 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 Hello! 2010-09-21 Uros Bizjak * config/i386/i386.c (ix86_split_ashl): Rename single_width variable to half_width. Use GET_MODE_BITSIZE to calculate mode size. (ix86_split_ashr): Ditto. (ix86_split_lshr): Ditto. Tested on x86_64-pc-linux-gnu {,-m32}. Committed to mainline SVN. Uros. Index: i386.c =================================================================== --- i386.c (revision 164475) +++ i386.c (working copy) @@ -18079,23 +18079,23 @@ ix86_split_ashl (rtx *operands, rtx scra { rtx (*gen_ashl3)(rtx, rtx, rtx); rtx (*gen_shld)(rtx, rtx, rtx); + int half_width = GET_MODE_BITSIZE (mode) >> 1; rtx low[2], high[2]; int count; - const int single_width = mode == DImode ? 32 : 64; if (CONST_INT_P (operands[2])) { split_double_mode (mode, operands, 2, low, high); - count = INTVAL (operands[2]) & (single_width * 2 - 1); + count = INTVAL (operands[2]) & (GET_MODE_BITSIZE (mode) - 1); - if (count >= single_width) + if (count >= half_width) { emit_move_insn (high[0], low[1]); emit_move_insn (low[0], const0_rtx); - if (count > single_width) - ix86_expand_ashl_const (high[0], count - single_width, mode); + if (count > half_width) + ix86_expand_ashl_const (high[0], count - half_width, mode); } else { @@ -18124,7 +18124,7 @@ ix86_split_ashl (rtx *operands, rtx scra ix86_expand_clear (low[0]); ix86_expand_clear (high[0]); - emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (single_width))); + emit_insn (gen_testqi_ccz_1 (operands[2], GEN_INT (half_width))); d = gen_lowpart (QImode, low[0]); d = gen_rtx_STRICT_LOW_PART (VOIDmode, d); @@ -18231,34 +18231,34 @@ ix86_split_ashr (rtx *operands, rtx scra rtx (*gen_ashr3)(rtx, rtx, rtx) = mode == DImode ? gen_ashrsi3 : gen_ashrdi3; rtx (*gen_shrd)(rtx, rtx, rtx); + int half_width = GET_MODE_BITSIZE (mode) >> 1; rtx low[2], high[2]; int count; - const int single_width = mode == DImode ? 32 : 64; if (CONST_INT_P (operands[2])) { split_double_mode (mode, operands, 2, low, high); - count = INTVAL (operands[2]) & (single_width * 2 - 1); + count = INTVAL (operands[2]) & (GET_MODE_BITSIZE (mode) - 1); - if (count == single_width * 2 - 1) + if (count == GET_MODE_BITSIZE (mode) - 1) { emit_move_insn (high[0], high[1]); emit_insn (gen_ashr3 (high[0], high[0], - GEN_INT (single_width - 1))); + GEN_INT (half_width - 1))); emit_move_insn (low[0], high[0]); } - else if (count >= single_width) + else if (count >= half_width) { emit_move_insn (low[0], high[1]); emit_move_insn (high[0], low[0]); emit_insn (gen_ashr3 (high[0], high[0], - GEN_INT (single_width - 1))); + GEN_INT (half_width - 1))); - if (count > single_width) + if (count > half_width) emit_insn (gen_ashr3 (low[0], low[0], - GEN_INT (count - single_width))); + GEN_INT (count - half_width))); } else { @@ -18290,7 +18290,7 @@ ix86_split_ashr (rtx *operands, rtx scra emit_move_insn (scratch, high[0]); emit_insn (gen_ashr3 (scratch, scratch, - GEN_INT (single_width - 1))); + GEN_INT (half_width - 1))); emit_insn (gen_x86_shift_adj_1 (low[0], high[0], operands[2], scratch)); } @@ -18310,24 +18310,24 @@ ix86_split_lshr (rtx *operands, rtx scra rtx (*gen_lshr3)(rtx, rtx, rtx) = mode == DImode ? gen_lshrsi3 : gen_lshrdi3; rtx (*gen_shrd)(rtx, rtx, rtx); + int half_width = GET_MODE_BITSIZE (mode) >> 1; rtx low[2], high[2]; int count; - const int single_width = mode == DImode ? 32 : 64; if (CONST_INT_P (operands[2])) { split_double_mode (mode, operands, 2, low, high); - count = INTVAL (operands[2]) & (single_width * 2 - 1); + count = INTVAL (operands[2]) & (GET_MODE_BITSIZE (mode) - 1); - if (count >= single_width) + if (count >= half_width) { emit_move_insn (low[0], high[1]); ix86_expand_clear (high[0]); - if (count > single_width) + if (count > half_width) emit_insn (gen_lshr3 (low[0], low[0], - GEN_INT (count - single_width))); + GEN_INT (count - half_width))); } else {