Skip to content

Commit 5fe7992

Browse files
Smita KamathSandhya Viswanathan
authored andcommitted
8283598: [vectorapi] Add new vector operation for compress and expand bits
Reviewed-by: psandoz, sviswanathan
1 parent 1bc4187 commit 5fe7992

File tree

80 files changed

+2773
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2773
-5
lines changed

src/hotspot/share/opto/classes.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ macro(Catch)
7676
macro(CatchProj)
7777
macro(CheckCastPP)
7878
macro(ClearArray)
79+
macro(CompressBits)
80+
macro(ExpandBits)
7981
macro(ConstraintCast)
8082
macro(CMoveD)
8183
macro(CMoveVD)

src/hotspot/share/opto/mulnode.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,20 @@ class MulAddS2INode : public Node {
389389
virtual uint ideal_reg() const { return Op_RegI; }
390390
};
391391

392+
//------------------------------CompressBitsNode-------------------------------
393+
// CompressBits placeholder node
394+
class CompressBitsNode : public Node {
395+
public:
396+
CompressBitsNode(Node *in1, Node *in2) : Node(0,in1,in2) {}
397+
virtual int Opcode() const;
398+
};
399+
400+
//------------------------------ExpandBitsNode---------------------------------
401+
// ExpandBits placeholder node
402+
class ExpandBitsNode : public Node {
403+
public:
404+
ExpandBitsNode(Node *in1, Node *in2) : Node(0,in1,in2) {}
405+
virtual int Opcode() const;
406+
};
407+
392408
#endif // SHARE_OPTO_MULNODE_HPP

src/hotspot/share/opto/vectornode.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ int VectorNode::opcode(int sopc, BasicType bt) {
161161
case Op_ReverseBytesI:
162162
case Op_ReverseBytesL:
163163
return (is_integral_type(bt) ? Op_ReverseBytesV : 0);
164+
case Op_CompressBits:
165+
// Not implemented. Returning 0 temporarily
166+
return 0;
167+
case Op_ExpandBits:
168+
// Not implemented. Returning 0 temporarily
169+
return 0;
164170
case Op_LShiftI:
165171
switch (bt) {
166172
case T_BOOLEAN:

src/hotspot/share/prims/vectorSupport.cpp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
480480
break;
481481
}
482482
case VECTOR_OP_BIT_COUNT: {
483-
switch (bt) {
483+
switch (bt) {
484484
case T_BYTE: // Returning Op_PopCountI
485485
case T_SHORT: // for byte and short types temporarily
486486
case T_INT: return Op_PopCountI;
@@ -490,7 +490,7 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
490490
break;
491491
}
492492
case VECTOR_OP_TZ_COUNT: {
493-
switch (bt) {
493+
switch (bt) {
494494
case T_BYTE:
495495
case T_SHORT:
496496
case T_INT: return Op_CountTrailingZerosI;
@@ -500,7 +500,7 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
500500
break;
501501
}
502502
case VECTOR_OP_LZ_COUNT: {
503-
switch (bt) {
503+
switch (bt) {
504504
case T_BYTE:
505505
case T_SHORT:
506506
case T_INT: return Op_CountLeadingZerosI;
@@ -510,7 +510,7 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
510510
break;
511511
}
512512
case VECTOR_OP_REVERSE: {
513-
switch (bt) {
513+
switch (bt) {
514514
case T_BYTE: // Temporarily returning
515515
case T_SHORT: // Op_ReverseI for byte and short
516516
case T_INT: return Op_ReverseI;
@@ -520,7 +520,7 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
520520
break;
521521
}
522522
case VECTOR_OP_REVERSE_BYTES: {
523-
switch (bt) {
523+
switch (bt) {
524524
case T_BYTE:
525525
case T_SHORT:
526526
case T_INT: return Op_ReverseBytesI;
@@ -529,6 +529,22 @@ int VectorSupport::vop2ideal(jint id, BasicType bt) {
529529
}
530530
break;
531531
}
532+
case VECTOR_OP_COMPRESS_BITS: {
533+
switch (bt) {
534+
case T_INT:
535+
case T_LONG: return Op_CompressBits;
536+
default: fatal("COMPRESS_BITS: %s", type2name(bt));
537+
}
538+
break;
539+
}
540+
case VECTOR_OP_EXPAND_BITS: {
541+
switch (bt) {
542+
case T_INT:
543+
case T_LONG: return Op_ExpandBits;
544+
default: fatal("EXPAND_BITS: %s", type2name(bt));
545+
}
546+
break;
547+
}
532548

533549
case VECTOR_OP_TAN:
534550
case VECTOR_OP_TANH:

src/hotspot/share/prims/vectorSupport.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ class VectorSupport : AllStatic {
9898
VECTOR_OP_LZ_COUNT = 30,
9999
VECTOR_OP_REVERSE = 31,
100100
VECTOR_OP_REVERSE_BYTES = 32,
101+
VECTOR_OP_COMPRESS_BITS = 33,
102+
VECTOR_OP_EXPAND_BITS = 34,
101103

102104
// Vector Math Library
103105
VECTOR_OP_TAN = 101,

src/java.base/share/classes/jdk/internal/vm/vector/VectorSupport.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ public class VectorSupport {
9090
public static final int VECTOR_OP_REVERSE = 31;
9191
public static final int VECTOR_OP_REVERSE_BYTES = 32;
9292

93+
// Compress and Expand Bits operation
94+
public static final int VECTOR_OP_COMPRESS_BITS = 33;
95+
public static final int VECTOR_OP_EXPAND_BITS = 34;
96+
9397
// Math routines
9498
public static final int VECTOR_OP_TAN = 101;
9599
public static final int VECTOR_OP_TANH = 102;

0 commit comments

Comments
 (0)