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.
9 // This file contains codegen tests related to boolean simplifications/optimizations.
11 func convertNeq0B(x uint8, c bool) bool {
12 // amd64:"ANDL\t[$]1",-"SETNE"
13 // ppc64x:"ANDCC",-"CMPW",-"ISEL"
18 func convertNeq0W(x uint16, c bool) bool {
19 // amd64:"ANDL\t[$]1",-"SETNE"
20 // ppc64x:"ANDCC",-"CMPW",-"ISEL"
25 func convertNeq0L(x uint32, c bool) bool {
26 // amd64:"ANDL\t[$]1",-"SETB"
27 // ppc64x:"ANDCC",-"CMPW",-"ISEL"
32 func convertNeq0Q(x uint64, c bool) bool {
33 // amd64:"ANDL\t[$]1",-"SETB"
34 // ppc64x:"ANDCC",-"CMP",-"ISEL"
39 func convertNeqBool32(x uint32) bool {
40 // ppc64x:"ANDCC",-"CMPW",-"ISEL"
44 func convertEqBool32(x uint32) bool {
45 // ppc64x:"ANDCC",-"CMPW","XOR",-"ISEL"
49 func convertNeqBool64(x uint64) bool {
50 // ppc64x:"ANDCC",-"CMP",-"ISEL"
54 func convertEqBool64(x uint64) bool {
55 // ppc64x:"ANDCC","XOR",-"CMP",-"ISEL"
59 func TestSetEq64(x uint64, y uint64) bool {
60 // ppc64x/power10:"SETBC\tCR0EQ",-"ISEL"
61 // ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0EQ"
62 // ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0EQ"
66 func TestSetNeq64(x uint64, y uint64) bool {
67 // ppc64x/power10:"SETBCR\tCR0EQ",-"ISEL"
68 // ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0EQ"
69 // ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0EQ"
73 func TestSetLt64(x uint64, y uint64) bool {
74 // ppc64x/power10:"SETBC\tCR0GT",-"ISEL"
75 // ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0GT"
76 // ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0GT"
80 func TestSetLe64(x uint64, y uint64) bool {
81 // ppc64x/power10:"SETBCR\tCR0LT",-"ISEL"
82 // ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0LT"
83 // ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0LT"
87 func TestSetGt64(x uint64, y uint64) bool {
88 // ppc64x/power10:"SETBC\tCR0LT",-"ISEL"
89 // ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0LT"
90 // ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0LT"
94 func TestSetGe64(x uint64, y uint64) bool {
95 // ppc64x/power10:"SETBCR\tCR0GT",-"ISEL"
96 // ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0GT"
97 // ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0GT"
101 func TestSetLtFp64(x float64, y float64) bool {
102 // ppc64x/power10:"SETBC\tCR0LT",-"ISEL"
103 // ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT"
104 // ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT"
108 func TestSetLeFp64(x float64, y float64) bool {
109 // ppc64x/power10:"SETBC\tCR0LT","SETBC\tCR0EQ","OR",-"ISEL",-"ISEL"
110 // ppc64x/power9:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR"
111 // ppc64x/power8:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR"
115 func TestSetGtFp64(x float64, y float64) bool {
116 // ppc64x/power10:"SETBC\tCR0LT",-"ISEL"
117 // ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT"
118 // ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT"
122 func TestSetGeFp64(x float64, y float64) bool {
123 // ppc64x/power10:"SETBC\tCR0LT","SETBC\tCR0EQ","OR",-"ISEL",-"ISEL"
124 // ppc64x/power9:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR"
125 // ppc64x/power8:"ISEL","ISEL",-"SETBC\tCR0LT",-"SETBC\tCR0EQ","OR"
129 func TestSetInvEq64(x uint64, y uint64) bool {
130 // ppc64x/power10:"SETBCR\tCR0EQ",-"ISEL"
131 // ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0EQ"
132 // ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0EQ"
136 func TestSetInvNeq64(x uint64, y uint64) bool {
137 // ppc64x/power10:"SETBC\tCR0EQ",-"ISEL"
138 // ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0EQ"
139 // ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0EQ"
143 func TestSetInvLt64(x uint64, y uint64) bool {
144 // ppc64x/power10:"SETBCR\tCR0GT",-"ISEL"
145 // ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0GT"
146 // ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0GT"
150 func TestSetInvLe64(x uint64, y uint64) bool {
151 // ppc64x/power10:"SETBC\tCR0LT",-"ISEL"
152 // ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0LT"
153 // ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0LT"
157 func TestSetInvGt64(x uint64, y uint64) bool {
158 // ppc64x/power10:"SETBCR\tCR0LT",-"ISEL"
159 // ppc64x/power9:"CMP","ISEL",-"SETBCR\tCR0LT"
160 // ppc64x/power8:"CMP","ISEL",-"SETBCR\tCR0LT"
164 func TestSetInvGe64(x uint64, y uint64) bool {
165 // ppc64x/power10:"SETBC\tCR0GT",-"ISEL"
166 // ppc64x/power9:"CMP","ISEL",-"SETBC\tCR0GT"
167 // ppc64x/power8:"CMP","ISEL",-"SETBC\tCR0GT"
172 func TestSetInvEqFp64(x float64, y float64) bool {
173 // ppc64x/power10:"SETBCR\tCR0EQ",-"ISEL"
174 // ppc64x/power9:"FCMP","ISEL",-"SETBCR\tCR0EQ"
175 // ppc64x/power8:"FCMP","ISEL",-"SETBCR\tCR0EQ"
179 func TestSetInvNeqFp64(x float64, y float64) bool {
180 // ppc64x/power10:"SETBC\tCR0EQ",-"ISEL"
181 // ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0EQ"
182 // ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0EQ"
186 func TestSetInvLtFp64(x float64, y float64) bool {
187 // ppc64x/power10:"SETBCR\tCR0LT",-"ISEL"
188 // ppc64x/power9:"FCMP","ISEL",-"SETBCR\tCR0LT"
189 // ppc64x/power8:"FCMP","ISEL",-"SETBCR\tCR0LT"
193 func TestSetInvLeFp64(x float64, y float64) bool {
194 // ppc64x/power10:"SETBC\tCR0LT",-"ISEL"
195 // ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT"
196 // ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT"
200 func TestSetInvGtFp64(x float64, y float64) bool {
201 // ppc64x/power10:"SETBCR\tCR0LT",-"ISEL"
202 // ppc64x/power9:"FCMP","ISEL",-"SETBCR\tCR0LT"
203 // ppc64x/power8:"FCMP","ISEL",-"SETBCR\tCR0LT"
207 func TestSetInvGeFp64(x float64, y float64) bool {
208 // ppc64x/power10:"SETBC\tCR0LT",-"ISEL"
209 // ppc64x/power9:"FCMP","ISEL",-"SETBC\tCR0LT"
210 // ppc64x/power8:"FCMP","ISEL",-"SETBC\tCR0LT"