CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
60 lines
2.2 KiB
C
60 lines
2.2 KiB
C
//===-- dnorm2.c - Handle double-precision denormal inputs to binary op ---===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This helper function is available for use by double-precision float
|
|
// arithmetic implementations, to handle denormal inputs on entry by
|
|
// renormalizing the mantissa and modifying the exponent to match.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <stdint.h>
|
|
|
|
// Structure containing the function's inputs and outputs.
|
|
//
|
|
// On entry: a, b are two input floating-point numbers, still in IEEE 754
|
|
// encoding. expa and expb are the 8-bit exponents of those numbers, extracted
|
|
// and shifted down to the low 8 bits of the word, with no other change.
|
|
// Neither value should be zero, or have the maximum exponent (indicating an
|
|
// infinity or NaN).
|
|
//
|
|
// On exit: each of a and b contains the mantissa of the input value, with the
|
|
// leading 1 bit made explicit, and shifted up to bit 52 (the same place it
|
|
// would have been if the number was normalized already). If expa was zero
|
|
// (indicating that a was denormal) then it is now represented as a normalized
|
|
// number with an out-of-range exponent (zero or negative). The same applies to
|
|
// expb and b.
|
|
//
|
|
// The sign bits from the input floating-point numbers are discarded
|
|
// completely. The caller is expected to have stored those somewhere
|
|
// safe already.
|
|
struct dnorm2 {
|
|
uint64_t a, b;
|
|
uint32_t expa, expb;
|
|
};
|
|
|
|
void __compiler_rt_dnorm2(struct dnorm2 *values) {
|
|
values->a &= ~0xFFF0000000000000ull;
|
|
values->b &= ~0xFFF0000000000000ull;
|
|
|
|
if (values->expa == 0) {
|
|
unsigned shift = __builtin_clzll(values->a) - 11;
|
|
values->a <<= shift;
|
|
values->expa = 1 - shift;
|
|
} else {
|
|
values->a |= 0x0010000000000000ull;
|
|
}
|
|
|
|
if (values->expb == 0) {
|
|
unsigned shift = __builtin_clzll(values->b) - 11;
|
|
values->b <<= shift;
|
|
values->expb = 1 - shift;
|
|
} else {
|
|
values->b |= 0x0010000000000000ull;
|
|
}
|
|
}
|