src/hotspot/cpu/ppc/stubGenerator_ppc.cpp
changeset 49376 7cd503c499a0
parent 49347 edb65305d3ac
child 49455 848864ed9b17
child 56348 f3b0961adb3c
equal deleted inserted replaced
49375:9453739cb5b0 49376:7cd503c499a0
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * Copyright (c) 2012, 2017, SAP SE. All rights reserved.
     3  * Copyright (c) 2012, 2018, SAP SE. All rights reserved.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5  *
     5  *
     6  * This code is free software; you can redistribute it and/or modify it
     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
     7  * under the terms of the GNU General Public License version 2 only, as
     8  * published by the Free Software Foundation.
     8  * published by the Free Software Foundation.
  3625     StubCodeMark mark(this, "StubRoutines", name);
  3625     StubCodeMark mark(this, "StubRoutines", name);
  3626     address start = __ function_entry();  // Remember stub start address (is rtn value).
  3626     address start = __ function_entry();  // Remember stub start address (is rtn value).
  3627 
  3627 
  3628     const Register table   = R6;       // crc table address
  3628     const Register table   = R6;       // crc table address
  3629 
  3629 
  3630 #ifdef VM_LITTLE_ENDIAN
       
  3631     // arguments to kernel_crc32:
  3630     // arguments to kernel_crc32:
  3632     const Register crc     = R3_ARG1;  // Current checksum, preset by caller or result from previous call.
  3631     const Register crc     = R3_ARG1;  // Current checksum, preset by caller or result from previous call.
  3633     const Register data    = R4_ARG2;  // source byte array
  3632     const Register data    = R4_ARG2;  // source byte array
  3634     const Register dataLen = R5_ARG3;  // #bytes to process
  3633     const Register dataLen = R5_ARG3;  // #bytes to process
  3635 
  3634 
  3648 
  3647 
  3649       StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
  3648       StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
  3650       StubRoutines::ppc64::generate_load_crc_constants_addr(_masm, constants);
  3649       StubRoutines::ppc64::generate_load_crc_constants_addr(_masm, constants);
  3651       StubRoutines::ppc64::generate_load_crc_barret_constants_addr(_masm, bconstants);
  3650       StubRoutines::ppc64::generate_load_crc_barret_constants_addr(_masm, bconstants);
  3652 
  3651 
  3653       __ kernel_crc32_1word_vpmsumd(crc, data, dataLen, table, constants, bconstants, t0, t1, t2, t3, t4, true);
  3652       __ kernel_crc32_1word_vpmsum(crc, data, dataLen, table, constants, bconstants, t0, t1, t2, t3, t4, true);
  3654 
  3653 
  3655       BLOCK_COMMENT("return");
  3654       BLOCK_COMMENT("return");
  3656       __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
  3655       __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
  3657       __ blr();
  3656       __ blr();
  3658 
  3657 
  3659       BLOCK_COMMENT("} Stub body");
  3658       BLOCK_COMMENT("} Stub body");
  3660     } else
  3659     } else {
  3661 #endif
       
  3662     {
       
  3663       StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
  3660       StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
  3664       generate_CRC_updateBytes(name, table, true);
  3661       generate_CRC_updateBytes(name, table, true);
  3665     }
  3662     }
  3666 
  3663 
  3667     return start;
  3664     return start;
  3688     StubCodeMark mark(this, "StubRoutines", name);
  3685     StubCodeMark mark(this, "StubRoutines", name);
  3689     address start = __ function_entry();  // Remember stub start address (is rtn value).
  3686     address start = __ function_entry();  // Remember stub start address (is rtn value).
  3690 
  3687 
  3691     const Register table   = R6;       // crc table address
  3688     const Register table   = R6;       // crc table address
  3692 
  3689 
  3693 #if 0   // no vector support yet for CRC32C
       
  3694 #ifdef VM_LITTLE_ENDIAN
       
  3695     // arguments to kernel_crc32:
  3690     // arguments to kernel_crc32:
  3696     const Register crc     = R3_ARG1;  // Current checksum, preset by caller or result from previous call.
  3691     const Register crc     = R3_ARG1;  // Current checksum, preset by caller or result from previous call.
  3697     const Register data    = R4_ARG2;  // source byte array
  3692     const Register data    = R4_ARG2;  // source byte array
  3698     const Register dataLen = R5_ARG3;  // #bytes to process
  3693     const Register dataLen = R5_ARG3;  // #bytes to process
  3699 
  3694 
  3712 
  3707 
  3713       StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table);
  3708       StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table);
  3714       StubRoutines::ppc64::generate_load_crc32c_constants_addr(_masm, constants);
  3709       StubRoutines::ppc64::generate_load_crc32c_constants_addr(_masm, constants);
  3715       StubRoutines::ppc64::generate_load_crc32c_barret_constants_addr(_masm, bconstants);
  3710       StubRoutines::ppc64::generate_load_crc32c_barret_constants_addr(_masm, bconstants);
  3716 
  3711 
  3717       __ kernel_crc32_1word_vpmsumd(crc, data, dataLen, table, constants, bconstants, t0, t1, t2, t3, t4, false);
  3712       __ kernel_crc32_1word_vpmsum(crc, data, dataLen, table, constants, bconstants, t0, t1, t2, t3, t4, false);
  3718 
  3713 
  3719       BLOCK_COMMENT("return");
  3714       BLOCK_COMMENT("return");
  3720       __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
  3715       __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
  3721       __ blr();
  3716       __ blr();
  3722 
  3717 
  3723       BLOCK_COMMENT("} Stub body");
  3718       BLOCK_COMMENT("} Stub body");
  3724     } else
  3719     } else {
  3725 #endif
       
  3726 #endif
       
  3727     {
       
  3728       StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table);
  3720       StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table);
  3729       generate_CRC_updateBytes(name, table, false);
  3721       generate_CRC_updateBytes(name, table, false);
  3730     }
  3722     }
  3731 
  3723 
  3732     return start;
  3724     return start;