1.1 --- a/src/share/vm/opto/mulnode.cpp Mon Jul 27 06:15:29 2009 -0700 1.2 +++ b/src/share/vm/opto/mulnode.cpp Tue Jul 28 09:02:30 2009 +0200 1.3 @@ -608,16 +608,14 @@ 1.4 } 1.5 1.6 // Are we masking a long that was converted from an int with a mask 1.7 - // that fits in 32-bits? Commute them and use an AndINode. 1.8 - if (op == Op_ConvI2L && (mask & CONST64(0xFFFFFFFF00000000)) == 0) { 1.9 - // If we are doing an UI2L conversion (i.e. the mask is 1.10 - // 0x00000000FFFFFFFF) we cannot convert the AndL to an AndI 1.11 - // because the AndI would be optimized away later in Identity. 1.12 - if (mask != CONST64(0x00000000FFFFFFFF)) { 1.13 - Node* andi = new (phase->C, 3) AndINode(in1->in(1), phase->intcon(mask)); 1.14 - andi = phase->transform(andi); 1.15 - return new (phase->C, 2) ConvI2LNode(andi); 1.16 - } 1.17 + // that fits in 32-bits? Commute them and use an AndINode. Don't 1.18 + // convert masks which would cause a sign extension of the integer 1.19 + // value. This check includes UI2L masks (0x00000000FFFFFFFF) which 1.20 + // would be optimized away later in Identity. 1.21 + if (op == Op_ConvI2L && (mask & CONST64(0xFFFFFFFF80000000)) == 0) { 1.22 + Node* andi = new (phase->C, 3) AndINode(in1->in(1), phase->intcon(mask)); 1.23 + andi = phase->transform(andi); 1.24 + return new (phase->C, 2) ConvI2LNode(andi); 1.25 } 1.26 1.27 // Masking off sign bits? Dont make them!