comparison src/cpu/sparc/vm/sparc.ad @ 1915:885e464e1a40

6996240: The BitSet.length method sometimes returns an index+1 value less than that of the highest bit set. Reviewed-by: never, kvn
author twisti
date Tue, 02 Nov 2010 14:56:40 -0700
parents ae065c367d93
children 2f644f85485d
comparison
equal deleted inserted replaced
1914:ae065c367d93 1915:885e464e1a40
9514 "SUB $tmp,$dst,$dst" %} 9514 "SUB $tmp,$dst,$dst" %}
9515 ins_encode %{ 9515 ins_encode %{
9516 Register Rdst = $dst$$Register; 9516 Register Rdst = $dst$$Register;
9517 Register Rsrc = $src$$Register; 9517 Register Rsrc = $src$$Register;
9518 Register Rtmp = $tmp$$Register; 9518 Register Rtmp = $tmp$$Register;
9519 __ srl(Rsrc, 1, Rtmp); 9519 __ srl(Rsrc, 1, Rtmp);
9520 __ srl(Rsrc, 0, Rdst); 9520 __ srl(Rsrc, 0, Rdst);
9521 __ or3(Rdst, Rtmp, Rdst); 9521 __ or3(Rdst, Rtmp, Rdst);
9522 __ srl(Rdst, 2, Rtmp); 9522 __ srl(Rdst, 2, Rtmp);
9523 __ or3(Rdst, Rtmp, Rdst); 9523 __ or3(Rdst, Rtmp, Rdst);
9524 __ srl(Rdst, 4, Rtmp); 9524 __ srl(Rdst, 4, Rtmp);
9525 __ or3(Rdst, Rtmp, Rdst); 9525 __ or3(Rdst, Rtmp, Rdst);
9526 __ srl(Rdst, 8, Rtmp); 9526 __ srl(Rdst, 8, Rtmp);
9527 __ or3(Rdst, Rtmp, Rdst); 9527 __ or3(Rdst, Rtmp, Rdst);
9528 __ srl(Rdst, 16, Rtmp); 9528 __ srl(Rdst, 16, Rtmp);
9529 __ or3(Rdst, Rtmp, Rdst); 9529 __ or3(Rdst, Rtmp, Rdst);
9530 __ popc(Rdst, Rdst); 9530 __ popc(Rdst, Rdst);
9531 __ mov(BitsPerInt, Rtmp); 9531 __ mov(BitsPerInt, Rtmp);
9532 __ sub(Rtmp, Rdst, Rdst); 9532 __ sub(Rtmp, Rdst, Rdst);
9533 %} 9533 %}
9534 ins_pipe(ialu_reg); 9534 ins_pipe(ialu_reg);
9535 %} 9535 %}
9536 9536
9537 instruct countLeadingZerosL(iRegI dst, iRegL src, iRegL tmp, flagsReg cr) %{ 9537 instruct countLeadingZerosL(iRegIsafe dst, iRegL src, iRegL tmp, flagsReg cr) %{
9538 predicate(UsePopCountInstruction); // See Matcher::match_rule_supported 9538 predicate(UsePopCountInstruction); // See Matcher::match_rule_supported
9539 match(Set dst (CountLeadingZerosL src)); 9539 match(Set dst (CountLeadingZerosL src));
9540 effect(TEMP dst, TEMP tmp, KILL cr); 9540 effect(TEMP dst, TEMP tmp, KILL cr);
9541 9541
9542 // x |= (x >> 1); 9542 // x |= (x >> 1);
9563 "SUB $tmp,$dst,$dst" %} 9563 "SUB $tmp,$dst,$dst" %}
9564 ins_encode %{ 9564 ins_encode %{
9565 Register Rdst = $dst$$Register; 9565 Register Rdst = $dst$$Register;
9566 Register Rsrc = $src$$Register; 9566 Register Rsrc = $src$$Register;
9567 Register Rtmp = $tmp$$Register; 9567 Register Rtmp = $tmp$$Register;
9568 __ srlx(Rsrc, 1, Rtmp); 9568 __ srlx(Rsrc, 1, Rtmp);
9569 __ or3(Rsrc, Rtmp, Rdst); 9569 __ or3( Rsrc, Rtmp, Rdst);
9570 __ srlx(Rdst, 2, Rtmp); 9570 __ srlx(Rdst, 2, Rtmp);
9571 __ or3(Rdst, Rtmp, Rdst); 9571 __ or3( Rdst, Rtmp, Rdst);
9572 __ srlx(Rdst, 4, Rtmp); 9572 __ srlx(Rdst, 4, Rtmp);
9573 __ or3(Rdst, Rtmp, Rdst); 9573 __ or3( Rdst, Rtmp, Rdst);
9574 __ srlx(Rdst, 8, Rtmp); 9574 __ srlx(Rdst, 8, Rtmp);
9575 __ or3(Rdst, Rtmp, Rdst); 9575 __ or3( Rdst, Rtmp, Rdst);
9576 __ srlx(Rdst, 16, Rtmp); 9576 __ srlx(Rdst, 16, Rtmp);
9577 __ or3(Rdst, Rtmp, Rdst); 9577 __ or3( Rdst, Rtmp, Rdst);
9578 __ srlx(Rdst, 32, Rtmp); 9578 __ srlx(Rdst, 32, Rtmp);
9579 __ or3(Rdst, Rtmp, Rdst); 9579 __ or3( Rdst, Rtmp, Rdst);
9580 __ popc(Rdst, Rdst); 9580 __ popc(Rdst, Rdst);
9581 __ mov(BitsPerLong, Rtmp); 9581 __ mov(BitsPerLong, Rtmp);
9582 __ sub(Rtmp, Rdst, Rdst); 9582 __ sub(Rtmp, Rdst, Rdst);
9583 %} 9583 %}
9584 ins_pipe(ialu_reg); 9584 ins_pipe(ialu_reg);