Files
TheRock/compiler/amd-llvm/amd/device-libs/ocml/src/cosbF.cl
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

61 lines
1.5 KiB
Common Lisp

/*===--------------------------------------------------------------------------
* ROCm Device Libraries
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*===------------------------------------------------------------------------*/
#include "mathF.h"
#include "trigredF.h"
#define FSUM2(A, B, H, L) \
do { \
float __s = A + B; \
float __t = B - (__s - A); \
H = __s; \
L = __t; \
} while (0)
#define FDIF2(A, B, H, L) \
do { \
float __d = A - B; \
float __e = (A - __d) - B; \
H = __d; \
L = __e; \
} while (0)
float
MATH_PRIVATE(cosb)(float x, int n, float p)
{
struct redret r = MATH_PRIVATE(trigred)(x);
bool b = r.hi < p;
r.i = (r.i - b - n) & 3;
#if defined EXTRA_PRECISION
float ph = AS_FLOAT(0xbf490fdb ^ (b ? SIGNBIT_SP32 : 0));
float pl = AS_FLOAT(0x32bbbd2e ^ (b ? SIGNBIT_SP32 : 0));
float sh, sl;
FDIF2(ph, p, ph, sl);
pl += sl;
FSUM2(ph, pl, ph, pl);
FSUM2(ph, r.hi, sh, sl);
sl += pl + r.lo;
FSUM2(sh, sl, sh, sl);
struct scret sc = MATH_PRIVATE(sincosred2)(sh, sl);
#else
r.hi = r.hi - p + AS_FLOAT(0xbf490fdb ^ (b ? SIGNBIT_SP32 : 0));
struct scret sc = MATH_PRIVATE(sincosred)(r.hi);
#endif
sc.s = -sc.s;
float c = (r.i & 1) != 0 ? sc.s : sc.c;
c = AS_FLOAT(AS_INT(c) ^ (r.i > 1 ? SIGNBIT_SP32 : 0));
return c;
}