[libc-commits] [libc] 505829e - [libc][obvious] Fix the FMA implementation on the GPU

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Jun 14 11:33:42 PDT 2023


Author: Joseph Huber
Date: 2023-06-14T13:33:25-05:00
New Revision: 505829eacf0ebf404de1606aabd06da40cfd741f

URL: https://github.com/llvm/llvm-project/commit/505829eacf0ebf404de1606aabd06da40cfd741f
DIFF: https://github.com/llvm/llvm-project/commit/505829eacf0ebf404de1606aabd06da40cfd741f.diff

LOG: [libc][obvious] Fix the FMA implementation on the GPU

Summary:
This doesn't include the type_traits to perform the indirection, nor
does it return the value.

Added: 
    

Modified: 
    libc/src/__support/FPUtil/gpu/FMA.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/FPUtil/gpu/FMA.h b/libc/src/__support/FPUtil/gpu/FMA.h
index 7b458db8b15a9..3e75a795ca09e 100644
--- a/libc/src/__support/FPUtil/gpu/FMA.h
+++ b/libc/src/__support/FPUtil/gpu/FMA.h
@@ -14,17 +14,19 @@
 static_assert(__has_builtin(__builtin_fma), "FMA builtins must be defined");
 static_assert(__has_builtin(__builtin_fmaf), "FMA builtins must be defined");
 
+#include "src/__support/CPP/type_traits.h"
+
 namespace __llvm_libc {
 namespace fputil {
 
 template <typename T>
 LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, float>, T> fma(T x, T y, T z) {
-  __builtin_fmaf(x, y, z);
+  return __builtin_fmaf(x, y, z);
 }
 
 template <typename T>
 LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) {
-  __builtin_fma(x, y, z);
+  return __builtin_fma(x, y, z);
 }
 
 } // namespace fputil


        


More information about the libc-commits mailing list