re PR target/88938 (ICE in extract_insn, at recog.c:2304)
authorUros Bizjak <ubizjak@gmail.com>
Mon, 21 Jan 2019 20:14:40 +0000 (21:14 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 21 Jan 2019 20:14:40 +0000 (21:14 +0100)
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
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr88938.c [new file with mode: 0644]

index 5ca20aed5da459ecf9be2526fc133017900dc953..73c3a6688cc98f1e3d2121e91650b10b860e1782 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-21  Uroš Bizjak  <ubizjak@gmail.com>
+
+       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  <michael.ploujnikov@oracle.com>
 
        * hash-map-tests.c (test_map_of_strings_to_int): Show how to use
index 8abff99cc626ec29c0d4660415e24a08e60ee1c1..88557f26c44ca5b9036e6f098efc72313345d75b 100644 (file)
@@ -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);
index ba5285fc71049891c40820e893816de035263d88..bb703a1b86ad600571eebe20ab2ad8693e5f003d 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-21  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/88938
+       * gcc.target/i386/pr88938.c: New test.
+
 2019-01-21  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..1314ebb
--- /dev/null
@@ -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"