/* Expands front end tree to back end RTL for GCC.
Copyright (C) 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of GCC.
rtx op = SET_SRC (p_sets[0]);
int ninputs = ASM_OPERANDS_INPUT_LENGTH (op);
rtvec inputs = ASM_OPERANDS_INPUT_VEC (op);
+ bool *output_matched = alloca (noutputs * sizeof (bool));
+ memset (output_matched, 0, noutputs * sizeof (bool));
for (i = 0; i < ninputs; i++)
{
rtx input, output, insns;
if (j != ninputs)
continue;
+ /* Avoid changing the same input several times. For
+ asm ("" : "=mr" (out1), "=mr" (out2) : "0" (in), "1" (in));
+ only change in once (to out1), rather than changing it
+ first to out1 and afterwards to out2. */
+ if (i > 0)
+ {
+ for (j = 0; j < noutputs; j++)
+ if (output_matched[j] && input == SET_DEST (p_sets[j]))
+ break;
+ if (j != noutputs)
+ continue;
+ }
+ output_matched[match] = true;
+
start_sequence ();
emit_move_insn (output, input);
insns = get_insns ();
--- /dev/null
+/* PR inline-asm/35160 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+void
+__attribute__((noinline))
+foo (unsigned int *y)
+{
+ unsigned int c0, c1, c2, d0, d1, d2;
+ d0 = 0; d1 = 0; d2 = 0; c0 = c1 = c2 = 0;
+
+ __asm__ ("movl $7, %k0; movl $8, %k1; movl $9, %k2"
+ : "+r" (d0), "+r" (d1), "+r" (d2));
+ __asm__ ("movl %3, %0; movl %4, %1; movl %5, %2"
+ : "+r" (c0), "+r" (c1), "+r" (c2), "+r" (d0), "+r" (d1), "+r" (d2));
+ y[0] = c0;
+ y[1] = c1;
+ y[2] = c2;
+}
+
+int
+main (void)
+{
+ unsigned int y[3];
+ foo (y);
+ if (y[0] != 7 || y[1] != 8 || y[2] != 9)
+ abort ();
+ return 0;
+}