Skip to content

Commit 7edc790

Browse files
author
jakub
committed
PR inline-asm/85034
* function.c (match_asm_constraints_1): Don't optimize if input doesn't satisfy general_operand predicate for output's mode. * gcc.target/i386/pr85034.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258796 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 0b41083 commit 7edc790

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

gcc/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
2018-03-23 Jakub Jelinek <[email protected]>
22

3+
PR inline-asm/85034
4+
* function.c (match_asm_constraints_1): Don't optimize if input
5+
doesn't satisfy general_operand predicate for output's mode.
6+
37
PR inline-asm/85022
48
* alias.c (write_dependence_p): Don't require for x_canonicalized
59
non-VOIDmode if x has VOIDmode.

gcc/function.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6661,10 +6661,9 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs)
66616661
/* Only do the transformation for pseudos. */
66626662
if (! REG_P (output)
66636663
|| rtx_equal_p (output, input)
6664-
|| (GET_MODE (input) != VOIDmode
6665-
&& GET_MODE (input) != GET_MODE (output))
66666664
|| !(REG_P (input) || SUBREG_P (input)
6667-
|| MEM_P (input) || CONSTANT_P (input)))
6665+
|| MEM_P (input) || CONSTANT_P (input))
6666+
|| !general_operand (input, GET_MODE (output)))
66686667
continue;
66696668

66706669
/* We can't do anything if the output is also used as input,

gcc/testsuite/ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
2018-03-23 Jakub Jelinek <[email protected]>
22

3+
PR inline-asm/85034
4+
* gcc.target/i386/pr85034.c: New test.
5+
36
PR inline-asm/85022
47
* c-c++-common/torture/pr85022.c: New test.
58

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* PR inline-asm/85034 */
2+
/* { dg-do compile } */
3+
/* { dg-options "-O2" } */
4+
5+
void
6+
foo (void)
7+
{
8+
volatile float a;
9+
struct S { char a; } b = { 0 };
10+
asm volatile ("" : "=r" (a) : "0ir" (b));
11+
}

0 commit comments

Comments
 (0)