From: Jakub Jelinek Date: Sat, 23 Nov 2019 10:07:21 +0000 (+0100) Subject: re PR inline-asm/92615 (ICE in extract_insn) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d0d7a63019a7d67943d1867348673e3ca3dc824;p=gcc.git re PR inline-asm/92615 (ICE in extract_insn) PR target/92615 * config/i386/i386.c (ix86_md_asm_adjust): If dest_mode is GET_MODE (dest), is not QImode, using ZERO_EXTEND and dest is not register_operand, force x into register before storing it into dest. Formatting fix. * gcc.target/i386/pr92615.c: New test. From-SVN: r278642 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5741316747..eadbfc082d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2019-11-23 Jakub Jelinek + PR target/92615 + * config/i386/i386.c (ix86_md_asm_adjust): If dest_mode is + GET_MODE (dest), is not QImode, using ZERO_EXTEND and dest is not + register_operand, force x into register before storing it into dest. + Formatting fix. + PR middle-end/83859 * doc/extend.texi (attribute access): Fix a typo. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7115ec44c2a..780ebb85ef8 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -20819,11 +20819,15 @@ ix86_md_asm_adjust (vec &outputs, vec &/*inputs*/, { x = force_reg (dest_mode, const0_rtx); - emit_insn (gen_movstrictqi - (gen_lowpart (QImode, x), destqi)); + emit_insn (gen_movstrictqi (gen_lowpart (QImode, x), destqi)); } else - x = gen_rtx_ZERO_EXTEND (dest_mode, destqi); + { + x = gen_rtx_ZERO_EXTEND (dest_mode, destqi); + if (dest_mode == GET_MODE (dest) + && !register_operand (dest, GET_MODE (dest))) + x = force_reg (dest_mode, x); + } } if (dest_mode != GET_MODE (dest)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c8f1a00d43..db2b2ea1041 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-11-23 Jakub Jelinek + PR target/92615 + * gcc.target/i386/pr92615.c: New test. + PR rtl-optimization/92610 * g++.dg/opt/pr92610.C: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr92615.c b/gcc/testsuite/gcc.target/i386/pr92615.c new file mode 100644 index 00000000000..b84bfcdabbe --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr92615.c @@ -0,0 +1,45 @@ +/* PR target/92615 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void *a; +long long b; +char c; + +void +foo (void) +{ + void *p; + long long q; + char r; + __asm__ ("" : : "r" (&p), "r" (&q), "r" (&r)); + __asm__ ("" : "=@cca" (p)); + a = p; + __asm__ ("" : "=@cca" (q)); + b = q; + __asm__ ("" : "=@cca" (r)); + c = r; + __asm__ ("" : : "r" (&p), "r" (&q), "r" (&r)); +} + +void +bar (void) +{ + void *p; + long long q; + char r; + __asm__ ("" : "=@cca" (p)); + a = p; + __asm__ ("" : "=@cca" (q)); + b = q; + __asm__ ("" : "=@cca" (r)); + c = r; + __asm__ ("" : : "r" (p), "A" (q), "q" (r)); +} + +void +baz (void) +{ + void *p = (void *) &p; + __asm__ __volatile__ ("" : "=@ccng" (p) : "r" (1)); +}