1.1 --- a/src/cpu/sparc/vm/sparc.ad Tue Dec 18 17:37:44 2012 -0800 1.2 +++ b/src/cpu/sparc/vm/sparc.ad Wed Dec 19 14:44:00 2012 -0800 1.3 @@ -10224,7 +10224,7 @@ 1.4 1.5 //---------- Zeros Count Instructions ------------------------------------------ 1.6 1.7 -instruct countLeadingZerosI(iRegI dst, iRegI src, iRegI tmp, flagsReg cr) %{ 1.8 +instruct countLeadingZerosI(iRegIsafe dst, iRegI src, iRegI tmp, flagsReg cr) %{ 1.9 predicate(UsePopCountInstruction); // See Matcher::match_rule_supported 1.10 match(Set dst (CountLeadingZerosI src)); 1.11 effect(TEMP dst, TEMP tmp, KILL cr); 1.12 @@ -10321,7 +10321,7 @@ 1.13 ins_pipe(ialu_reg); 1.14 %} 1.15 1.16 -instruct countTrailingZerosI(iRegI dst, iRegI src, flagsReg cr) %{ 1.17 +instruct countTrailingZerosI(iRegIsafe dst, iRegI src, flagsReg cr) %{ 1.18 predicate(UsePopCountInstruction); // See Matcher::match_rule_supported 1.19 match(Set dst (CountTrailingZerosI src)); 1.20 effect(TEMP dst, KILL cr); 1.21 @@ -10364,19 +10364,21 @@ 1.22 1.23 //---------- Population Count Instructions ------------------------------------- 1.24 1.25 -instruct popCountI(iRegI dst, iRegI src) %{ 1.26 +instruct popCountI(iRegIsafe dst, iRegI src) %{ 1.27 predicate(UsePopCountInstruction); 1.28 match(Set dst (PopCountI src)); 1.29 1.30 - format %{ "POPC $src, $dst" %} 1.31 - ins_encode %{ 1.32 - __ popc($src$$Register, $dst$$Register); 1.33 + format %{ "SRL $src, G0, $dst\t! clear upper word for 64 bit POPC\n\t" 1.34 + "POPC $dst, $dst" %} 1.35 + ins_encode %{ 1.36 + __ srl($src$$Register, G0, $dst$$Register); 1.37 + __ popc($dst$$Register, $dst$$Register); 1.38 %} 1.39 ins_pipe(ialu_reg); 1.40 %} 1.41 1.42 // Note: Long.bitCount(long) returns an int. 1.43 -instruct popCountL(iRegI dst, iRegL src) %{ 1.44 +instruct popCountL(iRegIsafe dst, iRegL src) %{ 1.45 predicate(UsePopCountInstruction); 1.46 match(Set dst (PopCountL src)); 1.47