codekingpro/portable-devtools
114k
1// asmcheck2 3// Copyright 2025 The Go Authors. All rights reserved.4// Use of this source code is governed by a BSD-style5// license that can be found in the LICENSE file.6 7package codegen8 9import "cmp"10 11func isNaN[T cmp.Ordered](x T) bool {12 return x != x13}14 15func compare[T cmp.Ordered](x, y T) int {16 // amd64:-"TESTB"17 // arm64:-"MOVB"18 xNaN := isNaN(x)19 yNaN := isNaN(y)20 if xNaN {21 if yNaN {22 return 023 }24 return -125 }26 if yNaN {27 return +128 }29 if x < y {30 return -131 }32 if x > y {33 return +134 }35 return 036}37 38func usesCompare(a, b int) int {39 return compare(a, b)40}41 