blob: ff49314a6b5789e1571b78e241266281b505db6f [file] [log] [blame]
Dan Willemsen0c157092016-07-08 13:57:52 -07001// +build !386
2// run
3
4// Copyright 2015 The Go Authors. All rights reserved.
5// Use of this source code is governed by a BSD-style
6// license that can be found in the LICENSE file.
7
8// Issue 12411. Loss of AX during %.
9
10package main
11
12func main() {
13 x := f(4)
14 if x != 0 {
15 println("BUG: x=", x)
16 }
17}
18
19//go:noinline
20func f(x int) int {
21 // AX was live on entry to one of the % code generations,
22 // and the % code generation smashed it.
23 return ((2 * x) % 3) % (2 % ((x << 2) ^ (x % 3)))
24}