2289 void MacroAssembler::add2_with_carry(Register final_dest_hi, Register dest_hi, Register dest_lo,
2290 Register src1, Register src2) {
2291 adds(dest_lo, dest_lo, src1);
2292 adc(dest_hi, dest_hi, zr);
2293 adds(dest_lo, dest_lo, src2);
2294 adc(final_dest_hi, dest_hi, zr);
2295 }
2296
2297 // Generate an address from (r + r1 extend offset). "size" is the
2298 // size of the operand. The result may be in rscratch2.
2299 Address MacroAssembler::offsetted_address(Register r, Register r1,
2300 Address::extend ext, int offset, int size) {
2301 if (offset || (ext.shift() % size != 0)) {
2302 lea(rscratch2, Address(r, r1, ext));
2303 return Address(rscratch2, offset);
2304 } else {
2305 return Address(r, r1, ext);
2306 }
2307 }
2308
2309 /**
2310 * Multiply 64 bit by 64 bit first loop.
2311 */
2312 void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
2313 Register y, Register y_idx, Register z,
2314 Register carry, Register product,
2315 Register idx, Register kdx) {
2316 //
2317 // jlong carry, x[], y[], z[];
2318 // for (int idx=ystart, kdx=ystart+1+xstart; idx >= 0; idx-, kdx--) {
2319 // huge_128 product = y[idx] * x[xstart] + carry;
2320 // z[kdx] = (jlong)product;
2321 // carry = (jlong)(product >>> 64);
2322 // }
2323 // z[xstart] = carry;
2324 //
2325
2326 Label L_first_loop, L_first_loop_exit;
2327 Label L_one_x, L_one_y, L_multiply;
2328
|
2289 void MacroAssembler::add2_with_carry(Register final_dest_hi, Register dest_hi, Register dest_lo,
2290 Register src1, Register src2) {
2291 adds(dest_lo, dest_lo, src1);
2292 adc(dest_hi, dest_hi, zr);
2293 adds(dest_lo, dest_lo, src2);
2294 adc(final_dest_hi, dest_hi, zr);
2295 }
2296
2297 // Generate an address from (r + r1 extend offset). "size" is the
2298 // size of the operand. The result may be in rscratch2.
2299 Address MacroAssembler::offsetted_address(Register r, Register r1,
2300 Address::extend ext, int offset, int size) {
2301 if (offset || (ext.shift() % size != 0)) {
2302 lea(rscratch2, Address(r, r1, ext));
2303 return Address(rscratch2, offset);
2304 } else {
2305 return Address(r, r1, ext);
2306 }
2307 }
2308
2309 Address MacroAssembler::spill_address(int size, int offset, Register tmp)
2310 {
2311 assert(offset >= 0, "spill to negative address?");
2312 // Offset reachable ?
2313 // Not aligned - 9 bits signed offset
2314 // Aligned - 12 bits unsigned offset shifted
2315 Register base = sp;
2316 if ((offset & (size-1)) && offset >= (1<<8)) {
2317 add(tmp, base, offset & ((1<<12)-1));
2318 base = tmp;
2319 offset &= -1<<12;
2320 }
2321
2322 if (offset >= (1<<12) * size) {
2323 add(tmp, base, offset & (((1<<12)-1)<<12));
2324 base = tmp;
2325 offset &= ~(((1<<12)-1)<<12);
2326 }
2327
2328 return Address(base, offset);
2329 }
2330
2331 /**
2332 * Multiply 64 bit by 64 bit first loop.
2333 */
2334 void MacroAssembler::multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
2335 Register y, Register y_idx, Register z,
2336 Register carry, Register product,
2337 Register idx, Register kdx) {
2338 //
2339 // jlong carry, x[], y[], z[];
2340 // for (int idx=ystart, kdx=ystart+1+xstart; idx >= 0; idx-, kdx--) {
2341 // huge_128 product = y[idx] * x[xstart] + carry;
2342 // z[kdx] = (jlong)product;
2343 // carry = (jlong)(product >>> 64);
2344 // }
2345 // z[xstart] = carry;
2346 //
2347
2348 Label L_first_loop, L_first_loop_exit;
2349 Label L_one_x, L_one_y, L_multiply;
2350
|