Commit 8554d9a4 by Jakub Jelinek Committed by Jakub Jelinek

final.c (output_asm_insn): Make sure assembly dialects are terminated, not nested.

	* final.c (output_asm_insn): Make sure assembly dialects are
	terminated, not nested.  Output `|' and `}' characters if they
	don't appear inside assembly dialect selection.
	* config/i386/i386.md (rep_movdi_rex64, rep_movsi, rep_movsi_rex64,
	rep_movqi, rep_movqi_rex64, rep_stosdi_rex64, rep_stossi,
	rep_stossi_rex64, rep_stosqi, rep_stosqi_rex64, strsetsi_1,
	strsetsi_rex_1): Add {} braces.

	* testsuite/gcc.dg/20011009-1.c: New test.

From-SVN: r46227
parent e60505a5
2001-10-12 Jakub Jelinek <jakub@redhat.com>
* final.c (output_asm_insn): Make sure assembly dialects are
terminated, not nested. Output `|' and `}' characters if they
don't appear inside assembly dialect selection.
* config/i386/i386.md (rep_movdi_rex64, rep_movsi, rep_movsi_rex64,
rep_movqi, rep_movqi_rex64, rep_stosdi_rex64, rep_stossi,
rep_stossi_rex64, rep_stosqi, rep_stosqi_rex64, strsetsi_1,
strsetsi_rex_1): Add {} braces.
2001-10-11 Zack Weinberg <zack@codesourcery.com> 2001-10-11 Zack Weinberg <zack@codesourcery.com>
* toplev.c (compile_file): Ignore return value from yyparse. * toplev.c (compile_file): Ignore return value from yyparse.
......
...@@ -14938,7 +14938,7 @@ ...@@ -14938,7 +14938,7 @@
(use (match_dup 5)) (use (match_dup 5))
(use (reg:SI 19))] (use (reg:SI 19))]
"TARGET_64BIT" "TARGET_64BIT"
"rep\;movsq|rep movsq" "{rep\;movsq|rep movsq}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "both") (set_attr "memory" "both")
...@@ -14958,7 +14958,7 @@ ...@@ -14958,7 +14958,7 @@
(use (match_dup 5)) (use (match_dup 5))
(use (reg:SI 19))] (use (reg:SI 19))]
"!TARGET_64BIT" "!TARGET_64BIT"
"rep\;movsl|rep movsd" "{rep\;movsl|rep movsd}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "both") (set_attr "memory" "both")
...@@ -14978,7 +14978,7 @@ ...@@ -14978,7 +14978,7 @@
(use (match_dup 5)) (use (match_dup 5))
(use (reg:SI 19))] (use (reg:SI 19))]
"TARGET_64BIT" "TARGET_64BIT"
"rep\;movsl|rep movsd" "{rep\;movsl|rep movsd}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "both") (set_attr "memory" "both")
...@@ -14996,7 +14996,7 @@ ...@@ -14996,7 +14996,7 @@
(use (match_dup 5)) (use (match_dup 5))
(use (reg:SI 19))] (use (reg:SI 19))]
"!TARGET_64BIT" "!TARGET_64BIT"
"rep\;movsb|rep movsb" "{rep\;movsb|rep movsb}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "both") (set_attr "memory" "both")
...@@ -15014,7 +15014,7 @@ ...@@ -15014,7 +15014,7 @@
(use (match_dup 5)) (use (match_dup 5))
(use (reg:SI 19))] (use (reg:SI 19))]
"TARGET_64BIT" "TARGET_64BIT"
"rep\;movsb|rep movsb" "{rep\;movsb|rep movsb}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "both") (set_attr "memory" "both")
...@@ -15181,7 +15181,7 @@ ...@@ -15181,7 +15181,7 @@
(const_int 4))) (const_int 4)))
(use (reg:SI 19))] (use (reg:SI 19))]
"!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)" "!TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
"stosl|stosd" "{stosl|stosd}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "memory" "store") (set_attr "memory" "store")
(set_attr "mode" "SI")]) (set_attr "mode" "SI")])
...@@ -15194,7 +15194,7 @@ ...@@ -15194,7 +15194,7 @@
(const_int 4))) (const_int 4)))
(use (reg:SI 19))] (use (reg:SI 19))]
"TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)" "TARGET_64BIT && (TARGET_SINGLE_STRINGOP || optimize_size)"
"stosl|stosd" "{stosl|stosd}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "memory" "store") (set_attr "memory" "store")
(set_attr "mode" "SI")]) (set_attr "mode" "SI")])
...@@ -15263,7 +15263,7 @@ ...@@ -15263,7 +15263,7 @@
(use (match_dup 4)) (use (match_dup 4))
(use (reg:SI 19))] (use (reg:SI 19))]
"TARGET_64BIT" "TARGET_64BIT"
"rep\;stosq|rep stosq" "{rep\;stosq|rep stosq}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "store") (set_attr "memory" "store")
...@@ -15281,7 +15281,7 @@ ...@@ -15281,7 +15281,7 @@
(use (match_dup 4)) (use (match_dup 4))
(use (reg:SI 19))] (use (reg:SI 19))]
"!TARGET_64BIT" "!TARGET_64BIT"
"rep\;stosl|rep stosd" "{rep\;stosl|rep stosd}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "store") (set_attr "memory" "store")
...@@ -15299,7 +15299,7 @@ ...@@ -15299,7 +15299,7 @@
(use (match_dup 4)) (use (match_dup 4))
(use (reg:SI 19))] (use (reg:SI 19))]
"TARGET_64BIT" "TARGET_64BIT"
"rep\;stosl|rep stosd" "{rep\;stosl|rep stosd}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "store") (set_attr "memory" "store")
...@@ -15316,7 +15316,7 @@ ...@@ -15316,7 +15316,7 @@
(use (match_dup 4)) (use (match_dup 4))
(use (reg:SI 19))] (use (reg:SI 19))]
"!TARGET_64BIT" "!TARGET_64BIT"
"rep\;stosb|rep stosb" "{rep\;stosb|rep stosb}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "store") (set_attr "memory" "store")
...@@ -15333,7 +15333,7 @@ ...@@ -15333,7 +15333,7 @@
(use (match_dup 4)) (use (match_dup 4))
(use (reg:DI 19))] (use (reg:DI 19))]
"TARGET_64BIT" "TARGET_64BIT"
"rep\;stosb|rep stosb" "{rep\;stosb|rep stosb}"
[(set_attr "type" "str") [(set_attr "type" "str")
(set_attr "prefix_rep" "1") (set_attr "prefix_rep" "1")
(set_attr "memory" "store") (set_attr "memory" "store")
......
...@@ -3313,6 +3313,9 @@ output_asm_insn (template, operands) ...@@ -3313,6 +3313,9 @@ output_asm_insn (template, operands)
{ {
const char *p; const char *p;
int c; int c;
#ifdef ASSEMBLER_DIALECT
int dialect = 0;
#endif
/* An insn may return a null string template /* An insn may return a null string template
in a case where no assembler code is needed. */ in a case where no assembler code is needed. */
...@@ -3347,6 +3350,11 @@ output_asm_insn (template, operands) ...@@ -3347,6 +3350,11 @@ output_asm_insn (template, operands)
{ {
int i; int i;
if (dialect)
output_operand_lossage ("nested assembly dialect alternatives");
else
dialect = 1;
/* If we want the first dialect, do nothing. Otherwise, skip /* If we want the first dialect, do nothing. Otherwise, skip
DIALECT_NUMBER of strings ending with '|'. */ DIALECT_NUMBER of strings ending with '|'. */
for (i = 0; i < dialect_number; i++) for (i = 0; i < dialect_number; i++)
...@@ -3358,16 +3366,35 @@ output_asm_insn (template, operands) ...@@ -3358,16 +3366,35 @@ output_asm_insn (template, operands)
if (*p == '|') if (*p == '|')
p++; p++;
} }
if (*p == '\0')
output_operand_lossage ("unterminated assembly dialect alternative");
} }
break; break;
case '|': case '|':
/* Skip to close brace. */ if (dialect)
while (*p && *p++ != '}') {
; /* Skip to close brace. */
do
{
if (*p == '\0')
{
output_operand_lossage ("unterminated assembly dialect alternative");
break;
}
}
while (*p++ != '}');
dialect = 0;
}
else
putc (c, asm_out_file);
break; break;
case '}': case '}':
if (! dialect)
putc (c, asm_out_file);
dialect = 0;
break; break;
#endif #endif
......
2001-10-12 Jakub Jelinek <jakub@redhat.com>
* testsuite/gcc.dg/20011009-1.c: New test.
2001-10-12 Nathan Sidwell <nathan@codesourcery.com> 2001-10-12 Nathan Sidwell <nathan@codesourcery.com>
PR g++/4476 PR g++/4476
......
/* { dg-do run { target i?86-*-* } } */
/* { dg-options "-O2" } */
extern void abort (void);
extern void exit (int);
int main ()
{
int x;
asm ("movl $26, %0 # 26 |-> reg \n\t"
"movl $28, %0" : "=r" (x));
if (x != 28)
abort ();
exit (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment