RFR: 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter
Jatin Bhateja
jbhateja at openjdk.org
Tue Mar 7 18:33:11 UTC 2023
On Tue, 7 Mar 2023 03:00:34 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Other than the minor comments above, the x86 side changes look good to me.
>
> @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.
-------------
PR: https://git.openjdk.org/jdk/pull/12869
More information about the hotspot-compiler-dev
mailing list