@@ -5344,42 +5344,6 @@ void MacroAssembler::add2_with_carry(Register final_dest_hi, Register dest_hi, R
53445344 add (final_dest_hi, dest_hi, carry);
53455345}
53465346
5347- /* *
5348- * Multiply 32 bit by 32 bit first loop.
5349- */
5350- void MacroAssembler::multiply_32_x_32_loop (Register x, Register xstart, Register x_xstart,
5351- Register y, Register y_idx, Register z,
5352- Register carry, Register product,
5353- Register idx, Register kdx) {
5354- // jlong carry, x[], y[], z[];
5355- // for (int idx=ystart, kdx=ystart+1+xstart; idx >= 0; idx--, kdx--) {
5356- // long product = y[idx] * x[xstart] + carry;
5357- // z[kdx] = (int)product;
5358- // carry = product >>> 32;
5359- // }
5360- // z[xstart] = (int)carry;
5361-
5362- Label L_first_loop, L_first_loop_exit;
5363- blez (idx, L_first_loop_exit);
5364-
5365- shadd (t0, xstart, x, t0, LogBytesPerInt);
5366- lwu (x_xstart, Address (t0, 0 ));
5367-
5368- bind (L_first_loop);
5369- subiw (idx, idx, 1 );
5370- shadd (t0, idx, y, t0, LogBytesPerInt);
5371- lwu (y_idx, Address (t0, 0 ));
5372- mul (product, x_xstart, y_idx);
5373- add (product, product, carry);
5374- srli (carry, product, 32 );
5375- subiw (kdx, kdx, 1 );
5376- shadd (t0, kdx, z, t0, LogBytesPerInt);
5377- sw (product, Address (t0, 0 ));
5378- bgtz (idx, L_first_loop);
5379-
5380- bind (L_first_loop_exit);
5381- }
5382-
53835347/* *
53845348 * Multiply 64 bit by 64 bit first loop.
53855349 */
@@ -5596,77 +5560,16 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi
55965560 const Register carry = tmp5;
55975561 const Register product = xlen;
55985562 const Register x_xstart = tmp0;
5563+ const Register jdx = tmp1;
55995564
56005565 mv (idx, ylen); // idx = ylen;
56015566 addw (kdx, xlen, ylen); // kdx = xlen+ylen;
56025567 mv (carry, zr); // carry = 0;
56035568
5604- Label L_multiply_64_x_64_loop, L_done;
5605-
5569+ Label L_done;
56065570 subiw (xstart, xlen, 1 );
56075571 bltz (xstart, L_done);
56085572
5609- const Register jdx = tmp1;
5610-
5611- if (AvoidUnalignedAccesses) {
5612- int base_offset = arrayOopDesc::base_offset_in_bytes (T_INT);
5613- assert ((base_offset % (UseCompactObjectHeaders ? 4 :
5614- (UseCompressedClassPointers ? 8 : 4 ))) == 0 , " Must be" );
5615-
5616- if ((base_offset % 8 ) == 0 ) {
5617- // multiply_64_x_64_loop emits 8-byte load/store to access two elements
5618- // at a time from int arrays x and y. When base_offset is 8 bytes, these
5619- // accesses are naturally aligned if both xlen and ylen are even numbers.
5620- orr (t0, xlen, ylen);
5621- test_bit (t0, t0, 0 );
5622- beqz (t0, L_multiply_64_x_64_loop);
5623- }
5624-
5625- Label L_second_loop_unaligned, L_third_loop, L_third_loop_exit;
5626-
5627- multiply_32_x_32_loop (x, xstart, x_xstart, y, y_idx, z, carry, product, idx, kdx);
5628- shadd (t0, xstart, z, t0, LogBytesPerInt);
5629- sw (carry, Address (t0, 0 ));
5630-
5631- bind (L_second_loop_unaligned);
5632- mv (carry, zr);
5633- mv (jdx, ylen);
5634- subiw (xstart, xstart, 1 );
5635- bltz (xstart, L_done);
5636-
5637- subi (sp, sp, 2 * wordSize);
5638- sd (z, Address (sp, 0 ));
5639- sd (zr, Address (sp, wordSize));
5640- shadd (t0, xstart, z, t0, LogBytesPerInt);
5641- addi (z, t0, 4 );
5642- shadd (t0, xstart, x, t0, LogBytesPerInt);
5643- lwu (product, Address (t0, 0 ));
5644-
5645- blez (jdx, L_third_loop_exit);
5646-
5647- bind (L_third_loop);
5648- subiw (jdx, jdx, 1 );
5649- shadd (t0, jdx, y, t0, LogBytesPerInt);
5650- lwu (t0, Address (t0, 0 ));
5651- mul (t1, t0, product);
5652- add (t0, t1, carry);
5653- shadd (tmp6, jdx, z, t1, LogBytesPerInt);
5654- lwu (t1, Address (tmp6, 0 ));
5655- add (t0, t0, t1);
5656- sw (t0, Address (tmp6, 0 ));
5657- srli (carry, t0, 32 );
5658- bgtz (jdx, L_third_loop);
5659-
5660- bind (L_third_loop_exit);
5661- ld (z, Address (sp, 0 ));
5662- addi (sp, sp, 2 * wordSize);
5663- shadd (t0, xstart, z, t0, LogBytesPerInt);
5664- sw (carry, Address (t0, 0 ));
5665-
5666- j (L_second_loop_unaligned);
5667- }
5668-
5669- bind (L_multiply_64_x_64_loop);
56705573 multiply_64_x_64_loop (x, xstart, x_xstart, y, y_idx, z, carry, product, idx, kdx);
56715574
56725575 Label L_second_loop_aligned;
0 commit comments