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