Source file test/codegen/spectre.go

     1  // +build amd64
     2  // asmcheck -gcflags=-spectre=index
     3  
     4  // Copyright 2020 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  package codegen
     9  
    10  func IndexArray(x *[10]int, i int) int {
    11  	// amd64:`CMOVQCC`
    12  	return x[i]
    13  }
    14  
    15  func IndexString(x string, i int) byte {
    16  	// amd64:`CMOVQLS`
    17  	return x[i]
    18  }
    19  
    20  func IndexSlice(x []float64, i int) float64 {
    21  	// amd64:`CMOVQLS`
    22  	return x[i]
    23  }
    24  
    25  func SliceArray(x *[10]int, i, j int) []int {
    26  	// amd64:`CMOVQHI`
    27  	return x[i:j]
    28  }
    29  
    30  func SliceString(x string, i, j int) string {
    31  	// amd64:`CMOVQHI`
    32  	return x[i:j]
    33  }
    34  
    35  func SliceSlice(x []float64, i, j int) []float64 {
    36  	// amd64:`CMOVQHI`
    37  	return x[i:j]
    38  }
    39  

View as plain text