LoongArch: Fix incorrect return type for frecipe/frsqrte intrinsic functions
gcc/ChangeLog: * config/loongarch/larchintrin.h (__frecipe_s): Update function return type. (__frecipe_d): Ditto. (__frsqrte_s): Ditto. (__frsqrte_d): Ditto. gcc/testsuite/ChangeLog: * gcc.target/loongarch/larch-frecipe-intrinsic.c: New test.
This commit is contained in:
parent
593d518a63
commit
92acc92ee5
2 changed files with 38 additions and 8 deletions
|
@ -336,38 +336,38 @@ __iocsrwr_d (unsigned long int _1, unsigned int _2)
|
|||
#ifdef __loongarch_frecipe
|
||||
/* Assembly instruction format: fd, fj. */
|
||||
/* Data types in instruction templates: SF, SF. */
|
||||
extern __inline void
|
||||
extern __inline float
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__frecipe_s (float _1)
|
||||
{
|
||||
__builtin_loongarch_frecipe_s ((float) _1);
|
||||
return (float) __builtin_loongarch_frecipe_s ((float) _1);
|
||||
}
|
||||
|
||||
/* Assembly instruction format: fd, fj. */
|
||||
/* Data types in instruction templates: DF, DF. */
|
||||
extern __inline void
|
||||
extern __inline double
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__frecipe_d (double _1)
|
||||
{
|
||||
__builtin_loongarch_frecipe_d ((double) _1);
|
||||
return (double) __builtin_loongarch_frecipe_d ((double) _1);
|
||||
}
|
||||
|
||||
/* Assembly instruction format: fd, fj. */
|
||||
/* Data types in instruction templates: SF, SF. */
|
||||
extern __inline void
|
||||
extern __inline float
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__frsqrte_s (float _1)
|
||||
{
|
||||
__builtin_loongarch_frsqrte_s ((float) _1);
|
||||
return (float) __builtin_loongarch_frsqrte_s ((float) _1);
|
||||
}
|
||||
|
||||
/* Assembly instruction format: fd, fj. */
|
||||
/* Data types in instruction templates: DF, DF. */
|
||||
extern __inline void
|
||||
extern __inline double
|
||||
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
|
||||
__frsqrte_d (double _1)
|
||||
{
|
||||
__builtin_loongarch_frsqrte_d ((double) _1);
|
||||
return (double) __builtin_loongarch_frsqrte_d ((double) _1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
30
gcc/testsuite/gcc.target/loongarch/larch-frecipe-intrinsic.c
Normal file
30
gcc/testsuite/gcc.target/loongarch/larch-frecipe-intrinsic.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* Test intrinsics for frecipe.{s/d} and frsqrte.{s/d} instructions */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-mfrecipe -O2" } */
|
||||
/* { dg-final { scan-assembler-times "test_frecipe_s:.*frecipe\\.s.*test_frecipe_s" 1 } } */
|
||||
/* { dg-final { scan-assembler-times "test_frecipe_d:.*frecipe\\.d.*test_frecipe_d" 1 } } */
|
||||
/* { dg-final { scan-assembler-times "test_frsqrte_s:.*frsqrte\\.s.*test_frsqrte_s" 1 } } */
|
||||
/* { dg-final { scan-assembler-times "test_frsqrte_d:.*frsqrte\\.d.*test_frsqrte_d" 1 } } */
|
||||
|
||||
#include <larchintrin.h>
|
||||
|
||||
float
|
||||
test_frecipe_s (float _1)
|
||||
{
|
||||
return __frecipe_s (_1);
|
||||
}
|
||||
double
|
||||
test_frecipe_d (double _1)
|
||||
{
|
||||
return __frecipe_d (_1);
|
||||
}
|
||||
float
|
||||
test_frsqrte_s (float _1)
|
||||
{
|
||||
return __frsqrte_s (_1);
|
||||
}
|
||||
double
|
||||
test_frsqrte_d (double _1)
|
||||
{
|
||||
return __frsqrte_d (_1);
|
||||
}
|
Loading…
Add table
Reference in a new issue