================
@@ -0,0 +1,135 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#if __CLC_FPSIZE == 32
+
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_cbrt(__CLC_GENTYPE x) {
+  __CLC_UINTN xi = __CLC_AS_UINTN(x);
+  __CLC_UINTN axi = __CLC_AS_UINTN(__clc_fabs(x));
+  __CLC_UINTN xsign = axi ^ xi;
+  xi = axi;
+
+  __CLC_INTN m = __CLC_AS_INTN(xi >> EXPSHIFTBITS_SP32) - EXPBIAS_SP32;
+
+  // Treat subnormals
+  __CLC_UINTN xisub = __CLC_AS_UINTN(__CLC_AS_GENTYPE(xi | 0x3f800000) - 1.0f);
+  __CLC_INTN msub = __CLC_AS_INTN(xisub >> EXPSHIFTBITS_SP32) - 253;
+  __CLC_INTN c = m == -127;
+  xi = c ? xisub : xi;
+  m = c ? msub : m;
----------------
frasercrmck wrote:

You might be right - I'll keep an eye on it. Thanks!

https://github.com/llvm/llvm-project/pull/133940
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to