aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2019-06-21 22:42:18 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-06-21 22:42:18 +0000
commitd54cf3a449fad57fcad8d2eafb8bb3d49585ea65 (patch)
treebf4410cb0c973ef258021efcf54a16d92bc7f1af /gcc/go/go-gcc.cc
parentf4e7200b1df3dde7d2d9cec8861c6567356db40f (diff)
downloadgcc-d54cf3a449fad57fcad8d2eafb8bb3d49585ea65.zip
gcc-d54cf3a449fad57fcad8d2eafb8bb3d49585ea65.tar.gz
gcc-d54cf3a449fad57fcad8d2eafb8bb3d49585ea65.tar.bz2
compiler: intrinsify some math/bits functions
Let the Go frontend recognize some math/bits functions and turn them into intrinsics. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183266 * go-gcc.cc (Gcc_backend::Gcc_backend): Define math/bits builtins. From-SVN: r272579
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 91043b5..879149e 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -613,7 +613,7 @@ Gcc_backend::Gcc_backend()
NULL_TREE),
false, false);
- // Used by runtime/internal/sys.
+ // Used by runtime/internal/sys and math/bits.
this->define_builtin(BUILT_IN_CTZ, "__builtin_ctz", "ctz",
build_function_type_list(integer_type_node,
unsigned_type_node,
@@ -624,6 +624,31 @@ Gcc_backend::Gcc_backend()
long_long_unsigned_type_node,
NULL_TREE),
true, false);
+ this->define_builtin(BUILT_IN_CLZ, "__builtin_clz", "clz",
+ build_function_type_list(integer_type_node,
+ unsigned_type_node,
+ NULL_TREE),
+ true, false);
+ this->define_builtin(BUILT_IN_CLZLL, "__builtin_clzll", "clzll",
+ build_function_type_list(integer_type_node,
+ long_long_unsigned_type_node,
+ NULL_TREE),
+ true, false);
+ this->define_builtin(BUILT_IN_POPCOUNT, "__builtin_popcount", "popcount",
+ build_function_type_list(integer_type_node,
+ unsigned_type_node,
+ NULL_TREE),
+ true, false);
+ this->define_builtin(BUILT_IN_POPCOUNTLL, "__builtin_popcountll", "popcountll",
+ build_function_type_list(integer_type_node,
+ long_long_unsigned_type_node,
+ NULL_TREE),
+ true, false);
+ this->define_builtin(BUILT_IN_BSWAP16, "__builtin_bswap16", "bswap16",
+ build_function_type_list(uint16_type_node,
+ uint16_type_node,
+ NULL_TREE),
+ true, false);
this->define_builtin(BUILT_IN_BSWAP32, "__builtin_bswap32", "bswap32",
build_function_type_list(uint32_type_node,
uint32_type_node,