[PATCH] D85910: libclc: Add a __builtin to let SPIRV targets select between SW and HW FMA
Daniel Stone via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 08:27:51 PDT 2020
daniels created this revision.
daniels added reviewers: jvesely, tstellar.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
daniels requested review of this revision.
The SPIRV targets are supposed to be generic, but some HW still don't
support the Fma instruction. Add the __builtin_has_hw_fma32() builtin
function to let the implementation express whether it has hardware FMA
support or not.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85910
Files:
libclc/generic/lib/math/math.h
Index: libclc/generic/lib/math/math.h
===================================================================
--- libclc/generic/lib/math/math.h
+++ libclc/generic/lib/math/math.h
@@ -40,6 +40,9 @@
#if (defined __AMDGCN__ || defined __R600__) && !defined __HAS_FMAF__
#define HAVE_HW_FMA32() (0)
+#elif defined CLC_SPIRV || defined CLC_SPIRV64
+bool __builtin_has_hw_fma32(void);
+#define HAVE_HW_FMA32() __builtin_has_hw_fma32()
#else
#define HAVE_HW_FMA32() (1)
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85910.285382.patch
Type: text/x-patch
Size: 474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200813/618636d2/attachment.bin>
More information about the llvm-commits
mailing list