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 <kirill.yuk...@intel.com> 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"