comparison src/cpu/x86/vm/x86_64.ad @ 6138:ccaa67adfe5b

7063674: Wrong results from basic comparisons after calls to Long.bitCount(long) Reviewed-by: kvn
author twisti
date Mon, 11 Jun 2012 16:47:41 -0700
parents 6759698e3140
children 8b0a4867acf0
comparison
equal deleted inserted replaced
6137:829ee34e7cbd 6138:ccaa67adfe5b
6415 6415
6416 instruct bytes_reverse_long(rRegL dst) %{ 6416 instruct bytes_reverse_long(rRegL dst) %{
6417 match(Set dst (ReverseBytesL dst)); 6417 match(Set dst (ReverseBytesL dst));
6418 6418
6419 format %{ "bswapq $dst" %} 6419 format %{ "bswapq $dst" %}
6420
6421 opcode(0x0F, 0xC8); /* Opcode 0F /C8 */ 6420 opcode(0x0F, 0xC8); /* Opcode 0F /C8 */
6422 ins_encode( REX_reg_wide(dst), OpcP, opc2_reg(dst) ); 6421 ins_encode( REX_reg_wide(dst), OpcP, opc2_reg(dst) );
6423 ins_pipe( ialu_reg); 6422 ins_pipe( ialu_reg);
6424 %} 6423 %}
6425 6424
6426 instruct bytes_reverse_unsigned_short(rRegI dst) %{ 6425 instruct bytes_reverse_unsigned_short(rRegI dst, rFlagsReg cr) %{
6427 match(Set dst (ReverseBytesUS dst)); 6426 match(Set dst (ReverseBytesUS dst));
6427 effect(KILL cr);
6428 6428
6429 format %{ "bswapl $dst\n\t" 6429 format %{ "bswapl $dst\n\t"
6430 "shrl $dst,16\n\t" %} 6430 "shrl $dst,16\n\t" %}
6431 ins_encode %{ 6431 ins_encode %{
6432 __ bswapl($dst$$Register); 6432 __ bswapl($dst$$Register);
6433 __ shrl($dst$$Register, 16); 6433 __ shrl($dst$$Register, 16);
6434 %} 6434 %}
6435 ins_pipe( ialu_reg ); 6435 ins_pipe( ialu_reg );
6436 %} 6436 %}
6437 6437
6438 instruct bytes_reverse_short(rRegI dst) %{ 6438 instruct bytes_reverse_short(rRegI dst, rFlagsReg cr) %{
6439 match(Set dst (ReverseBytesS dst)); 6439 match(Set dst (ReverseBytesS dst));
6440 effect(KILL cr);
6440 6441
6441 format %{ "bswapl $dst\n\t" 6442 format %{ "bswapl $dst\n\t"
6442 "sar $dst,16\n\t" %} 6443 "sar $dst,16\n\t" %}
6443 ins_encode %{ 6444 ins_encode %{
6444 __ bswapl($dst$$Register); 6445 __ bswapl($dst$$Register);
6562 %} 6563 %}
6563 6564
6564 6565
6565 //---------- Population Count Instructions ------------------------------------- 6566 //---------- Population Count Instructions -------------------------------------
6566 6567
6567 instruct popCountI(rRegI dst, rRegI src) %{ 6568 instruct popCountI(rRegI dst, rRegI src, rFlagsReg cr) %{
6568 predicate(UsePopCountInstruction); 6569 predicate(UsePopCountInstruction);
6569 match(Set dst (PopCountI src)); 6570 match(Set dst (PopCountI src));
6571 effect(KILL cr);
6570 6572
6571 format %{ "popcnt $dst, $src" %} 6573 format %{ "popcnt $dst, $src" %}
6572 ins_encode %{ 6574 ins_encode %{
6573 __ popcntl($dst$$Register, $src$$Register); 6575 __ popcntl($dst$$Register, $src$$Register);
6574 %} 6576 %}
6575 ins_pipe(ialu_reg); 6577 ins_pipe(ialu_reg);
6576 %} 6578 %}
6577 6579
6578 instruct popCountI_mem(rRegI dst, memory mem) %{ 6580 instruct popCountI_mem(rRegI dst, memory mem, rFlagsReg cr) %{
6579 predicate(UsePopCountInstruction); 6581 predicate(UsePopCountInstruction);
6580 match(Set dst (PopCountI (LoadI mem))); 6582 match(Set dst (PopCountI (LoadI mem)));
6583 effect(KILL cr);
6581 6584
6582 format %{ "popcnt $dst, $mem" %} 6585 format %{ "popcnt $dst, $mem" %}
6583 ins_encode %{ 6586 ins_encode %{
6584 __ popcntl($dst$$Register, $mem$$Address); 6587 __ popcntl($dst$$Register, $mem$$Address);
6585 %} 6588 %}
6586 ins_pipe(ialu_reg); 6589 ins_pipe(ialu_reg);
6587 %} 6590 %}
6588 6591
6589 // Note: Long.bitCount(long) returns an int. 6592 // Note: Long.bitCount(long) returns an int.
6590 instruct popCountL(rRegI dst, rRegL src) %{ 6593 instruct popCountL(rRegI dst, rRegL src, rFlagsReg cr) %{
6591 predicate(UsePopCountInstruction); 6594 predicate(UsePopCountInstruction);
6592 match(Set dst (PopCountL src)); 6595 match(Set dst (PopCountL src));
6596 effect(KILL cr);
6593 6597
6594 format %{ "popcnt $dst, $src" %} 6598 format %{ "popcnt $dst, $src" %}
6595 ins_encode %{ 6599 ins_encode %{
6596 __ popcntq($dst$$Register, $src$$Register); 6600 __ popcntq($dst$$Register, $src$$Register);
6597 %} 6601 %}
6598 ins_pipe(ialu_reg); 6602 ins_pipe(ialu_reg);
6599 %} 6603 %}
6600 6604
6601 // Note: Long.bitCount(long) returns an int. 6605 // Note: Long.bitCount(long) returns an int.
6602 instruct popCountL_mem(rRegI dst, memory mem) %{ 6606 instruct popCountL_mem(rRegI dst, memory mem, rFlagsReg cr) %{
6603 predicate(UsePopCountInstruction); 6607 predicate(UsePopCountInstruction);
6604 match(Set dst (PopCountL (LoadL mem))); 6608 match(Set dst (PopCountL (LoadL mem)));
6609 effect(KILL cr);
6605 6610
6606 format %{ "popcnt $dst, $mem" %} 6611 format %{ "popcnt $dst, $mem" %}
6607 ins_encode %{ 6612 ins_encode %{
6608 __ popcntq($dst$$Register, $mem$$Address); 6613 __ popcntq($dst$$Register, $mem$$Address);
6609 %} 6614 %}