revert: invoke.texi (-msselibm): Document.

2006-05-22  Richard Guenther  <rguenther@suse.de>
 
 	Revert
 	2006-01-31  Richard Guenther  <rguenther@suse.de>
 
 	* doc/invoke.texi (-msselibm): Document.
 	* target.h (expand_library_builtin): New target hook.
 	* builtins.c (expand_builtin): Use expand_library_builtin.
 	(default_expand_library_builtin): New function.
 	* gcc.c (LINK_GCC_MATH_SPEC): Define.
 	(LINK_COMMAND_SPEC): Handle %(link_gcc_math).
 	(link_gcc_math_spec): Declare.
 	(static_specs): Add link_gcc_math_spec.
 	* expr.h (default_expand_library_builtin): Declare.
 	* target-def.h (TARGET_EXPAND_LIBRARY_BUILTIN): Define.
 	(TARGET_INITIALIZER): Add TARGET_EXPAND_LIBRARY_BUILTIN.
 	* config/i386/i386.h: Provide LINK_GCC_MATH_SPEC.
 	* config/i386/i386.opt (msselibm): New target option.
 	* config/i386/i386.c (ix86_builtin_function_variants): New array.
 	(ix86_init_sse_abi_builtins): New function.
 	(ix86_expand_library_builtin): Likewise.
 	(TARGET_EXPAND_LIBRARY_BUILTIN): Define.
 	(override_options): Handle error conditions wrt -msselibm.
 	(ix86_builtins): Add function codes for SSE2 ABI builtins.
 	(ix86_init_builtins): Call ix86_init_sse_abi_builtins.
 	* doc/extend.texi (__builtin_sse2_*): Document new target specific
 	builtins.
 
 	* gcc.target/i386/sselibm-1.c: New testcase.
 	* gcc.target/i386/sselibm-2.c: Likewise.
 	* gcc.target/i386/sselibm-3.c: Likewise.
 	* gcc.target/i386/sselibm-4.c: Likewise.
 	* gcc.target/i386/sselibm-5.c: Likewise.

From-SVN: r113977
This commit is contained in:
Richard Guenther 2006-05-22 13:18:15 +00:00 committed by Richard Biener
parent 694fea202c
commit 9714c91192
17 changed files with 41 additions and 291 deletions

View File

@ -1,3 +1,31 @@
2006-05-22 Richard Guenther <rguenther@suse.de>
Revert
2006-01-31 Richard Guenther <rguenther@suse.de>
* doc/invoke.texi (-msselibm): Document.
* target.h (expand_library_builtin): New target hook.
* builtins.c (expand_builtin): Use expand_library_builtin.
(default_expand_library_builtin): New function.
* gcc.c (LINK_GCC_MATH_SPEC): Define.
(LINK_COMMAND_SPEC): Handle %(link_gcc_math).
(link_gcc_math_spec): Declare.
(static_specs): Add link_gcc_math_spec.
* expr.h (default_expand_library_builtin): Declare.
* target-def.h (TARGET_EXPAND_LIBRARY_BUILTIN): Define.
(TARGET_INITIALIZER): Add TARGET_EXPAND_LIBRARY_BUILTIN.
* config/i386/i386.h: Provide LINK_GCC_MATH_SPEC.
* config/i386/i386.opt (msselibm): New target option.
* config/i386/i386.c (ix86_builtin_function_variants): New array.
(ix86_init_sse_abi_builtins): New function.
(ix86_expand_library_builtin): Likewise.
(TARGET_EXPAND_LIBRARY_BUILTIN): Define.
(override_options): Handle error conditions wrt -msselibm.
(ix86_builtins): Add function codes for SSE2 ABI builtins.
(ix86_init_builtins): Call ix86_init_sse_abi_builtins.
* doc/extend.texi (__builtin_sse2_*): Document new target specific
builtins.
2006-05-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/27420

View File

@ -5598,14 +5598,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
else
{
/* Try expanding the builtin via the generic target hook. */
rtx tmp = targetm.expand_library_builtin (exp, target, subtarget,
mode, ignore);
if (tmp != NULL_RTX)
return tmp;
}
/* When not optimizing, generate calls to library functions for a certain
set of builtins. */
@ -8959,18 +8951,6 @@ default_expand_builtin (tree exp ATTRIBUTE_UNUSED,
return NULL_RTX;
}
/* Default target-specific library builtin expander that does nothing. */
rtx
default_expand_library_builtin (tree exp ATTRIBUTE_UNUSED,
rtx target ATTRIBUTE_UNUSED,
rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
return NULL_RTX;
}
/* Returns true is EXP represents data that would potentially reside
in a readonly section. */

