comparison src/share/vm/opto/vectornode.hpp @ 6275:957c266d8bc5

Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Aug 2012 10:39:19 +0200
parents 8c92982cbbc4
children 006050192a5a
comparison
equal deleted inserted replaced
5891:fd8832ae511d 6275:957c266d8bc5
1 /* 1 /*
2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
29 #include "opto/node.hpp" 29 #include "opto/node.hpp"
30 #include "opto/opcodes.hpp" 30 #include "opto/opcodes.hpp"
31 31
32 //------------------------------VectorNode-------------------------------------- 32 //------------------------------VectorNode--------------------------------------
33 // Vector Operation 33 // Vector Operation
34 class VectorNode : public Node { 34 class VectorNode : public TypeNode {
35 virtual uint size_of() const { return sizeof(*this); } 35 public:
36 protected: 36
37 uint _length; // vector length 37 VectorNode(Node* n1, const TypeVect* vt) : TypeNode(vt, 2) {
38 virtual BasicType elt_basic_type() const = 0; // Vector element basic type 38 init_class_id(Class_Vector);
39 39 init_req(1, n1);
40 static const Type* vect_type(BasicType elt_bt, uint len);
41 static const Type* vect_type(const Type* elt_type, uint len) {
42 return vect_type(elt_type->array_element_basic_type(), len);
43 } 40 }
44 41 VectorNode(Node* n1, Node* n2, const TypeVect* vt) : TypeNode(vt, 3) {
45 public:
46 friend class VectorLoadNode; // For vect_type
47 friend class VectorStoreNode; // ditto.
48
49 VectorNode(Node* n1, uint vlen) : Node(NULL, n1), _length(vlen) {
50 init_class_id(Class_Vector); 42 init_class_id(Class_Vector);
43 init_req(1, n1);
44 init_req(2, n2);
51 } 45 }
52 VectorNode(Node* n1, Node* n2, uint vlen) : Node(NULL, n1, n2), _length(vlen) { 46
53 init_class_id(Class_Vector); 47 const TypeVect* vect_type() const { return type()->is_vect(); }
54 } 48 uint length() const { return vect_type()->length(); } // Vector length
55 virtual int Opcode() const; 49
56 50 virtual int Opcode() const;
57 uint length() const { return _length; } // Vector length 51
58 52 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(vect_type()->length_in_bytes()); }
59 static uint max_vlen(BasicType bt) { // max vector length
60 return (uint)(Matcher::vector_width_in_bytes() / type2aelembytes(bt));
61 }
62
63 // Element and vector type
64 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
65 const Type* vect_type() const { return vect_type(elt_basic_type(), length()); }
66
67 virtual const Type *bottom_type() const { return vect_type(); }
68 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
69
70 // Vector opcode from scalar opcode
71 static int opcode(int sopc, uint vlen, const Type* opd_t);
72 53
73 static VectorNode* scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t); 54 static VectorNode* scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t);
74 55
75 static VectorNode* make(Compile* C, int sopc, Node* n1, Node* n2, uint vlen, const Type* elt_t); 56 static VectorNode* make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, BasicType bt);
57
58 static int opcode(int opc, uint vlen, BasicType bt);
59 static bool implemented(int opc, uint vlen, BasicType bt);
76 60
77 }; 61 };
78 62
79 //===========================Vector=ALU=Operations==================================== 63 //===========================Vector=ALU=Operations====================================
80 64
81 //------------------------------AddVBNode--------------------------------------- 65 //------------------------------AddVBNode---------------------------------------
82 // Vector add byte 66 // Vector add byte
83 class AddVBNode : public VectorNode { 67 class AddVBNode : public VectorNode {
84 protected: 68 public:
85 virtual BasicType elt_basic_type() const { return T_BYTE; } 69 AddVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
86 public:
87 AddVBNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
88 virtual int Opcode() const;
89 };
90
91 //------------------------------AddVCNode---------------------------------------
92 // Vector add char
93 class AddVCNode : public VectorNode {
94 protected:
95 virtual BasicType elt_basic_type() const { return T_CHAR; }
96 public:
97 AddVCNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
98 virtual int Opcode() const; 70 virtual int Opcode() const;
99 }; 71 };
100 72
101 //------------------------------AddVSNode--------------------------------------- 73 //------------------------------AddVSNode---------------------------------------
102 // Vector add short 74 // Vector add char/short
103 class AddVSNode : public VectorNode { 75 class AddVSNode : public VectorNode {
104 protected: 76 public:
105 virtual BasicType elt_basic_type() const { return T_SHORT; } 77 AddVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
106 public:
107 AddVSNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
108 virtual int Opcode() const; 78 virtual int Opcode() const;
109 }; 79 };
110 80
111 //------------------------------AddVINode--------------------------------------- 81 //------------------------------AddVINode---------------------------------------
112 // Vector add int 82 // Vector add int
113 class AddVINode : public VectorNode { 83 class AddVINode : public VectorNode {
114 protected: 84 public:
115 virtual BasicType elt_basic_type() const { return T_INT; } 85 AddVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
116 public:
117 AddVINode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
118 virtual int Opcode() const; 86 virtual int Opcode() const;
119 }; 87 };
120 88
121 //------------------------------AddVLNode--------------------------------------- 89 //------------------------------AddVLNode---------------------------------------
122 // Vector add long 90 // Vector add long
123 class AddVLNode : public VectorNode { 91 class AddVLNode : public VectorNode {
124 protected: 92 public:
125 virtual BasicType elt_basic_type() const { return T_LONG; } 93 AddVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
126 public:
127 AddVLNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
128 virtual int Opcode() const; 94 virtual int Opcode() const;
129 }; 95 };
130 96
131 //------------------------------AddVFNode--------------------------------------- 97 //------------------------------AddVFNode---------------------------------------
132 // Vector add float 98 // Vector add float
133 class AddVFNode : public VectorNode { 99 class AddVFNode : public VectorNode {
134 protected: 100 public:
135 virtual BasicType elt_basic_type() const { return T_FLOAT; } 101 AddVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
136 public:
137 AddVFNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
138 virtual int Opcode() const; 102 virtual int Opcode() const;
139 }; 103 };
140 104
141 //------------------------------AddVDNode--------------------------------------- 105 //------------------------------AddVDNode---------------------------------------
142 // Vector add double 106 // Vector add double
143 class AddVDNode : public VectorNode { 107 class AddVDNode : public VectorNode {
144 protected: 108 public:
145 virtual BasicType elt_basic_type() const { return T_DOUBLE; } 109 AddVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
146 public:
147 AddVDNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
148 virtual int Opcode() const; 110 virtual int Opcode() const;
149 }; 111 };
150 112
151 //------------------------------SubVBNode--------------------------------------- 113 //------------------------------SubVBNode---------------------------------------
152 // Vector subtract byte 114 // Vector subtract byte
153 class SubVBNode : public VectorNode { 115 class SubVBNode : public VectorNode {
154 protected: 116 public:
155 virtual BasicType elt_basic_type() const { return T_BYTE; } 117 SubVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
156 public:
157 SubVBNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
158 virtual int Opcode() const;
159 };
160
161 //------------------------------SubVCNode---------------------------------------
162 // Vector subtract char
163 class SubVCNode : public VectorNode {
164 protected:
165 virtual BasicType elt_basic_type() const { return T_CHAR; }
166 public:
167 SubVCNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
168 virtual int Opcode() const; 118 virtual int Opcode() const;
169 }; 119 };
170 120
171 //------------------------------SubVSNode--------------------------------------- 121 //------------------------------SubVSNode---------------------------------------
172 // Vector subtract short 122 // Vector subtract short
173 class SubVSNode : public VectorNode { 123 class SubVSNode : public VectorNode {
174 protected: 124 public:
175 virtual BasicType elt_basic_type() const { return T_SHORT; } 125 SubVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
176 public:
177 SubVSNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
178 virtual int Opcode() const; 126 virtual int Opcode() const;
179 }; 127 };
180 128
181 //------------------------------SubVINode--------------------------------------- 129 //------------------------------SubVINode---------------------------------------
182 // Vector subtract int 130 // Vector subtract int
183 class SubVINode : public VectorNode { 131 class SubVINode : public VectorNode {
184 protected: 132 public:
185 virtual BasicType elt_basic_type() const { return T_INT; } 133 SubVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
186 public:
187 SubVINode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
188 virtual int Opcode() const; 134 virtual int Opcode() const;
189 }; 135 };
190 136
191 //------------------------------SubVLNode--------------------------------------- 137 //------------------------------SubVLNode---------------------------------------
192 // Vector subtract long 138 // Vector subtract long
193 class SubVLNode : public VectorNode { 139 class SubVLNode : public VectorNode {
194 protected: 140 public:
195 virtual BasicType elt_basic_type() const { return T_LONG; } 141 SubVLNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
196 public:
197 SubVLNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
198 virtual int Opcode() const; 142 virtual int Opcode() const;
199 }; 143 };
200 144
201 //------------------------------SubVFNode--------------------------------------- 145 //------------------------------SubVFNode---------------------------------------
202 // Vector subtract float 146 // Vector subtract float
203 class SubVFNode : public VectorNode { 147 class SubVFNode : public VectorNode {
204 protected: 148 public:
205 virtual BasicType elt_basic_type() const { return T_FLOAT; } 149 SubVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
206 public:
207 SubVFNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
208 virtual int Opcode() const; 150 virtual int Opcode() const;
209 }; 151 };
210 152
211 //------------------------------SubVDNode--------------------------------------- 153 //------------------------------SubVDNode---------------------------------------
212 // Vector subtract double 154 // Vector subtract double
213 class SubVDNode : public VectorNode { 155 class SubVDNode : public VectorNode {
214 protected: 156 public:
215 virtual BasicType elt_basic_type() const { return T_DOUBLE; } 157 SubVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
216 public:
217 SubVDNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
218 virtual int Opcode() const; 158 virtual int Opcode() const;
219 }; 159 };
220 160
221 //------------------------------MulVFNode--------------------------------------- 161 //------------------------------MulVFNode---------------------------------------
222 // Vector multiply float 162 // Vector multiply float
223 class MulVFNode : public VectorNode { 163 class MulVFNode : public VectorNode {
224 protected: 164 public:
225 virtual BasicType elt_basic_type() const { return T_FLOAT; } 165 MulVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
226 public:
227 MulVFNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
228 virtual int Opcode() const; 166 virtual int Opcode() const;
229 }; 167 };
230 168
231 //------------------------------MulVDNode--------------------------------------- 169 //------------------------------MulVDNode---------------------------------------
232 // Vector multiply double 170 // Vector multiply double
233 class MulVDNode : public VectorNode { 171 class MulVDNode : public VectorNode {
234 protected: 172 public:
235 virtual BasicType elt_basic_type() const { return T_DOUBLE; } 173 MulVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
236 public:
237 MulVDNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
238 virtual int Opcode() const; 174 virtual int Opcode() const;
239 }; 175 };
240 176
241 //------------------------------DivVFNode--------------------------------------- 177 //------------------------------DivVFNode---------------------------------------
242 // Vector divide float 178 // Vector divide float
243 class DivVFNode : public VectorNode { 179 class DivVFNode : public VectorNode {
244 protected: 180 public:
245 virtual BasicType elt_basic_type() const { return T_FLOAT; } 181 DivVFNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
246 public:
247 DivVFNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
248 virtual int Opcode() const; 182 virtual int Opcode() const;
249 }; 183 };
250 184
251 //------------------------------DivVDNode--------------------------------------- 185 //------------------------------DivVDNode---------------------------------------
252 // Vector Divide double 186 // Vector Divide double
253 class DivVDNode : public VectorNode { 187 class DivVDNode : public VectorNode {
254 protected: 188 public:
255 virtual BasicType elt_basic_type() const { return T_DOUBLE; } 189 DivVDNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
256 public:
257 DivVDNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
258 virtual int Opcode() const; 190 virtual int Opcode() const;
259 }; 191 };
260 192
261 //------------------------------LShiftVBNode--------------------------------------- 193 //------------------------------LShiftVBNode---------------------------------------
262 // Vector lshift byte 194 // Vector lshift byte
263 class LShiftVBNode : public VectorNode { 195 class LShiftVBNode : public VectorNode {
264 protected: 196 public:
265 virtual BasicType elt_basic_type() const { return T_BYTE; } 197 LShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
266 public:
267 LShiftVBNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
268 virtual int Opcode() const;
269 };
270
271 //------------------------------LShiftVCNode---------------------------------------
272 // Vector lshift chars
273 class LShiftVCNode : public VectorNode {
274 protected:
275 virtual BasicType elt_basic_type() const { return T_CHAR; }
276 public:
277 LShiftVCNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
278 virtual int Opcode() const; 198 virtual int Opcode() const;
279 }; 199 };
280 200
281 //------------------------------LShiftVSNode--------------------------------------- 201 //------------------------------LShiftVSNode---------------------------------------
282 // Vector lshift shorts 202 // Vector lshift shorts
283 class LShiftVSNode : public VectorNode { 203 class LShiftVSNode : public VectorNode {
284 protected: 204 public:
285 virtual BasicType elt_basic_type() const { return T_SHORT; } 205 LShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
286 public:
287 LShiftVSNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
288 virtual int Opcode() const; 206 virtual int Opcode() const;
289 }; 207 };
290 208
291 //------------------------------LShiftVINode--------------------------------------- 209 //------------------------------LShiftVINode---------------------------------------
292 // Vector lshift ints 210 // Vector lshift ints
293 class LShiftVINode : public VectorNode { 211 class LShiftVINode : public VectorNode {
294 protected: 212 public:
295 virtual BasicType elt_basic_type() const { return T_INT; } 213 LShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
296 public:
297 LShiftVINode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
298 virtual int Opcode() const; 214 virtual int Opcode() const;
299 }; 215 };
300 216
301 //------------------------------URShiftVBNode--------------------------------------- 217 //------------------------------URShiftVBNode---------------------------------------
302 // Vector urshift bytes 218 // Vector urshift bytes
303 class URShiftVBNode : public VectorNode { 219 class RShiftVBNode : public VectorNode {
304 protected: 220 public:
305 virtual BasicType elt_basic_type() const { return T_BYTE; } 221 RShiftVBNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
306 public:
307 URShiftVBNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
308 virtual int Opcode() const;
309 };
310
311 //------------------------------URShiftVCNode---------------------------------------
312 // Vector urshift char
313 class URShiftVCNode : public VectorNode {
314 protected:
315 virtual BasicType elt_basic_type() const { return T_SHORT; }
316 public:
317 URShiftVCNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
318 virtual int Opcode() const; 222 virtual int Opcode() const;
319 }; 223 };
320 224
321 //------------------------------URShiftVSNode--------------------------------------- 225 //------------------------------URShiftVSNode---------------------------------------
322 // Vector urshift shorts 226 // Vector urshift shorts
323 class URShiftVSNode : public VectorNode { 227 class RShiftVSNode : public VectorNode {
324 protected: 228 public:
325 virtual BasicType elt_basic_type() const { return T_SHORT; } 229 RShiftVSNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
326 public:
327 URShiftVSNode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
328 virtual int Opcode() const; 230 virtual int Opcode() const;
329 }; 231 };
330 232
331 //------------------------------URShiftVINode--------------------------------------- 233 //------------------------------URShiftVINode---------------------------------------
332 // Vector urshift ints 234 // Vector urshift ints
333 class URShiftVINode : public VectorNode { 235 class RShiftVINode : public VectorNode {
334 protected: 236 public:
335 virtual BasicType elt_basic_type() const { return T_INT; } 237 RShiftVINode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
336 public:
337 URShiftVINode(Node* in1, Node* in2, uint vlen) : VectorNode(in1,in2,vlen) {}
338 virtual int Opcode() const; 238 virtual int Opcode() const;
339 }; 239 };
340 240
341 //------------------------------AndVNode--------------------------------------- 241 //------------------------------AndVNode---------------------------------------
342 // Vector and 242 // Vector and
343 class AndVNode : public VectorNode { 243 class AndVNode : public VectorNode {
344 protected: 244 public:
345 BasicType _bt; 245 AndVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
346 virtual BasicType elt_basic_type() const { return _bt; }
347 public:
348 AndVNode(Node* in1, Node* in2, uint vlen, BasicType bt) : VectorNode(in1,in2,vlen), _bt(bt) {}
349 virtual int Opcode() const; 246 virtual int Opcode() const;
350 }; 247 };
351 248
352 //------------------------------OrVNode--------------------------------------- 249 //------------------------------OrVNode---------------------------------------
353 // Vector or 250 // Vector or
354 class OrVNode : public VectorNode { 251 class OrVNode : public VectorNode {
355 protected: 252 public:
356 BasicType _bt; 253 OrVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
357 virtual BasicType elt_basic_type() const { return _bt; }
358 public:
359 OrVNode(Node* in1, Node* in2, uint vlen, BasicType bt) : VectorNode(in1,in2,vlen), _bt(bt) {}
360 virtual int Opcode() const; 254 virtual int Opcode() const;
361 }; 255 };
362 256
363 //------------------------------XorVNode--------------------------------------- 257 //------------------------------XorVNode---------------------------------------
364 // Vector xor 258 // Vector xor
365 class XorVNode : public VectorNode { 259 class XorVNode : public VectorNode {
366 protected: 260 public:
367 BasicType _bt; 261 XorVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
368 virtual BasicType elt_basic_type() const { return _bt; } 262 virtual int Opcode() const;
369 public: 263 };
370 XorVNode(Node* in1, Node* in2, uint vlen, BasicType bt) : VectorNode(in1,in2,vlen), _bt(bt) {} 264
371 virtual int Opcode() const; 265 //================================= M E M O R Y ===============================
372 }; 266
373 267 //------------------------------LoadVectorNode---------------------------------
374 //================================= M E M O R Y ================================== 268 // Load Vector from memory
375 269 class LoadVectorNode : public LoadNode {
376 270 public:
377 //------------------------------VectorLoadNode-------------------------------------- 271 LoadVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt)
378 // Vector Load from memory 272 : LoadNode(c, mem, adr, at, vt) {
379 class VectorLoadNode : public LoadNode { 273 init_class_id(Class_LoadVector);
380 virtual uint size_of() const { return sizeof(*this); }
381
382 protected:
383 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
384 // For use in constructor
385 static const Type* vect_type(const Type* elt_type, uint len) {
386 return VectorNode::vect_type(elt_type, len);
387 } 274 }
388 275
389 public: 276 const TypeVect* vect_type() const { return type()->is_vect(); }
390 VectorLoadNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *rt) 277 uint length() const { return vect_type()->length(); } // Vector length
391 : LoadNode(c,mem,adr,at,rt) { 278
392 init_class_id(Class_VectorLoad); 279 virtual int Opcode() const;
280
281 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); }
282 virtual BasicType memory_type() const { return T_VOID; }
283 virtual int memory_size() const { return vect_type()->length_in_bytes(); }
284
285 virtual int store_Opcode() const { return Op_StoreVector; }
286
287 static LoadVectorNode* make(Compile* C, int opc, Node* ctl, Node* mem,
288 Node* adr, const TypePtr* atyp, uint vlen, BasicType bt);
289 };
290
291 //------------------------------StoreVectorNode--------------------------------
292 // Store Vector to memory
293 class StoreVectorNode : public StoreNode {
294 public:
295 StoreVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
296 : StoreNode(c, mem, adr, at, val) {
297 assert(val->is_Vector() || val->is_LoadVector(), "sanity");
298 init_class_id(Class_StoreVector);
393 } 299 }
394 virtual int Opcode() const; 300
395 301 const TypeVect* vect_type() const { return in(MemNode::ValueIn)->bottom_type()->is_vect(); }
396 virtual uint length() const = 0; // Vector length 302 uint length() const { return vect_type()->length(); } // Vector length
397 303
398 // Element and vector type 304 virtual int Opcode() const;
399 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); } 305
400 const Type* vect_type() const { return VectorNode::vect_type(elt_basic_type(), length()); } 306 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); }
401
402 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
403 virtual BasicType memory_type() const { return T_VOID; } 307 virtual BasicType memory_type() const { return T_VOID; }
404 virtual int memory_size() const { return length()*type2aelembytes(elt_basic_type()); } 308 virtual int memory_size() const { return vect_type()->length_in_bytes(); }
405 309
406 // Vector opcode from scalar opcode 310 static StoreVectorNode* make(Compile* C, int opc, Node* ctl, Node* mem,
407 static int opcode(int sopc, uint vlen);
408
409 static VectorLoadNode* make(Compile* C, int opc, Node* ctl, Node* mem,
410 Node* adr, const TypePtr* atyp, uint vlen);
411 };
412
413 //------------------------------Load16BNode--------------------------------------
414 // Vector load of 16 bytes (8bits signed) from memory
415 class Load16BNode : public VectorLoadNode {
416 protected:
417 virtual BasicType elt_basic_type() const { return T_BYTE; }
418 public:
419 Load16BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::BYTE)
420 : VectorLoadNode(c,mem,adr,at,vect_type(ti,16)) {}
421 virtual int Opcode() const;
422 virtual int store_Opcode() const { return Op_Store16B; }
423 virtual uint length() const { return 16; }
424 };
425
426 //------------------------------Load8BNode--------------------------------------
427 // Vector load of 8 bytes (8bits signed) from memory
428 class Load8BNode : public VectorLoadNode {
429 protected:
430 virtual BasicType elt_basic_type() const { return T_BYTE; }
431 public:
432 Load8BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::BYTE)
433 : VectorLoadNode(c,mem,adr,at,vect_type(ti,8)) {}
434 virtual int Opcode() const;
435 virtual int store_Opcode() const { return Op_Store8B; }
436 virtual uint length() const { return 8; }
437 };
438
439 //------------------------------Load4BNode--------------------------------------
440 // Vector load of 4 bytes (8bits signed) from memory
441 class Load4BNode : public VectorLoadNode {
442 protected:
443 virtual BasicType elt_basic_type() const { return T_BYTE; }
444 public:
445 Load4BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::BYTE)
446 : VectorLoadNode(c,mem,adr,at,vect_type(ti,4)) {}
447 virtual int Opcode() const;
448 virtual int store_Opcode() const { return Op_Store4B; }
449 virtual uint length() const { return 4; }
450 };
451
452 //------------------------------Load8CNode--------------------------------------
453 // Vector load of 8 chars (16bits unsigned) from memory
454 class Load8CNode : public VectorLoadNode {
455 protected:
456 virtual BasicType elt_basic_type() const { return T_CHAR; }
457 public:
458 Load8CNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::CHAR)
459 : VectorLoadNode(c,mem,adr,at,vect_type(ti,8)) {}
460 virtual int Opcode() const;
461 virtual int store_Opcode() const { return Op_Store8C; }
462 virtual uint length() const { return 8; }
463 };
464
465 //------------------------------Load4CNode--------------------------------------
466 // Vector load of 4 chars (16bits unsigned) from memory
467 class Load4CNode : public VectorLoadNode {
468 protected:
469 virtual BasicType elt_basic_type() const { return T_CHAR; }
470 public:
471 Load4CNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::CHAR)
472 : VectorLoadNode(c,mem,adr,at,vect_type(ti,4)) {}
473 virtual int Opcode() const;
474 virtual int store_Opcode() const { return Op_Store4C; }
475 virtual uint length() const { return 4; }
476 };
477
478 //------------------------------Load2CNode--------------------------------------
479 // Vector load of 2 chars (16bits unsigned) from memory
480 class Load2CNode : public VectorLoadNode {
481 protected:
482 virtual BasicType elt_basic_type() const { return T_CHAR; }
483 public:
484 Load2CNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::CHAR)
485 : VectorLoadNode(c,mem,adr,at,vect_type(ti,2)) {}
486 virtual int Opcode() const;
487 virtual int store_Opcode() const { return Op_Store2C; }
488 virtual uint length() const { return 2; }
489 };
490
491 //------------------------------Load8SNode--------------------------------------
492 // Vector load of 8 shorts (16bits signed) from memory
493 class Load8SNode : public VectorLoadNode {
494 protected:
495 virtual BasicType elt_basic_type() const { return T_SHORT; }
496 public:
497 Load8SNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::SHORT)
498 : VectorLoadNode(c,mem,adr,at,vect_type(ti,8)) {}
499 virtual int Opcode() const;
500 virtual int store_Opcode() const { return Op_Store8C; }
501 virtual uint length() const { return 8; }
502 };
503
504 //------------------------------Load4SNode--------------------------------------
505 // Vector load of 4 shorts (16bits signed) from memory
506 class Load4SNode : public VectorLoadNode {
507 protected:
508 virtual BasicType elt_basic_type() const { return T_SHORT; }
509 public:
510 Load4SNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::SHORT)
511 : VectorLoadNode(c,mem,adr,at,vect_type(ti,4)) {}
512 virtual int Opcode() const;
513 virtual int store_Opcode() const { return Op_Store4C; }
514 virtual uint length() const { return 4; }
515 };
516
517 //------------------------------Load2SNode--------------------------------------
518 // Vector load of 2 shorts (16bits signed) from memory
519 class Load2SNode : public VectorLoadNode {
520 protected:
521 virtual BasicType elt_basic_type() const { return T_SHORT; }
522 public:
523 Load2SNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::SHORT)
524 : VectorLoadNode(c,mem,adr,at,vect_type(ti,2)) {}
525 virtual int Opcode() const;
526 virtual int store_Opcode() const { return Op_Store2C; }
527 virtual uint length() const { return 2; }
528 };
529
530 //------------------------------Load4INode--------------------------------------
531 // Vector load of 4 integers (32bits signed) from memory
532 class Load4INode : public VectorLoadNode {
533 protected:
534 virtual BasicType elt_basic_type() const { return T_INT; }
535 public:
536 Load4INode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::INT)
537 : VectorLoadNode(c,mem,adr,at,vect_type(ti,4)) {}
538 virtual int Opcode() const;
539 virtual int store_Opcode() const { return Op_Store4I; }
540 virtual uint length() const { return 4; }
541 };
542
543 //------------------------------Load2INode--------------------------------------
544 // Vector load of 2 integers (32bits signed) from memory
545 class Load2INode : public VectorLoadNode {
546 protected:
547 virtual BasicType elt_basic_type() const { return T_INT; }
548 public:
549 Load2INode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::INT)
550 : VectorLoadNode(c,mem,adr,at,vect_type(ti,2)) {}
551 virtual int Opcode() const;
552 virtual int store_Opcode() const { return Op_Store2I; }
553 virtual uint length() const { return 2; }
554 };
555
556 //------------------------------Load2LNode--------------------------------------
557 // Vector load of 2 longs (64bits signed) from memory
558 class Load2LNode : public VectorLoadNode {
559 protected:
560 virtual BasicType elt_basic_type() const { return T_LONG; }
561 public:
562 Load2LNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeLong *tl = TypeLong::LONG)
563 : VectorLoadNode(c,mem,adr,at,vect_type(tl,2)) {}
564 virtual int Opcode() const;
565 virtual int store_Opcode() const { return Op_Store2L; }
566 virtual uint length() const { return 2; }
567 };
568
569 //------------------------------Load4FNode--------------------------------------
570 // Vector load of 4 floats (32bits) from memory
571 class Load4FNode : public VectorLoadNode {
572 protected:
573 virtual BasicType elt_basic_type() const { return T_FLOAT; }
574 public:
575 Load4FNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *t = Type::FLOAT)
576 : VectorLoadNode(c,mem,adr,at,vect_type(t,4)) {}
577 virtual int Opcode() const;
578 virtual int store_Opcode() const { return Op_Store4F; }
579 virtual uint length() const { return 4; }
580 };
581
582 //------------------------------Load2FNode--------------------------------------
583 // Vector load of 2 floats (32bits) from memory
584 class Load2FNode : public VectorLoadNode {
585 protected:
586 virtual BasicType elt_basic_type() const { return T_FLOAT; }
587 public:
588 Load2FNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *t = Type::FLOAT)
589 : VectorLoadNode(c,mem,adr,at,vect_type(t,2)) {}
590 virtual int Opcode() const;
591 virtual int store_Opcode() const { return Op_Store2F; }
592 virtual uint length() const { return 2; }
593 };
594
595 //------------------------------Load2DNode--------------------------------------
596 // Vector load of 2 doubles (64bits) from memory
597 class Load2DNode : public VectorLoadNode {
598 protected:
599 virtual BasicType elt_basic_type() const { return T_DOUBLE; }
600 public:
601 Load2DNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *t = Type::DOUBLE)
602 : VectorLoadNode(c,mem,adr,at,vect_type(t,2)) {}
603 virtual int Opcode() const;
604 virtual int store_Opcode() const { return Op_Store2D; }
605 virtual uint length() const { return 2; }
606 };
607
608
609 //------------------------------VectorStoreNode--------------------------------------
610 // Vector Store to memory
611 class VectorStoreNode : public StoreNode {
612 virtual uint size_of() const { return sizeof(*this); }
613
614 protected:
615 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
616
617 public:
618 VectorStoreNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
619 : StoreNode(c,mem,adr,at,val) {
620 init_class_id(Class_VectorStore);
621 }
622 virtual int Opcode() const;
623
624 virtual uint length() const = 0; // Vector length
625
626 // Element and vector type
627 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
628 const Type* vect_type() const { return VectorNode::vect_type(elt_basic_type(), length()); }
629
630 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
631 virtual BasicType memory_type() const { return T_VOID; }
632 virtual int memory_size() const { return length()*type2aelembytes(elt_basic_type()); }
633
634 // Vector opcode from scalar opcode
635 static int opcode(int sopc, uint vlen);
636
637 static VectorStoreNode* make(Compile* C, int opc, Node* ctl, Node* mem,
638 Node* adr, const TypePtr* atyp, Node* val, 311 Node* adr, const TypePtr* atyp, Node* val,
639 uint vlen); 312 uint vlen);
640 }; 313 };
641 314
642 //------------------------------Store16BNode-------------------------------------- 315
643 // Vector store of 16 bytes (8bits signed) to memory 316 //=========================Promote_Scalar_to_Vector============================
644 class Store16BNode : public VectorStoreNode { 317
645 protected: 318 //------------------------------ReplicateBNode---------------------------------
646 virtual BasicType elt_basic_type() const { return T_BYTE; } 319 // Replicate byte scalar to be vector
647 public: 320 class ReplicateBNode : public VectorNode {
648 Store16BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) 321 public:
649 : VectorStoreNode(c,mem,adr,at,val) {} 322 ReplicateBNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
650 virtual int Opcode() const; 323 virtual int Opcode() const;
651 virtual uint length() const { return 16; } 324 };
652 }; 325
653 326 //------------------------------ReplicateSNode---------------------------------
654 //------------------------------Store8BNode-------------------------------------- 327 // Replicate short scalar to be vector
655 // Vector store of 8 bytes (8bits signed) to memory 328 class ReplicateSNode : public VectorNode {
656 class Store8BNode : public VectorStoreNode { 329 public:
657 protected: 330 ReplicateSNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
658 virtual BasicType elt_basic_type() const { return T_BYTE; } 331 virtual int Opcode() const;
659 public: 332 };
660 Store8BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) 333
661 : VectorStoreNode(c,mem,adr,at,val) {} 334 //------------------------------ReplicateINode---------------------------------
662 virtual int Opcode() const; 335 // Replicate int scalar to be vector
663 virtual uint length() const { return 8; } 336 class ReplicateINode : public VectorNode {
664 }; 337 public:
665 338 ReplicateINode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
666 //------------------------------Store4BNode-------------------------------------- 339 virtual int Opcode() const;
667 // Vector store of 4 bytes (8bits signed) to memory 340 };
668 class Store4BNode : public VectorStoreNode { 341
669 protected: 342 //------------------------------ReplicateLNode---------------------------------
670 virtual BasicType elt_basic_type() const { return T_BYTE; } 343 // Replicate long scalar to be vector
671 public: 344 class ReplicateLNode : public VectorNode {
672 Store4BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) 345 public:
673 : VectorStoreNode(c,mem,adr,at,val) {} 346 ReplicateLNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
674 virtual int Opcode() const; 347 virtual int Opcode() const;
675 virtual uint length() const { return 4; } 348 };
676 }; 349
677 350 //------------------------------ReplicateFNode---------------------------------
678 //------------------------------Store8CNode-------------------------------------- 351 // Replicate float scalar to be vector
679 // Vector store of 8 chars (16bits signed/unsigned) to memory 352 class ReplicateFNode : public VectorNode {
680 class Store8CNode : public VectorStoreNode { 353 public:
681 protected: 354 ReplicateFNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
682 virtual BasicType elt_basic_type() const { return T_CHAR; } 355 virtual int Opcode() const;
683 public: 356 };
684 Store8CNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val) 357
685 : VectorStoreNode(c,mem,adr,at,val) {} 358 //------------------------------ReplicateDNode---------------------------------
686 virtual int Opcode() const; 359 // Replicate double scalar to be vector
687 virtual uint length() const { return 8; } 360 class ReplicateDNode : public VectorNode {
688 }; 361 public:
689 362 ReplicateDNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
690 //------------------------------Store4CNode-------------------------------------- 363 virtual int Opcode() const;
691 // Vector store of 4 chars (16bits signed/unsigned) to memory 364 };
692 class Store4CNode : public VectorStoreNode { 365
693 protected: 366 //========================Pack_Scalars_into_a_Vector===========================
694 virtual BasicType elt_basic_type() const { return T_CHAR; }
695 public:
696 Store4CNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
697 : VectorStoreNode(c,mem,adr,at,val) {}
698 virtual int Opcode() const;
699 virtual uint length() const { return 4; }
700 };
701
702 //------------------------------Store2CNode--------------------------------------
703 // Vector store of 2 chars (16bits signed/unsigned) to memory
704 class Store2CNode : public VectorStoreNode {
705 protected:
706 virtual BasicType elt_basic_type() const { return T_CHAR; }
707 public:
708 Store2CNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
709 : VectorStoreNode(c,mem,adr,at,val) {}
710 virtual int Opcode() const;
711 virtual uint length() const { return 2; }
712 };
713
714 //------------------------------Store4INode--------------------------------------
715 // Vector store of 4 integers (32bits signed) to memory
716 class Store4INode : public VectorStoreNode {
717 protected:
718 virtual BasicType elt_basic_type() const { return T_INT; }
719 public:
720 Store4INode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
721 : VectorStoreNode(c,mem,adr,at,val) {}
722 virtual int Opcode() const;
723 virtual uint length() const { return 4; }
724 };
725
726 //------------------------------Store2INode--------------------------------------
727 // Vector store of 2 integers (32bits signed) to memory
728 class Store2INode : public VectorStoreNode {
729 protected:
730 virtual BasicType elt_basic_type() const { return T_INT; }
731 public:
732 Store2INode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
733 : VectorStoreNode(c,mem,adr,at,val) {}
734 virtual int Opcode() const;
735 virtual uint length() const { return 2; }
736 };
737
738 //------------------------------Store2LNode--------------------------------------
739 // Vector store of 2 longs (64bits signed) to memory
740 class Store2LNode : public VectorStoreNode {
741 protected:
742 virtual BasicType elt_basic_type() const { return T_LONG; }
743 public:
744 Store2LNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
745 : VectorStoreNode(c,mem,adr,at,val) {}
746 virtual int Opcode() const;
747 virtual uint length() const { return 2; }
748 };
749
750 //------------------------------Store4FNode--------------------------------------
751 // Vector store of 4 floats (32bits) to memory
752 class Store4FNode : public VectorStoreNode {
753 protected:
754 virtual BasicType elt_basic_type() const { return T_FLOAT; }
755 public:
756 Store4FNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
757 : VectorStoreNode(c,mem,adr,at,val) {}
758 virtual int Opcode() const;
759 virtual uint length() const { return 4; }
760 };
761
762 //------------------------------Store2FNode--------------------------------------
763 // Vector store of 2 floats (32bits) to memory
764 class Store2FNode : public VectorStoreNode {
765 protected:
766 virtual BasicType elt_basic_type() const { return T_FLOAT; }
767 public:
768 Store2FNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
769 : VectorStoreNode(c,mem,adr,at,val) {}
770 virtual int Opcode() const;
771 virtual uint length() const { return 2; }
772 };
773
774 //------------------------------Store2DNode--------------------------------------
775 // Vector store of 2 doubles (64bits) to memory
776 class Store2DNode : public VectorStoreNode {
777 protected:
778 virtual BasicType elt_basic_type() const { return T_DOUBLE; }
779 public:
780 Store2DNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
781 : VectorStoreNode(c,mem,adr,at,val) {}
782 virtual int Opcode() const;
783 virtual uint length() const { return 2; }
784 };
785
786 //=========================Promote_Scalar_to_Vector====================================
787
788 //------------------------------Replicate16BNode---------------------------------------
789 // Replicate byte scalar to be vector of 16 bytes
790 class Replicate16BNode : public VectorNode {
791 protected:
792 virtual BasicType elt_basic_type() const { return T_BYTE; }
793 public:
794 Replicate16BNode(Node* in1) : VectorNode(in1, 16) {}
795 virtual int Opcode() const;
796 };
797
798 //------------------------------Replicate8BNode---------------------------------------
799 // Replicate byte scalar to be vector of 8 bytes
800 class Replicate8BNode : public VectorNode {
801 protected:
802 virtual BasicType elt_basic_type() const { return T_BYTE; }
803 public:
804 Replicate8BNode(Node* in1) : VectorNode(in1, 8) {}
805 virtual int Opcode() const;
806 };
807
808 //------------------------------Replicate4BNode---------------------------------------
809 // Replicate byte scalar to be vector of 4 bytes
810 class Replicate4BNode : public VectorNode {
811 protected:
812 virtual BasicType elt_basic_type() const { return T_BYTE; }
813 public:
814 Replicate4BNode(Node* in1) : VectorNode(in1, 4) {}
815 virtual int Opcode() const;
816 };
817
818 //------------------------------Replicate8CNode---------------------------------------
819 // Replicate char scalar to be vector of 8 chars
820 class Replicate8CNode : public VectorNode {
821 protected:
822 virtual BasicType elt_basic_type() const { return T_CHAR; }
823 public:
824 Replicate8CNode(Node* in1) : VectorNode(in1, 8) {}
825 virtual int Opcode() const;
826 };
827
828 //------------------------------Replicate4CNode---------------------------------------
829 // Replicate char scalar to be vector of 4 chars
830 class Replicate4CNode : public VectorNode {
831 protected:
832 virtual BasicType elt_basic_type() const { return T_CHAR; }
833 public:
834 Replicate4CNode(Node* in1) : VectorNode(in1, 4) {}
835 virtual int Opcode() const;
836 };
837
838 //------------------------------Replicate2CNode---------------------------------------
839 // Replicate char scalar to be vector of 2 chars
840 class Replicate2CNode : public VectorNode {
841 protected:
842 virtual BasicType elt_basic_type() const { return T_CHAR; }
843 public:
844 Replicate2CNode(Node* in1) : VectorNode(in1, 2) {}
845 virtual int Opcode() const;
846 };
847
848 //------------------------------Replicate8SNode---------------------------------------
849 // Replicate short scalar to be vector of 8 shorts
850 class Replicate8SNode : public VectorNode {
851 protected:
852 virtual BasicType elt_basic_type() const { return T_SHORT; }
853 public:
854 Replicate8SNode(Node* in1) : VectorNode(in1, 8) {}
855 virtual int Opcode() const;
856 };
857
858 //------------------------------Replicate4SNode---------------------------------------
859 // Replicate short scalar to be vector of 4 shorts
860 class Replicate4SNode : public VectorNode {
861 protected:
862 virtual BasicType elt_basic_type() const { return T_SHORT; }
863 public:
864 Replicate4SNode(Node* in1) : VectorNode(in1, 4) {}
865 virtual int Opcode() const;
866 };
867
868 //------------------------------Replicate2SNode---------------------------------------
869 // Replicate short scalar to be vector of 2 shorts
870 class Replicate2SNode : public VectorNode {
871 protected:
872 virtual BasicType elt_basic_type() const { return T_SHORT; }
873 public:
874 Replicate2SNode(Node* in1) : VectorNode(in1, 2) {}
875 virtual int Opcode() const;
876 };
877
878 //------------------------------Replicate4INode---------------------------------------
879 // Replicate int scalar to be vector of 4 ints
880 class Replicate4INode : public VectorNode {
881 protected:
882 virtual BasicType elt_basic_type() const { return T_INT; }
883 public:
884 Replicate4INode(Node* in1) : VectorNode(in1, 4) {}
885 virtual int Opcode() const;
886 };
887
888 //------------------------------Replicate2INode---------------------------------------
889 // Replicate int scalar to be vector of 2 ints
890 class Replicate2INode : public VectorNode {
891 protected:
892 virtual BasicType elt_basic_type() const { return T_INT; }
893 public:
894 Replicate2INode(Node* in1) : VectorNode(in1, 2) {}
895 virtual int Opcode() const;
896 };
897
898 //------------------------------Replicate2LNode---------------------------------------
899 // Replicate long scalar to be vector of 2 longs
900 class Replicate2LNode : public VectorNode {
901 protected:
902 virtual BasicType elt_basic_type() const { return T_LONG; }
903 public:
904 Replicate2LNode(Node* in1) : VectorNode(in1, 2) {}
905 virtual int Opcode() const;
906 };
907
908 //------------------------------Replicate4FNode---------------------------------------
909 // Replicate float scalar to be vector of 4 floats
910 class Replicate4FNode : public VectorNode {
911 protected:
912 virtual BasicType elt_basic_type() const { return T_FLOAT; }
913 public:
914 Replicate4FNode(Node* in1) : VectorNode(in1, 4) {}
915 virtual int Opcode() const;
916 };
917
918 //------------------------------Replicate2FNode---------------------------------------
919 // Replicate float scalar to be vector of 2 floats
920 class Replicate2FNode : public VectorNode {
921 protected:
922 virtual BasicType elt_basic_type() const { return T_FLOAT; }
923 public:
924 Replicate2FNode(Node* in1) : VectorNode(in1, 2) {}
925 virtual int Opcode() const;
926 };
927
928 //------------------------------Replicate2DNode---------------------------------------
929 // Replicate double scalar to be vector of 2 doubles
930 class Replicate2DNode : public VectorNode {
931 protected:
932 virtual BasicType elt_basic_type() const { return T_DOUBLE; }
933 public:
934 Replicate2DNode(Node* in1) : VectorNode(in1, 2) {}
935 virtual int Opcode() const;
936 };
937
938 //========================Pack_Scalars_into_a_Vector==============================
939 367
940 //------------------------------PackNode--------------------------------------- 368 //------------------------------PackNode---------------------------------------
941 // Pack parent class (not for code generation). 369 // Pack parent class (not for code generation).
942 class PackNode : public VectorNode { 370 class PackNode : public VectorNode {
943 public: 371 public:
944 PackNode(Node* in1) : VectorNode(in1, 1) {} 372 PackNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
945 PackNode(Node* in1, Node* n2) : VectorNode(in1, n2, 2) {} 373 PackNode(Node* in1, Node* n2, const TypeVect* vt) : VectorNode(in1, n2, vt) {}
946 virtual int Opcode() const; 374 virtual int Opcode() const;
947 375
948 void add_opd(Node* n) { 376 void add_opd(uint i, Node* n) {
949 add_req(n); 377 init_req(i+1, n);
950 _length++;
951 assert(_length == req() - 1, "vector length matches edge count");
952 } 378 }
953 379
954 // Create a binary tree form for Packs. [lo, hi) (half-open) range 380 // Create a binary tree form for Packs. [lo, hi) (half-open) range
955 Node* binaryTreePack(Compile* C, int lo, int hi); 381 Node* binaryTreePack(Compile* C, int lo, int hi);
956 382
957 static PackNode* make(Compile* C, Node* s, const Type* elt_t); 383 static PackNode* make(Compile* C, Node* s, uint vlen, BasicType bt);
958 }; 384 };
959 385
960 //------------------------------PackBNode--------------------------------------- 386 //------------------------------PackBNode---------------------------------------
961 // Pack byte scalars into vector 387 // Pack byte scalars into vector
962 class PackBNode : public PackNode { 388 class PackBNode : public PackNode {
963 protected: 389 public:
964 virtual BasicType elt_basic_type() const { return T_BYTE; } 390 PackBNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {}
965 public:
966 PackBNode(Node* in1) : PackNode(in1) {}
967 virtual int Opcode() const;
968 };
969
970 //------------------------------PackCNode---------------------------------------
971 // Pack char scalars into vector
972 class PackCNode : public PackNode {
973 protected:
974 virtual BasicType elt_basic_type() const { return T_CHAR; }
975 public:
976 PackCNode(Node* in1) : PackNode(in1) {}
977 virtual int Opcode() const; 391 virtual int Opcode() const;
978 }; 392 };
979 393
980 //------------------------------PackSNode--------------------------------------- 394 //------------------------------PackSNode---------------------------------------
981 // Pack short scalars into a vector 395 // Pack short scalars into a vector
982 class PackSNode : public PackNode { 396 class PackSNode : public PackNode {
983 protected: 397 public:
984 virtual BasicType elt_basic_type() const { return T_SHORT; } 398 PackSNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {}
985 public: 399 PackSNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
986 PackSNode(Node* in1) : PackNode(in1) {}
987 virtual int Opcode() const; 400 virtual int Opcode() const;
988 }; 401 };
989 402
990 //------------------------------PackINode--------------------------------------- 403 //------------------------------PackINode---------------------------------------
991 // Pack integer scalars into a vector 404 // Pack integer scalars into a vector
992 class PackINode : public PackNode { 405 class PackINode : public PackNode {
993 protected: 406 public:
994 virtual BasicType elt_basic_type() const { return T_INT; } 407 PackINode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {}
995 public: 408 PackINode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
996 PackINode(Node* in1) : PackNode(in1) {}
997 PackINode(Node* in1, Node* in2) : PackNode(in1, in2) {}
998 virtual int Opcode() const; 409 virtual int Opcode() const;
999 }; 410 };
1000 411
1001 //------------------------------PackLNode--------------------------------------- 412 //------------------------------PackLNode---------------------------------------
1002 // Pack long scalars into a vector 413 // Pack long scalars into a vector
1003 class PackLNode : public PackNode { 414 class PackLNode : public PackNode {
1004 protected: 415 public:
1005 virtual BasicType elt_basic_type() const { return T_LONG; } 416 PackLNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {}
1006 public: 417 PackLNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
1007 PackLNode(Node* in1) : PackNode(in1) {} 418 virtual int Opcode() const;
1008 PackLNode(Node* in1, Node* in2) : PackNode(in1, in2) {} 419 };
420
421 //------------------------------Pack2LNode--------------------------------------
422 // Pack 2 long scalars into a vector
423 class Pack2LNode : public PackNode {
424 public:
425 Pack2LNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
1009 virtual int Opcode() const; 426 virtual int Opcode() const;
1010 }; 427 };
1011 428
1012 //------------------------------PackFNode--------------------------------------- 429 //------------------------------PackFNode---------------------------------------
1013 // Pack float scalars into vector 430 // Pack float scalars into vector
1014 class PackFNode : public PackNode { 431 class PackFNode : public PackNode {
1015 protected: 432 public:
1016 virtual BasicType elt_basic_type() const { return T_FLOAT; } 433 PackFNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {}
1017 public: 434 PackFNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
1018 PackFNode(Node* in1) : PackNode(in1) {}
1019 PackFNode(Node* in1, Node* in2) : PackNode(in1, in2) {}
1020 virtual int Opcode() const; 435 virtual int Opcode() const;
1021 }; 436 };
1022 437
1023 //------------------------------PackDNode--------------------------------------- 438 //------------------------------PackDNode---------------------------------------
1024 // Pack double scalars into a vector 439 // Pack double scalars into a vector
1025 class PackDNode : public PackNode { 440 class PackDNode : public PackNode {
1026 protected: 441 public:
1027 virtual BasicType elt_basic_type() const { return T_DOUBLE; } 442 PackDNode(Node* in1, const TypeVect* vt) : PackNode(in1, vt) {}
1028 public: 443 PackDNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
1029 PackDNode(Node* in1) : PackNode(in1) {} 444 virtual int Opcode() const;
1030 PackDNode(Node* in1, Node* in2) : PackNode(in1, in2) {} 445 };
1031 virtual int Opcode() const; 446
1032 }; 447 //------------------------------Pack2DNode--------------------------------------
1033 448 // Pack 2 double scalars into a vector
1034 // The Pack2xN nodes assist code generation. They are created from 449 class Pack2DNode : public PackNode {
1035 // Pack4C, etc. nodes in final_graph_reshape in the form of a 450 public:
1036 // balanced, binary tree. 451 Pack2DNode(Node* in1, Node* in2, const TypeVect* vt) : PackNode(in1, in2, vt) {}
1037 452 virtual int Opcode() const;
1038 //------------------------------Pack2x1BNode----------------------------------------- 453 };
1039 // Pack 2 1-byte integers into vector of 2 bytes 454
1040 class Pack2x1BNode : public PackNode {
1041 protected:
1042 virtual BasicType elt_basic_type() const { return T_BYTE; }
1043 public:
1044 Pack2x1BNode(Node *in1, Node* in2) : PackNode(in1, in2) {}
1045 virtual int Opcode() const;
1046 virtual uint ideal_reg() const { return Op_RegI; }
1047 };
1048
1049 //------------------------------Pack2x2BNode---------------------------------------
1050 // Pack 2 2-byte integers into vector of 4 bytes
1051 class Pack2x2BNode : public PackNode {
1052 protected:
1053 virtual BasicType elt_basic_type() const { return T_CHAR; }
1054 public:
1055 Pack2x2BNode(Node *in1, Node* in2) : PackNode(in1, in2) {}
1056 virtual int Opcode() const;
1057 virtual uint ideal_reg() const { return Op_RegI; }
1058 };
1059 455
1060 //========================Extract_Scalar_from_Vector=============================== 456 //========================Extract_Scalar_from_Vector===============================
1061 457
1062 //------------------------------ExtractNode--------------------------------------- 458 //------------------------------ExtractNode---------------------------------------
1063 // Extract a scalar from a vector at position "pos" 459 // Extract a scalar from a vector at position "pos"
1067 assert(in(2)->get_int() >= 0, "positive constants"); 463 assert(in(2)->get_int() >= 0, "positive constants");
1068 } 464 }
1069 virtual int Opcode() const; 465 virtual int Opcode() const;
1070 uint pos() const { return in(2)->get_int(); } 466 uint pos() const { return in(2)->get_int(); }
1071 467
1072 static Node* make(Compile* C, Node* v, uint position, const Type* opd_t); 468 static Node* make(Compile* C, Node* v, uint position, BasicType bt);
1073 }; 469 };
1074 470
1075 //------------------------------ExtractBNode--------------------------------------- 471 //------------------------------ExtractBNode---------------------------------------
1076 // Extract a byte from a vector at position "pos" 472 // Extract a byte from a vector at position "pos"
1077 class ExtractBNode : public ExtractNode { 473 class ExtractBNode : public ExtractNode {
1080 virtual int Opcode() const; 476 virtual int Opcode() const;
1081 virtual const Type *bottom_type() const { return TypeInt::INT; } 477 virtual const Type *bottom_type() const { return TypeInt::INT; }
1082 virtual uint ideal_reg() const { return Op_RegI; } 478 virtual uint ideal_reg() const { return Op_RegI; }
1083 }; 479 };
1084 480
481 //------------------------------ExtractUBNode--------------------------------------
482 // Extract a boolean from a vector at position "pos"
483 class ExtractUBNode : public ExtractNode {
484 public:
485 ExtractUBNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}
486 virtual int Opcode() const;
487 virtual const Type *bottom_type() const { return TypeInt::INT; }
488 virtual uint ideal_reg() const { return Op_RegI; }
489 };
490
1085 //------------------------------ExtractCNode--------------------------------------- 491 //------------------------------ExtractCNode---------------------------------------
1086 // Extract a char from a vector at position "pos" 492 // Extract a char from a vector at position "pos"
1087 class ExtractCNode : public ExtractNode { 493 class ExtractCNode : public ExtractNode {
1088 public: 494 public:
1089 ExtractCNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {} 495 ExtractCNode(Node* src, ConINode* pos) : ExtractNode(src, pos) {}