summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/builtins.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2012-06-12 15:04:18 +0000
committerpfg <pfg@FreeBSD.org>2012-06-12 15:04:18 +0000
commita6eb26cf6f3dbbb726fd6e5e9f02f222df40cdf8 (patch)
treeb2fbef554d2610927edad3f5917fcc94f901f6c1 /contrib/gcc/builtins.c
parent33675cab555bc824f32778ba0fed56733a19ef6e (diff)
downloadFreeBSD-src-a6eb26cf6f3dbbb726fd6e5e9f02f222df40cdf8.zip
FreeBSD-src-a6eb26cf6f3dbbb726fd6e5e9f02f222df40cdf8.tar.gz
Add experimental support for amdfam10/barcelona from the GCC 4.3 branch.
Initial support for the AMD barcelona chipsets has been available in the gcc43 branch under GPLv2 but was not included when the Core 2 support was brought to the system gcc. AMD and some linux distributions (OpenSUSE) did a backport of the amdfam10 support and made them available. Unfortunately this is still experimental and while it can improve performance, enabling the CPUTYPE may break some C++ ports (like clang). Special care was taken to make sure that the patches predate the GPLv3 switch upstream. Tested by: Vladimir Kushnir Reviewed by: mm Approved by: jhb (mentor) MFC after: 2 weeks
Diffstat (limited to 'contrib/gcc/builtins.c')
-rw-r--r--contrib/gcc/builtins.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/gcc/builtins.c b/contrib/gcc/builtins.c
index a65d725..3321821 100644
--- a/contrib/gcc/builtins.c
+++ b/contrib/gcc/builtins.c
@@ -7355,6 +7355,12 @@ fold_builtin_ceil (tree fndecl, tree arglist)
}
}
+ /* Fold floor (x) where x is nonnegative to trunc (x). */
+ if (tree_expr_nonnegative_p (arg))
+ return build_function_call_expr (mathfn_built_in (TREE_TYPE (arg),
+ BUILT_IN_TRUNC),
+ arglist);
+
return fold_trunc_transparent_mathfn (fndecl, arglist);
}
@@ -7442,6 +7448,18 @@ fold_builtin_int_roundingfn (tree fndecl, tree arglist)
}
}
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
+ CASE_FLT_FN (BUILT_IN_LFLOOR):
+ CASE_FLT_FN (BUILT_IN_LLFLOOR):
+ /* Fold lfloor (x) where x is nonnegative to FIX_TRUNC (x). */
+ if (tree_expr_nonnegative_p (arg))
+ return fold_build1 (FIX_TRUNC_EXPR, TREE_TYPE (TREE_TYPE (fndecl)),
+ arg);
+ break;
+ default:;
+ }
+
return fold_fixed_mathfn (fndecl, arglist);
}
OpenPOWER on IntegriCloud