< prev index next >

src/cpu/aarch64/vm/macroAssembler_aarch64.cpp

Print this page




2823   ldp(z, ylen, Address(post(sp, 2 * wordSize)));
2824   ldp(x, xlen, Address(post(sp, 2 * wordSize)));   // copy old xstart -> xlen
2825 
2826   addw(tmp3, xlen, 1);
2827   strw(carry, Address(z, tmp3, Address::uxtw(LogBytesPerInt)));
2828   subsw(tmp3, tmp3, 1);
2829   br(Assembler::MI, L_done);
2830 
2831   lsr(carry, carry, 32);
2832   strw(carry, Address(z, tmp3, Address::uxtw(LogBytesPerInt)));
2833   b(L_second_loop);
2834 
2835   // Next infrequent code is moved outside loops.
2836   bind(L_last_x);
2837   ldrw(product_hi, Address(x,  0));
2838   b(L_third_loop_prologue);
2839 
2840   bind(L_done);
2841 }
2842 






































2843 /**
2844  * Emits code to update CRC-32 with a byte value according to constants in table
2845  *
2846  * @param [in,out]crc   Register containing the crc.
2847  * @param [in]val       Register containing the byte to fold into the CRC.
2848  * @param [in]table     Register containing the table of crc constants.
2849  *
2850  * uint32_t crc;
2851  * val = crc_table[(val ^ crc) & 0xFF];
2852  * crc = val ^ (crc >> 8);
2853  *
2854  */
2855 void MacroAssembler::update_byte_crc32(Register crc, Register val, Register table) {
2856   eor(val, val, crc);
2857   andr(val, val, 0xff);
2858   ldrw(val, Address(table, val, Address::lsl(2)));
2859   eor(crc, val, crc, Assembler::LSR, 8);
2860 }
2861 
2862 /**




2823   ldp(z, ylen, Address(post(sp, 2 * wordSize)));
2824   ldp(x, xlen, Address(post(sp, 2 * wordSize)));   // copy old xstart -> xlen
2825 
2826   addw(tmp3, xlen, 1);
2827   strw(carry, Address(z, tmp3, Address::uxtw(LogBytesPerInt)));
2828   subsw(tmp3, tmp3, 1);
2829   br(Assembler::MI, L_done);
2830 
2831   lsr(carry, carry, 32);
2832   strw(carry, Address(z, tmp3, Address::uxtw(LogBytesPerInt)));
2833   b(L_second_loop);
2834 
2835   // Next infrequent code is moved outside loops.
2836   bind(L_last_x);
2837   ldrw(product_hi, Address(x,  0));
2838   b(L_third_loop_prologue);
2839 
2840   bind(L_done);
2841 }
2842 
2843 // Code for BigInteger::mulAdd instrinsic
2844 // out     = r0
2845 // in      = r1
2846 // offset  = r2  (already out.length-offset)
2847 // len     = r3
2848 // k       = r4
2849 //
2850 // pseudo code from java implementation:
2851 // carry = 0;
2852 // offset = out.length-offset - 1;
2853 // for (int j=len-1; j >= 0; j--) {
2854 //     product = (in[j] & LONG_MASK) * kLong + (out[offset] & LONG_MASK) + carry;
2855 //     out[offset--] = (int)product;
2856 //     carry = product >>> 32;
2857 // }
2858 // return (int)carry;
2859 void MacroAssembler::mul_add(Register out, Register in, Register offset,
2860       Register len, Register k) {
2861     Label LOOP, END;
2862     // pre-loop
2863     cmp(len, zr); // cmp, not cbz/cbnz: to use condition twice => less branches
2864     csel(out, zr, out, Assembler::EQ);
2865     br(Assembler::EQ, END);
2866     add(in, in, len, LSL, 2); // in[j+1] address
2867     add(offset, out, offset, LSL, 2); // out[offset + 1] address
2868     mov(out, zr); // used to keep carry now
2869     BIND(LOOP);
2870     ldrw(rscratch1, Address(pre(in, -4)));
2871     madd(rscratch1, rscratch1, k, out);
2872     ldrw(rscratch2, Address(pre(offset, -4)));
2873     add(rscratch1, rscratch1, rscratch2);
2874     strw(rscratch1, Address(offset));
2875     lsr(out, rscratch1, 32);
2876     subs(len, len, 1);
2877     br(Assembler::NE, LOOP);
2878     BIND(END);
2879 }
2880 
2881 /**
2882  * Emits code to update CRC-32 with a byte value according to constants in table
2883  *
2884  * @param [in,out]crc   Register containing the crc.
2885  * @param [in]val       Register containing the byte to fold into the CRC.
2886  * @param [in]table     Register containing the table of crc constants.
2887  *
2888  * uint32_t crc;
2889  * val = crc_table[(val ^ crc) & 0xFF];
2890  * crc = val ^ (crc >> 8);
2891  *
2892  */
2893 void MacroAssembler::update_byte_crc32(Register crc, Register val, Register table) {
2894   eor(val, val, crc);
2895   andr(val, val, 0xff);
2896   ldrw(val, Address(table, val, Address::lsl(2)));
2897   eor(crc, val, crc, Assembler::LSR, 8);
2898 }
2899 
2900 /**


< prev index next >