comparison src/share/vm/opto/mulnode.cpp @ 897:52898b0c43e9

6863155: Server compiler generates incorrect code (x86, long, bitshift, bitmask) Summary: Code compiled with server compiler generates an incorrect result. Reviewed-by: cfang, never, kvn
author twisti
date Tue, 28 Jul 2009 09:02:30 +0200
parents 18a08a7e16b5
children c18cbe5936b8
comparison
equal deleted inserted replaced
896:1cef5ec3ca56 897:52898b0c43e9
606 load->in(MemNode::Address), 606 load->in(MemNode::Address),
607 load->adr_type()); 607 load->adr_type());
608 } 608 }
609 609
610 // Are we masking a long that was converted from an int with a mask 610 // Are we masking a long that was converted from an int with a mask
611 // that fits in 32-bits? Commute them and use an AndINode. 611 // that fits in 32-bits? Commute them and use an AndINode. Don't
612 if (op == Op_ConvI2L && (mask & CONST64(0xFFFFFFFF00000000)) == 0) { 612 // convert masks which would cause a sign extension of the integer
613 // If we are doing an UI2L conversion (i.e. the mask is 613 // value. This check includes UI2L masks (0x00000000FFFFFFFF) which
614 // 0x00000000FFFFFFFF) we cannot convert the AndL to an AndI 614 // would be optimized away later in Identity.
615 // because the AndI would be optimized away later in Identity. 615 if (op == Op_ConvI2L && (mask & CONST64(0xFFFFFFFF80000000)) == 0) {
616 if (mask != CONST64(0x00000000FFFFFFFF)) { 616 Node* andi = new (phase->C, 3) AndINode(in1->in(1), phase->intcon(mask));
617 Node* andi = new (phase->C, 3) AndINode(in1->in(1), phase->intcon(mask)); 617 andi = phase->transform(andi);
618 andi = phase->transform(andi); 618 return new (phase->C, 2) ConvI2LNode(andi);
619 return new (phase->C, 2) ConvI2LNode(andi);
620 }
621 } 619 }
622 620
623 // Masking off sign bits? Dont make them! 621 // Masking off sign bits? Dont make them!
624 if (op == Op_RShiftL) { 622 if (op == Op_RShiftL) {
625 const TypeInt* t12 = phase->type(in1->in(2))->isa_int(); 623 const TypeInt* t12 = phase->type(in1->in(2))->isa_int();