summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/trans/codegen_c.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp
index 5f22f081..631db28b 100644
--- a/src/trans/codegen_c.cpp
+++ b/src/trans/codegen_c.cpp
@@ -4096,6 +4096,43 @@ namespace {
m_of << " }\n";
return ;
}
+ // parking_lot src/elision.rs
+ else if( matches_template("xacquire; lock; cmpxchgl $2, $1", /*input=*/{"r", "{rax}"}, /*output=*/{"={rax}", "+*m"}) )
+ {
+ m_of << indent << "InterlockedCompareExchangeAcquire(";
+ emit_lvalue(e.outputs[1].second); m_of << ",";
+ emit_lvalue(e.inputs[0].second); m_of << ",";
+ emit_lvalue(e.inputs[1].second);
+ m_of << ");\n";
+ return ;
+ }
+ else if( matches_template("xrelease; lock; cmpxchgl $2, $1", /*input=*/{"r", "{rax}"}, /*output=*/{"={rax}", "+*m"}) )
+ {
+ m_of << indent << "InterlockedCompareExchangeRelease(";
+ emit_lvalue(e.outputs[1].second); m_of << ",";
+ emit_lvalue(e.inputs[0].second); m_of << ",";
+ emit_lvalue(e.inputs[1].second);
+ m_of << ");\n";
+ return ;
+ }
+ else if( matches_template("xacquire; lock; cmpxchgq $2, $1", /*input=*/{"r", "{rax}"}, /*output=*/{"={rax}", "+*m"}) )
+ {
+ m_of << indent << "InterlockedCompareExchange64Acquire(";
+ emit_lvalue(e.outputs[1].second); m_of << ",";
+ emit_lvalue(e.inputs[0].second); m_of << ",";
+ emit_lvalue(e.inputs[1].second);
+ m_of << ");\n";
+ return ;
+ }
+ else if( matches_template("xrelease; lock; cmpxchgq $2, $1", /*input=*/{"r", "{rax}"}, /*output=*/{"={rax}", "+*m"}) )
+ {
+ m_of << indent << "InterlockedCompareExchange64Release(";
+ emit_lvalue(e.outputs[1].second); m_of << ",";
+ emit_lvalue(e.inputs[0].second); m_of << ",";
+ emit_lvalue(e.inputs[1].second);
+ m_of << ");\n";
+ return ;
+ }
else
{
// No hard-coded translations.