From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109689 invoked by alias); 8 Apr 2015 11:33:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 109673 invoked by uid 89); 8 Apr 2015 11:33:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vn0-f44.google.com Received: from mail-vn0-f44.google.com (HELO mail-vn0-f44.google.com) (209.85.216.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 08 Apr 2015 11:33:34 +0000 Received: by vnbf62 with SMTP id f62so14474807vnb.13 for ; Wed, 08 Apr 2015 04:33:32 -0700 (PDT) X-Received: by 10.170.155.198 with SMTP id w189mr24966799ykc.123.1428492812690; Wed, 08 Apr 2015 04:33:32 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by mx.google.com with ESMTPSA id x3sm8775647yhx.48.2015.04.08.04.33.29 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Apr 2015 04:33:31 -0700 (PDT) Date: Wed, 08 Apr 2015 11:33:00 -0000 From: Kirill Yukhin To: GCC Patches Cc: Uros Bizjak Subject: [PATCH, i386] Fix PR target/65676. Message-ID: <20150408113315.GD39448@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00304.txt.bz2 Hello, Patch in the bottom fixes PR65676. Bootstrapped, reg-testing is in progress. I am going to commit if testing will pass. I am also going back port the patch to 4.9.x. gcc/ PR target/65676 * config/i386/i386.c (fixup_modeless_constant): New. (ix86_expand_args_builtin): Fixup modeless constant operand. (ix86_expand_round_builtin): Ditto. (ix86_expand_special_args_builtin): Ditto. (ix86_expand_builtin): Ditto. gcc/testsuite/ PR target/65676 * gcc.target/i386/sse-25.c: New. -- Thanks, K commit bdb50f43ed940261230953a647c6a7197bc60c97 Author: Kirill Yukhin Date: Tue Apr 7 17:37:01 2015 +0300 Fix PR65676. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 02b5103..a02e004 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -35863,6 +35863,15 @@ safe_vector_operand (rtx x, machine_mode mode) return x; } +/* Fixup modeless constants to fit required mode. */ +static rtx +fixup_modeless_constant (rtx x, machine_mode mode) +{ + if (GET_MODE (x) == VOIDmode) + x = convert_to_mode (mode, x, 1); + return x; +} + /* Subroutine of ix86_expand_builtin to take care of binop insns. */ static rtx @@ -37509,6 +37518,8 @@ ix86_expand_args_builtin (const struct builtin_description *d, if (memory_operand (op, mode)) num_memory++; + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) { if (optimize || !match || num_memory > 1) @@ -37882,6 +37893,8 @@ ix86_expand_round_builtin (const struct builtin_description *d, if (VECTOR_MODE_P (mode)) op = safe_vector_operand (op, mode); + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) { if (optimize || !match) @@ -38289,6 +38302,8 @@ ix86_expand_special_args_builtin (const struct builtin_description *d, if (VECTOR_MODE_P (mode)) op = safe_vector_operand (op, mode); + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode) op = copy_to_mode_reg (mode, op); else @@ -39852,6 +39867,9 @@ addcarryx: op1 = copy_to_mode_reg (Pmode, op1); if (!insn_data[icode].operand[3].predicate (op2, mode2)) op2 = copy_to_mode_reg (mode2, op2); + + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op3) == mode3 || GET_MODE (op3) == VOIDmode) { if (!insn_data[icode].operand[4].predicate (op3, mode3)) @@ -39995,6 +40013,8 @@ addcarryx: if (!insn_data[icode].operand[0].predicate (op0, Pmode)) op0 = copy_to_mode_reg (Pmode, op0); + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op1) == mode1 || GET_MODE (op1) == VOIDmode) { if (!insn_data[icode].operand[1].predicate (op1, mode1)) @@ -40041,6 +40061,8 @@ addcarryx: mode3 = insn_data[icode].operand[3].mode; mode4 = insn_data[icode].operand[4].mode; + op = fixup_modeless_constant (op, mode); + if (GET_MODE (op0) == mode0 || (GET_MODE (op0) == VOIDmode && op0 != constm1_rtx)) { diff --git a/gcc/testsuite/gcc.target/i386/sse-25.c b/gcc/testsuite/gcc.target/i386/sse-25.c new file mode 100644 index 0000000..c4b334c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse-25.c @@ -0,0 +1,6 @@ +/* PR target/65676 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -funsigned-char" } */ +/* { dg-add-options bind_pic_locally } */ + +#include "sse-23.c"