Keith Randall | e97ab0a | 2015-08-13 12:25:19 -0700 | [diff] [blame] | 1 | // run |
| 2 | |
| 3 | // Copyright 2015 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | // Issue 12133. The CX register was getting clobbered |
| 8 | // because we did not keep track of its allocation correctly. |
| 9 | |
| 10 | package main |
| 11 | |
| 12 | import "fmt" |
| 13 | |
| 14 | func main() { |
| 15 | want := uint(48) |
| 16 | got := f1(48) |
| 17 | if got != want { |
| 18 | fmt.Println("got", got, ", wanted", want) |
| 19 | panic("bad") |
| 20 | } |
| 21 | } |
| 22 | func f1(v1 uint) uint { |
| 23 | switch { |
| 24 | } // prevent inlining |
| 25 | return v1 >> ((1 >> v1) + (1 >> v1)) |
| 26 | } |