optabs.h (enum optab_index): Add new OTI_lrint and OTI_llrint.
* optabs.h (enum optab_index): Add new OTI_lrint and OTI_llrint. (lrint_optab, llrint_optab): Define corresponding macros. * optabs.c (init_optabs): Initialize lrint_optab and llrint_optab. * genopinit.c (optabs): Implement lrint_optab using lrintsi2 pattern and llrint_optab using llrintdi2 patterns. * builtins.c (expand_builtin_mathfn): Handle BUILT_IN_LRINT{,F,L} using lrint_optab and BUILT_IN_LLRINT{,F,L} using llrint_optab. (expand_builtin): Expand BUILT_IN_LRINT{,F,L} and BUILT_IN_LLRINT{,F,L} using expand_builtin_mathfn if flag_unsafe_math_optimizations is set. testsuite: * gcc.dg/builtins-46.c: Also check lrint* and llrint*. From-SVN: r96802
This commit is contained in:
parent
14f02e7315
commit
21e01bf10d
7 changed files with 77 additions and 1 deletions
|
@ -1,3 +1,16 @@
|
|||
2005-03-21 Uros Bizjak <uros@kss-loka.si>
|
||||
|
||||
* optabs.h (enum optab_index): Add new OTI_lrint and OTI_llrint.
|
||||
(lrint_optab, llrint_optab): Define corresponding macros.
|
||||
* optabs.c (init_optabs): Initialize lrint_optab and llrint_optab.
|
||||
* genopinit.c (optabs): Implement lrint_optab using lrintsi2
|
||||
pattern and llrint_optab using llrintdi2 patterns.
|
||||
* builtins.c (expand_builtin_mathfn): Handle BUILT_IN_LRINT{,F,L}
|
||||
using lrint_optab and BUILT_IN_LLRINT{,F,L} using llrint_optab.
|
||||
(expand_builtin): Expand BUILT_IN_LRINT{,F,L} and
|
||||
BUILT_IN_LLRINT{,F,L} using expand_builtin_mathfn if
|
||||
flag_unsafe_math_optimizations is set.
|
||||
|
||||
2005-03-21 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* combine.c (combine_simplify_rtx, simplify_if_then_else,
|
||||
|
|
|
@ -1758,6 +1758,14 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
|
|||
case BUILT_IN_RINTF:
|
||||
case BUILT_IN_RINTL:
|
||||
builtin_optab = rint_optab; break;
|
||||
case BUILT_IN_LRINT:
|
||||
case BUILT_IN_LRINTF:
|
||||
case BUILT_IN_LRINTL:
|
||||
builtin_optab = lrint_optab; break;
|
||||
case BUILT_IN_LLRINT:
|
||||
case BUILT_IN_LLRINTF:
|
||||
case BUILT_IN_LLRINTL:
|
||||
builtin_optab = llrint_optab; break;
|
||||
default:
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
@ -5261,6 +5269,12 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
|
|||
case BUILT_IN_RINT:
|
||||
case BUILT_IN_RINTF:
|
||||
case BUILT_IN_RINTL:
|
||||
case BUILT_IN_LRINT:
|
||||
case BUILT_IN_LRINTF:
|
||||
case BUILT_IN_LRINTL:
|
||||
case BUILT_IN_LLRINT:
|
||||
case BUILT_IN_LLRINTF:
|
||||
case BUILT_IN_LLRINTL:
|
||||
target = expand_builtin_mathfn (exp, target, subtarget);
|
||||
if (target)
|
||||
return target;
|
||||
|
|
|
@ -124,6 +124,8 @@ static const char * const optabs[] =
|
|||
"btrunc_optab->handlers[$A].insn_code = CODE_FOR_$(btrunc$a2$)",
|
||||
"nearbyint_optab->handlers[$A].insn_code = CODE_FOR_$(nearbyint$a2$)",
|
||||
"rint_optab->handlers[$A].insn_code = CODE_FOR_$(rint$a2$)",
|
||||
"lrint_optab->handlers[$A].insn_code = CODE_FOR_$(lrint$a2$)",
|
||||
"llrint_optab->handlers[$A].insn_code = CODE_FOR_$(llrint$a2$)",
|
||||
"sincos_optab->handlers[$A].insn_code = CODE_FOR_$(sincos$a3$)",
|
||||
"sin_optab->handlers[$A].insn_code = CODE_FOR_$(sin$a2$)",
|
||||
"asin_optab->handlers[$A].insn_code = CODE_FOR_$(asin$a2$)",
|
||||
|
|
|
@ -5033,6 +5033,8 @@ init_optabs (void)
|
|||
btrunc_optab = init_optab (UNKNOWN);
|
||||
nearbyint_optab = init_optab (UNKNOWN);
|
||||
rint_optab = init_optab (UNKNOWN);
|
||||
lrint_optab = init_optab (UNKNOWN);
|
||||
llrint_optab = init_optab (UNKNOWN);
|
||||
sincos_optab = init_optab (UNKNOWN);
|
||||
sin_optab = init_optab (UNKNOWN);
|
||||
asin_optab = init_optab (UNKNOWN);
|
||||
|
|
|
@ -191,6 +191,8 @@ enum optab_index
|
|||
OTI_round,
|
||||
OTI_nearbyint,
|
||||
OTI_rint,
|
||||
OTI_lrint,
|
||||
OTI_llrint,
|
||||
/* Tangent */
|
||||
OTI_tan,
|
||||
/* Inverse tangent */
|
||||
|
@ -317,6 +319,8 @@ extern GTY(()) optab optab_table[OTI_MAX];
|
|||
#define round_optab (optab_table[OTI_round])
|
||||
#define nearbyint_optab (optab_table[OTI_nearbyint])
|
||||
#define rint_optab (optab_table[OTI_rint])
|
||||
#define lrint_optab (optab_table[OTI_lrint])
|
||||
#define llrint_optab (optab_table[OTI_llrint])
|
||||
#define tan_optab (optab_table[OTI_tan])
|
||||
#define atan_optab (optab_table[OTI_atan])
|
||||
#define copysign_optab (optab_table[OTI_copysign])
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2005-03-21 Uros Bizjak <uros@kss-loka.si>
|
||||
|
||||
* gcc.dg/builtins-46.c: Also check lrint* and llrint*.
|
||||
|
||||
2005-03-21 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* g++.dg/parse/crash25.C: Fix typo.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* Copyright (C) 2004 Free Software Foundation.
|
||||
|
||||
Check that rint, rintf, rintl, floor, floorf, floorl,
|
||||
Check that rint, rintf, rintl, lrint, lrintf, lrintl,
|
||||
llrint, llrintf, llrintl, floor, floorf, floorl,
|
||||
ceil, ceilf, ceill, trunc, truncf, truncl,
|
||||
nearbyint, nearbyintf and nearbyintl
|
||||
built-in functions compile.
|
||||
|
@ -11,18 +12,24 @@
|
|||
/* { dg-options "-O2 -ffast-math" } */
|
||||
|
||||
extern double rint(double);
|
||||
extern long int lrint(double);
|
||||
extern long long int llrint(double);
|
||||
extern double floor(double);
|
||||
extern double ceil(double);
|
||||
extern double trunc(double);
|
||||
extern double nearbyint(double);
|
||||
|
||||
extern float rintf(float);
|
||||
extern long int lrintf(float);
|
||||
extern long long int llrintf(float);
|
||||
extern float floorf(float);
|
||||
extern float ceilf(float);
|
||||
extern float truncf(float);
|
||||
extern float nearbyintf(float);
|
||||
|
||||
extern long double rintl(long double);
|
||||
extern long int lrintl(long double);
|
||||
extern long long int llrintl(long double);
|
||||
extern long double floorl(long double);
|
||||
extern long double ceill(long double);
|
||||
extern long double truncl(long double);
|
||||
|
@ -34,6 +41,16 @@ double test1(double x)
|
|||
return rint(x);
|
||||
}
|
||||
|
||||
long int test11(double x)
|
||||
{
|
||||
return lrint(x);
|
||||
}
|
||||
|
||||
long long int test12(double x)
|
||||
{
|
||||
return llrint(x);
|
||||
}
|
||||
|
||||
double test2(double x)
|
||||
{
|
||||
return floor(x);
|
||||
|
@ -59,6 +76,16 @@ float test1f(float x)
|
|||
return rintf(x);
|
||||
}
|
||||
|
||||
long int test11f(float x)
|
||||
{
|
||||
return lrintf(x);
|
||||
}
|
||||
|
||||
long long int test12f(float x)
|
||||
{
|
||||
return llrintf(x);
|
||||
}
|
||||
|
||||
float test2f(float x)
|
||||
{
|
||||
return floorf(x);
|
||||
|
@ -84,6 +111,16 @@ long double test1l(long double x)
|
|||
return rintl(x);
|
||||
}
|
||||
|
||||
long int test11l(long double x)
|
||||
{
|
||||
return lrintl(x);
|
||||
}
|
||||
|
||||
long long int test12l(long double x)
|
||||
{
|
||||
return llrintl(x);
|
||||
}
|
||||
|
||||
long double test2l(long double x)
|
||||
{
|
||||
return floorl(x);
|
||||
|
|
Loading…
Add table
Reference in a new issue