< prev index next >

src/cpu/s390/vm/macroAssembler_s390.cpp

Print this page

        

*** 1,8 **** /* ! * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,8 ---- /* ! * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. ! * Copyright (c) 2016, 2017, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 5882,5916 **** * @param crc register containing existing CRC (32-bit) * @param buf register pointing to input byte buffer (byte*) * @param len register containing number of bytes * @param table register pointing to CRC table */ ! void MacroAssembler::update_byteLoop_crc32(Register crc, Register buf, Register len, Register table, ! Register data, bool invertCRC) { assert_different_registers(crc, buf, len, table, data); Label L_mainLoop, L_done; const int mainLoop_stepping = 1; // Process all bytes in a single-byte loop. z_ltr(len, len); z_brnh(L_done); - if (invertCRC) { - not_(crc, noreg, false); // ~c - } - bind(L_mainLoop); z_llgc(data, Address(buf, (intptr_t)0));// Current byte of input buffer (zero extended). Avoids garbage in upper half of register. add2reg(buf, mainLoop_stepping); // Advance buffer position. update_byte_crc32(crc, data, table); z_brct(len, L_mainLoop); // Iterate. - if (invertCRC) { - not_(crc, noreg, false); // ~c - } - bind(L_done); } /** * Emits code to update CRC-32 with a 4-byte value according to constants in table. --- 5882,5907 ---- * @param crc register containing existing CRC (32-bit) * @param buf register pointing to input byte buffer (byte*) * @param len register containing number of bytes * @param table register pointing to CRC table */ ! void MacroAssembler::update_byteLoop_crc32(Register crc, Register buf, Register len, Register table, Register data) { assert_different_registers(crc, buf, len, table, data); Label L_mainLoop, L_done; const int mainLoop_stepping = 1; // Process all bytes in a single-byte loop. z_ltr(len, len); z_brnh(L_done); bind(L_mainLoop); z_llgc(data, Address(buf, (intptr_t)0));// Current byte of input buffer (zero extended). Avoids garbage in upper half of register. add2reg(buf, mainLoop_stepping); // Advance buffer position. update_byte_crc32(crc, data, table); z_brct(len, L_mainLoop); // Iterate. bind(L_done); } /** * Emits code to update CRC-32 with a 4-byte value according to constants in table.
*** 5964,5974 **** * @param table register pointing to CRC table * * uses Z_R10..Z_R13 as work register. Must be saved/restored by caller! */ void MacroAssembler::kernel_crc32_2word(Register crc, Register buf, Register len, Register table, ! Register t0, Register t1, Register t2, Register t3) { assert_different_registers(crc, buf, len, table); Label L_mainLoop, L_tail; Register data = t0; Register ctr = Z_R0; --- 5955,5966 ---- * @param table register pointing to CRC table * * uses Z_R10..Z_R13 as work register. Must be saved/restored by caller! */ void MacroAssembler::kernel_crc32_2word(Register crc, Register buf, Register len, Register table, ! Register t0, Register t1, Register t2, Register t3, ! bool invertCRC) { assert_different_registers(crc, buf, len, table); Label L_mainLoop, L_tail; Register data = t0; Register ctr = Z_R0;
*** 5979,5989 **** --- 5971,5983 ---- // Don't test for len <= 0 here. This pathological case should not occur anyway. // Optimizing for it by adding a test and a branch seems to be a waste of CPU cycles. // The situation itself is detected and handled correctly by the conditional branches // following aghi(len, -stepping) and aghi(len, +stepping). + if (invertCRC) { not_(crc, noreg, false); // 1s complement of crc + } #if 0 { // Pre-mainLoop alignment did not show any positive effect on performance. // We leave the code in for reference. Maybe the vector instructions in z13 depend on alignment.
*** 5994,6004 **** // Align buf to word (4-byte) boundary. z_lcr(ctr, buf); rotate_then_insert(ctr, ctr, 62, 63, 0, true); // TODO: should set cc z_sgfr(len, ctr); // Remaining len after alignment. ! update_byteLoop_crc32(crc, buf, ctr, table, data, false); } #endif // Check for short (<mainLoop_stepping bytes) buffer. z_srag(ctr, len, log_stepping); --- 5988,5998 ---- // Align buf to word (4-byte) boundary. z_lcr(ctr, buf); rotate_then_insert(ctr, ctr, 62, 63, 0, true); // TODO: should set cc z_sgfr(len, ctr); // Remaining len after alignment. ! update_byteLoop_crc32(crc, buf, ctr, table, data); } #endif // Check for short (<mainLoop_stepping bytes) buffer. z_srag(ctr, len, log_stepping);
*** 6014,6026 **** z_lrvr(crc, crc); // Revert byte order back to original. // Process last few (<8) bytes of buffer. BIND(L_tail); ! update_byteLoop_crc32(crc, buf, len, table, data, false); not_(crc, noreg, false); // 1s complement of crc } /** * @param crc register containing existing CRC (32-bit) * @param buf register pointing to input byte buffer (byte*) --- 6008,6022 ---- z_lrvr(crc, crc); // Revert byte order back to original. // Process last few (<8) bytes of buffer. BIND(L_tail); ! update_byteLoop_crc32(crc, buf, len, table, data); + if (invertCRC) { not_(crc, noreg, false); // 1s complement of crc + } } /** * @param crc register containing existing CRC (32-bit) * @param buf register pointing to input byte buffer (byte*)
*** 6028,6038 **** * @param table register pointing to CRC table * * uses Z_R10..Z_R13 as work register. Must be saved/restored by caller! */ void MacroAssembler::kernel_crc32_1word(Register crc, Register buf, Register len, Register table, ! Register t0, Register t1, Register t2, Register t3) { assert_different_registers(crc, buf, len, table); Label L_mainLoop, L_tail; Register data = t0; Register ctr = Z_R0; --- 6024,6035 ---- * @param table register pointing to CRC table * * uses Z_R10..Z_R13 as work register. Must be saved/restored by caller! */ void MacroAssembler::kernel_crc32_1word(Register crc, Register buf, Register len, Register table, ! Register t0, Register t1, Register t2, Register t3, ! bool invertCRC) { assert_different_registers(crc, buf, len, table); Label L_mainLoop, L_tail; Register data = t0; Register ctr = Z_R0;
*** 6042,6052 **** --- 6039,6051 ---- // Don't test for len <= 0 here. This pathological case should not occur anyway. // Optimizing for it by adding a test and a branch seems to be a waste of CPU cycles. // The situation itself is detected and handled correctly by the conditional branches // following aghi(len, -stepping) and aghi(len, +stepping). + if (invertCRC) { not_(crc, noreg, false); // 1s complement of crc + } // Check for short (<4 bytes) buffer. z_srag(ctr, len, log_stepping); z_brnh(L_tail);
*** 6058,6095 **** z_brct(ctr, L_mainLoop); // Iterate. z_lrvr(crc, crc); // Revert byte order back to original. // Process last few (<8) bytes of buffer. BIND(L_tail); ! update_byteLoop_crc32(crc, buf, len, table, data, false); not_(crc, noreg, false); // 1s complement of crc } /** * @param crc register containing existing CRC (32-bit) * @param buf register pointing to input byte buffer (byte*) * @param len register containing number of bytes * @param table register pointing to CRC table */ void MacroAssembler::kernel_crc32_1byte(Register crc, Register buf, Register len, Register table, ! Register t0, Register t1, Register t2, Register t3) { assert_different_registers(crc, buf, len, table); Register data = t0; ! update_byteLoop_crc32(crc, buf, len, table, data, true); } ! void MacroAssembler::kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp) { assert_different_registers(crc, buf, len, table, tmp); ! not_(crc, noreg, false); // ~c z_llgc(tmp, Address(buf, (intptr_t)0)); // Current byte of input buffer (zero extended). Avoids garbage in upper half of register. update_byte_crc32(crc, tmp, table); ! not_(crc, noreg, false); // ~c } // // Code for BigInteger::multiplyToLen() intrinsic. // --- 6057,6125 ---- z_brct(ctr, L_mainLoop); // Iterate. z_lrvr(crc, crc); // Revert byte order back to original. // Process last few (<8) bytes of buffer. BIND(L_tail); ! update_byteLoop_crc32(crc, buf, len, table, data); + if (invertCRC) { not_(crc, noreg, false); // 1s complement of crc + } } /** * @param crc register containing existing CRC (32-bit) * @param buf register pointing to input byte buffer (byte*) * @param len register containing number of bytes * @param table register pointing to CRC table */ void MacroAssembler::kernel_crc32_1byte(Register crc, Register buf, Register len, Register table, ! Register t0, Register t1, Register t2, Register t3, ! bool invertCRC) { assert_different_registers(crc, buf, len, table); Register data = t0; ! if (invertCRC) { ! not_(crc, noreg, false); // 1s complement of crc ! } ! ! update_byteLoop_crc32(crc, buf, len, table, data); ! ! if (invertCRC) { ! not_(crc, noreg, false); // 1s complement of crc ! } } ! void MacroAssembler::kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp, ! bool invertCRC) { assert_different_registers(crc, buf, len, table, tmp); ! if (invertCRC) { ! not_(crc, noreg, false); // 1s complement of crc ! } z_llgc(tmp, Address(buf, (intptr_t)0)); // Current byte of input buffer (zero extended). Avoids garbage in upper half of register. update_byte_crc32(crc, tmp, table); ! if (invertCRC) { ! not_(crc, noreg, false); // 1s complement of crc ! } ! } ! ! void MacroAssembler::kernel_crc32_singleByteReg(Register crc, Register val, Register table, ! bool invertCRC) { ! assert_different_registers(crc, val, table); ! ! if (invertCRC) { ! not_(crc, noreg, false); // 1s complement of crc ! } ! ! update_byte_crc32(crc, val, table); ! ! if (invertCRC) { ! not_(crc, noreg, false); // 1s complement of crc ! } } // // Code for BigInteger::multiplyToLen() intrinsic. //
< prev index next >