From 51853f7488afa69c0d14b0e96f1da84822cd83f1 Mon Sep 17 00:00:00 2001 From: Bhavana Kilambi Date: Mon, 5 Feb 2024 18:29:32 +0000 Subject: [PATCH] 8324724: Add Stub routines for FP16 conversions on aarch64 Reviewed-by: aph, ngasson --- .../cpu/aarch64/stubGenerator_aarch64.cpp | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index dfdfa194c4e..46a7d796267 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2022, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -5474,6 +5474,32 @@ class StubGenerator: public StubCodeGenerator { return entry; } + // r0 = input (float16) + // v0 = result (float) + // v1 = temporary float register + address generate_float16ToFloat() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "float16ToFloat"); + address entry = __ pc(); + BLOCK_COMMENT("Entry:"); + __ flt16_to_flt(v0, r0, v1); + __ ret(lr); + return entry; + } + + // v0 = input (float) + // r0 = result (float16) + // v1 = temporary float register + address generate_floatToFloat16() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "floatToFloat16"); + address entry = __ pc(); + BLOCK_COMMENT("Entry:"); + __ flt_to_flt16(r0, v0, v1); + __ ret(lr); + return entry; + } + address generate_method_entry_barrier() { __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier"); @@ -8327,6 +8353,12 @@ class StubGenerator: public StubCodeGenerator { if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_dcos)) { StubRoutines::_dcos = generate_dsin_dcos(/* isCos = */ true); } + + if (vmIntrinsics::is_intrinsic_available(vmIntrinsics::_float16ToFloat) && + vmIntrinsics::is_intrinsic_available(vmIntrinsics::_floatToFloat16)) { + StubRoutines::_hf2f = generate_float16ToFloat(); + StubRoutines::_f2hf = generate_floatToFloat16(); + } } void generate_continuation_stubs() {