Author: zhuqing
Date: 2011-02-28 05:13:47 -0500 (Mon, 28 Feb 2011)
New Revision: 3496

Modified:
   trunk/osprey/be/cg/x8664/expand.cxx
Log:
Fix bug609. Implement multiply for type V8I1,M8I1,V16I1

Code Review: Sun Chan


Modified: trunk/osprey/be/cg/x8664/expand.cxx
===================================================================
--- trunk/osprey/be/cg/x8664/expand.cxx 2011-02-27 13:18:36 UTC (rev 3495)
+++ trunk/osprey/be/cg/x8664/expand.cxx 2011-02-28 10:13:47 UTC (rev 3496)
@@ -2176,7 +2176,7 @@
   FmtAssert( MTYPE_is_integral(mtype) && !MTYPE_is_mmx_vector(mtype),
              ("Should be handled in Expand_Flop") );
 
-  if ( mtype == MTYPE_V16I2 || mtype == MTYPE_V8I2 || mtype == MTYPE_V16I4 ) {
+  if ( mtype == MTYPE_V16I2 || mtype == MTYPE_V8I2 || mtype == MTYPE_V16I4 || 
mtype == MTYPE_V16I1) {
     Expand_Flop( OPCODE_make_op(OPR_MPY, mtype, MTYPE_V), 
                  result, src1, src2, NULL, ops );
     return;
@@ -5949,6 +5949,83 @@
     Expand_Complex_Divide(opcode, result, src1, src2, ops);
     return;
 
+  case OPC_V8I1MPY:
+  case OPC_M8I1MPY:
+  {
+      TN* tmp_a = Build_TN_Like( src1 );
+      TN* tmp_b = Build_TN_Like( src1 );
+      TN* tmp_c = Build_TN_Like( src1 );
+      TN* tmp_d = Build_TN_Like( src1 );
+      TN* tmp_e = Build_TN_Like( src1 );
+      TN* tmp_f = Build_TN_Like( src1 );
+      TN* tmp_g = Build_TN_Like( src1 );
+      TN* tmp_h = Build_TN_Like( src1 );
+      TN* tmp_i = Build_TN_Like( src1 );
+
+      Exp_COPY(tmp_a, src1, ops);
+      Exp_COPY(tmp_c, src2, ops);
+    
+      Build_OP(TOP_mov64_m, tmp_b, tmp_a, ops); 
+      Build_OP(TOP_punpckhbw, tmp_b, tmp_b, tmp_a, ops);
+      Build_OP(TOP_mov64_m, tmp_d, tmp_c, ops);
+      Build_OP(TOP_punpckhbw, tmp_d, tmp_d, tmp_c, ops);
+      Build_OP(TOP_mov64_m, tmp_e, tmp_a, ops);
+      Build_OP(TOP_punpcklbw, tmp_e, tmp_e, tmp_a, ops);
+      Build_OP(TOP_mov64_m, tmp_f, tmp_c, ops);
+      Build_OP(TOP_punpcklbw, tmp_f, tmp_c, tmp_c, ops);
+      Build_OP(TOP_mov64_m, tmp_g, tmp_b, ops);
+      Build_OP(TOP_pmullw, tmp_g, tmp_g, tmp_d, ops);
+      Build_OP(TOP_pmullw, tmp_f, tmp_f, tmp_e, ops);
+      Build_OP(TOP_mov64_m, tmp_h, tmp_f, ops);
+      Build_OP(TOP_punpckhbw, tmp_h, tmp_h, tmp_g, ops);
+      Build_OP(TOP_punpcklbw, tmp_f, tmp_f, tmp_g, ops);
+      Build_OP(TOP_mov64_m, tmp_i, tmp_f, ops);
+      Build_OP(TOP_punpckhbw, tmp_i, tmp_i, tmp_h, ops);
+      Build_OP(TOP_punpcklbw, tmp_f, tmp_f, tmp_h, ops);
+      Build_OP(TOP_punpcklbw, result, tmp_f, tmp_i, ops);
+  }
+  return; 
+         
+  case OPC_V16I1MPY:
+  {
+      TN* tmp_a = Build_TN_Like( src1 );
+      TN* tmp_b = Build_TN_Like( src1 );
+      TN* tmp_c = Build_TN_Like( src1 );
+      TN* tmp_d = Build_TN_Like( src1 );
+      TN* tmp_e = Build_TN_Like( src1 );
+      TN* tmp_f = Build_TN_Like( src1 );
+      TN* tmp_g = Build_TN_Like( src1 );
+      TN* tmp_h = Build_TN_Like( src1 );
+      TN* tmp_i = Build_TN_Like( src1 );
+      TN* tmp_j = Build_TN_Like( src1 );
+
+      Exp_COPY(tmp_a, src1, ops);
+      Exp_COPY(tmp_c, src2, ops);
+    
+      Build_OP(TOP_movdq, tmp_b, tmp_a, ops); 
+      Build_OP(TOP_punpckhbw128, tmp_b, tmp_b, tmp_a, ops);
+      Build_OP(TOP_movdq, tmp_d, tmp_c, ops);
+      Build_OP(TOP_punpckhbw128, tmp_d, tmp_d, tmp_c, ops);
+      Build_OP(TOP_movdq, tmp_e, tmp_a, ops);
+      Build_OP(TOP_punpcklbw128, tmp_e, tmp_e, tmp_a, ops);
+      Build_OP(TOP_movdq, tmp_f, tmp_c, ops);
+      Build_OP(TOP_punpcklbw128, tmp_f, tmp_c, tmp_c, ops);
+      Build_OP(TOP_movdq, tmp_g, tmp_b, ops);
+      Build_OP(TOP_pmullw128, tmp_g, tmp_g, tmp_d, ops);
+      Build_OP(TOP_pmullw128, tmp_f, tmp_f, tmp_e, ops);
+      Build_OP(TOP_movdq, tmp_h, tmp_f, ops);
+      Build_OP(TOP_punpckhbw128, tmp_h, tmp_h, tmp_g, ops);
+      Build_OP(TOP_punpcklbw128, tmp_f, tmp_f, tmp_g, ops);
+      Build_OP(TOP_movdq, tmp_i, tmp_f, ops);
+      Build_OP(TOP_punpckhbw128, tmp_i, tmp_i, tmp_h, ops);
+      Build_OP(TOP_punpcklbw128, tmp_f, tmp_f, tmp_h, ops);
+      Build_OP(TOP_movdq, tmp_j, tmp_f, ops);
+      Build_OP(TOP_punpckhbw128, tmp_j, tmp_j, tmp_i, ops);
+      Build_OP(TOP_punpcklbw128, tmp_f, tmp_f, tmp_i, ops);
+      Build_OP(TOP_punpcklbw128, result, tmp_f, tmp_j, ops);
+  }  
+   return;
+ 
   default:
     #pragma mips_frequency_hint NEVER
     FmtAssert(FALSE, ("Unimplemented flop: %s", OPCODE_name(opcode)));


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to