RFR: 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter
Vladimir Kozlov
kvn at openjdk.org
Tue Mar 7 21:38:40 UTC 2023
On Tue, 7 Mar 2023 18:28:46 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> @sviswa7 I update changes based on your comments. Please, look: [9302d4b](https://github.com/openjdk/jdk/pull/12869/commits/9302d4bc00f8f1d8e774a260eb6aacb2d51a2dd4)
>
> Hi @vnkozlov , There is some discrepancy in results b/w interpreter, C1 and C2 for following case.
>
> public class Foo {
> public static short bar(float f) {return Float.floatToFloat16(f);}
> public static void main(String[] args) {
> System.out.println(Float.floatToRawIntBits(Float.float16ToFloat((short) 31745)));
> System.out.println(bar(Float.float16ToFloat((short) 31745)));
> }
> }
>
> CPROMPT>java -Xint -cp . Foo
> 2143297536 // FP32 QNaN + significand preserved
> 32257 // FP16 QNaN + significand preserved
> CPROMPT>java -Xbatch -Xcomp -cp . Foo
> 2139103232 // FP32 SNaN + significand preserved
> 31745 // FP16 SNaN + significand preserved
> CPROMPT>java -XX:-TieredCompilation -Xbatch -Xcomp -cp . Foo
> 2139103232 // FP32 SNaN + significand preserved
> 32257 // FP16 QNaN + significand preserved.
@jatin-bhateja I applied the fix. Please, verify.
-------------
PR: https://git.openjdk.org/jdk/pull/12869
More information about the hotspot-compiler-dev
mailing list