libclc: Add a __builtin to let SPIRV targets select between SW and HW FMA

Reviewer: jenatali jvesely
Differential Revision: https://reviews.llvm.org/D85910
This commit is contained in:
Daniel Stone 2020-09-15 13:01:04 -04:00 committed by Jan Vesely
parent 9c40495a35
commit 291bfff5db
3 changed files with 13 additions and 0 deletions

View File

@ -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 __attribute__((noinline)) __clc_runtime_has_hw_fma32(void);
#define HAVE_HW_FMA32() __clc_runtime_has_hw_fma32()
#else
#define HAVE_HW_FMA32() (1)
#endif

View File

@ -4,3 +4,8 @@
#define __CLC_BODY <fma.inc>
#define __FLOAT_ONLY
#include <clc/math/gentype.inc>
bool __clc_runtime_has_hw_fma32()
{
return false;
}

View File

@ -4,3 +4,8 @@
#define __CLC_BODY <fma.inc>
#define __FLOAT_ONLY
#include <clc/math/gentype.inc>
bool __clc_runtime_has_hw_fma32()
{
return false;
}