From patchwork Tue Nov 6 18:12:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 197529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 252EF2C0094 for ; Wed, 7 Nov 2012 05:13:07 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352830388; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=sovBxG1 PjYK87SfCY9taBfY/0js=; b=vzzv3RS4yCF/EWvfDeTwZ27trAkR7UfkkqmnLgR qqkwkwONoI8T2f+QuvPXiLNd7EYX+qgzWfPZbdSc0LIXo0tDZePl8JSAAAVZL72D 9kRJvMhiVNYCDTYDqb7yRu795Ka0MpAhpvH1Wcw7gL4mnKy3kT4i8/X9jAT5m7qA j5TQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=AGWmr4ZhyvG1B7Cj8c5bvHcSVDh5FEJrwKE0Tv0dN9edqCMCLI8cegHScp6MO8 1BcRWyjM5+1b2yDgJCNuAbD2Lpy16sTD3YEsg60B72mWOQIN8sx8g+XqkylK8bA+ 4YezQqM0eOwEDieO49dwxEG27NoNMOeJKKEKsQuYMUA9Y=; Received: (qmail 3237 invoked by alias); 6 Nov 2012 18:12:58 -0000 Received: (qmail 3229 invoked by uid 22791); 6 Nov 2012 18:12:56 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Nov 2012 18:12:50 +0000 Received: by mail-pa0-f47.google.com with SMTP id fa11so485497pad.20 for ; Tue, 06 Nov 2012 10:12:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=qFHWJDyIAtRgwfLoFT5EjvcmOww+dHVzl7iQprT4aEw=; b=PUV5ajr3La9OckbrTUwXvzEdZ6yVbdvYT0RSO2k/5yGs2Is1XQvxwFraufbKycF+Y+ LKP+qIFoZxeQVY9ZEvcqHlsXpdGwGgCnTL1kLhg/QdBM01nNl4XI6PA9kk7NM6xDEBNN px/5wgk3lc8hGsCWBmaJqcUSpNrVDp/q9rq551y6On+uwCMQFX5K7vOzc188c0oYiqi+ XGnm0RgkyV0+AcRlX0pM1SWsTauTPYyp70l+iP8yvykx6hqQs2fFiaw3AauLmlOOPkDg u0LjgJv++f8KhPSJHOyuf4gpWI39u2KHTCWlfuwUe4oxZ1HIWWvZSasEtu0i+cu1BFE1 vVKw== Received: by 10.66.84.163 with SMTP id a3mr4951833paz.2.1352225569600; Tue, 06 Nov 2012 10:12:49 -0800 (PST) Received: from coign.google.com ([2620:0:1000:1804:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id qi2sm12688684pbc.22.2012.11.06.10.12.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Nov 2012 10:12:49 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: The Go runtime memcmp needs to return intgo Date: Tue, 06 Nov 2012 10:12:48 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnLge6iHtLH7awIHaBgfr6CQSFFaIT9+OO+fMSomKk6PhNTiqiSjJCQo6bVENEAlCWTI+Nmaarzpud99rdDPsQL8FtQwQM6jtTx2OeemV4c6Cf5/xwaesSsUHTZoqmhGiaM81Wtln4cihOOs8XDO90Bc3FfJYjuC6vtxkZdLkQNmGG7zjhRO6rCuKYNqVqFbUMLMCzA X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 -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); +}