annotate src/share/vm/opto/vectornode.cpp @ 6179:8c92982cbbc4

7119644: Increase superword's vector size up to 256 bits Summary: Increase vector size up to 256-bits for YMM AVX registers on x86. Reviewed-by: never, twisti, roland
author kvn
date Fri, 15 Jun 2012 01:25:19 -0700
parents c7b60b601eb4
children 006050192a5a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 579
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 579
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 579
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 */
a61af66fc99e Initial load
duke
parents:
diff changeset
23
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
24 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "memory/allocation.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "opto/connode.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "opto/vectornode.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 //------------------------------VectorNode--------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // Return the vector operator for the specified scalar operation
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
32 // and vector length. Also used to check if the code generator
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // supports the vector operation.
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
34 int VectorNode::opcode(int sopc, uint vlen, BasicType bt) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 switch (sopc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 case Op_AddI:
a61af66fc99e Initial load
duke
parents:
diff changeset
37 switch (bt) {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 case T_BOOLEAN:
a61af66fc99e Initial load
duke
parents:
diff changeset
39 case T_BYTE: return Op_AddVB;
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
40 case T_CHAR:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
41 case T_SHORT: return Op_AddVS;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 case T_INT: return Op_AddVI;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 }
a61af66fc99e Initial load
duke
parents:
diff changeset
44 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
45 case Op_AddL:
a61af66fc99e Initial load
duke
parents:
diff changeset
46 assert(bt == T_LONG, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
47 return Op_AddVL;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 case Op_AddF:
a61af66fc99e Initial load
duke
parents:
diff changeset
49 assert(bt == T_FLOAT, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
50 return Op_AddVF;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 case Op_AddD:
a61af66fc99e Initial load
duke
parents:
diff changeset
52 assert(bt == T_DOUBLE, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
53 return Op_AddVD;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 case Op_SubI:
a61af66fc99e Initial load
duke
parents:
diff changeset
55 switch (bt) {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 case T_BOOLEAN:
a61af66fc99e Initial load
duke
parents:
diff changeset
57 case T_BYTE: return Op_SubVB;
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
58 case T_CHAR:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 case T_SHORT: return Op_SubVS;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 case T_INT: return Op_SubVI;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
63 case Op_SubL:
a61af66fc99e Initial load
duke
parents:
diff changeset
64 assert(bt == T_LONG, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
65 return Op_SubVL;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 case Op_SubF:
a61af66fc99e Initial load
duke
parents:
diff changeset
67 assert(bt == T_FLOAT, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
68 return Op_SubVF;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 case Op_SubD:
a61af66fc99e Initial load
duke
parents:
diff changeset
70 assert(bt == T_DOUBLE, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
71 return Op_SubVD;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 case Op_MulF:
a61af66fc99e Initial load
duke
parents:
diff changeset
73 assert(bt == T_FLOAT, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
74 return Op_MulVF;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 case Op_MulD:
a61af66fc99e Initial load
duke
parents:
diff changeset
76 assert(bt == T_DOUBLE, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
77 return Op_MulVD;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 case Op_DivF:
a61af66fc99e Initial load
duke
parents:
diff changeset
79 assert(bt == T_FLOAT, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
80 return Op_DivVF;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 case Op_DivD:
a61af66fc99e Initial load
duke
parents:
diff changeset
82 assert(bt == T_DOUBLE, "must be");
a61af66fc99e Initial load
duke
parents:
diff changeset
83 return Op_DivVD;
a61af66fc99e Initial load
duke
parents:
diff changeset
84 case Op_LShiftI:
a61af66fc99e Initial load
duke
parents:
diff changeset
85 switch (bt) {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 case T_BOOLEAN:
a61af66fc99e Initial load
duke
parents:
diff changeset
87 case T_BYTE: return Op_LShiftVB;
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
88 case T_CHAR:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
89 case T_SHORT: return Op_LShiftVS;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 case T_INT: return Op_LShiftVI;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 ShouldNotReachHere();
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
93 case Op_RShiftI:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
94 switch (bt) {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 case T_BOOLEAN:
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
96 case T_BYTE: return Op_RShiftVB;
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
97 case T_CHAR:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
98 case T_SHORT: return Op_RShiftVS;
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
99 case T_INT: return Op_RShiftVI;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
102 case Op_AndI:
a61af66fc99e Initial load
duke
parents:
diff changeset
103 case Op_AndL:
a61af66fc99e Initial load
duke
parents:
diff changeset
104 return Op_AndV;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 case Op_OrI:
a61af66fc99e Initial load
duke
parents:
diff changeset
106 case Op_OrL:
a61af66fc99e Initial load
duke
parents:
diff changeset
107 return Op_OrV;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 case Op_XorI:
a61af66fc99e Initial load
duke
parents:
diff changeset
109 case Op_XorL:
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return Op_XorV;
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 case Op_LoadB:
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
113 case Op_LoadUB:
558
3b5ac9e7e6ea 6796746: rename LoadC (char) opcode class to LoadUS (unsigned short)
twisti
parents: 196
diff changeset
114 case Op_LoadUS:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
115 case Op_LoadS:
a61af66fc99e Initial load
duke
parents:
diff changeset
116 case Op_LoadI:
a61af66fc99e Initial load
duke
parents:
diff changeset
117 case Op_LoadL:
a61af66fc99e Initial load
duke
parents:
diff changeset
118 case Op_LoadF:
a61af66fc99e Initial load
duke
parents:
diff changeset
119 case Op_LoadD:
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
120 return Op_LoadVector;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 case Op_StoreB:
a61af66fc99e Initial load
duke
parents:
diff changeset
123 case Op_StoreC:
a61af66fc99e Initial load
duke
parents:
diff changeset
124 case Op_StoreI:
a61af66fc99e Initial load
duke
parents:
diff changeset
125 case Op_StoreL:
a61af66fc99e Initial load
duke
parents:
diff changeset
126 case Op_StoreF:
a61af66fc99e Initial load
duke
parents:
diff changeset
127 case Op_StoreD:
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
128 return Op_StoreVector;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
129 }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 return 0; // Unimplemented
a61af66fc99e Initial load
duke
parents:
diff changeset
131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
132
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
133 bool VectorNode::implemented(int opc, uint vlen, BasicType bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
134 if (is_java_primitive(bt) &&
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
135 (vlen > 1) && is_power_of_2(vlen) &&
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
136 Matcher::vector_size_supported(bt, vlen)) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
137 int vopc = VectorNode::opcode(opc, vlen, bt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
138 return vopc > 0 && Matcher::has_match_rule(vopc);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
140 return false;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // Return the vector version of a scalar operation node.
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
144 VectorNode* VectorNode::make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
145 const TypeVect* vt = TypeVect::make(bt, vlen);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
146 int vopc = VectorNode::opcode(opc, vlen, bt);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 switch (vopc) {
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
149 case Op_AddVB: return new (C, 3) AddVBNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
150 case Op_AddVS: return new (C, 3) AddVSNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
151 case Op_AddVI: return new (C, 3) AddVINode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
152 case Op_AddVL: return new (C, 3) AddVLNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
153 case Op_AddVF: return new (C, 3) AddVFNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
154 case Op_AddVD: return new (C, 3) AddVDNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
155
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
156 case Op_SubVB: return new (C, 3) SubVBNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
157 case Op_SubVS: return new (C, 3) SubVSNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
158 case Op_SubVI: return new (C, 3) SubVINode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
159 case Op_SubVL: return new (C, 3) SubVLNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
160 case Op_SubVF: return new (C, 3) SubVFNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
161 case Op_SubVD: return new (C, 3) SubVDNode(n1, n2, vt);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
162
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
163 case Op_MulVF: return new (C, 3) MulVFNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
164 case Op_MulVD: return new (C, 3) MulVDNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
165
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
166 case Op_DivVF: return new (C, 3) DivVFNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
167 case Op_DivVD: return new (C, 3) DivVDNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
168
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
169 case Op_LShiftVB: return new (C, 3) LShiftVBNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
170 case Op_LShiftVS: return new (C, 3) LShiftVSNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
171 case Op_LShiftVI: return new (C, 3) LShiftVINode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
172
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
173 case Op_RShiftVB: return new (C, 3) RShiftVBNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
174 case Op_RShiftVS: return new (C, 3) RShiftVSNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
175 case Op_RShiftVI: return new (C, 3) RShiftVINode(n1, n2, vt);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
176
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
177 case Op_AndV: return new (C, 3) AndVNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
178 case Op_OrV: return new (C, 3) OrVNode (n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
179 case Op_XorV: return new (C, 3) XorVNode(n1, n2, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
180 }
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
181 ShouldNotReachHere();
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
182 return NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
183
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
184 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
185
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
186 // Scalar promotion
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
187 VectorNode* VectorNode::scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
188 BasicType bt = opd_t->array_element_basic_type();
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
189 const TypeVect* vt = opd_t->singleton() ? TypeVect::make(opd_t, vlen)
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
190 : TypeVect::make(bt, vlen);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
191 switch (bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
192 case T_BOOLEAN:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
193 case T_BYTE:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
194 return new (C, 2) ReplicateBNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
195 case T_CHAR:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
196 case T_SHORT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
197 return new (C, 2) ReplicateSNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
198 case T_INT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
199 return new (C, 2) ReplicateINode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
200 case T_LONG:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
201 return new (C, 2) ReplicateLNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
202 case T_FLOAT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
203 return new (C, 2) ReplicateFNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
204 case T_DOUBLE:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
205 return new (C, 2) ReplicateDNode(s, vt);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
208 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
209 }
a61af66fc99e Initial load
duke
parents:
diff changeset
210
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
211 // Return initial Pack node. Additional operands added with add_opd() calls.
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
212 PackNode* PackNode::make(Compile* C, Node* s, uint vlen, BasicType bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
213 const TypeVect* vt = TypeVect::make(bt, vlen);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
214 switch (bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
215 case T_BOOLEAN:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
216 case T_BYTE:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
217 return new (C, vlen+1) PackBNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
218 case T_CHAR:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
219 case T_SHORT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
220 return new (C, vlen+1) PackSNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
221 case T_INT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
222 return new (C, vlen+1) PackINode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
223 case T_LONG:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
224 return new (C, vlen+1) PackLNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
225 case T_FLOAT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
226 return new (C, vlen+1) PackFNode(s, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
227 case T_DOUBLE:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
228 return new (C, vlen+1) PackDNode(s, vt);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
229 }
a61af66fc99e Initial load
duke
parents:
diff changeset
230 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
231 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
234 // Create a binary tree form for Packs. [lo, hi) (half-open) range
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
235 Node* PackNode::binaryTreePack(Compile* C, int lo, int hi) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
236 int ct = hi - lo;
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
237 assert(is_power_of_2(ct), "power of 2");
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
238 if (ct == 2) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
239 PackNode* pk = PackNode::make(C, in(lo), 2, vect_type()->element_basic_type());
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
240 pk->add_opd(1, in(lo+1));
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
241 return pk;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
242
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
243 } else {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
244 int mid = lo + ct/2;
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
245 Node* n1 = binaryTreePack(C, lo, mid);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
246 Node* n2 = binaryTreePack(C, mid, hi );
0
a61af66fc99e Initial load
duke
parents:
diff changeset
247
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
248 BasicType bt = vect_type()->element_basic_type();
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
249 switch (bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
250 case T_BOOLEAN:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
251 case T_BYTE:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
252 return new (C, 3) PackSNode(n1, n2, TypeVect::make(T_SHORT, 2));
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
253 case T_CHAR:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
254 case T_SHORT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
255 return new (C, 3) PackINode(n1, n2, TypeVect::make(T_INT, 2));
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
256 case T_INT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
257 return new (C, 3) PackLNode(n1, n2, TypeVect::make(T_LONG, 2));
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
258 case T_LONG:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
259 return new (C, 3) Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2));
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
260 case T_FLOAT:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
261 return new (C, 3) PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
262 case T_DOUBLE:
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
263 return new (C, 3) Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
264 }
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
265 ShouldNotReachHere();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
268 }
a61af66fc99e Initial load
duke
parents:
diff changeset
269
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
270 // Return the vector version of a scalar load node.
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
271 LoadVectorNode* LoadVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
272 Node* adr, const TypePtr* atyp, uint vlen, BasicType bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
273 const TypeVect* vt = TypeVect::make(bt, vlen);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
274 return new (C, 3) LoadVectorNode(ctl, mem, adr, atyp, vt);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
275 return NULL;
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
276 }
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
277
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
278 // Return the vector version of a scalar store node.
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
279 StoreVectorNode* StoreVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem,
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
280 Node* adr, const TypePtr* atyp, Node* val,
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
281 uint vlen) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
282 return new (C, 4) StoreVectorNode(ctl, mem, adr, atyp, val);
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
283 }
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
284
0
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // Extract a scalar element of vector.
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
286 Node* ExtractNode::make(Compile* C, Node* v, uint position, BasicType bt) {
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
287 assert((int)position < Matcher::max_vector_size(bt), "pos in range");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
288 ConINode* pos = ConINode::make(C, (int)position);
a61af66fc99e Initial load
duke
parents:
diff changeset
289 switch (bt) {
a61af66fc99e Initial load
duke
parents:
diff changeset
290 case T_BOOLEAN:
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
291 return new (C, 3) ExtractUBNode(v, pos);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
292 case T_BYTE:
a61af66fc99e Initial load
duke
parents:
diff changeset
293 return new (C, 3) ExtractBNode(v, pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
294 case T_CHAR:
a61af66fc99e Initial load
duke
parents:
diff changeset
295 return new (C, 3) ExtractCNode(v, pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
296 case T_SHORT:
a61af66fc99e Initial load
duke
parents:
diff changeset
297 return new (C, 3) ExtractSNode(v, pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
298 case T_INT:
a61af66fc99e Initial load
duke
parents:
diff changeset
299 return new (C, 3) ExtractINode(v, pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
300 case T_LONG:
a61af66fc99e Initial load
duke
parents:
diff changeset
301 return new (C, 3) ExtractLNode(v, pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
302 case T_FLOAT:
a61af66fc99e Initial load
duke
parents:
diff changeset
303 return new (C, 3) ExtractFNode(v, pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
304 case T_DOUBLE:
a61af66fc99e Initial load
duke
parents:
diff changeset
305 return new (C, 3) ExtractDNode(v, pos);
a61af66fc99e Initial load
duke
parents:
diff changeset
306 }
a61af66fc99e Initial load
duke
parents:
diff changeset
307 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
308 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 }
6179
8c92982cbbc4 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 3842
diff changeset
310