Revision: 12657
Author:   [email protected]
Date:     Thu Oct  4 02:46:50 2012
Log:      MIPS: Changed "marked" nops to use sll(zero_reg, at, type).

We use marking bits in nops (in the 'sa' field) for debug markers, and for some IC stuff. A normal NOP in mips is sll(zero_reg, zero_reg, 0), where the 0 is a 5 bit immediate field in 'sa'.

See enum NopMarkerTypes at around line 654 of assembler-mips.h

The problem is that these markers use encodings that are reserved for the 'ssnop' and 'ehb' instructions. These are instructions used for hazard barriers.

It does not break anything, but it will slow things down a little bit as some pipeline stages are cleared, etc.

This commit changes the "marked" NOPs to sll(zero_reg, at, type) instructions, which is also a NOP operation on MIPS.

BUG=
TEST=

Review URL: https://codereview.chromium.org/10990110
Patch from Akos Palfi <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12657

Modified:
 /branches/bleeding_edge/src/mips/assembler-mips.cc
 /branches/bleeding_edge/src/mips/assembler-mips.h

=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.cc Mon Aug 6 07:13:09 2012 +++ /branches/bleeding_edge/src/mips/assembler-mips.cc Thu Oct 4 02:46:50 2012
@@ -580,17 +580,20 @@
   // See Assembler::nop(type).
   ASSERT(type < 32);
   uint32_t opcode = GetOpcodeField(instr);
+  uint32_t function = GetFunctionField(instr);
   uint32_t rt = GetRt(instr);
-  uint32_t rs = GetRs(instr);
+  uint32_t rd = GetRd(instr);
   uint32_t sa = GetSa(instr);

-  // nop(type) == sll(zero_reg, zero_reg, type);
-  // Technically all these values will be 0 but
-  // this makes more sense to the reader.
+  // Traditional mips nop == sll(zero_reg, zero_reg, 0)
+  // When marking non-zero type, use sll(zero_reg, at, type)
+  // to avoid use of mips ssnop and ehb special encodings
+  // of the sll instruction.

-  bool ret = (opcode == SLL &&
-              rt == static_cast<uint32_t>(ToNumber(zero_reg)) &&
-              rs == static_cast<uint32_t>(ToNumber(zero_reg)) &&
+  Register nop_rt_reg = (type == 0) ? zero_reg : at;
+  bool ret = (opcode == SPECIAL && function == SLL &&
+              rd == static_cast<uint32_t>(ToNumber(zero_reg)) &&
+              rt == static_cast<uint32_t>(ToNumber(nop_rt_reg)) &&
               sa == type);

   return ret;
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.h Mon Aug 6 07:13:09 2012 +++ /branches/bleeding_edge/src/mips/assembler-mips.h Thu Oct 4 02:46:50 2012
@@ -663,10 +663,13 @@
     FIRST_IC_MARKER = PROPERTY_ACCESS_INLINED
   };

-  // Type == 0 is the default non-marking type.
+  // Type == 0 is the default non-marking nop. For mips this is a
+  // sll(zero_reg, zero_reg, 0). We use rt_reg == at for non-zero
+  // marking, to avoid conflict with ssnop and ehb instructions.
   void nop(unsigned int type = 0) {
     ASSERT(type < 32);
-    sll(zero_reg, zero_reg, type, true);
+    Register nop_rt_reg = (type == 0) ? zero_reg : at;
+    sll(zero_reg, nop_rt_reg, type, true);
   }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to