1 /* 2 * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2012, 2016 SAP SE. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 800 void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart, 801 Register y, Register y_idx, Register z, 802 Register carry, Register product_high, Register product, 803 Register idx, Register kdx, Register tmp); 804 void multiply_add_128_x_128(Register x_xstart, Register y, Register z, 805 Register yz_idx, Register idx, Register carry, 806 Register product_high, Register product, Register tmp, 807 int offset); 808 void multiply_128_x_128_loop(Register x_xstart, 809 Register y, Register z, 810 Register yz_idx, Register idx, Register carry, 811 Register product_high, Register product, 812 Register carry2, Register tmp); 813 void multiply_to_len(Register x, Register xlen, 814 Register y, Register ylen, 815 Register z, Register zlen, 816 Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5, 817 Register tmp6, Register tmp7, Register tmp8, Register tmp9, Register tmp10, 818 Register tmp11, Register tmp12, Register tmp13); 819 820 // CRC32 Intrinsics. 821 void load_reverse_32(Register dst, Register src); 822 int crc32_table_columns(Register table, Register tc0, Register tc1, Register tc2, Register tc3); 823 void fold_byte_crc32(Register crc, Register val, Register table, Register tmp); 824 void fold_8bit_crc32(Register crc, Register table, Register tmp); 825 void update_byte_crc32(Register crc, Register val, Register table); 826 void update_byteLoop_crc32(Register crc, Register buf, Register len, Register table, 827 Register data, bool loopAlignment, bool invertCRC); 828 void update_1word_crc32(Register crc, Register buf, Register table, int bufDisp, int bufInc, 829 Register t0, Register t1, Register t2, Register t3, 830 Register tc0, Register tc1, Register tc2, Register tc3); 831 void kernel_crc32_2word(Register crc, Register buf, Register len, Register table, 832 Register t0, Register t1, Register t2, Register t3, 833 Register tc0, Register tc1, Register tc2, Register tc3); 834 void kernel_crc32_1word(Register crc, Register buf, Register len, Register table, 835 Register t0, Register t1, Register t2, Register t3, 836 Register tc0, Register tc1, Register tc2, Register tc3); 837 void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table, 838 Register t0, Register t1, Register t2, Register t3); 839 void kernel_crc32_1word_vpmsumd(Register crc, Register buf, Register len, Register table, 840 Register constants, Register barretConstants, 841 Register t0, Register t1, Register t2, Register t3, Register t4); 842 void kernel_crc32_1word_aligned(Register crc, Register buf, Register len, 843 Register constants, Register barretConstants, 844 Register t0, Register t1, Register t2); 845 846 void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp); 847 848 // 849 // Debugging 850 // 851 852 // assert on cr0 853 void asm_assert(bool check_equal, const char* msg, int id); 854 void asm_assert_eq(const char* msg, int id) { asm_assert(true, msg, id); } 855 void asm_assert_ne(const char* msg, int id) { asm_assert(false, msg, id); } 856 857 private: 858 void asm_assert_mems_zero(bool check_equal, int size, int mem_offset, Register mem_base, 859 const char* msg, int id); 860 861 public: 862 863 void asm_assert_mem8_is_zero(int mem_offset, Register mem_base, const char* msg, int id) { 864 asm_assert_mems_zero(true, 8, mem_offset, mem_base, msg, id); 865 } 866 void asm_assert_mem8_isnot_zero(int mem_offset, Register mem_base, const char* msg, int id) { | 1 /* 2 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2012, 2017, SAP SE. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 800 void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart, 801 Register y, Register y_idx, Register z, 802 Register carry, Register product_high, Register product, 803 Register idx, Register kdx, Register tmp); 804 void multiply_add_128_x_128(Register x_xstart, Register y, Register z, 805 Register yz_idx, Register idx, Register carry, 806 Register product_high, Register product, Register tmp, 807 int offset); 808 void multiply_128_x_128_loop(Register x_xstart, 809 Register y, Register z, 810 Register yz_idx, Register idx, Register carry, 811 Register product_high, Register product, 812 Register carry2, Register tmp); 813 void multiply_to_len(Register x, Register xlen, 814 Register y, Register ylen, 815 Register z, Register zlen, 816 Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5, 817 Register tmp6, Register tmp7, Register tmp8, Register tmp9, Register tmp10, 818 Register tmp11, Register tmp12, Register tmp13); 819 820 // Emitters for CRC32 calculation. 821 // A note on invertCRC: 822 // Unfortunately, internal representation of crc differs between CRC32 and CRC32C. 823 // CRC32 holds it's current crc value in the externally visible representation. 824 // CRC32C holds it's current crc value in internal format, ready for updating. 825 // Thus, the crc value must be bit-flipped before updating it in the CRC32 case. 826 // In the CRC32C case, it must be bit-flipped when it is given to the outside world (getValue()). 827 // The bool invertCRC parameter indicates whether bit-flipping is required before updates. 828 void load_reverse_32(Register dst, Register src); 829 int crc32_table_columns(Register table, Register tc0, Register tc1, Register tc2, Register tc3); 830 void fold_byte_crc32(Register crc, Register val, Register table, Register tmp); 831 void fold_8bit_crc32(Register crc, Register table, Register tmp); 832 void update_byte_crc32(Register crc, Register val, Register table); 833 void update_byteLoop_crc32(Register crc, Register buf, Register len, Register table, 834 Register data, bool loopAlignment); 835 void update_1word_crc32(Register crc, Register buf, Register table, int bufDisp, int bufInc, 836 Register t0, Register t1, Register t2, Register t3, 837 Register tc0, Register tc1, Register tc2, Register tc3); 838 void kernel_crc32_2word(Register crc, Register buf, Register len, Register table, 839 Register t0, Register t1, Register t2, Register t3, 840 Register tc0, Register tc1, Register tc2, Register tc3, 841 bool invertCRC); 842 void kernel_crc32_1word(Register crc, Register buf, Register len, Register table, 843 Register t0, Register t1, Register t2, Register t3, 844 Register tc0, Register tc1, Register tc2, Register tc3, 845 bool invertCRC); 846 void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table, 847 Register t0, Register t1, Register t2, Register t3, 848 bool invertCRC); 849 void kernel_crc32_1word_vpmsumd(Register crc, Register buf, Register len, Register table, 850 Register constants, Register barretConstants, 851 Register t0, Register t1, Register t2, Register t3, Register t4, 852 bool invertCRC); 853 void kernel_crc32_1word_aligned(Register crc, Register buf, Register len, 854 Register constants, Register barretConstants, 855 Register t0, Register t1, Register t2); 856 857 void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp, 858 bool invertCRC); 859 void kernel_crc32_singleByteReg(Register crc, Register val, Register table, 860 bool invertCRC); 861 862 // 863 // Debugging 864 // 865 866 // assert on cr0 867 void asm_assert(bool check_equal, const char* msg, int id); 868 void asm_assert_eq(const char* msg, int id) { asm_assert(true, msg, id); } 869 void asm_assert_ne(const char* msg, int id) { asm_assert(false, msg, id); } 870 871 private: 872 void asm_assert_mems_zero(bool check_equal, int size, int mem_offset, Register mem_base, 873 const char* msg, int id); 874 875 public: 876 877 void asm_assert_mem8_is_zero(int mem_offset, Register mem_base, const char* msg, int id) { 878 asm_assert_mems_zero(true, 8, mem_offset, mem_base, msg, id); 879 } 880 void asm_assert_mem8_isnot_zero(int mem_offset, Register mem_base, const char* msg, int id) { |