OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// | 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- 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 /// \file | 10 /// \file |
(...skipping 5309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5320 return nullptr; | 5320 return nullptr; |
5321 | 5321 |
5322 SizeT ZeroesAvailable = 0; | 5322 SizeT ZeroesAvailable = 0; |
5323 if (VarDef->getOp() == InstArithmetic::Shl) { | 5323 if (VarDef->getOp() == InstArithmetic::Shl) { |
5324 if (auto *ConstInt = | 5324 if (auto *ConstInt = |
5325 llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1))) { | 5325 llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1))) { |
5326 ZeroesAvailable = ConstInt->getValue(); | 5326 ZeroesAvailable = ConstInt->getValue(); |
5327 } | 5327 } |
5328 } else if (VarDef->getOp() == InstArithmetic::Mul) { | 5328 } else if (VarDef->getOp() == InstArithmetic::Mul) { |
5329 SizeT PowerOfTwo = 0; | 5329 SizeT PowerOfTwo = 0; |
5330 ConstantInteger32 *MultConst = | 5330 if (auto *MultConst = |
5331 llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(0)); | 5331 llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(0))) { |
5332 if (llvm::isPowerOf2_32(MultConst->getValue())) { | 5332 if (llvm::isPowerOf2_32(MultConst->getValue())) { |
5333 PowerOfTwo += MultConst->getValue(); | 5333 PowerOfTwo += MultConst->getValue(); |
| 5334 } |
5334 } | 5335 } |
5335 MultConst = llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1)); | 5336 if (auto *MultConst = |
5336 if (llvm::isPowerOf2_32(MultConst->getValue())) { | 5337 llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1))) { |
5337 PowerOfTwo += MultConst->getValue(); | 5338 if (llvm::isPowerOf2_32(MultConst->getValue())) { |
| 5339 PowerOfTwo += MultConst->getValue(); |
| 5340 } |
5338 } | 5341 } |
5339 ZeroesAvailable = llvm::Log2_32(PowerOfTwo) + 1; | 5342 ZeroesAvailable = llvm::Log2_32(PowerOfTwo) + 1; |
5340 } | 5343 } |
5341 SizeT ZeroesNeeded = llvm::Log2_32(Const->getValue()) + 1; | 5344 SizeT ZeroesNeeded = llvm::Log2_32(Const->getValue()) + 1; |
5342 if (ZeroesNeeded == 0 || ZeroesNeeded > ZeroesAvailable) | 5345 if (ZeroesNeeded == 0 || ZeroesNeeded > ZeroesAvailable) |
5343 return nullptr; | 5346 return nullptr; |
5344 IsAdd = true; // treat it as an add if the above conditions hold | 5347 IsAdd = true; // treat it as an add if the above conditions hold |
5345 } else { | 5348 } else { |
5346 IsAdd = ArithInst->getOp() == InstArithmetic::Add; | 5349 IsAdd = ArithInst->getOp() == InstArithmetic::Add; |
5347 } | 5350 } |
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8028 emitGlobal(*Var, SectionSuffix); | 8031 emitGlobal(*Var, SectionSuffix); |
8029 } | 8032 } |
8030 } | 8033 } |
8031 } break; | 8034 } break; |
8032 } | 8035 } |
8033 } | 8036 } |
8034 } // end of namespace X86NAMESPACE | 8037 } // end of namespace X86NAMESPACE |
8035 } // end of namespace Ice | 8038 } // end of namespace Ice |
8036 | 8039 |
8037 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 8040 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
OLD | NEW |