aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const-call.cc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2023-05-31 23:40:11 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2023-05-31 23:40:11 +0100
commit0ede6b5ad77c4791a513ab312b9e278dafc2bff9 (patch)
tree6950b178e9ffd14459fb0f5c785c253a8ed34c7d /gcc/fold-const-call.cc
parent49f59826c66bcaa3531429381b4aed944c332e5b (diff)
downloadgcc-0ede6b5ad77c4791a513ab312b9e278dafc2bff9.zip
gcc-0ede6b5ad77c4791a513ab312b9e278dafc2bff9.tar.gz
gcc-0ede6b5ad77c4791a513ab312b9e278dafc2bff9.tar.bz2
Refactor wi::bswap as a function (instead of a method).
This patch implements Richard Sandiford's suggestion from https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618215.html that wi::bswap (and a new wi::bitreverse) should be functions, and ideally only accessors are member functions. This patch implements the first step, moving/refactoring wi::bswap. 2023-05-31 Roger Sayle <roger@nextmovesoftware.com> Richard Sandiford <richard.sandiford@arm.com> gcc/ChangeLog * fold-const-call.cc (fold_const_call_ss) <CFN_BUILT_IN_BSWAP*>: Update call to wi::bswap. * simplify-rtx.cc (simplify_const_unary_operation) <case BSWAP>: Update call to wi::bswap. * tree-ssa-ccp.cc (evaluate_stmt) <case BUILT_IN_BSWAP*>: Update calls to wi::bswap. * wide-int.cc (wide_int_storage::bswap): Remove/rename to... (wi::bswap_large): New function, with revised API. * wide-int.h (wi::bswap): New (template) function prototype. (wide_int_storage::bswap): Remove method. (sext_large, zext_large): Consistent indentation/line wrapping. (bswap_large): Prototype helper function containing implementation. (wi::bswap): New template wrapper around bswap_large.
Diffstat (limited to 'gcc/fold-const-call.cc')
-rw-r--r--gcc/fold-const-call.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fold-const-call.cc b/gcc/fold-const-call.cc
index 340cb66..663eae2 100644
--- a/gcc/fold-const-call.cc
+++ b/gcc/fold-const-call.cc
@@ -1060,7 +1060,8 @@ fold_const_call_ss (wide_int *result, combined_fn fn, const wide_int_ref &arg,
case CFN_BUILT_IN_BSWAP32:
case CFN_BUILT_IN_BSWAP64:
case CFN_BUILT_IN_BSWAP128:
- *result = wide_int::from (arg, precision, TYPE_SIGN (arg_type)).bswap ();
+ *result = wi::bswap (wide_int::from (arg, precision,
+ TYPE_SIGN (arg_type)));
return true;
default: