RFR: 8285868: x86 intrinsics for floating point method isInfinite [v13]

Jatin Bhateja jbhateja at openjdk.java.net
Wed Jun 1 15:29:38 UTC 2022


On Wed, 1 Jun 2022 06:42:20 GMT, Srinivas Vamsi Parasa <duke at openjdk.java.net> wrote:

>> We develop optimized x86 intrinsics for the floating point class check methods `isNaN()`, `isFinite()` and `IsInfinite()` for Float and Double classes. JMH benchmarks show upto `~70% `improvement using` vfpclasss(s/d)` instructions.
>> 
>> 
>> Benchmark (ns/op)	        Baseline Intrinsic(vfpclasss/d)	Speedup(%)
>> FloatClassCheck.testIsFinite	0.562	          0.406	         28%
>> FloatClassCheck.testIsInfinite	0.815	          0.383	         53%
>> FloatClassCheck.testIsNaN	0.63	          0.382	         39%
>> DoubleClassCheck.testIsFinite	0.565	          0.409	         28%
>> DoubleClassCheck.testIsInfinite	0.812	          0.375	         54%
>> DoubleClassCheck.testIsNaN	0.631	          0.38	         40%
>> FPComparison.isFiniteDouble	332.638	          272.577	 18%
>> FPComparison.isFiniteFloat	413.217	          331.825	 20%
>> FPComparison.isInfiniteDouble	874.897	          240.632	 72%
>> FPComparison.isInfiniteFloat	872.279	          321.269	 63%
>> FPComparison.isNanDouble	286.566	          240.36	 16%
>> FPComparison.isNanFloat	        346.123	          316.923	  8%
>
> Srinivas Vamsi Parasa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Support only IsInfinite with vfpclasss/d instruction

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 5335:

> 5333: 
> 5334: void C2_MacroAssembler::double_class_check_vfp(int opcode, Register dst, XMMRegister src, KRegister tmp) {
> 5335:   uint8_t imm8;

May be ok to move it back to instruction encoding block , only two instructions.

src/hotspot/cpu/x86/x86.ad line 10148:

> 10146: instruct FloatClassCheck_reg_reg_vfpclass(rRegI dst, regF src, kReg ktmp, rFlagsReg cr)
> 10147: %{
> 10148:   predicate(VM_Version::supports_avx512dq());

Predicate is no longer needed you have done the check in match_rule_supported routine.

src/hotspot/cpu/x86/x86.ad line 10161:

> 10159: instruct DoubleClassCheck_reg_reg_vfpclass(rRegI dst, regD src, kReg ktmp, rFlagsReg cr)
> 10160: %{
> 10161:   predicate(VM_Version::supports_avx512dq());

Same as above

-------------

PR: https://git.openjdk.java.net/jdk/pull/8459


More information about the hotspot-compiler-dev mailing list