Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file declares the InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 protected: | 1024 protected: |
| 1025 bool Locked; | 1025 bool Locked; |
| 1026 | 1026 |
| 1027 InstX8632Lockable(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, | 1027 InstX8632Lockable(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, |
| 1028 Variable *Dest, bool Locked) | 1028 Variable *Dest, bool Locked) |
| 1029 : InstX8632(Func, Kind, Maxsrcs, Dest), Locked(Locked) { | 1029 : InstX8632(Func, Kind, Maxsrcs, Dest), Locked(Locked) { |
| 1030 // Assume that such instructions are used for Atomics and be careful | 1030 // Assume that such instructions are used for Atomics and be careful |
| 1031 // with optimizations. | 1031 // with optimizations. |
| 1032 HasSideEffects = Locked; | 1032 HasSideEffects = Locked; |
| 1033 } | 1033 } |
| 1034 // emitPrefix() and emitSuffix() are a workaround for an apparent | |
| 1035 // llvm-mc bug in which "lock" is considered a separate instruction | |
| 1036 // and may be placed in a different bundle from the instruction | |
| 1037 // being locked, e.g.: | |
| 1038 // 1e: lock nop | |
| 1039 // 20: cmpxchg ... | |
|
jvoung (off chromium)
2015/02/23 17:58:36
Weird, I thought it would have been fixed by:
htt
Jim Stichnoth
2015/02/23 21:38:19
Aha! The szbuild.py was running llvm-mc with just
| |
| 1040 // The workaround is to emit an explicit bundle_lock/bundle_unlock | |
| 1041 // for instructions with a lock prefix. | |
| 1042 void emitPrefix(Ostream &Str) const { | |
| 1043 if (!ALLOW_DUMP) | |
| 1044 return; | |
| 1045 if (Locked) | |
| 1046 Str << "\t.bundle_lock\n"; | |
| 1047 } | |
| 1048 void emitSuffix(Ostream &Str) const { | |
| 1049 if (!ALLOW_DUMP) | |
| 1050 return; | |
| 1051 if (Locked) | |
| 1052 Str << "\n\t.bundle_unlock"; | |
| 1053 } | |
| 1034 ~InstX8632Lockable() override {} | 1054 ~InstX8632Lockable() override {} |
| 1035 }; | 1055 }; |
| 1036 | 1056 |
| 1037 // Mul instruction - unsigned multiply. | 1057 // Mul instruction - unsigned multiply. |
| 1038 class InstX8632Mul : public InstX8632 { | 1058 class InstX8632Mul : public InstX8632 { |
| 1039 InstX8632Mul(const InstX8632Mul &) = delete; | 1059 InstX8632Mul(const InstX8632Mul &) = delete; |
| 1040 InstX8632Mul &operator=(const InstX8632Mul &) = delete; | 1060 InstX8632Mul &operator=(const InstX8632Mul &) = delete; |
| 1041 | 1061 |
| 1042 public: | 1062 public: |
| 1043 static InstX8632Mul *create(Cfg *Func, Variable *Dest, Variable *Source1, | 1063 static InstX8632Mul *create(Cfg *Func, Variable *Dest, Variable *Source1, |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1604 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; | 1624 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; |
| 1605 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; | 1625 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; |
| 1606 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; | 1626 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; |
| 1607 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1627 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
| 1608 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; | 1628 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; |
| 1609 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; | 1629 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; |
| 1610 | 1630 |
| 1611 } // end of namespace Ice | 1631 } // end of namespace Ice |
| 1612 | 1632 |
| 1613 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1633 #endif // SUBZERO_SRC_ICEINSTX8632_H |
| OLD | NEW |