diff options
author | Uros Bizjak <uros@kss-loka.si> | 2005-04-14 13:26:45 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2005-04-14 13:26:45 +0200 |
commit | 2ec76fdb2413bee3123b322e4f4259ba9f9c8310 (patch) | |
tree | e66d3ba10f9caef0d152e7a4934acc4e6d2153d0 /gcc | |
parent | 559be41a519baec62f81099ba904338607c687dd (diff) | |
download | gcc-2ec76fdb2413bee3123b322e4f4259ba9f9c8310.zip gcc-2ec76fdb2413bee3123b322e4f4259ba9f9c8310.tar.gz gcc-2ec76fdb2413bee3123b322e4f4259ba9f9c8310.tar.bz2 |
convert.c (convert_to_integer): Convert (long int)trunc{,f,l}, and (long long int)ceil{,f,l} into FIX_TRUNC_EXPR.
* convert.c (convert_to_integer): Convert (long int)trunc{,f,l},
and (long long int)ceil{,f,l} into FIX_TRUNC_EXPR.
testsuite:
* gcc.dg/builtins-53.c: Also check (int)trunc* and
(long long int)trunc*.
From-SVN: r98131
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/convert.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-53.c | 33 |
4 files changed, 50 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f96cfbd..cdbbf33 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-04-14 Uros Bizjak <uros@kss-loka.si> + + * convert.c (convert_to_integer): Convert (long int)trunc{,f,l}, + and (long long int)ceil{,f,l} into FIX_TRUNC_EXPR. + 2005-04-14 Ulrich Weigand <uweigand@de.ibm.com> PR target/20927 diff --git a/gcc/convert.c b/gcc/convert.c index 9ae300d..4e0fc84 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -381,6 +381,13 @@ convert_to_integer (tree type, tree expr) else fn = mathfn_built_in (s_intype, BUILT_IN_LRINT); break; + + case BUILT_IN_TRUNC: case BUILT_IN_TRUNCF: case BUILT_IN_TRUNCL: + { + tree arglist = TREE_OPERAND (s_expr, 1); + return convert_to_integer (type, TREE_VALUE (arglist)); + } + default: break; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70a0126..d773106 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-14 Uros Bizjak <uros@kss-loka.si> + + * gcc.dg/builtins-53.c: Also check (int)trunc* and + (long long int)trunc*. + 2005-04-14 Ulrich Weigand <uweigand@de.ibm.com> PR target/20927 diff --git a/gcc/testsuite/gcc.dg/builtins-53.c b/gcc/testsuite/gcc.dg/builtins-53.c index 6bf481b..0a08070 100644 --- a/gcc/testsuite/gcc.dg/builtins-53.c +++ b/gcc/testsuite/gcc.dg/builtins-53.c @@ -13,12 +13,15 @@ extern double floor(double); extern double ceil(double); +extern double trunc(double); extern float floorf(float); extern float ceilf(float); +extern float truncf(float); extern long double floorl(long double); extern long double ceill(long double); +extern long double truncl(long double); long int test1(double x) @@ -41,6 +44,16 @@ long long int test4(double x) return ceil(x); } +long int test5(double x) +{ + return trunc(x); +} + +long long int test6(double x) +{ + return trunc(x); +} + long int test1f(float x) { return floorf(x); @@ -61,6 +74,16 @@ long long int test4f(float x) return ceilf(x); } +long int test5f(float x) +{ + return truncf(x); +} + +long long int test6f(float x) +{ + return truncf(x); +} + long int test1l(long double x) { return floorl(x); @@ -80,3 +103,13 @@ long long int test4l(long double x) { return ceill(x); } + +long int test5l(long double x) +{ + return truncl(x); +} + +long long int test6l(long double x) +{ + return truncl(x); +} |