aboutsummaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authortwisti <none@none>2012-06-11 16:47:41 -0700
committertwisti <none@none>2012-06-11 16:47:41 -0700
commit935e7429ff878430b0142af46f2eb05290673b91 (patch)
treed121f8521f6687306d1b4aebcd27d8e1e0aec76b /src/cpu
parent58e01b1cb69b12733bdbb26b5c00a0f8d979e288 (diff)
7063674: Wrong results from basic comparisons after calls to Long.bitCount(long)
Reviewed-by: kvn
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/x86/vm/x86_32.ad12
-rw-r--r--src/cpu/x86/vm/x86_64.ad19
2 files changed, 20 insertions, 11 deletions
diff --git a/src/cpu/x86/vm/x86_32.ad b/src/cpu/x86/vm/x86_32.ad
index cd4adccd3..fe14c31da 100644
--- a/src/cpu/x86/vm/x86_32.ad
+++ b/src/cpu/x86/vm/x86_32.ad
@@ -5555,8 +5555,9 @@ instruct bytes_reverse_long(eRegL dst) %{
ins_pipe( ialu_reg_reg);
%}
-instruct bytes_reverse_unsigned_short(eRegI dst) %{
+instruct bytes_reverse_unsigned_short(eRegI dst, eFlagsReg cr) %{
match(Set dst (ReverseBytesUS dst));
+ effect(KILL cr);
format %{ "BSWAP $dst\n\t"
"SHR $dst,16\n\t" %}
@@ -5567,8 +5568,9 @@ instruct bytes_reverse_unsigned_short(eRegI dst) %{
ins_pipe( ialu_reg );
%}
-instruct bytes_reverse_short(eRegI dst) %{
+instruct bytes_reverse_short(eRegI dst, eFlagsReg cr) %{
match(Set dst (ReverseBytesS dst));
+ effect(KILL cr);
format %{ "BSWAP $dst\n\t"
"SAR $dst,16\n\t" %}
@@ -5729,9 +5731,10 @@ instruct countTrailingZerosL(eRegI dst, eRegL src, eFlagsReg cr) %{
//---------- Population Count Instructions -------------------------------------
-instruct popCountI(eRegI dst, eRegI src) %{
+instruct popCountI(eRegI dst, eRegI src, eFlagsReg cr) %{
predicate(UsePopCountInstruction);
match(Set dst (PopCountI src));
+ effect(KILL cr);
format %{ "POPCNT $dst, $src" %}
ins_encode %{
@@ -5740,9 +5743,10 @@ instruct popCountI(eRegI dst, eRegI src) %{
ins_pipe(ialu_reg);
%}
-instruct popCountI_mem(eRegI dst, memory mem) %{
+instruct popCountI_mem(eRegI dst, memory mem, eFlagsReg cr) %{
predicate(UsePopCountInstruction);
match(Set dst (PopCountI (LoadI mem)));
+ effect(KILL cr);
format %{ "POPCNT $dst, $mem" %}
ins_encode %{
diff --git a/src/cpu/x86/vm/x86_64.ad b/src/cpu/x86/vm/x86_64.ad
index 80928c3fa..dc2c0ec92 100644
--- a/src/cpu/x86/vm/x86_64.ad
+++ b/src/cpu/x86/vm/x86_64.ad
@@ -6417,14 +6417,14 @@ instruct bytes_reverse_long(rRegL dst) %{
match(Set dst (ReverseBytesL dst));
format %{ "bswapq $dst" %}
-
opcode(0x0F, 0xC8); /* Opcode 0F /C8 */
ins_encode( REX_reg_wide(dst), OpcP, opc2_reg(dst) );
ins_pipe( ialu_reg);
%}
-instruct bytes_reverse_unsigned_short(rRegI dst) %{
+instruct bytes_reverse_unsigned_short(rRegI dst, rFlagsReg cr) %{
match(Set dst (ReverseBytesUS dst));
+ effect(KILL cr);
format %{ "bswapl $dst\n\t"
"shrl $dst,16\n\t" %}
@@ -6435,8 +6435,9 @@ instruct bytes_reverse_unsigned_short(rRegI dst) %{
ins_pipe( ialu_reg );
%}
-instruct bytes_reverse_short(rRegI dst) %{
+instruct bytes_reverse_short(rRegI dst, rFlagsReg cr) %{
match(Set dst (ReverseBytesS dst));
+ effect(KILL cr);
format %{ "bswapl $dst\n\t"
"sar $dst,16\n\t" %}
@@ -6564,9 +6565,10 @@ instruct countTrailingZerosL(rRegI dst, rRegL src, rFlagsReg cr) %{
//---------- Population Count Instructions -------------------------------------
-instruct popCountI(rRegI dst, rRegI src) %{
+instruct popCountI(rRegI dst, rRegI src, rFlagsReg cr) %{
predicate(UsePopCountInstruction);
match(Set dst (PopCountI src));
+ effect(KILL cr);
format %{ "popcnt $dst, $src" %}
ins_encode %{
@@ -6575,9 +6577,10 @@ instruct popCountI(rRegI dst, rRegI src) %{
ins_pipe(ialu_reg);
%}
-instruct popCountI_mem(rRegI dst, memory mem) %{
+instruct popCountI_mem(rRegI dst, memory mem, rFlagsReg cr) %{
predicate(UsePopCountInstruction);
match(Set dst (PopCountI (LoadI mem)));
+ effect(KILL cr);
format %{ "popcnt $dst, $mem" %}
ins_encode %{
@@ -6587,9 +6590,10 @@ instruct popCountI_mem(rRegI dst, memory mem) %{
%}
// Note: Long.bitCount(long) returns an int.
-instruct popCountL(rRegI dst, rRegL src) %{
+instruct popCountL(rRegI dst, rRegL src, rFlagsReg cr) %{
predicate(UsePopCountInstruction);
match(Set dst (PopCountL src));
+ effect(KILL cr);
format %{ "popcnt $dst, $src" %}
ins_encode %{
@@ -6599,9 +6603,10 @@ instruct popCountL(rRegI dst, rRegL src) %{
%}
// Note: Long.bitCount(long) returns an int.
-instruct popCountL_mem(rRegI dst, memory mem) %{
+instruct popCountL_mem(rRegI dst, memory mem, rFlagsReg cr) %{
predicate(UsePopCountInstruction);
match(Set dst (PopCountL (LoadL mem)));
+ effect(KILL cr);
format %{ "popcnt $dst, $mem" %}
ins_encode %{