< prev index next >
src/hotspot/cpu/x86/x86.ad
Print this page
rev 49190 : Add support for vector popcount
@@ -1221,10 +1221,14 @@
case Op_PopCountI:
case Op_PopCountL:
if (!UsePopCountInstruction)
ret_value = false;
break;
+ case Op_PopCountVI:
+ if (!UsePopCountInstruction || !VM_Version::support_avx512_vpopcntdq() || UseAVX <= 2)
+ ret_value = false;
+ break;
case Op_MulVI:
if ((UseSSE < 4) && (UseAVX < 1)) // only with SSE4_1 or AVX
ret_value = false;
break;
case Op_MulVL:
@@ -10786,5 +10790,51 @@
int vector_len = 2;
__ vfmaf($c$$XMMRegister, $a$$XMMRegister, $b$$Address, $c$$XMMRegister, vector_len);
%}
ins_pipe( pipe_slow );
%}
+
+// --------------------------------- PopCount --------------------------------------
+
+instruct vpopcount2I(vecD dst, vecD src) %{
+ predicate(UseAVX > 2 && VM_Version::support_avx512_vpopcntdq() && UsePopCountInstruction);
+ match(Set dst (PopCountVI src));
+ format %{ "vpopcntd $dst,$src\t! vector popcount packed2I" %}
+ ins_encode %{
+ int vector_len = 0;
+ __ vpopcntd($dst$$XMMRegister, $src$$XMMRegister, vector_len);
+ %}
+ ins_pipe( pipe_slow );
+%}
+
+instruct vpopcount4I(vecX dst, vecX src) %{
+ predicate(UseAVX > 2 && VM_Version::support_avx512_vpopcntdq() && UsePopCountInstruction);
+ match(Set dst (PopCountVI src));
+ format %{ "vpopcntd $dst,$src\t! vector popcount packed4I" %}
+ ins_encode %{
+ int vector_len = 0;
+ __ vpopcntd($dst$$XMMRegister, $src$$XMMRegister, vector_len);
+ %}
+ ins_pipe( pipe_slow );
+%}
+
+instruct vpopcount8I(vecY dst, vecY src) %{
+ predicate(UseAVX > 2 && VM_Version::support_avx512_vpopcntdq() && UsePopCountInstruction);
+ match(Set dst (PopCountVI src));
+ format %{ "vpopcntd $dst,$src\t! vector popcount packed8I" %}
+ ins_encode %{
+ int vector_len = 1;
+ __ vpopcntd($dst$$XMMRegister, $src$$XMMRegister, vector_len);
+ %}
+ ins_pipe( pipe_slow );
+%}
+
+instruct vpopcount16I(vecZ dst, vecZ src) %{
+ predicate(UseAVX > 2 && VM_Version::support_avx512_vpopcntdq() && UsePopCountInstruction);
+ match(Set dst (PopCountVI src));
+ format %{ "vpopcntd $dst,$src\t! vector popcount packed16I" %}
+ ins_encode %{
+ int vector_len = 2;
+ __ vpopcntd($dst$$XMMRegister, $src$$XMMRegister, vector_len);
+ %}
+ ins_pipe( pipe_slow );
+%}
< prev index next >