src/share/vm/opto/subnode.cpp

changeset 1609
ddb7834449d0
parent 1279
bd02caa94611
child 1907
c18cbe5936b8
equal deleted inserted replaced
1608:73b22f919c34 1609:ddb7834449d0
1 /* 1 /*
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1997-2010 Sun Microsystems, Inc. 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.
1242 const Type *CosDNode::Value( PhaseTransform *phase ) const { 1242 const Type *CosDNode::Value( PhaseTransform *phase ) const {
1243 const Type *t1 = phase->type( in(1) ); 1243 const Type *t1 = phase->type( in(1) );
1244 if( t1 == Type::TOP ) return Type::TOP; 1244 if( t1 == Type::TOP ) return Type::TOP;
1245 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; 1245 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1246 double d = t1->getd(); 1246 double d = t1->getd();
1247 if( d < 0.0 ) return Type::DOUBLE; 1247 return TypeD::make( StubRoutines::intrinsic_cos( d ) );
1248 return TypeD::make( SharedRuntime::dcos( d ) );
1249 } 1248 }
1250 1249
1251 //============================================================================= 1250 //=============================================================================
1252 //------------------------------Value------------------------------------------ 1251 //------------------------------Value------------------------------------------
1253 // Compute sin 1252 // Compute sin
1254 const Type *SinDNode::Value( PhaseTransform *phase ) const { 1253 const Type *SinDNode::Value( PhaseTransform *phase ) const {
1255 const Type *t1 = phase->type( in(1) ); 1254 const Type *t1 = phase->type( in(1) );
1256 if( t1 == Type::TOP ) return Type::TOP; 1255 if( t1 == Type::TOP ) return Type::TOP;
1257 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; 1256 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1258 double d = t1->getd(); 1257 double d = t1->getd();
1259 if( d < 0.0 ) return Type::DOUBLE; 1258 return TypeD::make( StubRoutines::intrinsic_sin( d ) );
1260 return TypeD::make( SharedRuntime::dsin( d ) );
1261 } 1259 }
1262 1260
1263 //============================================================================= 1261 //=============================================================================
1264 //------------------------------Value------------------------------------------ 1262 //------------------------------Value------------------------------------------
1265 // Compute tan 1263 // Compute tan
1266 const Type *TanDNode::Value( PhaseTransform *phase ) const { 1264 const Type *TanDNode::Value( PhaseTransform *phase ) const {
1267 const Type *t1 = phase->type( in(1) ); 1265 const Type *t1 = phase->type( in(1) );
1268 if( t1 == Type::TOP ) return Type::TOP; 1266 if( t1 == Type::TOP ) return Type::TOP;
1269 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; 1267 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1270 double d = t1->getd(); 1268 double d = t1->getd();
1271 if( d < 0.0 ) return Type::DOUBLE; 1269 return TypeD::make( StubRoutines::intrinsic_tan( d ) );
1272 return TypeD::make( SharedRuntime::dtan( d ) );
1273 } 1270 }
1274 1271
1275 //============================================================================= 1272 //=============================================================================
1276 //------------------------------Value------------------------------------------ 1273 //------------------------------Value------------------------------------------
1277 // Compute log 1274 // Compute log
1278 const Type *LogDNode::Value( PhaseTransform *phase ) const { 1275 const Type *LogDNode::Value( PhaseTransform *phase ) const {
1279 const Type *t1 = phase->type( in(1) ); 1276 const Type *t1 = phase->type( in(1) );
1280 if( t1 == Type::TOP ) return Type::TOP; 1277 if( t1 == Type::TOP ) return Type::TOP;
1281 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; 1278 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1282 double d = t1->getd(); 1279 double d = t1->getd();
1283 if( d < 0.0 ) return Type::DOUBLE; 1280 return TypeD::make( StubRoutines::intrinsic_log( d ) );
1284 return TypeD::make( SharedRuntime::dlog( d ) );
1285 } 1281 }
1286 1282
1287 //============================================================================= 1283 //=============================================================================
1288 //------------------------------Value------------------------------------------ 1284 //------------------------------Value------------------------------------------
1289 // Compute log10 1285 // Compute log10
1290 const Type *Log10DNode::Value( PhaseTransform *phase ) const { 1286 const Type *Log10DNode::Value( PhaseTransform *phase ) const {
1291 const Type *t1 = phase->type( in(1) ); 1287 const Type *t1 = phase->type( in(1) );
1292 if( t1 == Type::TOP ) return Type::TOP; 1288 if( t1 == Type::TOP ) return Type::TOP;
1293 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; 1289 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1294 double d = t1->getd(); 1290 double d = t1->getd();
1295 if( d < 0.0 ) return Type::DOUBLE; 1291 return TypeD::make( StubRoutines::intrinsic_log10( d ) );
1296 return TypeD::make( SharedRuntime::dlog10( d ) );
1297 } 1292 }
1298 1293
1299 //============================================================================= 1294 //=============================================================================
1300 //------------------------------Value------------------------------------------ 1295 //------------------------------Value------------------------------------------
1301 // Compute exp 1296 // Compute exp
1302 const Type *ExpDNode::Value( PhaseTransform *phase ) const { 1297 const Type *ExpDNode::Value( PhaseTransform *phase ) const {
1303 const Type *t1 = phase->type( in(1) ); 1298 const Type *t1 = phase->type( in(1) );
1304 if( t1 == Type::TOP ) return Type::TOP; 1299 if( t1 == Type::TOP ) return Type::TOP;
1305 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; 1300 if( t1->base() != Type::DoubleCon ) return Type::DOUBLE;
1306 double d = t1->getd(); 1301 double d = t1->getd();
1307 if( d < 0.0 ) return Type::DOUBLE; 1302 return TypeD::make( StubRoutines::intrinsic_exp( d ) );
1308 return TypeD::make( SharedRuntime::dexp( d ) );
1309 } 1303 }
1310 1304
1311 1305
1312 //============================================================================= 1306 //=============================================================================
1313 //------------------------------Value------------------------------------------ 1307 //------------------------------Value------------------------------------------
1321 if( t2->base() != Type::DoubleCon ) return Type::DOUBLE; 1315 if( t2->base() != Type::DoubleCon ) return Type::DOUBLE;
1322 double d1 = t1->getd(); 1316 double d1 = t1->getd();
1323 double d2 = t2->getd(); 1317 double d2 = t2->getd();
1324 if( d1 < 0.0 ) return Type::DOUBLE; 1318 if( d1 < 0.0 ) return Type::DOUBLE;
1325 if( d2 < 0.0 ) return Type::DOUBLE; 1319 if( d2 < 0.0 ) return Type::DOUBLE;
1326 return TypeD::make( SharedRuntime::dpow( d1, d2 ) ); 1320 return TypeD::make( StubRoutines::intrinsic_pow( d1, d2 ) );
1327 } 1321 }

mercurial