From d50114960965a85deb3ba6a19ac4f7640ed97e7e Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 21 Jan 2019 21:14:40 +0100 Subject: [PATCH] re PR target/88938 (ICE in extract_insn, at recog.c:2304) PR target/88938 * config/i386/i386.c (ix86_expand_builtin) [case IX86_BUILTIN_BEXTRI32, case IX86_BUILTIN_BEXTRI64]: Sanitize operands. testsuite/ChangeLog: PR target/88938 * gcc.target/i386/pr88938.c: New test. From-SVN: r268123 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 10 ++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr88938.c | 5 +++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr88938.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ca20aed5da..73c3a6688cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-21 Uroš Bizjak + + PR target/88938 + * config/i386/i386.c (ix86_expand_builtin) [case IX86_BUILTIN_BEXTRI32, + case IX86_BUILTIN_BEXTRI64]: Sanitize operands. + 2019-01-21 Michael Ploujnikov * hash-map-tests.c (test_map_of_strings_to_int): Show how to use diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 8abff99cc62..88557f26c44 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -37215,6 +37215,16 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, unsigned char lsb_index = INTVAL (op1) & 0xFF; op1 = GEN_INT (length); op2 = GEN_INT (lsb_index); + + mode1 = insn_data[icode].operand[1].mode; + if (!insn_data[icode].operand[1].predicate (op0, mode1)) + op0 = copy_to_mode_reg (mode1, op0); + + mode0 = insn_data[icode].operand[0].mode; + if (target == 0 + || !register_operand (target, mode0)) + target = gen_reg_rtx (mode0); + pat = GEN_FCN (icode) (target, op0, op1, op2); if (pat) emit_insn (pat); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ba5285fc710..bb703a1b86a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-21 Uroš Bizjak + + PR target/88938 + * gcc.target/i386/pr88938.c: New test. + 2019-01-21 Jakub Jelinek PR sanitizer/88901 diff --git a/gcc/testsuite/gcc.target/i386/pr88938.c b/gcc/testsuite/gcc.target/i386/pr88938.c new file mode 100644 index 00000000000..1314ebb1f35 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr88938.c @@ -0,0 +1,5 @@ +/* PR target/88938 */ +/* { dg-do compile } */ +/* { dg-options "-Og -fno-tree-ccp -fno-tree-fre -mtbm" } */ + +#include "tbm-bextri-1.c" -- 2.30.2