Skip to content

Commit

Permalink
Codegen C - "Fix" some strange inline assembly (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
thepowersgang committed Nov 5, 2021
1 parent 72fcc58 commit da3b6fd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/trans/codegen_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4266,6 +4266,16 @@ namespace {
return ;
}
}
if(asm_matches_template(e, "pushfd; popl $0", {}, {"=r"}))
{
m_of << indent << "__asm__ __volatile__ (\"pushfl; popl %0\" : \"=r\" ("; emit_lvalue(e.outputs[0].second); m_of << ") : : );\n";
return;
}
if(asm_matches_template(e, "pushl $0; popfd", {"r"}, {}))
{
m_of << indent << "__asm__ __volatile__ (\"pushl %0; popfl\" : : \"r\" ("; emit_lvalue(e.inputs[0].second); m_of << ") : );\n";
return;
}

m_of << indent << "__asm__ ";
if (is_volatile) m_of << "__volatile__";
Expand Down

0 comments on commit da3b6fd

Please sign in to comment.