diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 8d8b094889f..52040da8c47 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -18807,7 +18807,8 @@ ix86_veclibabi_svml (combined_fn fn, tree type_out, tree type_in) return NULL_TREE; } - tree fndecl = mathfn_built_in (TREE_TYPE (type_in), fn); + tree fndecl = mathfn_built_in (el_mode == DFmode + ? double_type_node : float_type_node, fn); bname = IDENTIFIER_POINTER (DECL_NAME (fndecl)); if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_LOGF) @@ -18899,7 +18900,8 @@ ix86_veclibabi_acml (combined_fn fn, tree type_out, tree type_in) return NULL_TREE; } - tree fndecl = mathfn_built_in (TREE_TYPE (type_in), fn); + tree fndecl = mathfn_built_in (el_mode == DFmode + ? double_type_node : float_type_node, fn); bname = IDENTIFIER_POINTER (DECL_NAME (fndecl)); sprintf (name + 7, "%s", bname+10); diff --git a/gcc/testsuite/gcc.target/i386/pr105367.c b/gcc/testsuite/gcc.target/i386/pr105367.c new file mode 100644 index 00000000000..558e3e58e4e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr105367.c @@ -0,0 +1,12 @@ +/* PR target/105367 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -mveclibabi=acml" } */ + +_Float64 g; + +void +foo (void) +{ + _Float64 f = __builtin_sin (g); + g = __builtin_fmax (__builtin_sin (f), f); +}