1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:18:32 -06:00
The Go programming language
Go to file
Matthew Dempsky bb192d1399 cmd/6c: Optimize rotate expressions to use rotate instructions.
For simplicity, only recognizes expressions of the exact form
"(x << a) | (x >> b)" where x is a variable and a and b are
integer constant expressions that add to x's bit width.

Fixes #4629.

$ cat rotate.c
unsigned int
rotate(unsigned int x)
{
        x = (x << 3) | (x >> (sizeof(x) * 8 - 3));
        return x;
}

## BEFORE
$ go tool 6c -S rotate.c
(rotate.c:2)	TEXT	rotate+0(SB),$0-8
(rotate.c:2)	MOVL	x+0(FP),!!DX
(rotate.c:4)	MOVL	DX,!!AX
(rotate.c:4)	SALL	$3,!!AX
(rotate.c:4)	MOVL	DX,!!CX
(rotate.c:4)	SHRL	$29,!!CX
(rotate.c:4)	ORL	CX,!!AX
(rotate.c:5)	RET	,!!
(rotate.c:5)	RET	,!!
(rotate.c:5)	END	,!!

## AFTER
$ go tool 6c -S rotate.c
(rotate.c:2)	TEXT	rotate+0(SB),$0-8
(rotate.c:4)	MOVL	x+0(FP),!!AX
(rotate.c:4)	ROLL	$3,!!AX
(rotate.c:5)	RET	,!!
(rotate.c:5)	RET	,!!
(rotate.c:5)	END	,!!

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7069056
2013-01-18 17:29:53 -05:00
api api: add go/types to next.txt 2013-01-02 15:28:30 -05:00
doc spec: clarify lhs syntax for range and select 2013-01-18 13:59:25 -08:00
include build: add missing function declarations for Plan 9 2013-01-11 16:58:46 -08:00
lib lib/godoc: link to Projects wiki page instead of dashboard 2013-01-18 19:25:45 +11:00
misc misc/dashboard/godashboard: delete 2013-01-18 13:47:01 +11:00
src cmd/6c: Optimize rotate expressions to use rotate instructions. 2013-01-18 17:29:53 -05:00
test test: re-enable issue4348.go. 2013-01-18 22:54:27 +01:00
.hgignore build: update Makefile to track source code dependencies better 2012-03-13 03:31:11 +08:00
.hgtags tag go1.0.3 2012-09-24 13:15:33 -05:00
AUTHORS A+C: Georg Reinke (individual CLA) 2013-01-10 11:37:52 -08:00
CONTRIBUTORS C: add Carl Shapiro (Google CLA). 2013-01-18 10:25:23 +11:00
favicon.ico godoc: update favicon 2012-10-11 17:02:36 +11:00
LICENSE doc: update licensing text one more time 2012-03-27 15:09:13 +11:00
PATENTS LICENSE: separate, change PATENTS text 2010-12-06 16:31:59 -05:00
README build: update, streamline documentation for new $GOBIN 2010-08-24 20:00:50 -04:00
robots.txt godoc: serve robots.txt raw 2011-02-19 05:46:20 +11:00

This is the source code repository for the Go programming language.  

For documentation about how to install and use Go,
visit http://golang.org/ or load doc/install.html in your web browser.

After installing Go, you can view a nicely formatted
doc/install.html by running godoc --http=:6060
and then visiting http://localhost:6060/doc/install.html.

Unless otherwise noted, the Go source files are distributed
under the BSD-style license found in the LICENSE file.

--

Binary Distribution Notes

If you have just untarred a binary Go distribution, you need to set
the environment variable $GOROOT to the full path of the go
directory (the one containing this README).  You can omit the
variable if you unpack it into /usr/local/go, or if you rebuild
from sources by running all.bash (see doc/install.html).
You should also add the Go binary directory $GOROOT/bin
to your shell's path.

For example, if you extracted the tar file into $HOME/go, you might
put the following in your .profile:

    export GOROOT=$HOME/go
    export PATH=$PATH:$GOROOT/bin

See doc/install.html for more details.