diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-10-05 13:37:15 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-10-05 13:37:15 +0000 |
commit | 73463c5e847ca23a8f51ef5b8ad8a19c99696799 (patch) | |
tree | 1e4a42eb36f306f1da5a94e136fcbde03c213296 /gcc/tree.c | |
parent | 5b295a81dd8e7650d334dc71581e64d5736bc3ab (diff) | |
download | gcc-73463c5e847ca23a8f51ef5b8ad8a19c99696799.zip gcc-73463c5e847ca23a8f51ef5b8ad8a19c99696799.tar.gz gcc-73463c5e847ca23a8f51ef5b8ad8a19c99696799.tar.bz2 |
Add a build_real_truncate helper function
...which simplifies the match.pd patterns I'm about to add.
Bootstrapped & regression-tested on x86_64-linux-gnu.
gcc/
* real.h (build_real_truncate): Declare.
* tree.c (build_real_truncate): New function.
(strip_float_extensions): Use it.
* builtins.c (fold_builtin_cabs, fold_builtin_sqrt, fold_builtin_cbrt)
(fold_builtin_hypot, fold_builtin_pow): Likewise.
* match.pd: Likewise.
From-SVN: r228483
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1877,6 +1877,14 @@ build_real (tree type, REAL_VALUE_TYPE d) return v; } +/* Like build_real, but first truncate D to the type. */ + +tree +build_real_truncate (tree type, REAL_VALUE_TYPE d) +{ + return build_real (type, real_value_truncate (TYPE_MODE (type), d)); +} + /* Return a new REAL_CST node whose type is TYPE and whose value is the integer value of the INTEGER_CST node I. */ @@ -12093,7 +12101,7 @@ strip_float_extensions (tree exp) && exact_real_truncate (TYPE_MODE (double_type_node), &orig)) type = double_type_node; if (type) - return build_real (type, real_value_truncate (TYPE_MODE (type), orig)); + return build_real_truncate (type, orig); } if (!CONVERT_EXPR_P (exp)) |