/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/connode.hpp"
#include "opto/vectornode.hpp"
//------------------------------VectorNode--------------------------------------
// Return the vector operator for the specified scalar operation
// and vector length.
switch (sopc) {
case Op_AddI:
switch (bt) {
case T_BOOLEAN:
case T_CHAR:
}
case Op_AddL:
return Op_AddVL;
case Op_AddF:
return Op_AddVF;
case Op_AddD:
return Op_AddVD;
case Op_SubI:
switch (bt) {
case T_BOOLEAN:
case T_CHAR:
}
case Op_SubL:
return Op_SubVL;
case Op_SubF:
return Op_SubVF;
case Op_SubD:
return Op_SubVD;
case Op_MulI:
switch (bt) {
case T_BOOLEAN:
case T_BYTE: return 0; // Unimplemented
case T_CHAR:
}
case Op_MulF:
return Op_MulVF;
case Op_MulD:
return Op_MulVD;
case Op_DivF:
return Op_DivVF;
case Op_DivD:
return Op_DivVD;
case Op_LShiftI:
switch (bt) {
case T_BOOLEAN:
case T_BYTE: return Op_LShiftVB;
case T_CHAR:
case T_SHORT: return Op_LShiftVS;
case T_INT: return Op_LShiftVI;
}
case Op_LShiftL:
return Op_LShiftVL;
case Op_RShiftI:
switch (bt) {
case T_BYTE: return Op_RShiftVB;
case T_SHORT: return Op_RShiftVS;
case T_INT: return Op_RShiftVI;
}
case Op_RShiftL:
return Op_RShiftVL;
case Op_URShiftI:
switch (bt) {
case T_BOOLEAN:return Op_URShiftVB;
case T_CHAR: return Op_URShiftVS;
case T_BYTE:
case T_SHORT: return 0; // Vector logical right shift for signed short
// values produces incorrect Java result for
// negative data because java code should convert
// a short value into int value with sign
// extension before a shift.
case T_INT: return Op_URShiftVI;
}
case Op_URShiftL:
return Op_URShiftVL;
case Op_AndI:
case Op_AndL:
return Op_AndV;
case Op_OrI:
case Op_OrL:
return Op_OrV;
case Op_XorI:
case Op_XorL:
return Op_XorV;
case Op_LoadB:
case Op_LoadUB:
case Op_LoadUS:
case Op_LoadS:
case Op_LoadI:
case Op_LoadL:
case Op_LoadF:
case Op_LoadD:
return Op_LoadVector;
case Op_StoreB:
case Op_StoreC:
case Op_StoreI:
case Op_StoreL:
case Op_StoreF:
case Op_StoreD:
return Op_StoreVector;
}
return 0; // Unimplemented
}
// Also used to check if the code generator
// supports the vector operation.
if (is_java_primitive(bt) &&
}
return false;
}
switch (n->Opcode()) {
case Op_LShiftI:
case Op_LShiftL:
case Op_RShiftI:
case Op_RShiftL:
case Op_URShiftI:
case Op_URShiftL:
return true;
}
return false;
}
// Check if input is loop invariant vector.
// Only Replicate vector nodes are loop invariant for now.
switch (n->Opcode()) {
case Op_ReplicateB:
case Op_ReplicateS:
case Op_ReplicateI:
case Op_ReplicateL:
case Op_ReplicateF:
case Op_ReplicateD:
return true;
}
return false;
}
// [Start, end) half-open range defining which operands are vectors
switch (n->Opcode()) {
*start = 0;
*end = 0; // no vector operands
break;
break;
case Op_LShiftI: case Op_LShiftL:
case Op_RShiftI: case Op_RShiftL:
case Op_URShiftI: case Op_URShiftL:
*start = 1;
break;
*start = 1;
break;
*start = 2;
break;
default:
*start = 1;
}
}
// Return the vector version of a scalar operation node.
// This method should not be called for unimplemented vectors.
switch (vopc) {
}
return NULL;
}
// Scalar promotion
switch (bt) {
case T_BOOLEAN:
case T_BYTE:
return new (C) ReplicateBNode(s, vt);
case T_CHAR:
case T_SHORT:
return new (C) ReplicateSNode(s, vt);
case T_INT:
return new (C) ReplicateINode(s, vt);
case T_LONG:
return new (C) ReplicateLNode(s, vt);
case T_FLOAT:
return new (C) ReplicateFNode(s, vt);
case T_DOUBLE:
return new (C) ReplicateDNode(s, vt);
}
return NULL;
}
// Match shift count type with shift vector type.
case Op_LShiftI:
case Op_LShiftL:
case Op_RShiftI:
case Op_RShiftL:
case Op_URShiftI:
case Op_URShiftL:
}
return NULL;
}
// Return initial Pack node. Additional operands added with add_opd() calls.
switch (bt) {
case T_BOOLEAN:
case T_BYTE:
case T_CHAR:
case T_SHORT:
case T_INT:
case T_LONG:
case T_FLOAT:
case T_DOUBLE:
}
return NULL;
}
// Create a binary tree form for Packs. [lo, hi) (half-open) range
if (ct == 2) {
return pk;
} else {
switch (bt) {
case T_BOOLEAN:
case T_BYTE:
case T_CHAR:
case T_SHORT:
case T_INT:
case T_LONG:
case T_FLOAT:
case T_DOUBLE:
}
}
return NULL;
}
// Return the vector version of a scalar load node.
}
// Return the vector version of a scalar store node.
}
// Extract a scalar element of vector.
switch (bt) {
case T_BOOLEAN:
return new (C) ExtractUBNode(v, pos);
case T_BYTE:
return new (C) ExtractBNode(v, pos);
case T_CHAR:
return new (C) ExtractCNode(v, pos);
case T_SHORT:
return new (C) ExtractSNode(v, pos);
case T_INT:
return new (C) ExtractINode(v, pos);
case T_LONG:
return new (C) ExtractLNode(v, pos);
case T_FLOAT:
return new (C) ExtractFNode(v, pos);
case T_DOUBLE:
return new (C) ExtractDNode(v, pos);
}
return NULL;
}