Quiet SNaN inputs in Half.toFloat()
This CL fixes Half.toFloat() in handling SNaN inputs, to make sure the Java implementation has same semantics as the hardware implementations (Arm and Intel). 1. Armv8.2 implementation (FCVT): // tested as ART intrinsic on Pixel3 __ Fmov(h31, w1); // input: w1 register __ Fcvt(s0, h31); // output: s0 register 2. X86 implementation (VCVTPH2PS): // clang -mf16c test.c float x86_toFloat(short h) { __v8hi v = {h, 0, 0, 0, 0, 0, 0, 0}; __v4sf r = __builtin_ia32_vcvtph2ps(v); return r[0]; } 3. Java implementation (software): android.util.Half.toFloat(short); Test: Exhaustive testing of 0x0..0xFFFF input bits on above three implementations and compare output values. Change-Id: Iff137858379bf43e59cde94c9d19c2054a3d4f93
Loading
Please register or sign in to comment