From patchwork Thu Oct 6 16:47:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 118130 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 E727FB6FAF for ; Fri, 7 Oct 2011 03:48:35 +1100 (EST) Received: (qmail 18706 invoked by alias); 6 Oct 2011 16:48:25 -0000 Received: (qmail 18504 invoked by uid 22791); 6 Oct 2011 16:48:22 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_DV, TW_VP, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 06 Oct 2011 16:48:04 +0000 Received: by wwf10 with SMTP id 10so3937669wwf.8 for ; Thu, 06 Oct 2011 09:48:03 -0700 (PDT) Received: by 10.227.25.67 with SMTP id y3mr1303276wbb.20.1317919683343; Thu, 06 Oct 2011 09:48:03 -0700 (PDT) Received: from localhost.localdomain (c-71-227-161-214.hsd1.wa.comcast.net. [71.227.161.214]) by mx.google.com with ESMTPS id gg21sm11132659wbb.15.2011.10.06.09.48.01 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Oct 2011 09:48:02 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Use the proper mode for blend in vshuffle. Date: Thu, 6 Oct 2011 09:47:13 -0700 Message-Id: <1317919633-17991-4-git-send-email-rth@redhat.com> 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 allows the use of blendvpd instead of pblendvb on the final step. I don't *really* know if this helps or hurts with the re-interpretation of the data from byte data to double data. But it looks "nicer" anyway. r~ --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 28 +++++++++++++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) + * config/i386/i386.c (ix86_expand_sse_movcc): Use correct mode + for vector_all_ones_operand. + (ix86_expand_int_vcond): Distinguish between comparison mode + and data mode. Allow them to differ. + (ix86_expand_vshuffle): Don't force data mode to match maskmode. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9960fd2..2fdf540 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -18941,7 +18941,7 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false) enum machine_mode mode = GET_MODE (dest); rtx t2, t3, x; - if (vector_all_ones_operand (op_true, GET_MODE (op_true)) + if (vector_all_ones_operand (op_true, mode) && rtx_equal_p (op_false, CONST0_RTX (mode))) { emit_insn (gen_rtx_SET (VOIDmode, dest, cmp)); @@ -19170,7 +19170,8 @@ ix86_expand_fp_vcond (rtx operands[]) bool ix86_expand_int_vcond (rtx operands[]) { - enum machine_mode mode = GET_MODE (operands[0]); + enum machine_mode data_mode = GET_MODE (operands[0]); + enum machine_mode mode = GET_MODE (operands[4]); enum rtx_code code = GET_CODE (operands[3]); bool negate = false; rtx x, cop0, cop1; @@ -19297,8 +19298,21 @@ ix86_expand_int_vcond (rtx operands[]) } } - x = ix86_expand_sse_cmp (operands[0], code, cop0, cop1, - operands[1+negate], operands[2-negate]); + /* Allow the comparison to be done in one mode, but the movcc to + happen in another mode. */ + if (data_mode == mode) + { + x = ix86_expand_sse_cmp (operands[0], code, cop0, cop1, + operands[1+negate], operands[2-negate]); + } + else + { + gcc_assert (GET_MODE_SIZE (data_mode) == GET_MODE_SIZE (mode)); + x = ix86_expand_sse_cmp (gen_lowpart (mode, operands[0]), + code, cop0, cop1, + operands[1+negate], operands[2-negate]); + x = gen_lowpart (data_mode, x); + } ix86_expand_sse_movcc (operands[0], x, operands[1+negate], operands[2-negate]); @@ -19533,9 +19547,9 @@ ix86_expand_vshuffle (rtx operands[]) mask = expand_simple_binop (maskmode, AND, mask, vt, NULL_RTX, 0, OPTAB_DIRECT); - xops[0] = gen_lowpart (maskmode, operands[0]); - xops[1] = gen_lowpart (maskmode, t2); - xops[2] = gen_lowpart (maskmode, t1); + xops[0] = operands[0]; + xops[1] = gen_lowpart (mode, t2); + xops[2] = gen_lowpart (mode, t1); xops[3] = gen_rtx_EQ (maskmode, mask, vt); xops[4] = mask; xops[5] = vt;