Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: src/compiler/mips/code-generator-mips.cc

Issue 2477453005: MIPS[64]: Optimize kMips[64]Tst in code-generator-mips[64].cc (Closed)
Patch Set: Address code review remarks Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/mips/instruction-selector-mips.cc » ('j') | src/mips64/macro-assembler-mips64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/mips/code-generator-mips.cc
diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc
index ee374798b1e309df37be2e6ee4ae767ed6e69a4d..6324614ee06572002030bfbacd0409defc51bfb1 100644
--- a/src/compiler/mips/code-generator-mips.cc
+++ b/src/compiler/mips/code-generator-mips.cc
@@ -1716,8 +1716,15 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr,
if (instr->arch_opcode() == kMipsTst) {
cc = FlagsConditionToConditionTst(condition);
- __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1));
- __ Sltu(result, zero_reg, kScratchReg);
+ if (instr->InputAt(1)->IsImmediate() &&
+ base::bits::IsPowerOfTwo32(i.InputOperand(1).immediate())) {
+ uint16_t pos =
+ base::bits::CountTrailingZeros32(i.InputOperand(1).immediate());
+ __ Ext(result, i.InputRegister(0), pos, 1);
+ } else {
+ __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1));
+ __ Sltu(result, zero_reg, kScratchReg);
+ }
if (cc == eq) {
// Sltu produces 0 for equality, invert the result.
__ xori(result, result, 1);
« no previous file with comments | « no previous file | src/compiler/mips/instruction-selector-mips.cc » ('j') | src/mips64/macro-assembler-mips64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698