View File

@ -1067,9 +1067,6 @@ int ix86_section_threshold = 65536;
/* Prefix built by ASM_GENERATE_INTERNAL_LABEL. */
char internal_label_prefix[16];
int internal_label_prefix_len;
/* Table for BUILT_IN_NORMAL to BUILT_IN_MD mapping. */
static GTY(()) tree ix86_builtin_function_variants[(int) END_BUILTINS];
static bool ix86_handle_option (size_t, const char *, int);
static void output_pic_addr_const (FILE *, rtx, int);
@ -1104,7 +1101,6 @@ static int ix86_issue_rate (void);
static int ix86_adjust_cost (rtx, rtx, rtx, int);
static int ia32_multipass_dfa_lookahead (void);
static void ix86_init_mmx_sse_builtins (void);
static void ix86_init_sse_abi_builtins (void);
static rtx x86_this_parameter (tree);
static void x86_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
HOST_WIDE_INT, tree);
@ -1162,7 +1158,6 @@ static bool ix86_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static void ix86_init_builtins (void);
static rtx ix86_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static rtx ix86_expand_library_builtin (tree, rtx, rtx, enum machine_mode, int);
static const char *ix86_mangle_fundamental_type (tree);
static tree ix86_stack_protect_fail (void);
static rtx ix86_internal_arg_pointer (void);
@ -1227,8 +1222,6 @@ static section *x86_64_elf_select_section (tree decl, int reloc,
#define TARGET_INIT_BUILTINS ix86_init_builtins
#undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN ix86_expand_builtin
#undef TARGET_EXPAND_LIBRARY_BUILTIN
#define TARGET_EXPAND_LIBRARY_BUILTIN ix86_expand_library_builtin
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE ix86_output_function_epilogue
@ -1920,16 +1913,6 @@ override_options (void)
&& ! TARGET_SSE)
error ("-msseregparm used without SSE enabled");
/* Accept -msselibm only if at least SSE support is enabled. */
if (TARGET_SSELIBM
&& ! TARGET_SSE2)
error ("-msselibm used without SSE2 enabled");
/* Ignore -msselibm on 64bit targets. */
if (TARGET_SSELIBM
&& TARGET_64BIT)
error ("-msselibm used on a 64bit target");
ix86_fpmath = TARGET_FPMATH_DEFAULT;
if (ix86_fpmath_string != 0)
@ -14378,28 +14361,6 @@ enum ix86_builtins
IX86_BUILTIN_VEC_SET_V8HI,
IX86_BUILTIN_VEC_SET_V4HI,
/* SSE2 ABI functions. */
IX86_BUILTIN_SSE2_ACOS,
IX86_BUILTIN_SSE2_ACOSF,
IX86_BUILTIN_SSE2_ASIN,
IX86_BUILTIN_SSE2_ASINF,
IX86_BUILTIN_SSE2_ATAN,
IX86_BUILTIN_SSE2_ATANF,
IX86_BUILTIN_SSE2_ATAN2,
IX86_BUILTIN_SSE2_ATAN2F,
IX86_BUILTIN_SSE2_COS,
IX86_BUILTIN_SSE2_COSF,
IX86_BUILTIN_SSE2_EXP,
IX86_BUILTIN_SSE2_EXPF,
IX86_BUILTIN_SSE2_LOG10,
IX86_BUILTIN_SSE2_LOG10F,
IX86_BUILTIN_SSE2_LOG,
IX86_BUILTIN_SSE2_LOGF,
IX86_BUILTIN_SSE2_SIN,
IX86_BUILTIN_SSE2_SINF,
IX86_BUILTIN_SSE2_TAN,
IX86_BUILTIN_SSE2_TANF,
IX86_BUILTIN_MAX
};
@ -14781,8 +14742,6 @@ ix86_init_builtins (void)
{
if (TARGET_MMX)
ix86_init_mmx_sse_builtins ();
if (TARGET_SSE2)
ix86_init_sse_abi_builtins ();
}
/* Set up all the MMX/SSE builtins. This is not called if TARGET_MMX
@ -15422,52 +15381,6 @@ ix86_init_mmx_sse_builtins (void)
def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_vec_set_v4hi",
ftype, IX86_BUILTIN_VEC_SET_V4HI);
}
#undef def_builtin
/* Set up all the SSE ABI builtins that we may use to override
the normal builtins. */
static void
ix86_init_sse_abi_builtins (void)
{
tree flt, flt2;
/* Bail out in case the template definitions are not available. */
if (! built_in_decls [BUILT_IN_SIN]
|| ! built_in_decls [BUILT_IN_SINF]
|| ! built_in_decls [BUILT_IN_ATAN2]
|| ! built_in_decls [BUILT_IN_ATAN2F])
return;
/* Build the function types as variants of the existing ones. */
flt = build_variant_type_copy (TREE_TYPE (built_in_decls [BUILT_IN_SINF]));
TYPE_ATTRIBUTES (flt)
= tree_cons (get_identifier ("sseregparm"),
NULL_TREE, TYPE_ATTRIBUTES (flt));
flt2 = build_variant_type_copy (TREE_TYPE (built_in_decls [BUILT_IN_ATAN2F]));
TYPE_ATTRIBUTES (flt2)
= tree_cons (get_identifier ("sseregparm"),
NULL_TREE, TYPE_ATTRIBUTES (flt2));
#define def_builtin(capname, name, type) \
ix86_builtin_function_variants [BUILT_IN_ ## capname] \
= lang_hooks.builtin_function ("__builtin_sse2_" # name, type, \
IX86_BUILTIN_SSE2_ ## capname, \
BUILT_IN_NORMAL, \
"__libm_sse2_" # name, NULL_TREE)
def_builtin (ACOSF, acosf, flt);
def_builtin (ASINF, asinf, flt);
def_builtin (ATANF, atanf, flt);
def_builtin (ATAN2F, atan2f, flt2);
def_builtin (COSF, cosf, flt);
def_builtin (EXPF, expf, flt);
def_builtin (LOG10F, log10f, flt);
def_builtin (LOGF, logf, flt);
def_builtin (SINF, sinf, flt);
def_builtin (TANF, tanf, flt);
#undef def_builtin
}
/* Errors in the source file can cause expand_expr to return const0_rtx
where we expect a vector. To avoid crashing, use one of the vector
@ -16302,39 +16215,6 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
gcc_unreachable ();
}
/* Expand an expression EXP that calls a built-in library function,
with result going to TARGET if that's convenient
(and in mode MODE if that's convenient).
SUBTARGET may be used as the target for computing one of EXP's operands.
IGNORE is nonzero if the value is to be ignored. */
static rtx
ix86_expand_library_builtin (tree exp, rtx target,
rtx subtarget ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
int ignore)
{
enum built_in_function fncode;
tree fndecl, newfn, call;
/* Try expanding builtin math functions to the SSE2 ABI variants. */
if (!TARGET_SSELIBM)
return NULL_RTX;
fncode = builtin_mathfn_code (exp);
if (!ix86_builtin_function_variants [(int)fncode])
return NULL_RTX;
fndecl = get_callee_fndecl (exp);
if (DECL_RTL_SET_P (fndecl))
return NULL_RTX;
/* Build the redirected call and expand it. */
newfn = ix86_builtin_function_variants [(int)fncode];
call = build_function_call_expr (newfn, TREE_OPERAND (exp, 1));
return expand_call (call, target, ignore);
}
/* Store OPERAND to the memory after reload is completed. This means
that we can't easily use assign_stack_local. */
rtx

View File

@ -513,8 +513,6 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define EXTRA_SPECS \
{ "cc1_cpu", CC1_CPU_SPEC }, \
SUBTARGET_EXTRA_SPECS
#define LINK_GCC_MATH_SPEC "%{msselibm:-lgcc-math}"
/* target machine storage layout */

View File

@ -201,10 +201,6 @@ msseregparm
Target RejectNegative Mask(SSEREGPARM)
Use SSE register passing conventions for SF and DF mode
msselibm
Target Mask(SSELIBM)
Use SSE2 ABI libgcc-math routines if using SSE math
mstackrealign
Target Report Var(ix86_force_align_arg_pointer)
Realign stack in prologue

View File

@ -6856,35 +6856,6 @@ v2sf __builtin_ia32_pswapdsf (v2sf)
v2si __builtin_ia32_pswapdsi (v2si)
@end smallexample
The following built-in functions are available when @option{-msse2}
is used. All of them generate calls to an SSE2 ABI IEEE754 math intrinsic
that is part of the name. Rather than using these directly you may
want them automatically substituted for calls to the regular intrinsics
using the @option{-msselibm}.
@smallexample
double __builtin_sse2_acos (double)
float __builtin_sse2_acosf (float)
double __builtin_sse2_asin (double)
float __builtin_sse2_asinf (float)
double __builtin_sse2_atan (double)
float __builtin_sse2_atanf (float)
double __builtin_sse2_atan2 (double, double)
float __builtin_sse2_atan2f (float, float)
double __builtin_sse2_cos (double)
float __builtin_sse2_cosf (float)
double __builtin_sse2_exp (double)
float __builtin_sse2_expf (float)
double __builtin_sse2_log10 (double)
float __builtin_sse2_log10f (float)
double __builtin_sse2_log (double)
float __builtin_sse2_logf (float)
double __builtin_sse2_sin (double)
float __builtin_sse2_sinf (float)
double __builtin_sse2_tan (double)
float __builtin_sse2_tanf (float)
@end smallexample
@node MIPS DSP Built-in Functions
@subsection MIPS DSP Built-in Functions

View File

@ -533,7 +533,7 @@ Objective-C and Objective-C++ Dialects}.
-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol
-mno-wide-multiply -mrtd -malign-double @gol
-mpreferred-stack-boundary=@var{num} @gol
-mmmx -msse -msse2 -msse3 -m3dnow -msselibm @gol
-mmmx -msse -msse2 -msse3 -m3dnow @gol
-mthreads -mno-align-stringops -minline-all-stringops @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
-m96bit-long-double -mregparm=@var{num} -msseregparm @gol
@ -9538,12 +9538,6 @@ supported architecture, using the appropriate flags. In particular,
the file containing the CPU detection code should be compiled without
these options.
@item -msselibm
@opindex msselibm
Use special versions of certain libm routines that come with an SSE
ABI and an SSE implementation. Useful together with @option{-mfpmath=sse}
to avoid moving values between SSE registers and the x87 FP stack.
@item -mpush-args
@itemx -mno-push-args
@opindex mpush-args

View File

@ -338,7 +338,6 @@ extern rtx expand_builtin (tree, rtx, rtx, enum machine_mode, int);
extern tree std_build_builtin_va_list (void);
extern void std_expand_builtin_va_start (tree, rtx);
extern rtx default_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
extern rtx default_expand_library_builtin (tree, rtx, rtx, enum machine_mode, int);
extern void expand_builtin_setjmp_setup (rtx, rtx);
extern void expand_builtin_setjmp_receiver (rtx);
extern rtx expand_builtin_saveregs (void);

View File

@ -682,10 +682,6 @@ proper position among the other output files. */
#endif
#endif
#ifndef LINK_GCC_MATH_SPEC
#define LINK_GCC_MATH_SPEC ""
#endif
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#define LINK_PIE_SPEC "%{pie:-pie} "
@ -708,7 +704,7 @@ proper position among the other output files. */
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
%{fopenmp:%:include(libgomp.spec)%(link_gomp)} %(mflib)\
%{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
%{!nostdlib:%{!nodefaultlibs:%(link_gcc_math) %(link_ssp) %(link_gcc_c_sequence)}}\
%{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif
@ -739,7 +735,6 @@ static const char *cc1_spec = CC1_SPEC;
static const char *cc1plus_spec = CC1PLUS_SPEC;
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
static const char *link_ssp_spec = LINK_SSP_SPEC;
static const char *link_gcc_math_spec = LINK_GCC_MATH_SPEC;
static const char *asm_spec = ASM_SPEC;
static const char *asm_final_spec = ASM_FINAL_SPEC;
static const char *link_spec = LINK_SPEC;
@ -1547,7 +1542,6 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec),
INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec),
INIT_STATIC_SPEC ("link_gcc_math", &link_gcc_math_spec),
INIT_STATIC_SPEC ("endfile", &endfile_spec),
INIT_STATIC_SPEC ("link", &link_spec),
INIT_STATIC_SPEC ("lib", &lib_spec),

View File

@ -348,7 +348,6 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/* In builtins.c. */
#define TARGET_INIT_BUILTINS hook_void_void
#define TARGET_EXPAND_BUILTIN default_expand_builtin
#define TARGET_EXPAND_LIBRARY_BUILTIN default_expand_library_builtin
#define TARGET_RESOLVE_OVERLOADED_BUILTIN NULL
#define TARGET_FOLD_BUILTIN hook_tree_tree_tree_bool_null
@ -619,7 +618,6 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
TARGET_NARROW_VOLATILE_BITFIELD, \
TARGET_INIT_BUILTINS, \
TARGET_EXPAND_BUILTIN, \
TARGET_EXPAND_LIBRARY_BUILTIN, \
TARGET_RESOLVE_OVERLOADED_BUILTIN, \
TARGET_FOLD_BUILTIN, \
TARGET_MANGLE_FUNDAMENTAL_TYPE, \

View File

@ -430,10 +430,6 @@ struct gcc_target
rtx (* expand_builtin) (tree exp, rtx target, rtx subtarget,
enum machine_mode mode, int ignore);
/* Expand a target-specific library builtin. */
rtx (* expand_library_builtin) (tree exp, rtx target, rtx subtarget,
enum machine_mode mode, int ignore);
/* Select a replacement for a target-specific builtin. This is done
*before* regular type checking, and so allows the target to implement
a crude form of function overloading. The result is a complete

View File

@ -1,3 +1,14 @@
2006-05-22 Richard Guenther <rguenther@suse.de>
Revert
2006-01-31 Richard Guenther <rguenther@suse.de>
* gcc.target/i386/sselibm-1.c: New testcase.
* gcc.target/i386/sselibm-2.c: Likewise.
* gcc.target/i386/sselibm-3.c: Likewise.
* gcc.target/i386/sselibm-4.c: Likewise.
* gcc.target/i386/sselibm-5.c: Likewise.
2006-05-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/27420

View File

@ -1,12 +0,0 @@
/* { dg-do compile } */
/* { dg-options "-msse2 -mfpmath=sse" } */
/* { dg-require-effective-target ilp32 } */
float sinf(float);
float foo(float x)
{
return sinf(x);
}
/* { dg-final { scan-assembler-not "__libm_sse2_sinf" } } */

View File

@ -1,12 +0,0 @@
/* { dg-do compile } */
/* { dg-options "-msse2 -mfpmath=sse -msselibm" } */
/* { dg-require-effective-target ilp32 } */
float sinf(float);
float foo(float x)
{
return sinf(x);
}
/* { dg-final { scan-assembler "__libm_sse2_sinf" } } */

View File

@ -1,19 +0,0 @@
/* { dg-do compile } */
/* { dg-options "-O1 -msse2 -mfpmath=sse -msselibm" } */
/* { dg-require-effective-target ilp32 } */
float sinf(float);
float (*mysin)(float) = sinf;
float f1(float x)
{
return sinf(x);
}
float f2(float x)
{
/* Verify we do not expand the following call to __libm_sse2_sinf. */
return (*mysin)(x);
}
/* { dg-final { scan-assembler-times "__libm_sse2_sinf" 1 } } */

View File

@ -1,22 +0,0 @@
/* { dg-do compile } */
/* { dg-options "-O1 -msse2 -mfpmath=sse -msselibm" } */
/* { dg-require-effective-target ilp32 } */
extern float acosf(float);
extern float asinf(float);
extern float atanf(float);
extern float atan2f(float, float);
extern float cosf(float);
extern float expf(float);
extern float log10f(float);
extern float logf(float);
extern float sinf(float);
extern float tanf(float);
float foof(float x)
{
return acosf(x) + asinf(x) + atanf(x) + atan2f(x, x) + cosf(x) + expf(x)
+ log10f(x) + logf(x) + sinf(x) + tanf(x);
}
/* { dg-final { scan-assembler-times "__libm_sse2" 10 } } */

View File

@ -1,30 +0,0 @@
/* { dg-do compile } */
/* { dg-options "-O1 -msse2 -mfpmath=sse -msselibm" } */
/* { dg-require-effective-target ilp32 } */
extern float acosf(float);
extern float asinf(float);
extern float atanf(float);
extern float atan2f(float, float);
extern float cosf(float);
extern float expf(float);
extern float log10f(float);
extern float logf(float);
extern float sinf(float);
extern float tanf(float);
float foof(float x)
{
return __builtin_sse2_acosf(x)
+ __builtin_sse2_asinf(x)
+ __builtin_sse2_atanf(x)
+ __builtin_sse2_atan2f(x, x)
+ __builtin_sse2_cosf(x)
+ __builtin_sse2_expf(x)
+ __builtin_sse2_log10f(x)
+ __builtin_sse2_logf(x)
+ __builtin_sse2_sinf(x)
+ __builtin_sse2_tanf(x);
}
/* { dg-final { scan-assembler-times "__libm_sse2" 10 } } */