From be3830f845753a70a38599f3d963a5cbbedcd306 Mon Sep 17 00:00:00 2001 From: Sebastian Peryt Date: Wed, 25 Apr 2018 14:39:57 +0200 Subject: [PATCH] re PR target/85473 (internal compiler error: in emit_move_insn, at expr.c:3722) 2018-04-25 Sebastian Peryt gcc/ChangeLog: PR target/85473 * config/i386/i386.c (ix86_expand_builtin): Change memory operand to XI, extend p0 to Pmode. * config/i386/i386.md: Change unspec volatile and operand 1 mode to XI, change operand 0 mode to P. gcc/testsuite/ChangeLog: PR target/85473 * gcc.target/i386/pr85473-1.c: New test. * gcc.target/i386/pr85473-2.c: New test. From-SVN: r259648 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386.c | 11 +++++++---- gcc/config/i386/i386.md | 4 ++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.target/i386/pr85473-1.c | 15 +++++++++++++++ gcc/testsuite/gcc.target/i386/pr85473-2.c | 7 +++++++ 6 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr85473-1.c create mode 100644 gcc/testsuite/gcc.target/i386/pr85473-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ea0aaa7eea..e65ab7bd83f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-04-25 Sebastian Peryt + + PR target/85473 + * config/i386/i386.c (ix86_expand_builtin): Change memory + operand to XI, extend p0 to Pmode. + * config/i386/i386.md: Change unspec volatile and operand + 1 mode to XI, change operand 0 mode to P. + 2018-04-25 Chung-Ju Wu * config/nds32/nds32-predicates.c (nds32_can_use_bclr_p): Mask with diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a3c3870d4f4..6a2141e48db 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -37147,11 +37147,14 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, arg1 = CALL_EXPR_ARG (exp, 1); op0 = expand_normal (arg0); op1 = expand_normal (arg1); - mode0 = (TARGET_64BIT ? DImode : SImode); - op0 = force_reg (mode0, op0); - if (!memory_operand (op1, mode0)) - op1 = gen_rtx_MEM (mode0, op1); + op0 = ix86_zero_extend_to_Pmode (op0); + if (!address_operand (op1, VOIDmode)) + { + op1 = convert_memory_address (Pmode, op1); + op1 = copy_addr_to_reg (op1); + } + op1 = gen_rtx_MEM (XImode, op1); insn = (TARGET_64BIT ? gen_movdir64b_di (op0, op1) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a134ca88014..ad9ccf9d1d7 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -20697,8 +20697,8 @@ [(set_attr "type" "other")]) (define_insn "movdir64b_" - [(unspec_volatile:SWI48[(match_operand:SWI48 0 "register_operand" "r") - (match_operand:SWI48 1 "memory_operand")] + [(unspec_volatile:XI[(match_operand:P 0 "register_operand" "r") + (match_operand:XI 1 "memory_operand")] UNSPECV_MOVDIR64B)] "TARGET_MOVDIR64B" "movdir64b\t{%1, %0|%0, %1}" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a955a68c3e..a62a9cb86f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-04-25 Sebastian Peryt + + PR target/85473 + * gcc.target/i386/pr85473-1.c: New test. + * gcc.target/i386/pr85473-2.c: New test. + 2018-04-25 Nathan Sidwell Jakub Jelinek diff --git a/gcc/testsuite/gcc.target/i386/pr85473-1.c b/gcc/testsuite/gcc.target/i386/pr85473-1.c new file mode 100644 index 00000000000..d0c04d35625 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr85473-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-O2 -mx32 -maddress-mode=short -mmovdir64b" } */ +/* { dg-final { scan-assembler "movdir64b\[ \\t\]" } } */ + +unsigned int w[5] __attribute__((aligned(64))); + +void +foo () +{ + + unsigned int array[] = {1, 2, 3, 4, 5}; + __builtin_ia32_movdir64b(w, array); +} + diff --git a/gcc/testsuite/gcc.target/i386/pr85473-2.c b/gcc/testsuite/gcc.target/i386/pr85473-2.c new file mode 100644 index 00000000000..a325d04a96f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr85473-2.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-O2 -mx32 -maddress-mode=long -mmovdir64b" } */ +/* { dg-final { scan-assembler "movdir64b\[ \\t\]" } } */ + +#include "pr85473-1.c" + -- 2.30.2