Source file test/codegen/issue31618.go

     1  // asmcheck
     2  
     3  // Copyright 2019 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  package codegen
     8  
     9  // Make sure we remove both inline marks in the following code.
    10  // Both +5 and +6 should map to real instructions, which can
    11  // be used as inline marks instead of explicit nops.
    12  func f(x int) int {
    13  	// amd64:-"XCHGL"
    14  	x = g(x) + 5
    15  	// amd64:-"XCHGL"
    16  	x = g(x) + 6
    17  	return x
    18  }
    19  
    20  func g(x int) int {
    21  	return x >> 3
    22  }
    23  

View as plain text