Author: laijx
Date: 2012-01-18 05:12:40 -0500 (Wed, 18 Jan 2012)
New Revision: 3859

Modified:
   trunk/osprey/be/opt/opt_htable.cxx
Log:
Refix bug 830.
The original patch checked in by rev 3688 and 3689 exposed a performance 
degradation due to the instruction size for movl and movq is different. If the 
constant is not negative and less than 2^31, it's fine to use movl. So that we 
can save 1 byte here.
Since the difference between movl and movq only appears on x86, this change is 
made to be x86-specific. In this patch, only negative offset is handled because 
If the constant is greater than 2^31, I8/U8 will be used when CODEREP is 
created.

CR by Mei Ye. Thanks



Modified: trunk/osprey/be/opt/opt_htable.cxx
===================================================================
--- trunk/osprey/be/opt/opt_htable.cxx  2012-01-17 05:48:57 UTC (rev 3858)
+++ trunk/osprey/be/opt/opt_htable.cxx  2012-01-18 10:12:40 UTC (rev 3859)
@@ -2544,13 +2544,18 @@
   CODEREP          *retv;
   OPERATOR         oper = OPCODE_operator(opc);
 
-  // make sure the dtyp for constant base is Pointer_type
-  if (lbase != NULL && lbase->Kind() == CK_CONST 
+#if defined(TARG_X8664)
+  // make sure the dtyp for constant base is Pointer_type if the address
+  // is negative because movl on x86_64 does zero-ext.
+  if (lbase != NULL && lbase->Kind() == CK_CONST
+      && lbase->Const_val() + (INT64)ofst < 0
       && lbase->Dtyp() != Pointer_type)
     lbase->Set_dtyp_strictly(Pointer_type);
-  if (sbase != NULL && sbase->Kind() == CK_CONST 
+  if (sbase != NULL && sbase->Kind() == CK_CONST
+      && sbase->Const_val() + (INT64)ofst < 0
       && sbase->Dtyp() != Pointer_type)
     sbase->Set_dtyp_strictly(Pointer_type);
+#endif
 
   cr->Init_ivar(opc, dtyp, occ, dsctyp, lodty, lbase, sbase,
                ofst, size, field_id);


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to