1// run 2 3// Copyright 2018 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 7package main 8 9//go:noinline 10func cmovClobberAX64(v1, v2 int64, x1, x2 float64) int64 { 11 r := v1 12 if x1 == x2 { 13 r = v2 14 } 15 return r 16} 17 18//go:noinline 19func cmovClobberAX32(v1, v2 int32, x1, x2 float64) int32 { 20 r := v1 21 if x1 == x2 { 22 r = v2 23 } 24 return r 25} 26 27//go:noinline 28func cmovClobberAX16(v1, v2 int16, x1, x2 float64) int16 { 29 r := v1 30 if x1 == x2 { 31 r = v2 32 } 33 return r 34} 35 36func main() { 37 if cmovClobberAX16(1, 2, 4.0, 5.0) != 1 { 38 panic("CMOVQEQF causes incorrect code") 39 } 40 if cmovClobberAX32(1, 2, 4.0, 5.0) != 1 { 41 panic("CMOVQEQF causes incorrect code") 42 } 43 if cmovClobberAX64(1, 2, 4.0, 5.0) != 1 { 44 panic("CMOVQEQF causes incorrect code") 45 } 46 47} 48