author | twisti |
Mon, 06 Jan 2014 17:23:07 -0800 | |
changeset 22236 | 44508442b8da |
parent 14131 | e376e3d428c9 |
child 24923 | 9631f7d691dc |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
2 |
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2105
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2105
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2105
diff
changeset
|
21 |
* questions. |
1 | 22 |
*/ |
23 |
||
7397 | 24 |
#include "precompiled.hpp" |
25 |
#include "memory/allocation.inline.hpp" |
|
26 |
#include "opto/connode.hpp" |
|
27 |
#include "opto/vectornode.hpp" |
|
1 | 28 |
|
29 |
//------------------------------VectorNode-------------------------------------- |
|
30 |
||
31 |
// Return the vector operator for the specified scalar operation |
|
14128 | 32 |
// and vector length. |
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
33 |
int VectorNode::opcode(int sopc, BasicType bt) { |
1 | 34 |
switch (sopc) { |
35 |
case Op_AddI: |
|
36 |
switch (bt) { |
|
37 |
case T_BOOLEAN: |
|
38 |
case T_BYTE: return Op_AddVB; |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
39 |
case T_CHAR: |
1 | 40 |
case T_SHORT: return Op_AddVS; |
41 |
case T_INT: return Op_AddVI; |
|
42 |
} |
|
43 |
ShouldNotReachHere(); |
|
44 |
case Op_AddL: |
|
45 |
assert(bt == T_LONG, "must be"); |
|
46 |
return Op_AddVL; |
|
47 |
case Op_AddF: |
|
48 |
assert(bt == T_FLOAT, "must be"); |
|
49 |
return Op_AddVF; |
|
50 |
case Op_AddD: |
|
51 |
assert(bt == T_DOUBLE, "must be"); |
|
52 |
return Op_AddVD; |
|
53 |
case Op_SubI: |
|
54 |
switch (bt) { |
|
55 |
case T_BOOLEAN: |
|
56 |
case T_BYTE: return Op_SubVB; |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
57 |
case T_CHAR: |
1 | 58 |
case T_SHORT: return Op_SubVS; |
59 |
case T_INT: return Op_SubVI; |
|
60 |
} |
|
61 |
ShouldNotReachHere(); |
|
62 |
case Op_SubL: |
|
63 |
assert(bt == T_LONG, "must be"); |
|
64 |
return Op_SubVL; |
|
65 |
case Op_SubF: |
|
66 |
assert(bt == T_FLOAT, "must be"); |
|
67 |
return Op_SubVF; |
|
68 |
case Op_SubD: |
|
69 |
assert(bt == T_DOUBLE, "must be"); |
|
70 |
return Op_SubVD; |
|
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
71 |
case Op_MulI: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
72 |
switch (bt) { |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
73 |
case T_BOOLEAN: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
74 |
case T_BYTE: return 0; // Unimplemented |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
75 |
case T_CHAR: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
76 |
case T_SHORT: return Op_MulVS; |
14128 | 77 |
case T_INT: return Op_MulVI; |
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
78 |
} |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
79 |
ShouldNotReachHere(); |
1 | 80 |
case Op_MulF: |
81 |
assert(bt == T_FLOAT, "must be"); |
|
82 |
return Op_MulVF; |
|
83 |
case Op_MulD: |
|
84 |
assert(bt == T_DOUBLE, "must be"); |
|
85 |
return Op_MulVD; |
|
86 |
case Op_DivF: |
|
87 |
assert(bt == T_FLOAT, "must be"); |
|
88 |
return Op_DivVF; |
|
89 |
case Op_DivD: |
|
90 |
assert(bt == T_DOUBLE, "must be"); |
|
91 |
return Op_DivVD; |
|
92 |
case Op_LShiftI: |
|
93 |
switch (bt) { |
|
94 |
case T_BOOLEAN: |
|
95 |
case T_BYTE: return Op_LShiftVB; |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
96 |
case T_CHAR: |
1 | 97 |
case T_SHORT: return Op_LShiftVS; |
98 |
case T_INT: return Op_LShiftVI; |
|
99 |
} |
|
100 |
ShouldNotReachHere(); |
|
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
101 |
case Op_LShiftL: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
102 |
assert(bt == T_LONG, "must be"); |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
103 |
return Op_LShiftVL; |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
104 |
case Op_RShiftI: |
1 | 105 |
switch (bt) { |
14131
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
106 |
case T_BOOLEAN:return Op_URShiftVB; // boolean is unsigned value |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
107 |
case T_CHAR: return Op_URShiftVS; // char is unsigned value |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
108 |
case T_BYTE: return Op_RShiftVB; |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
109 |
case T_SHORT: return Op_RShiftVS; |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
110 |
case T_INT: return Op_RShiftVI; |
1 | 111 |
} |
112 |
ShouldNotReachHere(); |
|
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
113 |
case Op_RShiftL: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
114 |
assert(bt == T_LONG, "must be"); |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
115 |
return Op_RShiftVL; |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
116 |
case Op_URShiftI: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
117 |
switch (bt) { |
14131
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
118 |
case T_BOOLEAN:return Op_URShiftVB; |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
119 |
case T_CHAR: return Op_URShiftVS; |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
120 |
case T_BYTE: |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
121 |
case T_SHORT: return 0; // Vector logical right shift for signed short |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
122 |
// values produces incorrect Java result for |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
123 |
// negative data because java code should convert |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
124 |
// a short value into int value with sign |
e376e3d428c9
8001183: incorrect results of char vectors right shift operaiton
kvn
parents:
14128
diff
changeset
|
125 |
// extension before a shift. |
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
126 |
case T_INT: return Op_URShiftVI; |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
127 |
} |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
128 |
ShouldNotReachHere(); |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
129 |
case Op_URShiftL: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
130 |
assert(bt == T_LONG, "must be"); |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
131 |
return Op_URShiftVL; |
1 | 132 |
case Op_AndI: |
133 |
case Op_AndL: |
|
134 |
return Op_AndV; |
|
135 |
case Op_OrI: |
|
136 |
case Op_OrL: |
|
137 |
return Op_OrV; |
|
138 |
case Op_XorI: |
|
139 |
case Op_XorL: |
|
140 |
return Op_XorV; |
|
141 |
||
142 |
case Op_LoadB: |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
143 |
case Op_LoadUB: |
2022
28ce8115a91d
6796746: rename LoadC (char) opcode class to LoadUS (unsigned short)
twisti
parents:
670
diff
changeset
|
144 |
case Op_LoadUS: |
1 | 145 |
case Op_LoadS: |
146 |
case Op_LoadI: |
|
147 |
case Op_LoadL: |
|
148 |
case Op_LoadF: |
|
149 |
case Op_LoadD: |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
150 |
return Op_LoadVector; |
1 | 151 |
|
152 |
case Op_StoreB: |
|
153 |
case Op_StoreC: |
|
154 |
case Op_StoreI: |
|
155 |
case Op_StoreL: |
|
156 |
case Op_StoreF: |
|
157 |
case Op_StoreD: |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
158 |
return Op_StoreVector; |
1 | 159 |
} |
160 |
return 0; // Unimplemented |
|
161 |
} |
|
162 |
||
14128 | 163 |
// Also used to check if the code generator |
164 |
// supports the vector operation. |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
165 |
bool VectorNode::implemented(int opc, uint vlen, BasicType bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
166 |
if (is_java_primitive(bt) && |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
167 |
(vlen > 1) && is_power_of_2(vlen) && |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
168 |
Matcher::vector_size_supported(bt, vlen)) { |
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
169 |
int vopc = VectorNode::opcode(opc, bt); |
14128 | 170 |
return vopc > 0 && Matcher::match_rule_supported(vopc); |
1 | 171 |
} |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
172 |
return false; |
1 | 173 |
} |
174 |
||
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
175 |
bool VectorNode::is_shift(Node* n) { |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
176 |
switch (n->Opcode()) { |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
177 |
case Op_LShiftI: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
178 |
case Op_LShiftL: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
179 |
case Op_RShiftI: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
180 |
case Op_RShiftL: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
181 |
case Op_URShiftI: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
182 |
case Op_URShiftL: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
183 |
return true; |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
184 |
} |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
185 |
return false; |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
186 |
} |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
187 |
|
13488 | 188 |
// Check if input is loop invariant vector. |
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
189 |
bool VectorNode::is_invariant_vector(Node* n) { |
13488 | 190 |
// Only Replicate vector nodes are loop invariant for now. |
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
191 |
switch (n->Opcode()) { |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
192 |
case Op_ReplicateB: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
193 |
case Op_ReplicateS: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
194 |
case Op_ReplicateI: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
195 |
case Op_ReplicateL: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
196 |
case Op_ReplicateF: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
197 |
case Op_ReplicateD: |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
198 |
return true; |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
199 |
} |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
200 |
return false; |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
201 |
} |
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
202 |
|
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
203 |
// [Start, end) half-open range defining which operands are vectors |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
204 |
void VectorNode::vector_operands(Node* n, uint* start, uint* end) { |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
205 |
switch (n->Opcode()) { |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
206 |
case Op_LoadB: case Op_LoadUB: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
207 |
case Op_LoadS: case Op_LoadUS: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
208 |
case Op_LoadI: case Op_LoadL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
209 |
case Op_LoadF: case Op_LoadD: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
210 |
case Op_LoadP: case Op_LoadN: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
211 |
*start = 0; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
212 |
*end = 0; // no vector operands |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
213 |
break; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
214 |
case Op_StoreB: case Op_StoreC: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
215 |
case Op_StoreI: case Op_StoreL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
216 |
case Op_StoreF: case Op_StoreD: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
217 |
case Op_StoreP: case Op_StoreN: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
218 |
*start = MemNode::ValueIn; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
219 |
*end = MemNode::ValueIn + 1; // 1 vector operand |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
220 |
break; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
221 |
case Op_LShiftI: case Op_LShiftL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
222 |
case Op_RShiftI: case Op_RShiftL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
223 |
case Op_URShiftI: case Op_URShiftL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
224 |
*start = 1; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
225 |
*end = 2; // 1 vector operand |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
226 |
break; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
227 |
case Op_AddI: case Op_AddL: case Op_AddF: case Op_AddD: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
228 |
case Op_SubI: case Op_SubL: case Op_SubF: case Op_SubD: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
229 |
case Op_MulI: case Op_MulL: case Op_MulF: case Op_MulD: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
230 |
case Op_DivF: case Op_DivD: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
231 |
case Op_AndI: case Op_AndL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
232 |
case Op_OrI: case Op_OrL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
233 |
case Op_XorI: case Op_XorL: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
234 |
*start = 1; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
235 |
*end = 3; // 2 vector operands |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
236 |
break; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
237 |
case Op_CMoveI: case Op_CMoveL: case Op_CMoveF: case Op_CMoveD: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
238 |
*start = 2; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
239 |
*end = n->req(); |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
240 |
break; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
241 |
default: |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
242 |
*start = 1; |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
243 |
*end = n->req(); // default is all operands |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
244 |
} |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
245 |
} |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
246 |
|
1 | 247 |
// Return the vector version of a scalar operation node. |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
248 |
VectorNode* VectorNode::make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, BasicType bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
249 |
const TypeVect* vt = TypeVect::make(bt, vlen); |
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
250 |
int vopc = VectorNode::opcode(opc, bt); |
13930 | 251 |
// This method should not be called for unimplemented vectors. |
252 |
guarantee(vopc > 0, err_msg_res("Vector for '%s' is not implemented", NodeClassNames[opc])); |
|
1 | 253 |
|
254 |
switch (vopc) { |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
255 |
case Op_AddVB: return new (C) AddVBNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
256 |
case Op_AddVS: return new (C) AddVSNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
257 |
case Op_AddVI: return new (C) AddVINode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
258 |
case Op_AddVL: return new (C) AddVLNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
259 |
case Op_AddVF: return new (C) AddVFNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
260 |
case Op_AddVD: return new (C) AddVDNode(n1, n2, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
261 |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
262 |
case Op_SubVB: return new (C) SubVBNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
263 |
case Op_SubVS: return new (C) SubVSNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
264 |
case Op_SubVI: return new (C) SubVINode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
265 |
case Op_SubVL: return new (C) SubVLNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
266 |
case Op_SubVF: return new (C) SubVFNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
267 |
case Op_SubVD: return new (C) SubVDNode(n1, n2, vt); |
1 | 268 |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
269 |
case Op_MulVS: return new (C) MulVSNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
270 |
case Op_MulVI: return new (C) MulVINode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
271 |
case Op_MulVF: return new (C) MulVFNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
272 |
case Op_MulVD: return new (C) MulVDNode(n1, n2, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
273 |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
274 |
case Op_DivVF: return new (C) DivVFNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
275 |
case Op_DivVD: return new (C) DivVDNode(n1, n2, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
276 |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
277 |
case Op_LShiftVB: return new (C) LShiftVBNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
278 |
case Op_LShiftVS: return new (C) LShiftVSNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
279 |
case Op_LShiftVI: return new (C) LShiftVINode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
280 |
case Op_LShiftVL: return new (C) LShiftVLNode(n1, n2, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
281 |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
282 |
case Op_RShiftVB: return new (C) RShiftVBNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
283 |
case Op_RShiftVS: return new (C) RShiftVSNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
284 |
case Op_RShiftVI: return new (C) RShiftVINode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
285 |
case Op_RShiftVL: return new (C) RShiftVLNode(n1, n2, vt); |
13485
6c7faa516fc6
6340864: Implement vectorization optimizations in hotspot-server
kvn
parents:
13104
diff
changeset
|
286 |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
287 |
case Op_URShiftVB: return new (C) URShiftVBNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
288 |
case Op_URShiftVS: return new (C) URShiftVSNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
289 |
case Op_URShiftVI: return new (C) URShiftVINode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
290 |
case Op_URShiftVL: return new (C) URShiftVLNode(n1, n2, vt); |
1 | 291 |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
292 |
case Op_AndV: return new (C) AndVNode(n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
293 |
case Op_OrV: return new (C) OrVNode (n1, n2, vt); |
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
294 |
case Op_XorV: return new (C) XorVNode(n1, n2, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
295 |
} |
13930 | 296 |
fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[vopc])); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
297 |
return NULL; |
1 | 298 |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
299 |
} |
1 | 300 |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
301 |
// Scalar promotion |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
302 |
VectorNode* VectorNode::scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
303 |
BasicType bt = opd_t->array_element_basic_type(); |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
304 |
const TypeVect* vt = opd_t->singleton() ? TypeVect::make(opd_t, vlen) |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
305 |
: TypeVect::make(bt, vlen); |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
306 |
switch (bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
307 |
case T_BOOLEAN: |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
308 |
case T_BYTE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
309 |
return new (C) ReplicateBNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
310 |
case T_CHAR: |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
311 |
case T_SHORT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
312 |
return new (C) ReplicateSNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
313 |
case T_INT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
314 |
return new (C) ReplicateINode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
315 |
case T_LONG: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
316 |
return new (C) ReplicateLNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
317 |
case T_FLOAT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
318 |
return new (C) ReplicateFNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
319 |
case T_DOUBLE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
320 |
return new (C) ReplicateDNode(s, vt); |
1 | 321 |
} |
13930 | 322 |
fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); |
323 |
return NULL; |
|
324 |
} |
|
325 |
||
326 |
VectorNode* VectorNode::shift_count(Compile* C, Node* shift, Node* cnt, uint vlen, BasicType bt) { |
|
327 |
assert(VectorNode::is_shift(shift) && !cnt->is_Con(), "only variable shift count"); |
|
328 |
// Match shift count type with shift vector type. |
|
329 |
const TypeVect* vt = TypeVect::make(bt, vlen); |
|
330 |
switch (shift->Opcode()) { |
|
331 |
case Op_LShiftI: |
|
332 |
case Op_LShiftL: |
|
333 |
return new (C) LShiftCntVNode(cnt, vt); |
|
334 |
case Op_RShiftI: |
|
335 |
case Op_RShiftL: |
|
336 |
case Op_URShiftI: |
|
337 |
case Op_URShiftL: |
|
338 |
return new (C) RShiftCntVNode(cnt, vt); |
|
339 |
} |
|
340 |
fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[shift->Opcode()])); |
|
1 | 341 |
return NULL; |
342 |
} |
|
343 |
||
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
344 |
// Return initial Pack node. Additional operands added with add_opd() calls. |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
345 |
PackNode* PackNode::make(Compile* C, Node* s, uint vlen, BasicType bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
346 |
const TypeVect* vt = TypeVect::make(bt, vlen); |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
347 |
switch (bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
348 |
case T_BOOLEAN: |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
349 |
case T_BYTE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
350 |
return new (C) PackBNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
351 |
case T_CHAR: |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
352 |
case T_SHORT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
353 |
return new (C) PackSNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
354 |
case T_INT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
355 |
return new (C) PackINode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
356 |
case T_LONG: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
357 |
return new (C) PackLNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
358 |
case T_FLOAT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
359 |
return new (C) PackFNode(s, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
360 |
case T_DOUBLE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
361 |
return new (C) PackDNode(s, vt); |
1 | 362 |
} |
13930 | 363 |
fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); |
1 | 364 |
return NULL; |
365 |
} |
|
366 |
||
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
367 |
// Create a binary tree form for Packs. [lo, hi) (half-open) range |
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
368 |
PackNode* PackNode::binary_tree_pack(Compile* C, int lo, int hi) { |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
369 |
int ct = hi - lo; |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
370 |
assert(is_power_of_2(ct), "power of 2"); |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
371 |
if (ct == 2) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
372 |
PackNode* pk = PackNode::make(C, in(lo), 2, vect_type()->element_basic_type()); |
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
373 |
pk->add_opd(in(lo+1)); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
374 |
return pk; |
1 | 375 |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
376 |
} else { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
377 |
int mid = lo + ct/2; |
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
378 |
PackNode* n1 = binary_tree_pack(C, lo, mid); |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
379 |
PackNode* n2 = binary_tree_pack(C, mid, hi ); |
1 | 380 |
|
13490
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
381 |
BasicType bt = n1->vect_type()->element_basic_type(); |
d19348851d2e
7192963: assert(_in[req-1] == this) failed: Must pass arg count to 'new'
kvn
parents:
13488
diff
changeset
|
382 |
assert(bt == n2->vect_type()->element_basic_type(), "should be the same"); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
383 |
switch (bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
384 |
case T_BOOLEAN: |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
385 |
case T_BYTE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
386 |
return new (C) PackSNode(n1, n2, TypeVect::make(T_SHORT, 2)); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
387 |
case T_CHAR: |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
388 |
case T_SHORT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
389 |
return new (C) PackINode(n1, n2, TypeVect::make(T_INT, 2)); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
390 |
case T_INT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
391 |
return new (C) PackLNode(n1, n2, TypeVect::make(T_LONG, 2)); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
392 |
case T_LONG: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
393 |
return new (C) Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2)); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
394 |
case T_FLOAT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
395 |
return new (C) PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
396 |
case T_DOUBLE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
397 |
return new (C) Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
398 |
} |
13930 | 399 |
fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); |
1 | 400 |
} |
401 |
return NULL; |
|
402 |
} |
|
403 |
||
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
404 |
// Return the vector version of a scalar load node. |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
405 |
LoadVectorNode* LoadVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem, |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
406 |
Node* adr, const TypePtr* atyp, uint vlen, BasicType bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
407 |
const TypeVect* vt = TypeVect::make(bt, vlen); |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
408 |
return new (C) LoadVectorNode(ctl, mem, adr, atyp, vt); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
409 |
} |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
410 |
|
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
411 |
// Return the vector version of a scalar store node. |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
412 |
StoreVectorNode* StoreVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem, |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
413 |
Node* adr, const TypePtr* atyp, Node* val, |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
414 |
uint vlen) { |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
415 |
return new (C) StoreVectorNode(ctl, mem, adr, atyp, val); |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
416 |
} |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
417 |
|
1 | 418 |
// Extract a scalar element of vector. |
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
419 |
Node* ExtractNode::make(Compile* C, Node* v, uint position, BasicType bt) { |
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
420 |
assert((int)position < Matcher::max_vector_size(bt), "pos in range"); |
1 | 421 |
ConINode* pos = ConINode::make(C, (int)position); |
422 |
switch (bt) { |
|
423 |
case T_BOOLEAN: |
|
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
424 |
return new (C) ExtractUBNode(v, pos); |
1 | 425 |
case T_BYTE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
426 |
return new (C) ExtractBNode(v, pos); |
1 | 427 |
case T_CHAR: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
428 |
return new (C) ExtractCNode(v, pos); |
1 | 429 |
case T_SHORT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
430 |
return new (C) ExtractSNode(v, pos); |
1 | 431 |
case T_INT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
432 |
return new (C) ExtractINode(v, pos); |
1 | 433 |
case T_LONG: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
434 |
return new (C) ExtractLNode(v, pos); |
1 | 435 |
case T_FLOAT: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
436 |
return new (C) ExtractFNode(v, pos); |
1 | 437 |
case T_DOUBLE: |
13895
f6dfe4123709
7193318: C2: remove number of inputs requirement from Node's new operator
kvn
parents:
13490
diff
changeset
|
438 |
return new (C) ExtractDNode(v, pos); |
1 | 439 |
} |
13930 | 440 |
fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); |
1 | 441 |
return NULL; |
442 |
} |
|
13104
657b387034fb
7119644: Increase superword's vector size up to 256 bits
kvn
parents:
10255
diff
changeset
|
443 |