]> Cypherpunks.ru repositories - gostls13.git/blob - test/codegen/bool.go
test/codegen: combine trivial PPC64 tests into ppc64x
[gostls13.git] / test / codegen / bool.go
1 // asmcheck
2
3 // Copyright 2020 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 // This file contains codegen tests related to boolean simplifications/optimizations.
10
11 func convertNeq0B(x uint8, c bool) bool {
12         // amd64:"ANDL\t[$]1",-"SETNE"
13         // ppc64x:"ANDCC",-"CMPW",-"ISEL"
14         b := x&1 != 0
15         return c && b
16 }
17
18 func convertNeq0W(x uint16, c bool) bool {
19         // amd64:"ANDL\t[$]1",-"SETNE"
20         // ppc64x:"ANDCC",-"CMPW",-"ISEL"
21         // ppc64le/power9:"ANDCC",-CMPW",-"ISEL"
22         b := x&1 != 0
23         return c && b
24 }
25
26 func convertNeq0L(x uint32, c bool) bool {
27         // amd64:"ANDL\t[$]1",-"SETB"
28         // ppc64x:"ANDCC",-"CMPW",-"ISEL"
29         b := x&1 != 0
30         return c && b
31 }
32
33 func convertNeq0Q(x uint64, c bool) bool {
34         // amd64:"ANDL\t[$]1",-"SETB"
35         // ppc64x:"ANDCC",-"CMP",-"ISEL"
36         b := x&1 != 0
37         return c && b
38 }
39
40 func convertNeqBool32(x uint32) bool {
41         // ppc64x:"ANDCC",-"CMPW",-"ISEL"
42         return x&1 != 0
43 }
44
45 func convertEqBool32(x uint32) bool {
46         // ppc64x:"ANDCC",-"CMPW","XOR",-"ISEL"
47         // ppc64le/power9:"ANDCC","XOR",-"CMPW",-"ISEL"
48         return x&1 == 0
49 }
50
51 func convertNeqBool64(x uint64) bool {
52         // ppc64x:"ANDCC",-"CMP",-"ISEL"
53         return x&1 != 0
54 }
55
56 func convertEqBool64(x uint64) bool {
57         // ppc64x:"ANDCC","XOR",-"CMP",-"ISEL"
58         return x&1 == 0
59 }