diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2010-08-31 18:56:46 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2010-08-31 18:56:46 +0000 |
commit | ad5f4de228737897d59cb3e629f934d504029e16 (patch) | |
tree | e145f27a4197eb4dadc10cca9f891e62a370f50d /gcc/fortran/f95-lang.c | |
parent | 18dbb8590310fedf2948bf0677d18cddb85fa5c9 (diff) | |
download | gcc-ad5f4de228737897d59cb3e629f934d504029e16.zip gcc-ad5f4de228737897d59cb3e629f934d504029e16.tar.gz gcc-ad5f4de228737897d59cb3e629f934d504029e16.tar.bz2 |
re PR fortran/38282 (Bit intrinsics: ILEN and IBCHNG)
PR fortran/38282
* f95-lang.c (gfc_init_builtin_functions): Define popcount{,l,ll}
and parity{,l,ll} builtins.
* trans-intrinsic.c (gfc_conv_intrinsic_popcnt_poppar): New function.
(gfc_conv_intrinsic_function): Call above new functions.
* simplify.c (gfc_simplify_popcnt, gfc_simplify_poppar): New
functions.
* intrinsic.texi: Document POPCNT and POPPAR.
* gfortran.dg/popcnt_poppar_1.F90: New test.
* gfortran.dg/popcnt_poppar_2.F90: New test.
From-SVN: r163691
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r-- | gcc/fortran/f95-lang.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 91dc491..163c0d2 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -938,13 +938,17 @@ gfc_init_builtin_functions (void) BUILT_IN_SINCOSF, "sincosf", false); } - /* For LEADZ / TRAILZ. */ + /* For LEADZ, TRAILZ, POPCNT and POPAR. */ ftype = build_function_type_list (integer_type_node, unsigned_type_node, NULL_TREE); gfc_define_builtin ("__builtin_clz", ftype, BUILT_IN_CLZ, "__builtin_clz", true); gfc_define_builtin ("__builtin_ctz", ftype, BUILT_IN_CTZ, "__builtin_ctz", true); + gfc_define_builtin ("__builtin_parity", ftype, BUILT_IN_PARITY, + "__builtin_parity", true); + gfc_define_builtin ("__builtin_popcount", ftype, BUILT_IN_POPCOUNT, + "__builtin_popcount", true); ftype = build_function_type_list (integer_type_node, long_unsigned_type_node, NULL_TREE); @@ -952,6 +956,10 @@ gfc_init_builtin_functions (void) "__builtin_clzl", true); gfc_define_builtin ("__builtin_ctzl", ftype, BUILT_IN_CTZL, "__builtin_ctzl", true); + gfc_define_builtin ("__builtin_parityl", ftype, BUILT_IN_PARITYL, + "__builtin_parityl", true); + gfc_define_builtin ("__builtin_popcountl", ftype, BUILT_IN_POPCOUNTL, + "__builtin_popcountl", true); ftype = build_function_type_list (integer_type_node, long_long_unsigned_type_node, NULL_TREE); @@ -959,6 +967,10 @@ gfc_init_builtin_functions (void) "__builtin_clzll", true); gfc_define_builtin ("__builtin_ctzll", ftype, BUILT_IN_CTZLL, "__builtin_ctzll", true); + gfc_define_builtin ("__builtin_parityll", ftype, BUILT_IN_PARITYLL, + "__builtin_parityll", true); + gfc_define_builtin ("__builtin_popcountll", ftype, BUILT_IN_POPCOUNTLL, + "__builtin_popcountll", true); /* Other builtin functions we use. */ |