Source file test/codegen/schedule.go

     1  // asmcheck
     2  
     3  // Copyright 2025 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  import "math/bits"
    10  
    11  func f(n int) int {
    12  	r := 0
    13  	// arm64:-"MOVD R[0-9]+, R[0-9]+"
    14  	// amd64:-"LEAQ" "INCQ"
    15  	for i := range n {
    16  		r += i
    17  	}
    18  	return r
    19  }
    20  
    21  // addVW has loop body with both a flag-producing op and an induction-variable increment.
    22  // It ensures that the induction increment doesn't get pointlessly spilled.
    23  func addVWLike(z, x []uint, y uint) uint {
    24  	c := y
    25  	// arm64:-"MOVD R[0-9]+, R[0-9]+"
    26  	// amd64:-"LEAQ" "INCQ"
    27  	for i := range z {
    28  		zi, cc := bits.Add(x[i], c, 0)
    29  		z[i] = zi
    30  		c = cc
    31  	}
    32  	return c
    33  }
    34  

View as plain text