< prev index next >

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

Print this page

 778     __ jcc(Assembler::negative, L); // NaN -> 0
 779     __ testq(c_rarg0, c_rarg0); // signed ? min_jlong : max_jlong
 780     __ mov64(c_rarg2, 0x8000000000000000);
 781     __ mov64(rax, 0x7fffffffffffffff);
 782     __ cmovq(Assembler::positive, c_rarg2, rax);
 783 
 784     __ bind(L);
 785     __ movq(inout, c_rarg2);
 786 
 787     __ pop(c_rarg0);
 788     __ pop(c_rarg1);
 789     __ pop(c_rarg2);
 790     __ pop(c_rarg3);
 791     __ pop(rax);
 792 
 793     __ ret(0);
 794 
 795     return start;
 796   }
 797 















 798   address generate_popcount_avx_lut(const char *stub_name) {
 799     __ align64();
 800     StubCodeMark mark(this, "StubRoutines", stub_name);
 801     address start = __ pc();
 802     __ emit_data64(0x0302020102010100, relocInfo::none);
 803     __ emit_data64(0x0403030203020201, relocInfo::none);
 804     __ emit_data64(0x0302020102010100, relocInfo::none);
 805     __ emit_data64(0x0403030203020201, relocInfo::none);
 806     __ emit_data64(0x0302020102010100, relocInfo::none);
 807     __ emit_data64(0x0403030203020201, relocInfo::none);
 808     __ emit_data64(0x0302020102010100, relocInfo::none);
 809     __ emit_data64(0x0403030203020201, relocInfo::none);
 810     return start;
 811   }
 812 
 813   address generate_iota_indices(const char *stub_name) {
 814     __ align(CodeEntryAlignment);
 815     StubCodeMark mark(this, "StubRoutines", stub_name);
 816     address start = __ pc();
 817     __ emit_data64(0x0706050403020100, relocInfo::none);
 818     __ emit_data64(0x0F0E0D0C0B0A0908, relocInfo::none);
 819     __ emit_data64(0x1716151413121110, relocInfo::none);
 820     __ emit_data64(0x1F1E1D1C1B1A1918, relocInfo::none);
 821     __ emit_data64(0x2726252423222120, relocInfo::none);
 822     __ emit_data64(0x2F2E2D2C2B2A2928, relocInfo::none);
 823     __ emit_data64(0x3736353433323130, relocInfo::none);
 824     __ emit_data64(0x3F3E3D3C3B3A3938, relocInfo::none);
 825     return start;
 826   }
 827 




























































 828   address generate_vector_byte_shuffle_mask(const char *stub_name) {
 829     __ align(CodeEntryAlignment);
 830     StubCodeMark mark(this, "StubRoutines", stub_name);
 831     address start = __ pc();
 832     __ emit_data64(0x7070707070707070, relocInfo::none);
 833     __ emit_data64(0x7070707070707070, relocInfo::none);
 834     __ emit_data64(0xF0F0F0F0F0F0F0F0, relocInfo::none);
 835     __ emit_data64(0xF0F0F0F0F0F0F0F0, relocInfo::none);
 836     return start;
 837   }
 838 
 839   address generate_fp_mask(const char *stub_name, int64_t mask) {
 840     __ align(CodeEntryAlignment);
 841     StubCodeMark mark(this, "StubRoutines", stub_name);
 842     address start = __ pc();
 843 
 844     __ emit_data64( mask, relocInfo::none );
 845     __ emit_data64( mask, relocInfo::none );
 846 
 847     return start;

7662     StubRoutines::x86::_vector_float_sign_mask = generate_vector_mask("vector_float_sign_mask", 0x7FFFFFFF7FFFFFFF);
7663     StubRoutines::x86::_vector_float_sign_flip = generate_vector_mask("vector_float_sign_flip", 0x8000000080000000);
7664     StubRoutines::x86::_vector_double_sign_mask = generate_vector_mask("vector_double_sign_mask", 0x7FFFFFFFFFFFFFFF);
7665     StubRoutines::x86::_vector_double_sign_flip = generate_vector_mask("vector_double_sign_flip", 0x8000000000000000);
7666     StubRoutines::x86::_vector_all_bits_set = generate_vector_mask("vector_all_bits_set", 0xFFFFFFFFFFFFFFFF);
7667     StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask("vector_int_mask_cmp_bits", 0x0000000100000001);
7668     StubRoutines::x86::_vector_short_to_byte_mask = generate_vector_mask("vector_short_to_byte_mask", 0x00ff00ff00ff00ff);
7669     StubRoutines::x86::_vector_byte_perm_mask = generate_vector_byte_perm_mask("vector_byte_perm_mask");
7670     StubRoutines::x86::_vector_int_to_byte_mask = generate_vector_mask("vector_int_to_byte_mask", 0x000000ff000000ff);
7671     StubRoutines::x86::_vector_int_to_short_mask = generate_vector_mask("vector_int_to_short_mask", 0x0000ffff0000ffff);
7672     StubRoutines::x86::_vector_32_bit_mask = generate_vector_custom_i32("vector_32_bit_mask", Assembler::AVX_512bit,
7673                                                                         0xFFFFFFFF, 0, 0, 0);
7674     StubRoutines::x86::_vector_64_bit_mask = generate_vector_custom_i32("vector_64_bit_mask", Assembler::AVX_512bit,
7675                                                                         0xFFFFFFFF, 0xFFFFFFFF, 0, 0);
7676     StubRoutines::x86::_vector_int_shuffle_mask = generate_vector_mask("vector_int_shuffle_mask", 0x0302010003020100);
7677     StubRoutines::x86::_vector_byte_shuffle_mask = generate_vector_byte_shuffle_mask("vector_byte_shuffle_mask");
7678     StubRoutines::x86::_vector_short_shuffle_mask = generate_vector_mask("vector_short_shuffle_mask", 0x0100010001000100);
7679     StubRoutines::x86::_vector_long_shuffle_mask = generate_vector_mask("vector_long_shuffle_mask", 0x0000000100000000);
7680     StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask("vector_long_sign_mask", 0x8000000000000000);
7681     StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices");





7682 
7683     if (UsePopCountInstruction && VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) {
7684       // lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight.
7685       StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut");
7686     }
7687 
7688     // support for verify_oop (must happen after universe_init)
7689     if (VerifyOops) {
7690       StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
7691     }
7692 
7693     // data cache line writeback
7694     StubRoutines::_data_cache_writeback = generate_data_cache_writeback();
7695     StubRoutines::_data_cache_writeback_sync = generate_data_cache_writeback_sync();
7696 
7697     // arraycopy stubs used by compilers
7698     generate_arraycopy_stubs();
7699 
7700     // don't bother generating these AES intrinsic stubs unless global flag is set
7701     if (UseAESIntrinsics) {
7702       StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask();  // needed by the others
7703       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();

 778     __ jcc(Assembler::negative, L); // NaN -> 0
 779     __ testq(c_rarg0, c_rarg0); // signed ? min_jlong : max_jlong
 780     __ mov64(c_rarg2, 0x8000000000000000);
 781     __ mov64(rax, 0x7fffffffffffffff);
 782     __ cmovq(Assembler::positive, c_rarg2, rax);
 783 
 784     __ bind(L);
 785     __ movq(inout, c_rarg2);
 786 
 787     __ pop(c_rarg0);
 788     __ pop(c_rarg1);
 789     __ pop(c_rarg2);
 790     __ pop(c_rarg3);
 791     __ pop(rax);
 792 
 793     __ ret(0);
 794 
 795     return start;
 796   }
 797 
 798   address generate_count_leading_zeros_lut(const char *stub_name) {
 799     __ align64();
 800     StubCodeMark mark(this, "StubRoutines", stub_name);
 801     address start = __ pc();
 802     __ emit_data64(0x0101010102020304, relocInfo::none);
 803     __ emit_data64(0x0000000000000000, relocInfo::none);
 804     __ emit_data64(0x0101010102020304, relocInfo::none);
 805     __ emit_data64(0x0000000000000000, relocInfo::none);
 806     __ emit_data64(0x0101010102020304, relocInfo::none);
 807     __ emit_data64(0x0000000000000000, relocInfo::none);
 808     __ emit_data64(0x0101010102020304, relocInfo::none);
 809     __ emit_data64(0x0000000000000000, relocInfo::none);
 810     return start;
 811   }
 812 
 813   address generate_popcount_avx_lut(const char *stub_name) {
 814     __ align64();
 815     StubCodeMark mark(this, "StubRoutines", stub_name);
 816     address start = __ pc();
 817     __ emit_data64(0x0302020102010100, relocInfo::none);
 818     __ emit_data64(0x0403030203020201, relocInfo::none);
 819     __ emit_data64(0x0302020102010100, relocInfo::none);
 820     __ emit_data64(0x0403030203020201, relocInfo::none);
 821     __ emit_data64(0x0302020102010100, relocInfo::none);
 822     __ emit_data64(0x0403030203020201, relocInfo::none);
 823     __ emit_data64(0x0302020102010100, relocInfo::none);
 824     __ emit_data64(0x0403030203020201, relocInfo::none);
 825     return start;
 826   }
 827 
 828   address generate_iota_indices(const char *stub_name) {
 829     __ align(CodeEntryAlignment);
 830     StubCodeMark mark(this, "StubRoutines", stub_name);
 831     address start = __ pc();
 832     __ emit_data64(0x0706050403020100, relocInfo::none);
 833     __ emit_data64(0x0F0E0D0C0B0A0908, relocInfo::none);
 834     __ emit_data64(0x1716151413121110, relocInfo::none);
 835     __ emit_data64(0x1F1E1D1C1B1A1918, relocInfo::none);
 836     __ emit_data64(0x2726252423222120, relocInfo::none);
 837     __ emit_data64(0x2F2E2D2C2B2A2928, relocInfo::none);
 838     __ emit_data64(0x3736353433323130, relocInfo::none);
 839     __ emit_data64(0x3F3E3D3C3B3A3938, relocInfo::none);
 840     return start;
 841   }
 842 
 843   address generate_vector_reverse_bit_lut(const char *stub_name) {
 844     __ align(CodeEntryAlignment);
 845     StubCodeMark mark(this, "StubRoutines", stub_name);
 846     address start = __ pc();
 847     __ emit_data64(0x0E060A020C040800, relocInfo::none);
 848     __ emit_data64(0x0F070B030D050901, relocInfo::none);
 849     __ emit_data64(0x0E060A020C040800, relocInfo::none);
 850     __ emit_data64(0x0F070B030D050901, relocInfo::none);
 851     __ emit_data64(0x0E060A020C040800, relocInfo::none);
 852     __ emit_data64(0x0F070B030D050901, relocInfo::none);
 853     __ emit_data64(0x0E060A020C040800, relocInfo::none);
 854     __ emit_data64(0x0F070B030D050901, relocInfo::none);
 855     return start;
 856   }
 857 
 858   address generate_vector_reverse_byte_perm_mask_long(const char *stub_name) {
 859     __ align(CodeEntryAlignment);
 860     StubCodeMark mark(this, "StubRoutines", stub_name);
 861     address start = __ pc();
 862     __ emit_data64(0x0001020304050607, relocInfo::none);
 863     __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none);
 864     __ emit_data64(0x0001020304050607, relocInfo::none);
 865     __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none);
 866     __ emit_data64(0x0001020304050607, relocInfo::none);
 867     __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none);
 868     __ emit_data64(0x0001020304050607, relocInfo::none);
 869     __ emit_data64(0x08090A0B0C0D0E0F, relocInfo::none);
 870     return start;
 871   }
 872 
 873   address generate_vector_reverse_byte_perm_mask_int(const char *stub_name) {
 874     __ align(CodeEntryAlignment);
 875     StubCodeMark mark(this, "StubRoutines", stub_name);
 876     address start = __ pc();
 877     __ emit_data64(0x0405060700010203, relocInfo::none);
 878     __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none);
 879     __ emit_data64(0x0405060700010203, relocInfo::none);
 880     __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none);
 881     __ emit_data64(0x0405060700010203, relocInfo::none);
 882     __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none);
 883     __ emit_data64(0x0405060700010203, relocInfo::none);
 884     __ emit_data64(0x0C0D0E0F08090A0B, relocInfo::none);
 885     return start;
 886   }
 887 
 888   address generate_vector_reverse_byte_perm_mask_short(const char *stub_name) {
 889     __ align(CodeEntryAlignment);
 890     StubCodeMark mark(this, "StubRoutines", stub_name);
 891     address start = __ pc();
 892     __ emit_data64(0x0607040502030001, relocInfo::none);
 893     __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none);
 894     __ emit_data64(0x0607040502030001, relocInfo::none);
 895     __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none);
 896     __ emit_data64(0x0607040502030001, relocInfo::none);
 897     __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none);
 898     __ emit_data64(0x0607040502030001, relocInfo::none);
 899     __ emit_data64(0x0E0F0C0D0A0B0809, relocInfo::none);
 900     return start;
 901   }
 902 
 903   address generate_vector_byte_shuffle_mask(const char *stub_name) {
 904     __ align(CodeEntryAlignment);
 905     StubCodeMark mark(this, "StubRoutines", stub_name);
 906     address start = __ pc();
 907     __ emit_data64(0x7070707070707070, relocInfo::none);
 908     __ emit_data64(0x7070707070707070, relocInfo::none);
 909     __ emit_data64(0xF0F0F0F0F0F0F0F0, relocInfo::none);
 910     __ emit_data64(0xF0F0F0F0F0F0F0F0, relocInfo::none);
 911     return start;
 912   }
 913 
 914   address generate_fp_mask(const char *stub_name, int64_t mask) {
 915     __ align(CodeEntryAlignment);
 916     StubCodeMark mark(this, "StubRoutines", stub_name);
 917     address start = __ pc();
 918 
 919     __ emit_data64( mask, relocInfo::none );
 920     __ emit_data64( mask, relocInfo::none );
 921 
 922     return start;

7737     StubRoutines::x86::_vector_float_sign_mask = generate_vector_mask("vector_float_sign_mask", 0x7FFFFFFF7FFFFFFF);
7738     StubRoutines::x86::_vector_float_sign_flip = generate_vector_mask("vector_float_sign_flip", 0x8000000080000000);
7739     StubRoutines::x86::_vector_double_sign_mask = generate_vector_mask("vector_double_sign_mask", 0x7FFFFFFFFFFFFFFF);
7740     StubRoutines::x86::_vector_double_sign_flip = generate_vector_mask("vector_double_sign_flip", 0x8000000000000000);
7741     StubRoutines::x86::_vector_all_bits_set = generate_vector_mask("vector_all_bits_set", 0xFFFFFFFFFFFFFFFF);
7742     StubRoutines::x86::_vector_int_mask_cmp_bits = generate_vector_mask("vector_int_mask_cmp_bits", 0x0000000100000001);
7743     StubRoutines::x86::_vector_short_to_byte_mask = generate_vector_mask("vector_short_to_byte_mask", 0x00ff00ff00ff00ff);
7744     StubRoutines::x86::_vector_byte_perm_mask = generate_vector_byte_perm_mask("vector_byte_perm_mask");
7745     StubRoutines::x86::_vector_int_to_byte_mask = generate_vector_mask("vector_int_to_byte_mask", 0x000000ff000000ff);
7746     StubRoutines::x86::_vector_int_to_short_mask = generate_vector_mask("vector_int_to_short_mask", 0x0000ffff0000ffff);
7747     StubRoutines::x86::_vector_32_bit_mask = generate_vector_custom_i32("vector_32_bit_mask", Assembler::AVX_512bit,
7748                                                                         0xFFFFFFFF, 0, 0, 0);
7749     StubRoutines::x86::_vector_64_bit_mask = generate_vector_custom_i32("vector_64_bit_mask", Assembler::AVX_512bit,
7750                                                                         0xFFFFFFFF, 0xFFFFFFFF, 0, 0);
7751     StubRoutines::x86::_vector_int_shuffle_mask = generate_vector_mask("vector_int_shuffle_mask", 0x0302010003020100);
7752     StubRoutines::x86::_vector_byte_shuffle_mask = generate_vector_byte_shuffle_mask("vector_byte_shuffle_mask");
7753     StubRoutines::x86::_vector_short_shuffle_mask = generate_vector_mask("vector_short_shuffle_mask", 0x0100010001000100);
7754     StubRoutines::x86::_vector_long_shuffle_mask = generate_vector_mask("vector_long_shuffle_mask", 0x0000000100000000);
7755     StubRoutines::x86::_vector_long_sign_mask = generate_vector_mask("vector_long_sign_mask", 0x8000000000000000);
7756     StubRoutines::x86::_vector_iota_indices = generate_iota_indices("iota_indices");
7757     StubRoutines::x86::_vector_count_leading_zeros_lut = generate_count_leading_zeros_lut("count_leading_zeros_lut");
7758     StubRoutines::x86::_vector_reverse_bit_lut = generate_vector_reverse_bit_lut("reverse_bit_lut");
7759     StubRoutines::x86::_vector_reverse_byte_perm_mask_long = generate_vector_reverse_byte_perm_mask_long("perm_mask_long");
7760     StubRoutines::x86::_vector_reverse_byte_perm_mask_int = generate_vector_reverse_byte_perm_mask_int("perm_mask_int");
7761     StubRoutines::x86::_vector_reverse_byte_perm_mask_short = generate_vector_reverse_byte_perm_mask_short("perm_mask_short");
7762 
7763     if (VM_Version::supports_avx2() && !VM_Version::supports_avx512_vpopcntdq()) {
7764       // lut implementation influenced by counting 1s algorithm from section 5-1 of Hackers' Delight.
7765       StubRoutines::x86::_vector_popcount_lut = generate_popcount_avx_lut("popcount_lut");
7766     }
7767 
7768     // support for verify_oop (must happen after universe_init)
7769     if (VerifyOops) {
7770       StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
7771     }
7772 
7773     // data cache line writeback
7774     StubRoutines::_data_cache_writeback = generate_data_cache_writeback();
7775     StubRoutines::_data_cache_writeback_sync = generate_data_cache_writeback_sync();
7776 
7777     // arraycopy stubs used by compilers
7778     generate_arraycopy_stubs();
7779 
7780     // don't bother generating these AES intrinsic stubs unless global flag is set
7781     if (UseAESIntrinsics) {
7782       StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask();  // needed by the others
7783       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
< prev index next >