aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-06-24 16:54:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-06-24 16:54:22 +0000
commit2b92d5c69b4e4ffd89e6bfe928ea2cc2114357a8 (patch)
tree318ef6fa71679125858dacabc9a1992333294ccc /gcc
parent1e3d475ea16e89332e07651d61b60b408e0a0932 (diff)
downloadgcc-2b92d5c69b4e4ffd89e6bfe928ea2cc2114357a8.zip
gcc-2b92d5c69b4e4ffd89e6bfe928ea2cc2114357a8.tar.gz
gcc-2b92d5c69b4e4ffd89e6bfe928ea2cc2114357a8.tar.bz2
compiler: use builtin memcmp directly
Instead of going through a C function __go_memcmp, we can just use __builtin_memcmp directly. This allows more optimizations in the compiler backend. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183537 From-SVN: r272620
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc3
-rw-r--r--gcc/go/gofrontend/runtime.def2
3 files changed, 4 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 92d863e..89d401b 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-1232eef628227ef855c5fa6d94b31778b2e74a85
+338e4baf88a4ae676205dff601dbef2d31b19d2d
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index c9d8ea2..050da32 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -6199,7 +6199,8 @@ Binary_expression::lower_compare_to_memcmp(Gogo*, Statement_inserter* inserter)
TYPE_INFO_SIZE);
Expression* call = Runtime::make_call(Runtime::MEMCMP, loc, 3, a1, a2, len);
- Expression* zero = Expression::make_integer_ul(0, NULL, loc);
+ Type* int32_type = Type::lookup_integer_type("int32");
+ Expression* zero = Expression::make_integer_ul(0, int32_type, loc);
return Expression::make_binary(this->op_, call, zero, loc);
}
diff --git a/gcc/go/gofrontend/runtime.def b/gcc/go/gofrontend/runtime.def
index 27d5e47..7b66b16 100644
--- a/gcc/go/gofrontend/runtime.def
+++ b/gcc/go/gofrontend/runtime.def
@@ -29,7 +29,7 @@
// result types.
// The standard C memcmp function, used for struct comparisons.
-DEF_GO_RUNTIME(MEMCMP, "__go_memcmp", P3(POINTER, POINTER, UINTPTR), R1(INT))
+DEF_GO_RUNTIME(MEMCMP, "__builtin_memcmp", P3(POINTER, POINTER, UINTPTR), R1(INT32))
// Decode a non-ASCII rune from a string.
DEF_GO_RUNTIME(DECODERUNE, "runtime.decoderune", P2(STRING, INT),