 Chromium Code Reviews
 Chromium Code Reviews Issue 362463002:
  Subzero: lower the rest of the atomic operations.  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
    
  
    Issue 362463002:
  Subzero: lower the rest of the atomic operations.  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master| Index: src/IceTargetLoweringX8632.h | 
| diff --git a/src/IceTargetLoweringX8632.h b/src/IceTargetLoweringX8632.h | 
| index 521c36e49e691386ff9dd8b4bc020434b84d3efc..693da663af56b5ac45513dba24ec135c87a3f987 100644 | 
| --- a/src/IceTargetLoweringX8632.h | 
| +++ b/src/IceTargetLoweringX8632.h | 
| @@ -94,9 +94,15 @@ protected: | 
| virtual void doAddressOptLoad(); | 
| virtual void doAddressOptStore(); | 
| + void lowerAtomicCmpxchg(Variable *DestPrev, Operand *Ptr, Operand *Expected, | 
| + Operand *Desired); | 
| void lowerAtomicRMW(Variable *Dest, uint32_t Operation, Operand *Ptr, | 
| Operand *Val); | 
| + typedef void (TargetX8632::*LowerBinOp)(Variable *, Operand *); | 
| + void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, | 
| + Variable *Dest, Operand *Ptr, Operand *Val); | 
| + | 
| // Operand legalization helpers. To deal with address mode | 
| // constraints, the helpers will create a new Operand and emit | 
| // instructions that guarantee that the Operand kind is one of those | 
| @@ -171,6 +177,21 @@ protected: | 
| void _cmp(Operand *Src0, Operand *Src1) { | 
| Context.insert(InstX8632Icmp::create(Func, Src0, Src1)); | 
| } | 
| + void _cmpxchg(Operand *DestOrAddr, Variable *Eax, Variable *Desired, | 
| 
Jim Stichnoth
2014/07/08 04:50:19
This is probably not worth doing now, but in the f
 
jvoung (off chromium)
2014/07/08 18:14:07
Yes that would be pretty sweet syntax.
The issue
 
jvoung (off chromium)
2014/07/09 17:07:56
As we discussed, I'll leave this alone for now. Th
 
Jim Stichnoth
2014/07/09 18:14:28
Yeah, I wouldn't like a separate lock instruction
 | 
| + bool Locked) { | 
| + Context.insert( | 
| + InstX8632Cmpxchg::create(Func, DestOrAddr, Eax, Desired, Locked)); | 
| + // Mark eax as possibly modified by cmpxchg. | 
| + Context.insert(InstFakeDef::create(Func, Eax)); | 
| + } | 
| + void _cmpxchg8b(OperandX8632 *Addr, Variable *Edx, Variable *Eax, | 
| + Variable *Ecx, Variable *Ebx, bool Locked) { | 
| + Context.insert( | 
| + InstX8632Cmpxchg8b::create(Func, Addr, Edx, Eax, Ecx, Ebx, Locked)); | 
| + // Mark edx, and eax as possibly modified by cmpxchg8b. | 
| + Context.insert(InstFakeDef::create(Func, Edx)); | 
| + Context.insert(InstFakeDef::create(Func, Eax)); | 
| + } | 
| void _cvt(Variable *Dest, Operand *Src0) { | 
| Context.insert(InstX8632Cvt::create(Func, Dest, Src0)); | 
| } | 
| @@ -217,6 +238,9 @@ protected: | 
| void _mulss(Variable *Dest, Operand *Src0) { | 
| Context.insert(InstX8632Mulss::create(Func, Dest, Src0)); | 
| } | 
| + void _neg(Variable *SrcDest) { | 
| + Context.insert(InstX8632Neg::create(Func, SrcDest)); | 
| + } | 
| void _or(Variable *Dest, Operand *Src0) { | 
| Context.insert(InstX8632Or::create(Func, Dest, Src0)); | 
| } | 
| @@ -272,6 +296,11 @@ protected: | 
| // Model that update with a FakeDef. | 
| Context.insert(InstFakeDef::create(Func, Src)); | 
| } | 
| + void _xchg(Operand *Dest, Variable *Src) { | 
| + Context.insert(InstX8632Xchg::create(Func, Dest, Src)); | 
| + // The xchg modifies Dest and Src -- model that update with a FakeDef. | 
| + Context.insert(InstFakeDef::create(Func, Src)); | 
| 
Jim Stichnoth
2014/07/08 04:50:19
If (as suggested earlier) Dest becomes a Variable
 | 
| + } | 
| void _xor(Variable *Dest, Operand *Src0) { | 
| Context.insert(InstX8632Xor::create(Func, Dest, Src0)); | 
| } |