From 54414978ae4085ffce4bb00d802e29e35ed6d6b3 Mon Sep 17 00:00:00 2001 From: Kirill Yukhin Date: Thu, 9 Apr 2015 09:11:27 +0000 Subject: [PATCH] re PR target/65676 (ICE: in extract_insn, at recog.c:2343 (unrecognizable insn) with -mavx512f -funsigned-char and __builtin_ia32_pmovsxwq512_mask()) PR target/65676 gcc/ * config/i386/i386.c (fixup_modeless_constant): New. (ix86_expand_args_builtin): Fixup modeless constant operand. 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/ * gcc.target/i386/sse-25.c: New. (ix86_expand_round_builtin): Ditto. (ix86_expand_special_args_builtin): Ditto. (ix86_expand_builtin): Ditto. testsuite/ PR target/65676 * gcc.target/i386/sse-25.c: New. From-SVN: r221943 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/i386.c | 22 ++++++++++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/sse-25.c | 6 ++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/sse-25.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a2a9f8ef53..e3bf58e4515 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-04-09 Kirill Yukhin + + 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. + 2015-04-09 Jakub Jelinek PR target/65693 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 02b5103138a..a0b543a4101 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); + + op3 = fixup_modeless_constant (op3, mode3); + 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); + op1 = fixup_modeless_constant (op1, mode1); + 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; + op0 = fixup_modeless_constant (op0, mode0); + if (GET_MODE (op0) == mode0 || (GET_MODE (op0) == VOIDmode && op0 != constm1_rtx)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 667d42e29ba..1cd869a0fb5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-04-09 Kirill Yukhin + + PR target/65676 + * gcc.target/i386/sse-25.c: New. + 2015-04-09 Jakub Jelinek PR target/65693 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 00000000000..c4b334c66e3 --- /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" -- 2.30.2