158 //------------------------------make------------------------------------------- |
158 //------------------------------make------------------------------------------- |
159 // Make a correctly-flavored CMove. Since _type is directly determined |
159 // Make a correctly-flavored CMove. Since _type is directly determined |
160 // from the inputs we do not need to specify it here. |
160 // from the inputs we do not need to specify it here. |
161 CMoveNode *CMoveNode::make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ) { |
161 CMoveNode *CMoveNode::make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ) { |
162 switch( t->basic_type() ) { |
162 switch( t->basic_type() ) { |
163 case T_INT: return new (C) CMoveINode( bol, left, right, t->is_int() ); |
163 case T_INT: return new CMoveINode( bol, left, right, t->is_int() ); |
164 case T_FLOAT: return new (C) CMoveFNode( bol, left, right, t ); |
164 case T_FLOAT: return new CMoveFNode( bol, left, right, t ); |
165 case T_DOUBLE: return new (C) CMoveDNode( bol, left, right, t ); |
165 case T_DOUBLE: return new CMoveDNode( bol, left, right, t ); |
166 case T_LONG: return new (C) CMoveLNode( bol, left, right, t->is_long() ); |
166 case T_LONG: return new CMoveLNode( bol, left, right, t->is_long() ); |
167 case T_OBJECT: return new (C) CMovePNode( c, bol, left, right, t->is_oopptr() ); |
167 case T_OBJECT: return new CMovePNode( c, bol, left, right, t->is_oopptr() ); |
168 case T_ADDRESS: return new (C) CMovePNode( c, bol, left, right, t->is_ptr() ); |
168 case T_ADDRESS: return new CMovePNode( c, bol, left, right, t->is_ptr() ); |
169 case T_NARROWOOP: return new (C) CMoveNNode( c, bol, left, right, t ); |
169 case T_NARROWOOP: return new CMoveNNode( c, bol, left, right, t ); |
170 default: |
170 default: |
171 ShouldNotReachHere(); |
171 ShouldNotReachHere(); |
172 return NULL; |
172 return NULL; |
173 } |
173 } |
174 } |
174 } |
231 // Convert to a bool (flipped) |
231 // Convert to a bool (flipped) |
232 // Build int->bool conversion |
232 // Build int->bool conversion |
233 #ifndef PRODUCT |
233 #ifndef PRODUCT |
234 if( PrintOpto ) tty->print_cr("CMOV to I2B"); |
234 if( PrintOpto ) tty->print_cr("CMOV to I2B"); |
235 #endif |
235 #endif |
236 Node *n = new (phase->C) Conv2BNode( cmp->in(1) ); |
236 Node *n = new Conv2BNode( cmp->in(1) ); |
237 if( flip ) |
237 if( flip ) |
238 n = new (phase->C) XorINode( phase->transform(n), phase->intcon(1) ); |
238 n = new XorINode( phase->transform(n), phase->intcon(1) ); |
239 |
239 |
240 return n; |
240 return n; |
241 } |
241 } |
242 |
242 |
243 //============================================================================= |
243 //============================================================================= |
287 // Allow only SubF(0,X) and fail out for all others; NegF is not OK |
287 // Allow only SubF(0,X) and fail out for all others; NegF is not OK |
288 if( sub->Opcode() != Op_SubF || |
288 if( sub->Opcode() != Op_SubF || |
289 sub->in(2) != X || |
289 sub->in(2) != X || |
290 phase->type(sub->in(1)) != TypeF::ZERO ) return NULL; |
290 phase->type(sub->in(1)) != TypeF::ZERO ) return NULL; |
291 |
291 |
292 Node *abs = new (phase->C) AbsFNode( X ); |
292 Node *abs = new AbsFNode( X ); |
293 if( flip ) |
293 if( flip ) |
294 abs = new (phase->C) SubFNode(sub->in(1), phase->transform(abs)); |
294 abs = new SubFNode(sub->in(1), phase->transform(abs)); |
295 |
295 |
296 return abs; |
296 return abs; |
297 } |
297 } |
298 |
298 |
299 //============================================================================= |
299 //============================================================================= |
343 // Allow only SubD(0,X) and fail out for all others; NegD is not OK |
343 // Allow only SubD(0,X) and fail out for all others; NegD is not OK |
344 if( sub->Opcode() != Op_SubD || |
344 if( sub->Opcode() != Op_SubD || |
345 sub->in(2) != X || |
345 sub->in(2) != X || |
346 phase->type(sub->in(1)) != TypeD::ZERO ) return NULL; |
346 phase->type(sub->in(1)) != TypeD::ZERO ) return NULL; |
347 |
347 |
348 Node *abs = new (phase->C) AbsDNode( X ); |
348 Node *abs = new AbsDNode( X ); |
349 if( flip ) |
349 if( flip ) |
350 abs = new (phase->C) SubDNode(sub->in(1), phase->transform(abs)); |
350 abs = new SubDNode(sub->in(1), phase->transform(abs)); |
351 |
351 |
352 return abs; |
352 return abs; |
353 } |
353 } |
354 |
354 |
355 //------------------------------Value------------------------------------------ |
355 //------------------------------Value------------------------------------------ |