Skip to content

Commit b82aa8f

Browse files
gbaraldibryanpkc
authored andcommitted
Delete libpgmath veclib definitions for sincos
As noted in #11, flang currently crashes when lowering a sincos reference into a libpgmath runtime function call. The issue is that `__fd_sincos_1` is defined as returning a `<{ double, double }>` struct and there is no LLVM support for automatically vectorizing target functions of this form. In particular, it is somewhat ambiguous how to vectorize such functions, i.e. how they pack their return values into the vector registers. libpgmath itself also has a somewhat questionable implementation of the vector forms of `sincos`, relying on this beauty: https://github.com/flang-compiler/flang/blob/master/runtime/libpgmath/lib/common/mth_vreturns.c#L8-L47 This may sometimes work in practice, but it is not particularly robust. For example, this will definitely break in any sort of LTO or instrumentation setting. I think until libpgmath is updated and LLVM upstream has a consensus on how to vectorize these functions, we just need to stop trying to vectorize these functions. As noted, since LLVM was crashing anyway, no performance and functionality is lost here over current master. Fixes #11. Originally By: Keno Fischer <[email protected]>
1 parent aae0f27 commit b82aa8f

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

llvm/include/llvm/Analysis/VecFuncs.def

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,30 +1599,6 @@ TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_4", FIXED(4))
15991599
TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_8", FIXED(8))
16001600
TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_16", FIXED(16))
16011601

1602-
TLI_DEFINE_VECFUNC("__fd_sincos_1", "__fd_sincos_2", FIXED(2))
1603-
TLI_DEFINE_VECFUNC("__fd_sincos_1", "__fd_sincos_4", FIXED(4))
1604-
TLI_DEFINE_VECFUNC("__fd_sincos_1", "__fd_sincos_8", FIXED(8))
1605-
1606-
TLI_DEFINE_VECFUNC("__fs_sincos_1", "__fs_sincos_4", FIXED(4))
1607-
TLI_DEFINE_VECFUNC("__fs_sincos_1", "__fs_sincos_8", FIXED(8))
1608-
TLI_DEFINE_VECFUNC("__fs_sincos_1", "__fs_sincos_16", FIXED(16))
1609-
1610-
TLI_DEFINE_VECFUNC("__pd_sincos_1", "__pd_sincos_2", FIXED(2))
1611-
TLI_DEFINE_VECFUNC("__pd_sincos_1", "__pd_sincos_4", FIXED(4))
1612-
TLI_DEFINE_VECFUNC("__pd_sincos_1", "__pd_sincos_8", FIXED(8))
1613-
1614-
TLI_DEFINE_VECFUNC("__ps_sincos_1", "__ps_sincos_4", FIXED(4))
1615-
TLI_DEFINE_VECFUNC("__ps_sincos_1", "__ps_sincos_8", FIXED(8))
1616-
TLI_DEFINE_VECFUNC("__ps_sincos_1", "__ps_sincos_16", FIXED(16))
1617-
1618-
TLI_DEFINE_VECFUNC("__rd_sincos_1", "__rd_sincos_2", FIXED(2))
1619-
TLI_DEFINE_VECFUNC("__rd_sincos_1", "__rd_sincos_4", FIXED(4))
1620-
TLI_DEFINE_VECFUNC("__rd_sincos_1", "__rd_sincos_8", FIXED(8))
1621-
1622-
TLI_DEFINE_VECFUNC("__rs_sincos_1", "__rs_sincos_4", FIXED(4))
1623-
TLI_DEFINE_VECFUNC("__rs_sincos_1", "__rs_sincos_8", FIXED(8))
1624-
TLI_DEFINE_VECFUNC("__rs_sincos_1", "__rs_sincos_16", FIXED(16))
1625-
16261602
TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_2", FIXED(2))
16271603
TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_4", FIXED(4))
16281604
TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_8", FIXED(8))

0 commit comments

Comments
 (0)