diff mbox

Go patch committed: The Go runtime memcmp needs to return intgo

Message ID mcrehk6siqn.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Nov. 6, 2012, 6:12 p.m. UTC
This patch to the Go frontend and libgo add a Go-specific memcmp
routine, which returns intgo rather than int.  This is a step toward
using 64-bit int.  The memcmp routine is only used for struct and array
equality comparisons, it is not really a performance issue.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian
diff mbox

Patch

diff -r c1a6ccf93d67 go/runtime.def
--- a/go/runtime.def	Mon Nov 05 09:40:48 2012 -0800
+++ b/go/runtime.def	Tue Nov 06 09:53:54 2012 -0800
@@ -29,7 +29,7 @@ 
 // result types.
 
 // The standard C memcmp function, used for struct comparisons.
-DEF_GO_RUNTIME(MEMCMP, "memcmp", P3(POINTER, POINTER, UINTPTR), R1(INT))
+DEF_GO_RUNTIME(MEMCMP, "__go_memcmp", P3(POINTER, POINTER, UINTPTR), R1(INT))
 
 // Range over a string, returning the next index.
 DEF_GO_RUNTIME(STRINGITER, "runtime.stringiter", P2(STRING, INT), R1(INT))
diff -r c1a6ccf93d67 libgo/Makefile.am
--- a/libgo/Makefile.am	Mon Nov 05 09:40:48 2012 -0800
+++ b/libgo/Makefile.am	Tue Nov 06 09:53:54 2012 -0800
@@ -462,6 +462,7 @@ 
 	runtime/go-map-len.c \
 	runtime/go-map-range.c \
 	runtime/go-matherr.c \
+	runtime/go-memcmp.c \
 	runtime/go-nanotime.c \
 	runtime/go-now.c \
 	runtime/go-new-map.c \
diff -r c1a6ccf93d67 libgo/runtime/go-memcmp.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/runtime/go-memcmp.c	Tue Nov 06 09:53:54 2012 -0800
@@ -0,0 +1,13 @@ 
+/* go-memcmp.c -- the go memory comparison function.
+
+   Copyright 2012 The Go Authors. All rights reserved.
+   Use of this source code is governed by a BSD-style
+   license that can be found in the LICENSE file.  */
+
+#include "runtime.h"
+
+intgo
+__go_memcmp (const void *p1, const void *p2, uintptr len)
+{
+  return __builtin_memcmp (p1, p2, len);
+}