From 98b7d98697ab31ab7115cfac2d454e43f51746db Mon Sep 17 00:00:00 2001 From: Joe Ramsay Date: Mon, 15 Jul 2024 11:41:28 +0100 Subject: [PATCH] Fix masked GNUABI build for NOALIAS The previous patch only added support for the unmasked build - masked symbols also need to sidestep aliases when they are not supported. --- src/libm/mkmasked_gnuabi.c | 21 +++++++-------------- src/libm/sleefsimddp.c | 11 +++++++++++ src/libm/sleefsimdsp.c | 11 +++++++++++ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/libm/mkmasked_gnuabi.c b/src/libm/mkmasked_gnuabi.c index 45210a23..1c2a4b36 100644 --- a/src/libm/mkmasked_gnuabi.c +++ b/src/libm/mkmasked_gnuabi.c @@ -77,25 +77,21 @@ int main(int argc, char **argv) { switch(funcList[i].funcType) { case 0: { printf("EXPORT CONST %s %s(%s a0, vopmask m) { return %s(a0); }\n", - vfpname[fptype], funcname[1], vfpname[fptype], funcname[0]); + vfpname[fptype], funcname[1], vfpname[fptype], funcname[0]); if (funcList[i].ulp < 20) - printf("EXPORT CONST %s %s(%s, vopmask) __attribute__((weak, alias(\"%s\")));\n", - vfpname[fptype], funcname[3], vfpname[fptype], funcname[1]); + printf("DMASKED_ALIAS_%s(%s, %s)\n", vfpname[fptype], funcname[3], funcname[1]); else - printf("EXPORT CONST %s %s_u%d(%s, vopmask) __attribute__((weak, alias(\"%s\")));\n", - vfpname[fptype], funcname[3],funcList[i].ulp, vfpname[fptype], funcname[1]); + printf("DMASKED_ALIAS_%s(%s_u%d, %s)\n", vfpname[fptype], funcname[3], funcList[i].ulp, funcname[1]); break; } case 1: { printf("EXPORT CONST %s %s(%s a0, %s a1, vopmask m) { return %s(a0, a1); }\n", vfpname[fptype], funcname[1], vfpname[fptype], vfpname[fptype], funcname[0]); if (funcList[i].ulp < 20) - printf("EXPORT CONST %s %s(%s, %s, vopmask) __attribute__((weak, alias(\"%s\")));\n", - vfpname[fptype], funcname[3], vfpname[fptype], vfpname[fptype], funcname[1]); + printf("DMASKED_ALIAS_%s2(%s, %s)\n", vfpname[fptype], funcname[3], funcname[1]); else - printf("EXPORT CONST %s %s_u%d(%s, %s, vopmask) __attribute__((weak, alias(\"%s\")));\n", - vfpname[fptype], funcname[3],funcList[i].ulp, vfpname[fptype], vfpname[fptype], funcname[1]); + printf("DMASKED_ALIAS_%s2(%s_u%d, %s)\n", vfpname[fptype], funcname[3], funcList[i].ulp, funcname[1]); break; } case 2: @@ -160,13 +156,10 @@ int main(int argc, char **argv) { printf("EXPORT CONST %s %s(%s a0, %s a1, vopmask m) { return %s(a0, a1); }\n", vfpname[fptype], funcname[1], vfpname[fptype], ptr_type, funcname[0]); - if (funcList[i].ulp < 20) - printf("EXPORT CONST %s %s(%s, %s, vopmask) __attribute__((weak, alias(\"%s\")));\n", - vfpname[fptype], funcname[3], vfpname[fptype], ptr_type, funcname[1]); + printf("DMASKED_ALIAS_%sp(%s, %s)\n", vfpname[fptype], funcname[3], funcname[1]); else - printf("EXPORT CONST %s %s_u%d(%s, %s, vopmask) __attribute__((weak, alias(\"%s\")));\n", - vfpname[fptype], funcname[3],funcList[i].ulp, vfpname[fptype], ptr_type, funcname[1]); + printf("DMASKED_ALIAS_%sp(%s_u%d, %s)\n", vfpname[fptype], funcname[3], funcList[i].ulp, funcname[1]); } break; } diff --git a/src/libm/sleefsimddp.c b/src/libm/sleefsimddp.c index bce32a8a..ce09b52e 100644 --- a/src/libm/sleefsimddp.c +++ b/src/libm/sleefsimddp.c @@ -3745,6 +3745,17 @@ DFINITE_ALIAS_vd_vd(__sqrt_finite, xsqrt) DFINITE_ALIAS_vd_vd(__tgamma_u1_finite, xtgamma_u1) #ifdef HEADER_MASKED + +#if ENABLE_ALIAS +#define DMASKED_ALIAS_vdouble(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vdouble ALIASEE(vdouble, vopmask) __attribute__((weak, alias(FUNC))); +#define DMASKED_ALIAS_vdouble2(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vdouble ALIASEE(vdouble, vdouble, vopmask) __attribute__((weak, alias(FUNC))); +#define DMASKED_ALIAS_vdoublep(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vdouble ALIASEE(vdouble, vdouble*, vopmask) __attribute__((weak, alias(FUNC))); +#else +#define DMASKED_ALIAS_vdouble(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vdouble ALIASEE(vdouble x, vopmask m) { return TARGET(x, m); } +#define DMASKED_ALIAS_vdouble2(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vdouble ALIASEE(vdouble x, vdouble y, vopmask m) { return TARGET(x, y, m); } +#define DMASKED_ALIAS_vdoublep(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vdouble ALIASEE(vdouble x, double *y, vopmask m) { return TARGET(x, y, m); } +#endif + #include HEADER_MASKED #endif #endif /* #ifdef ENABLE_GNUABI */ diff --git a/src/libm/sleefsimdsp.c b/src/libm/sleefsimdsp.c index cafdb472..0a2b5189 100644 --- a/src/libm/sleefsimdsp.c +++ b/src/libm/sleefsimdsp.c @@ -3695,6 +3695,17 @@ DFINITE_ALIAS_vf_vf(__sqrtf_finite, xsqrtf) DFINITE_ALIAS_vf_vf(__tgammaf_u1_finite, xtgammaf_u1) #ifdef HEADER_MASKED + +#if ENABLE_ALIAS +#define DMASKED_ALIAS_vfloat(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vfloat ALIASEE(vfloat, vopmask) __attribute__((weak, alias(FUNC))); +#define DMASKED_ALIAS_vfloat2(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vfloat ALIASEE(vfloat, vfloat, vopmask) __attribute__((weak, alias(FUNC))); +#define DMASKED_ALIAS_vfloatp(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vfloat ALIASEE(vfloat, vfloat*, vopmask) __attribute__((weak, alias(FUNC))); +#else +#define DMASKED_ALIAS_vfloat(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vfloat ALIASEE(vfloat x, vopmask m) { return TARGET(x, m); } +#define DMASKED_ALIAS_vfloat2(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vfloat ALIASEE(vfloat x, vfloat y, vopmask m) { return TARGET(x, y, m); } +#define DMASKED_ALIAS_vfloatp(ALIASEE, TARGET) EXPORT CONST VECTOR_CC vfloat ALIASEE(vfloat x, float *y, vopmask m) { return TARGET(x, y, m); } +#endif + #include HEADER_MASKED #endif #endif /* #ifdef ENABLE_GNUABI */