comparison src/cpu/ppc/vm/stubGenerator_ppc.cpp @ 8979:bcccbecdde63

8131048: ppc implement CRC32 intrinsic Reviewed-by: goetz
author gromero
date Mon, 24 Sep 2018 17:18:38 -0400
parents 9575483cce09
children f892c3b6b651
comparison
equal deleted inserted replaced
8:197da85f0c93 9:aa052b136fbd
2471 *continuation_pc = __ pc(); 2471 *continuation_pc = __ pc();
2472 __ mr(R3_RET, R4_ARG2); 2472 __ mr(R3_RET, R4_ARG2);
2473 __ blr(); 2473 __ blr();
2474 } 2474 }
2475 2475
2476 /**
2477 * Arguments:
2478 *
2479 * Inputs:
2480 * R3_ARG1 - int crc
2481 * R4_ARG2 - byte* buf
2482 * R5_ARG3 - int length (of buffer)
2483 *
2484 * scratch:
2485 * R6_ARG4 - crc table address
2486 * R7_ARG5 - tmp1
2487 * R8_ARG6 - tmp2
2488 *
2489 * Ouput:
2490 * R3_RET - int crc result
2491 */
2492 // Compute CRC32 function.
2493 address generate_CRC32_updateBytes(const char* name) {
2494 __ align(CodeEntryAlignment);
2495 StubCodeMark mark(this, "StubRoutines", name);
2496 address start = __ function_entry(); // Remember stub start address (is rtn value).
2497
2498 // arguments to kernel_crc32:
2499 Register crc = R3_ARG1; // Current checksum, preset by caller or result from previous call.
2500 Register data = R4_ARG2; // source byte array
2501 Register dataLen = R5_ARG3; // #bytes to process
2502 Register table = R6_ARG4; // crc table address
2503
2504 Register t0 = R9; // work reg for kernel* emitters
2505 Register t1 = R10; // work reg for kernel* emitters
2506 Register t2 = R11; // work reg for kernel* emitters
2507 Register t3 = R12; // work reg for kernel* emitters
2508
2509 BLOCK_COMMENT("Stub body {");
2510 assert_different_registers(crc, data, dataLen, table);
2511
2512 StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
2513
2514 __ kernel_crc32_1byte(crc, data, dataLen, table, t0, t1, t2, t3);
2515
2516 BLOCK_COMMENT("return");
2517 __ mr_if_needed(R3_RET, crc); // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
2518 __ blr();
2519
2520 BLOCK_COMMENT("} Stub body");
2521 return start;
2522 }
2523
2476 // Initialization 2524 // Initialization
2477 void generate_initial() { 2525 void generate_initial() {
2478 // Generates all stubs and initializes the entry points 2526 // Generates all stubs and initializes the entry points
2479 2527
2480 // Entry points that exist in all platforms. 2528 // Entry points that exist in all platforms.
2489 2537
2490 // Build this early so it's available for the interpreter. 2538 // Build this early so it's available for the interpreter.
2491 StubRoutines::_throw_StackOverflowError_entry = 2539 StubRoutines::_throw_StackOverflowError_entry =
2492 generate_throw_exception("StackOverflowError throw_exception", 2540 generate_throw_exception("StackOverflowError throw_exception",
2493 CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false); 2541 CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);
2542
2543 // CRC32 Intrinsics.
2544 if (UseCRC32Intrinsics) {
2545 StubRoutines::_crc_table_adr = (address)StubRoutines::ppc64::_crc_table;
2546 StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes("CRC32_updateBytes");
2547 }
2494 } 2548 }
2495 2549
2496 void generate_all() { 2550 void generate_all() {
2497 // Generates all stubs and initializes the entry points 2551 // Generates all stubs and initializes the entry points
2498 2552