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