Case in point is when the i386 backend moved from cc0 to a hard reg --
maintaining source-level compatibility means automatically clobbering
the flags register. */
- rtx_insn *after_md_seq = NULL;
auto_vec<rtx> use_rvec;
if (targetm.md_asm_adjust)
- after_md_seq
+ {
+ rtx_insn *after_md_seq
= targetm.md_asm_adjust (output_rvec, input_rvec, input_mode,
constraints, use_rvec, clobber_rvec,
clobbered_regs, locus);
+ if (after_md_seq)
+ {
+ push_to_sequence (after_md_seq);
+ emit_insn (after_rtl_seq);
+ after_rtl_seq = get_insns ();
+ after_rtl_end = get_last_insn ();
+ end_sequence ();
+ }
+ }
/* Do not allow the hook to change the output and input count,
lest it mess up the operand numbering. */
if (fallthru_label)
emit_label (fallthru_label);
- if (after_md_seq)
- emit_insn (after_md_seq);
if (after_rtl_seq)
{
if (nlabels == 0)
--- /dev/null
+/* PR middle-end/124056 */
+/* { dg-do run } */
+/* { dg-options "-O2 -masm=att" } */
+
+int v;
+
+[[gnu::noipa]] void
+foo (void)
+{
+ v = 42;
+}
+
+[[gnu::noipa]] void
+bar (void)
+{
+ v = 43;
+}
+
+[[gnu::noipa]] int
+baz (void)
+{
+ bool err;
+ __asm goto ("movl %1, %%ecx\n\t"
+ "test %%ecx, %%ecx\n\t"
+ "js 1f\n\t"
+ "jmp %l[lab]\n\t"
+ "1: cmpl $-1, %%ecx"
+ : "=@ccz" (err) : "m" (v) : "ecx" : lab);
+ if (err)
+ {
+ bar ();
+ return -1;
+ }
+ return 0;
+
+ lab:
+ if (err)
+ {
+ foo ();
+ return -2;
+ }
+
+ return 1;
+}
+
+int
+main ()
+{
+ v = 0;
+ if (baz () != -2 || v != 42)
+ __builtin_abort ();
+ v = 1;
+ if (baz () != 1 || v != 1)
+ __builtin_abort ();
+ v = -1;
+ if (baz () != -1 || v != 43)
+ __builtin_abort ();
+ v = -2;
+ if (baz () != 0 || v != -2)
+ __builtin_abort ();
+}