Commit 93a0b0f3 authored by Todd Neal's avatar Todd Neal

[dev.ssa] cmd/compile: rewrites for constant shifts

Add rewrite rules to optimize constant shifts.

Fixes #10637

Change-Id: I74b724d3e81aeb7098c696d02c050f7fdfd5b523
Reviewed-on: https://go-review.googlesource.com/19106Reviewed-by: default avatarKeith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 606a11f4
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,6 +8,102 @@
package main
import "fmt"
// testArithRshConst ensures that "const >> const" right shifts correctly perform
// sign extension on the lhs constant
func testArithRshConst() {
wantu := uint64(0x4000000000000000)
if got := arithRshuConst_ssa(); got != wantu {
println("arithRshuConst failed, wanted", wantu, "got", got)
failed = true
}
wants := int64(-0x4000000000000000)
if got := arithRshConst_ssa(); got != wants {
println("arithRshuConst failed, wanted", wants, "got", got)
failed = true
}
}
//go:noinline
func arithRshuConst_ssa() uint64 {
y := uint64(0x8000000000000001)
z := uint64(1)
return uint64(y >> z)
}
//go:noinline
func arithRshConst_ssa() int64 {
y := int64(-0x8000000000000000)
z := uint64(1)
return int64(y >> z)
}
//go:noinline
func arithConstShift_ssa(x int64) int64 {
return x >> 100
}
// testArithConstShift tests that right shift by large constants preserve
// the sign of the input.
func testArithConstShift() {
want := int64(-1)
if got := arithConstShift_ssa(-1); want != got {
println("arithConstShift_ssa(-1) failed, wanted", want, "got", got)
failed = true
}
want = 0
if got := arithConstShift_ssa(1); want != got {
println("arithConstShift_ssa(1) failed, wanted", want, "got", got)
failed = true
}
}
// overflowConstShift_ssa verifes that constant folding for shift
// doesn't wrap (i.e. x << MAX_INT << 1 doesn't get folded to x << 0).
//go:noinline
func overflowConstShift64_ssa(x int64) int64 {
return x << uint64(0xffffffffffffffff) << uint64(1)
}
//go:noinline
func overflowConstShift32_ssa(x int64) int32 {
return int32(x) << uint32(0xffffffff) << uint32(1)
}
//go:noinline
func overflowConstShift16_ssa(x int64) int16 {
return int16(x) << uint16(0xffff) << uint16(1)
}
//go:noinline
func overflowConstShift8_ssa(x int64) int8 {
return int8(x) << uint8(0xff) << uint8(1)
}
func testOverflowConstShift() {
want := int64(0)
for x := int64(-127); x < int64(127); x++ {
got := overflowConstShift64_ssa(x)
if want != got {
fmt.Printf("overflowShift64 failed, wanted %d got %d\n", want, got)
}
got = int64(overflowConstShift32_ssa(x))
if want != got {
fmt.Printf("overflowShift32 failed, wanted %d got %d\n", want, got)
}
got = int64(overflowConstShift16_ssa(x))
if want != got {
fmt.Printf("overflowShift16 failed, wanted %d got %d\n", want, got)
}
got = int64(overflowConstShift8_ssa(x))
if want != got {
fmt.Printf("overflowShift8 failed, wanted %d got %d\n", want, got)
}
}
}
// test64BitConstMult tests that rewrite rules don't fold 64 bit constants
// into multiply instructions.
func test64BitConstMult() {
......@@ -275,6 +371,9 @@ func main() {
testLrot()
testShiftCX()
testSubConst()
testOverflowConstShift()
testArithConstShift()
testArithRshConst()
if failed {
panic("failed")
......
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This program generates a test to verify that the standard arithmetic
// operators properly handle const cases. The test file should be
// generated with a known working version of go.
// launch with `go run arithConstGen.go` a file called arithConst_ssa.go
// will be written into the parent directory containing the tests
package main
import (
"bytes"
"fmt"
"go/format"
"io/ioutil"
"log"
"strings"
"text/template"
)
type op struct {
name, symbol string
}
type szD struct {
name string
sn string
u []uint64
i []int64
}
var szs []szD = []szD{
szD{name: "uint64", sn: "64", u: []uint64{0, 1, 4294967296, 0xffffFFFFffffFFFF}},
szD{name: "int64", sn: "64", i: []int64{-0x8000000000000000, -0x7FFFFFFFFFFFFFFF,
-4294967296, -1, 0, 1, 4294967296, 0x7FFFFFFFFFFFFFFE, 0x7FFFFFFFFFFFFFFF}},
szD{name: "uint32", sn: "32", u: []uint64{0, 1, 4294967295}},
szD{name: "int32", sn: "32", i: []int64{-0x80000000, -0x7FFFFFFF, -1, 0,
1, 0x7FFFFFFF}},
szD{name: "uint16", sn: "16", u: []uint64{0, 1, 65535}},
szD{name: "int16", sn: "16", i: []int64{-32768, -32767, -1, 0, 1, 32766, 32767}},
szD{name: "uint8", sn: "8", u: []uint64{0, 1, 255}},
szD{name: "int8", sn: "8", i: []int64{-128, -127, -1, 0, 1, 126, 127}},
}
var ops []op = []op{op{"add", "+"}, op{"sub", "-"}, op{"div", "/"}, op{"mul", "*"},
op{"lsh", "<<"}, op{"rsh", ">>"}}
// compute the result of i op j, cast as type t.
func ansU(i, j uint64, t, op string) string {
var ans uint64
switch op {
case "+":
ans = i + j
case "-":
ans = i - j
case "*":
ans = i * j
case "/":
if j != 0 {
ans = i / j
}
case "<<":
ans = i << j
case ">>":
ans = i >> j
}
switch t {
case "uint32":
ans = uint64(uint32(ans))
case "uint16":
ans = uint64(uint16(ans))
case "uint8":
ans = uint64(uint8(ans))
}
return fmt.Sprintf("%d", ans)
}
// compute the result of i op j, cast as type t.
func ansS(i, j int64, t, op string) string {
var ans int64
switch op {
case "+":
ans = i + j
case "-":
ans = i - j
case "*":
ans = i * j
case "/":
if j != 0 {
ans = i / j
}
case "<<":
ans = i << uint64(j)
case ">>":
ans = i >> uint64(j)
}
switch t {
case "int32":
ans = int64(int32(ans))
case "int16":
ans = int64(int16(ans))
case "int8":
ans = int64(int8(ans))
}
return fmt.Sprintf("%d", ans)
}
func main() {
w := new(bytes.Buffer)
fmt.Fprintf(w, "package main;\n")
fmt.Fprintf(w, "import \"fmt\"\n")
fncCnst1, err := template.New("fnc").Parse(
`//go:noinline
func {{.Name}}_{{.Type_}}_{{.FNumber}}_ssa(a {{.Type_}}) {{.Type_}} {
return a {{.Symbol}} {{.Number}}
}
`)
if err != nil {
panic(err)
}
fncCnst2, err := template.New("fnc").Parse(
`//go:noinline
func {{.Name}}_{{.FNumber}}_{{.Type_}}_ssa(a {{.Type_}}) {{.Type_}} {
return {{.Number}} {{.Symbol}} a
}
`)
if err != nil {
panic(err)
}
type fncData struct {
Name, Type_, Symbol, FNumber, Number string
}
for _, s := range szs {
for _, o := range ops {
fd := fncData{o.name, s.name, o.symbol, "", ""}
// unsigned test cases
if len(s.u) > 0 {
for _, i := range s.u {
fd.Number = fmt.Sprintf("%d", i)
fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1)
// avoid division by zero
if o.name != "div" || i != 0 {
fncCnst1.Execute(w, fd)
}
fncCnst2.Execute(w, fd)
}
}
// signed test cases
if len(s.i) > 0 {
// don't generate tests for shifts by signed integers
if o.name == "lsh" || o.name == "rsh" {
continue
}
for _, i := range s.i {
fd.Number = fmt.Sprintf("%d", i)
fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1)
// avoid division by zero
if o.name != "div" || i != 0 {
fncCnst1.Execute(w, fd)
}
fncCnst2.Execute(w, fd)
}
}
}
}
fmt.Fprintf(w, "var failed bool\n\n")
fmt.Fprintf(w, "func main() {\n\n")
vrf1, _ := template.New("vrf1").Parse(`
if got := {{.Name}}_{{.FNumber}}_{{.Type_}}_ssa({{.Input}}); got != {{.Ans}} {
fmt.Printf("{{.Name}}_{{.Type_}} {{.Number}}{{.Symbol}}{{.Input}} = %d, wanted {{.Ans}}\n",got)
failed = true
}
`)
vrf2, _ := template.New("vrf2").Parse(`
if got := {{.Name}}_{{.Type_}}_{{.FNumber}}_ssa({{.Input}}); got != {{.Ans}} {
fmt.Printf("{{.Name}}_{{.Type_}} {{.Input}}{{.Symbol}}{{.Number}} = %d, wanted {{.Ans}}\n",got)
failed = true
}
`)
type cfncData struct {
Name, Type_, Symbol, FNumber, Number string
Ans, Input string
}
for _, s := range szs {
if len(s.u) > 0 {
for _, o := range ops {
fd := cfncData{o.name, s.name, o.symbol, "", "", "", ""}
for _, i := range s.u {
fd.Number = fmt.Sprintf("%d", i)
fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1)
// unsigned
for _, j := range s.u {
if o.name != "div" || j != 0 {
fd.Ans = ansU(i, j, s.name, o.symbol)
fd.Input = fmt.Sprintf("%d", j)
err = vrf1.Execute(w, fd)
if err != nil {
panic(err)
}
}
if o.name != "div" || i != 0 {
fd.Ans = ansU(j, i, s.name, o.symbol)
fd.Input = fmt.Sprintf("%d", j)
err = vrf2.Execute(w, fd)
if err != nil {
panic(err)
}
}
}
}
}
}
// signed
if len(s.i) > 0 {
for _, o := range ops {
// don't generate tests for shifts by signed integers
if o.name == "lsh" || o.name == "rsh" {
continue
}
fd := cfncData{o.name, s.name, o.symbol, "", "", "", ""}
for _, i := range s.i {
fd.Number = fmt.Sprintf("%d", i)
fd.FNumber = strings.Replace(fd.Number, "-", "Neg", -1)
for _, j := range s.i {
if o.name != "div" || j != 0 {
fd.Ans = ansS(i, j, s.name, o.symbol)
fd.Input = fmt.Sprintf("%d", j)
err = vrf1.Execute(w, fd)
if err != nil {
panic(err)
}
}
if o.name != "div" || i != 0 {
fd.Ans = ansS(j, i, s.name, o.symbol)
fd.Input = fmt.Sprintf("%d", j)
err = vrf2.Execute(w, fd)
if err != nil {
panic(err)
}
}
}
}
}
}
}
fmt.Fprintf(w, `if failed {
panic("tests failed")
}
`)
fmt.Fprintf(w, "}\n")
// gofmt result
b := w.Bytes()
src, err := format.Source(b)
if err != nil {
fmt.Printf("%s\n", b)
panic(err)
}
// write to file
err = ioutil.WriteFile("../arithConst_ssa.go", src, 0666)
if err != nil {
log.Fatalf("can't write output: %v\n", err)
}
}
......@@ -35,6 +35,19 @@
(Mul32 (Const32 [c]) (Const32 [d])) -> (Const32 [c*d])
(Mul64 (Const64 [c]) (Const64 [d])) -> (Const64 [c*d])
(Lsh64x64 (Const64 [c]) (Const64 [d])) -> (Const64 [c << uint64(d)])
(Rsh64x64 (Const64 [c]) (Const64 [d])) -> (Const64 [c >> uint64(d)])
(Rsh64Ux64 (Const64 [c]) (Const64 [d])) -> (Const64 [int64(uint64(c) >> uint64(d))])
(Lsh32x64 (Const32 [c]) (Const64 [d])) -> (Const32 [int64(int32(c) << uint64(d))])
(Rsh32x64 (Const32 [c]) (Const64 [d])) -> (Const32 [int64(int32(c) >> uint64(d))])
(Rsh32Ux64 (Const32 [c]) (Const64 [d])) -> (Const32 [int64(uint32(c) >> uint64(d))])
(Lsh16x64 (Const16 [c]) (Const64 [d])) -> (Const16 [int64(int16(c) << uint64(d))])
(Rsh16x64 (Const16 [c]) (Const64 [d])) -> (Const16 [int64(int16(c) >> uint64(d))])
(Rsh16Ux64 (Const16 [c]) (Const64 [d])) -> (Const16 [int64(uint16(c) >> uint64(d))])
(Lsh8x64 (Const8 [c]) (Const64 [d])) -> (Const8 [int64(int8(c) << uint64(d))])
(Rsh8x64 (Const8 [c]) (Const64 [d])) -> (Const8 [int64(int8(c) >> uint64(d))])
(Rsh8Ux64 (Const8 [c]) (Const64 [d])) -> (Const8 [int64(uint8(c) >> uint64(d))])
(IsInBounds (Const32 [c]) (Const32 [d])) -> (ConstBool [b2i(inBounds32(c,d))])
(IsInBounds (Const64 [c]) (Const64 [d])) -> (ConstBool [b2i(inBounds64(c,d))])
(IsSliceInBounds (Const32 [c]) (Const32 [d])) -> (ConstBool [b2i(sliceInBounds32(c,d))])
......@@ -79,6 +92,89 @@
(Sub16 x (Const16 <t> [c])) && x.Op != OpConst16 -> (Add16 (Const16 <t> [-c]) x)
(Sub8 x (Const8 <t> [c])) && x.Op != OpConst8 -> (Add8 (Const8 <t> [-c]) x)
// rewrite shifts of 8/16/32 bit consts into 64 bit consts to reduce
// the number of the other rewrite rules for const shifts
(Lsh64x32 <t> x (Const32 [c])) -> (Lsh64x64 x (Const64 <t> [int64(uint32(c))]))
(Lsh64x16 <t> x (Const16 [c])) -> (Lsh64x64 x (Const64 <t> [int64(uint16(c))]))
(Lsh64x8 <t> x (Const8 [c])) -> (Lsh64x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh64x32 <t> x (Const32 [c])) -> (Rsh64x64 x (Const64 <t> [int64(uint32(c))]))
(Rsh64x16 <t> x (Const16 [c])) -> (Rsh64x64 x (Const64 <t> [int64(uint16(c))]))
(Rsh64x8 <t> x (Const8 [c])) -> (Rsh64x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh64Ux32 <t> x (Const32 [c])) -> (Rsh64Ux64 x (Const64 <t> [int64(uint32(c))]))
(Rsh64Ux16 <t> x (Const16 [c])) -> (Rsh64Ux64 x (Const64 <t> [int64(uint16(c))]))
(Rsh64Ux8 <t> x (Const8 [c])) -> (Rsh64Ux64 x (Const64 <t> [int64(uint8(c))]))
(Lsh32x32 <t> x (Const32 [c])) -> (Lsh32x64 x (Const64 <t> [int64(uint32(c))]))
(Lsh32x16 <t> x (Const16 [c])) -> (Lsh32x64 x (Const64 <t> [int64(uint16(c))]))
(Lsh32x8 <t> x (Const8 [c])) -> (Lsh32x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh32x32 <t> x (Const32 [c])) -> (Rsh32x64 x (Const64 <t> [int64(uint32(c))]))
(Rsh32x16 <t> x (Const16 [c])) -> (Rsh32x64 x (Const64 <t> [int64(uint16(c))]))
(Rsh32x8 <t> x (Const8 [c])) -> (Rsh32x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh32Ux32 <t> x (Const32 [c])) -> (Rsh32Ux64 x (Const64 <t> [int64(uint32(c))]))
(Rsh32Ux16 <t> x (Const16 [c])) -> (Rsh32Ux64 x (Const64 <t> [int64(uint16(c))]))
(Rsh32Ux8 <t> x (Const8 [c])) -> (Rsh32Ux64 x (Const64 <t> [int64(uint8(c))]))
(Lsh16x32 <t> x (Const32 [c])) -> (Lsh16x64 x (Const64 <t> [int64(uint32(c))]))
(Lsh16x16 <t> x (Const16 [c])) -> (Lsh16x64 x (Const64 <t> [int64(uint16(c))]))
(Lsh16x8 <t> x (Const8 [c])) -> (Lsh16x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh16x32 <t> x (Const32 [c])) -> (Rsh16x64 x (Const64 <t> [int64(uint32(c))]))
(Rsh16x16 <t> x (Const16 [c])) -> (Rsh16x64 x (Const64 <t> [int64(uint16(c))]))
(Rsh16x8 <t> x (Const8 [c])) -> (Rsh16x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh16Ux32 <t> x (Const32 [c])) -> (Rsh16Ux64 x (Const64 <t> [int64(uint32(c))]))
(Rsh16Ux16 <t> x (Const16 [c])) -> (Rsh16Ux64 x (Const64 <t> [int64(uint16(c))]))
(Rsh16Ux8 <t> x (Const8 [c])) -> (Rsh16Ux64 x (Const64 <t> [int64(uint8(c))]))
(Lsh8x32 <t> x (Const32 [c])) -> (Lsh8x64 x (Const64 <t> [int64(uint32(c))]))
(Lsh8x16 <t> x (Const16 [c])) -> (Lsh8x64 x (Const64 <t> [int64(uint16(c))]))
(Lsh8x8 <t> x (Const8 [c])) -> (Lsh8x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh8x32 <t> x (Const32 [c])) -> (Rsh8x64 x (Const64 <t> [int64(uint32(c))]))
(Rsh8x16 <t> x (Const16 [c])) -> (Rsh8x64 x (Const64 <t> [int64(uint16(c))]))
(Rsh8x8 <t> x (Const8 [c])) -> (Rsh8x64 x (Const64 <t> [int64(uint8(c))]))
(Rsh8Ux32 <t> x (Const32 [c])) -> (Rsh8Ux64 x (Const64 <t> [int64(uint32(c))]))
(Rsh8Ux16 <t> x (Const16 [c])) -> (Rsh8Ux64 x (Const64 <t> [int64(uint16(c))]))
(Rsh8Ux8 <t> x (Const8 [c])) -> (Rsh8Ux64 x (Const64 <t> [int64(uint8(c))]))
// shifts by zero
(Lsh64x64 x (Const64 [0])) -> x
(Rsh64x64 x (Const64 [0])) -> x
(Rsh64Ux64 x (Const64 [0])) -> x
(Lsh32x64 x (Const64 [0])) -> x
(Rsh32x64 x (Const64 [0])) -> x
(Rsh32Ux64 x (Const64 [0])) -> x
(Lsh16x64 x (Const64 [0])) -> x
(Rsh16x64 x (Const64 [0])) -> x
(Rsh16Ux64 x (Const64 [0])) -> x
(Lsh8x64 x (Const64 [0])) -> x
(Rsh8x64 x (Const64 [0])) -> x
(Rsh8Ux64 x (Const64 [0])) -> x
// large left shifts of all values, and right shifts of unsigned values
(Lsh64x64 _ (Const64 [c])) && uint64(c) >= 64 -> (Const64 [0])
(Rsh64Ux64 _ (Const64 [c])) && uint64(c) >= 64 -> (Const64 [0])
(Lsh32x64 _ (Const64 [c])) && uint64(c) >= 32 -> (Const64 [0])
(Rsh32Ux64 _ (Const64 [c])) && uint64(c) >= 32 -> (Const64 [0])
(Lsh16x64 _ (Const64 [c])) && uint64(c) >= 16 -> (Const64 [0])
(Rsh16Ux64 _ (Const64 [c])) && uint64(c) >= 16 -> (Const64 [0])
(Lsh8x64 _ (Const64 [c])) && uint64(c) >= 8 -> (Const64 [0])
(Rsh8Ux64 _ (Const64 [c])) && uint64(c) >= 8 -> (Const64 [0])
// combine const shifts
(Lsh64x64 <t> (Lsh64x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Lsh64x64 x (Const64 <t> [c+d]))
(Lsh32x64 <t> (Lsh32x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Lsh32x64 x (Const64 <t> [c+d]))
(Lsh16x64 <t> (Lsh16x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Lsh16x64 x (Const64 <t> [c+d]))
(Lsh8x64 <t> (Lsh8x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Lsh8x64 x (Const64 <t> [c+d]))
(Rsh64x64 <t> (Rsh64x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh64x64 x (Const64 <t> [c+d]))
(Rsh32x64 <t> (Rsh32x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh32x64 x (Const64 <t> [c+d]))
(Rsh16x64 <t> (Rsh16x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh16x64 x (Const64 <t> [c+d]))
(Rsh8x64 <t> (Rsh8x64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh8x64 x (Const64 <t> [c+d]))
(Rsh64Ux64 <t> (Rsh64Ux64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh64Ux64 x (Const64 <t> [c+d]))
(Rsh32Ux64 <t> (Rsh32Ux64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh32Ux64 x (Const64 <t> [c+d]))
(Rsh16Ux64 <t> (Rsh16Ux64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh16Ux64 x (Const64 <t> [c+d]))
(Rsh8Ux64 <t> (Rsh8Ux64 x (Const64 [c])) (Const64 [d])) && !uaddOvf(c,d) -> (Rsh8Ux64 x (Const64 <t> [c+d]))
// constant comparisons
(Eq64 (Const64 [c]) (Const64 [d])) -> (ConstBool [b2i(int64(c) == int64(d))])
(Eq32 (Const32 [c]) (Const32 [d])) -> (ConstBool [b2i(int32(c) == int32(d))])
......
......@@ -181,6 +181,11 @@ func f2i(f float64) int64 {
return int64(math.Float64bits(f))
}
// uaddOvf returns true if unsigned a+b would overflow.
func uaddOvf(a, b int64) bool {
return uint64(a)+uint64(b) < uint64(a)
}
// DUFFZERO consists of repeated blocks of 4 MOVUPSs + ADD,
// See runtime/mkduff.go.
const (
......
......@@ -135,6 +135,38 @@ func rewriteValuegeneric(v *Value, config *Config) bool {
return rewriteValuegeneric_OpLess8U(v, config)
case OpLoad:
return rewriteValuegeneric_OpLoad(v, config)
case OpLsh16x16:
return rewriteValuegeneric_OpLsh16x16(v, config)
case OpLsh16x32:
return rewriteValuegeneric_OpLsh16x32(v, config)
case OpLsh16x64:
return rewriteValuegeneric_OpLsh16x64(v, config)
case OpLsh16x8:
return rewriteValuegeneric_OpLsh16x8(v, config)
case OpLsh32x16:
return rewriteValuegeneric_OpLsh32x16(v, config)
case OpLsh32x32:
return rewriteValuegeneric_OpLsh32x32(v, config)
case OpLsh32x64:
return rewriteValuegeneric_OpLsh32x64(v, config)
case OpLsh32x8:
return rewriteValuegeneric_OpLsh32x8(v, config)
case OpLsh64x16:
return rewriteValuegeneric_OpLsh64x16(v, config)
case OpLsh64x32:
return rewriteValuegeneric_OpLsh64x32(v, config)
case OpLsh64x64:
return rewriteValuegeneric_OpLsh64x64(v, config)
case OpLsh64x8:
return rewriteValuegeneric_OpLsh64x8(v, config)
case OpLsh8x16:
return rewriteValuegeneric_OpLsh8x16(v, config)
case OpLsh8x32:
return rewriteValuegeneric_OpLsh8x32(v, config)
case OpLsh8x64:
return rewriteValuegeneric_OpLsh8x64(v, config)
case OpLsh8x8:
return rewriteValuegeneric_OpLsh8x8(v, config)
case OpMul16:
return rewriteValuegeneric_OpMul16(v, config)
case OpMul32:
......@@ -167,6 +199,70 @@ func rewriteValuegeneric(v *Value, config *Config) bool {
return rewriteValuegeneric_OpOr8(v, config)
case OpPtrIndex:
return rewriteValuegeneric_OpPtrIndex(v, config)
case OpRsh16Ux16:
return rewriteValuegeneric_OpRsh16Ux16(v, config)
case OpRsh16Ux32:
return rewriteValuegeneric_OpRsh16Ux32(v, config)
case OpRsh16Ux64:
return rewriteValuegeneric_OpRsh16Ux64(v, config)
case OpRsh16Ux8:
return rewriteValuegeneric_OpRsh16Ux8(v, config)
case OpRsh16x16:
return rewriteValuegeneric_OpRsh16x16(v, config)
case OpRsh16x32:
return rewriteValuegeneric_OpRsh16x32(v, config)
case OpRsh16x64:
return rewriteValuegeneric_OpRsh16x64(v, config)
case OpRsh16x8:
return rewriteValuegeneric_OpRsh16x8(v, config)
case OpRsh32Ux16:
return rewriteValuegeneric_OpRsh32Ux16(v, config)
case OpRsh32Ux32:
return rewriteValuegeneric_OpRsh32Ux32(v, config)
case OpRsh32Ux64:
return rewriteValuegeneric_OpRsh32Ux64(v, config)
case OpRsh32Ux8:
return rewriteValuegeneric_OpRsh32Ux8(v, config)
case OpRsh32x16:
return rewriteValuegeneric_OpRsh32x16(v, config)
case OpRsh32x32:
return rewriteValuegeneric_OpRsh32x32(v, config)
case OpRsh32x64:
return rewriteValuegeneric_OpRsh32x64(v, config)
case OpRsh32x8:
return rewriteValuegeneric_OpRsh32x8(v, config)
case OpRsh64Ux16:
return rewriteValuegeneric_OpRsh64Ux16(v, config)
case OpRsh64Ux32:
return rewriteValuegeneric_OpRsh64Ux32(v, config)
case OpRsh64Ux64:
return rewriteValuegeneric_OpRsh64Ux64(v, config)
case OpRsh64Ux8:
return rewriteValuegeneric_OpRsh64Ux8(v, config)
case OpRsh64x16:
return rewriteValuegeneric_OpRsh64x16(v, config)
case OpRsh64x32:
return rewriteValuegeneric_OpRsh64x32(v, config)
case OpRsh64x64:
return rewriteValuegeneric_OpRsh64x64(v, config)
case OpRsh64x8:
return rewriteValuegeneric_OpRsh64x8(v, config)
case OpRsh8Ux16:
return rewriteValuegeneric_OpRsh8Ux16(v, config)
case OpRsh8Ux32:
return rewriteValuegeneric_OpRsh8Ux32(v, config)
case OpRsh8Ux64:
return rewriteValuegeneric_OpRsh8Ux64(v, config)
case OpRsh8Ux8:
return rewriteValuegeneric_OpRsh8Ux8(v, config)
case OpRsh8x16:
return rewriteValuegeneric_OpRsh8x16(v, config)
case OpRsh8x32:
return rewriteValuegeneric_OpRsh8x32(v, config)
case OpRsh8x64:
return rewriteValuegeneric_OpRsh8x64(v, config)
case OpRsh8x8:
return rewriteValuegeneric_OpRsh8x8(v, config)
case OpSliceCap:
return rewriteValuegeneric_OpSliceCap(v, config)
case OpSliceLen:
......@@ -242,8 +338,7 @@ end359c546ef662b7990116329cb30d6892:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst16, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -296,8 +391,7 @@ enda3edaa9a512bd1d7a95f002c890bfb88:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst32, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -350,8 +444,7 @@ end8c46df6f85a11cb1d594076b0e467908:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -404,8 +497,7 @@ end60c66721511a442aade8e4da2fb326bd:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst8, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -1234,8 +1326,7 @@ end0c0fe5fdfba3821add3448fd3f1fc6b7:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst16, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
......@@ -1261,8 +1352,7 @@ end79c830afa265161fc0f0532c4c4e7f50:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst16, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -1340,8 +1430,7 @@ end6da547ec4ee93d787434f3bda873e4a0:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst32, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
......@@ -1367,8 +1456,7 @@ end1a69730a32c6e432784dcdf643320ecd:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst32, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -1446,8 +1534,7 @@ endb1d471cc503ba8bb05440f01dbf33d81:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
......@@ -1473,8 +1560,7 @@ endffd67f3b83f6972cd459153d318f714d:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -1552,8 +1638,7 @@ enda66da0d3e7e51624ee46527727c48a9a:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst8, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
......@@ -1579,8 +1664,7 @@ end6912961350bb485f56ef176522aa683b:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst8, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
......@@ -3033,713 +3117,2861 @@ end12671c83ebe3ccbc8e53383765ee7675:
;
return false
}
func rewriteValuegeneric_OpMul16(v *Value, config *Config) bool {
func rewriteValuegeneric_OpLsh16x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul16 (Const16 [c]) (Const16 [d]))
// match: (Lsh16x16 <t> x (Const16 [c]))
// cond:
// result: (Const16 [c*d])
// result: (Lsh16x64 x (Const64 <t> [int64(uint16(c))]))
{
if v.Args[0].Op != OpConst16 {
goto ende8dd468add3015aea24531cf3c89ccb7
}
c := v.Args[0].AuxInt
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto ende8dd468add3015aea24531cf3c89ccb7
goto end2f5aa78b30ebd2471e8d03a307923b06
}
d := v.Args[1].AuxInt
v.Op = OpConst16
c := v.Args[1].AuxInt
v.Op = OpLsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto ende8dd468add3015aea24531cf3c89ccb7
ende8dd468add3015aea24531cf3c89ccb7:
goto end2f5aa78b30ebd2471e8d03a307923b06
end2f5aa78b30ebd2471e8d03a307923b06:
;
return false
}
func rewriteValuegeneric_OpMul32(v *Value, config *Config) bool {
func rewriteValuegeneric_OpLsh16x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul32 (Const32 [c]) (Const32 [d]))
// match: (Lsh16x32 <t> x (Const32 [c]))
// cond:
// result: (Const32 [c*d])
// result: (Lsh16x64 x (Const64 <t> [int64(uint32(c))]))
{
if v.Args[0].Op != OpConst32 {
goto end60b4523099fa7b55e2e872e05bd497a7
}
c := v.Args[0].AuxInt
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto end60b4523099fa7b55e2e872e05bd497a7
goto endedeb000c8c97090261a47f08a2ff17e4
}
d := v.Args[1].AuxInt
v.Op = OpConst32
c := v.Args[1].AuxInt
v.Op = OpLsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end60b4523099fa7b55e2e872e05bd497a7
end60b4523099fa7b55e2e872e05bd497a7:
goto endedeb000c8c97090261a47f08a2ff17e4
endedeb000c8c97090261a47f08a2ff17e4:
;
return false
}
func rewriteValuegeneric_OpMul64(v *Value, config *Config) bool {
func rewriteValuegeneric_OpLsh16x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul64 (Const64 [c]) (Const64 [d]))
// match: (Lsh16x64 (Const16 [c]) (Const64 [d]))
// cond:
// result: (Const64 [c*d])
// result: (Const16 [int64(int16(c) << uint64(d))])
{
if v.Args[0].Op != OpConst64 {
goto end7aea1048b5d1230974b97f17238380ae
if v.Args[0].Op != OpConst16 {
goto endc9f0d91f3da4bdd46a634a62549810e0
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto end7aea1048b5d1230974b97f17238380ae
goto endc9f0d91f3da4bdd46a634a62549810e0
}
d := v.Args[1].AuxInt
v.Op = OpConst64
v.Op = OpConst16
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
v.AuxInt = int64(int16(c) << uint64(d))
return true
}
goto end7aea1048b5d1230974b97f17238380ae
end7aea1048b5d1230974b97f17238380ae:
goto endc9f0d91f3da4bdd46a634a62549810e0
endc9f0d91f3da4bdd46a634a62549810e0:
;
return false
}
func rewriteValuegeneric_OpMul8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul8 (Const8 [c]) (Const8 [d]))
// match: (Lsh16x64 x (Const64 [0]))
// cond:
// result: (Const8 [c*d])
// result: x
{
if v.Args[0].Op != OpConst8 {
goto end2f1952fd654c4a62ff00511041728809
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end7ecc343739fab9b50a0bdff6e9d121e6
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst8 {
goto end2f1952fd654c4a62ff00511041728809
if v.Args[1].AuxInt != 0 {
goto end7ecc343739fab9b50a0bdff6e9d121e6
}
d := v.Args[1].AuxInt
v.Op = OpConst8
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
v.Type = x.Type
v.AddArg(x)
return true
}
goto end2f1952fd654c4a62ff00511041728809
end2f1952fd654c4a62ff00511041728809:
goto end7ecc343739fab9b50a0bdff6e9d121e6
end7ecc343739fab9b50a0bdff6e9d121e6:
;
return false
}
func rewriteValuegeneric_OpNeq16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq16 x x)
// cond:
// result: (ConstBool [0])
// match: (Lsh16x64 _ (Const64 [c]))
// cond: uint64(c) >= 16
// result: (Const64 [0])
{
x := v.Args[0]
if v.Args[1] != x {
goto ende76a50b524aeb16c7aeccf5f5cc60c06
if v.Args[1].Op != OpConst64 {
goto end1d2c74d359df9d89b16c4f658a231dfe
}
v.Op = OpConstBool
c := v.Args[1].AuxInt
if !(uint64(c) >= 16) {
goto end1d2c74d359df9d89b16c4f658a231dfe
}
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto ende76a50b524aeb16c7aeccf5f5cc60c06
ende76a50b524aeb16c7aeccf5f5cc60c06:
goto end1d2c74d359df9d89b16c4f658a231dfe
end1d2c74d359df9d89b16c4f658a231dfe:
;
// match: (Neq16 (Const16 <t> [c]) (Add16 (Const16 <t> [d]) x))
// cond:
// result: (Neq16 (Const16 <t> [c-d]) x)
// match: (Lsh16x64 <t> (Lsh16x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Lsh16x64 x (Const64 <t> [c+d]))
{
if v.Args[0].Op != OpConst16 {
goto end552011bd97e6f92ebc2672aa1843eadd
t := v.Type
if v.Args[0].Op != OpLsh16x64 {
goto end26a91e42735a02a30e94a998f54372dd
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd16 {
goto end552011bd97e6f92ebc2672aa1843eadd
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto end26a91e42735a02a30e94a998f54372dd
}
if v.Args[1].Args[0].Op != OpConst16 {
goto end552011bd97e6f92ebc2672aa1843eadd
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto end26a91e42735a02a30e94a998f54372dd
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto end552011bd97e6f92ebc2672aa1843eadd
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto end26a91e42735a02a30e94a998f54372dd
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq16
v.Op = OpLsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
v0.Type = t
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto end552011bd97e6f92ebc2672aa1843eadd
end552011bd97e6f92ebc2672aa1843eadd:
goto end26a91e42735a02a30e94a998f54372dd
end26a91e42735a02a30e94a998f54372dd:
;
// match: (Neq16 x (Const16 <t> [c]))
// cond: x.Op != OpConst16
// result: (Neq16 (Const16 <t> [c]) x)
return false
}
func rewriteValuegeneric_OpLsh16x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh16x8 <t> x (Const8 [c]))
// cond:
// result: (Lsh16x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end0e45958f29e87997f632248aa9ee97e0
if v.Args[1].Op != OpConst8 {
goto endce2401b8a6c6190fe81d77e2d562a10c
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst16) {
goto end0e45958f29e87997f632248aa9ee97e0
}
v.Op = OpNeq16
v.Op = OpLsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
v0.Type = t
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end0e45958f29e87997f632248aa9ee97e0
end0e45958f29e87997f632248aa9ee97e0:
goto endce2401b8a6c6190fe81d77e2d562a10c
endce2401b8a6c6190fe81d77e2d562a10c:
;
// match: (Neq16 (Const16 [c]) (Const16 [d]))
return false
}
func rewriteValuegeneric_OpLsh32x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh32x16 <t> x (Const16 [c]))
// cond:
// result: (ConstBool [b2i(int16(c) != int16(d))])
// result: (Lsh32x64 x (Const64 <t> [int64(uint16(c))]))
{
if v.Args[0].Op != OpConst16 {
goto end6302c9b645bb191982d28c2f846904d6
}
c := v.Args[0].AuxInt
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end6302c9b645bb191982d28c2f846904d6
goto end7205eb3e315971143ac5584d07045570
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
c := v.Args[1].AuxInt
v.Op = OpLsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int16(c) != int16(d))
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end6302c9b645bb191982d28c2f846904d6
end6302c9b645bb191982d28c2f846904d6:
goto end7205eb3e315971143ac5584d07045570
end7205eb3e315971143ac5584d07045570:
;
return false
}
func rewriteValuegeneric_OpNeq32(v *Value, config *Config) bool {
func rewriteValuegeneric_OpLsh32x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq32 x x)
// match: (Lsh32x32 <t> x (Const32 [c]))
// cond:
// result: (ConstBool [0])
// result: (Lsh32x64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1] != x {
goto end3713a608cffd29b40ff7c3b3f2585cbb
if v.Args[1].Op != OpConst32 {
goto endc1a330b287199c80228e665a53881298
}
v.Op = OpConstBool
c := v.Args[1].AuxInt
v.Op = OpLsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end3713a608cffd29b40ff7c3b3f2585cbb
end3713a608cffd29b40ff7c3b3f2585cbb:
goto endc1a330b287199c80228e665a53881298
endc1a330b287199c80228e665a53881298:
;
// match: (Neq32 (Const32 <t> [c]) (Add32 (Const32 <t> [d]) x))
return false
}
func rewriteValuegeneric_OpLsh32x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh32x64 (Const32 [c]) (Const64 [d]))
// cond:
// result: (Neq32 (Const32 <t> [c-d]) x)
// result: (Const32 [int64(int32(c) << uint64(d))])
{
if v.Args[0].Op != OpConst32 {
goto end93fc3b4a3639b965b414891111b16245
goto end5896bd9a3fe78f1e1712563642d33254
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd32 {
goto end93fc3b4a3639b965b414891111b16245
if v.Args[1].Op != OpConst64 {
goto end5896bd9a3fe78f1e1712563642d33254
}
if v.Args[1].Args[0].Op != OpConst32 {
goto end93fc3b4a3639b965b414891111b16245
d := v.Args[1].AuxInt
v.Op = OpConst32
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = int64(int32(c) << uint64(d))
return true
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto end93fc3b4a3639b965b414891111b16245
goto end5896bd9a3fe78f1e1712563642d33254
end5896bd9a3fe78f1e1712563642d33254:
;
// match: (Lsh32x64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto endd9ce9639a91b11e601823be3d4d6c209
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq32
if v.Args[1].AuxInt != 0 {
goto endd9ce9639a91b11e601823be3d4d6c209
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
v0.Type = t
v0.AuxInt = c - d
v.AddArg(v0)
v.Type = x.Type
v.AddArg(x)
return true
}
goto end93fc3b4a3639b965b414891111b16245
end93fc3b4a3639b965b414891111b16245:
goto endd9ce9639a91b11e601823be3d4d6c209
endd9ce9639a91b11e601823be3d4d6c209:
;
// match: (Neq32 x (Const32 <t> [c]))
// cond: x.Op != OpConst32
// result: (Neq32 (Const32 <t> [c]) x)
// match: (Lsh32x64 _ (Const64 [c]))
// cond: uint64(c) >= 32
// result: (Const64 [0])
{
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto end5376f9ab90e282450f49011d0e0ce236
if v.Args[1].Op != OpConst64 {
goto end81247a2423f489be15859d3930738fdf
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst32) {
goto end5376f9ab90e282450f49011d0e0ce236
if !(uint64(c) >= 32) {
goto end81247a2423f489be15859d3930738fdf
}
v.Op = OpNeq32
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
v0.Type = t
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
v.AuxInt = 0
return true
}
goto end5376f9ab90e282450f49011d0e0ce236
end5376f9ab90e282450f49011d0e0ce236:
goto end81247a2423f489be15859d3930738fdf
end81247a2423f489be15859d3930738fdf:
;
// match: (Neq32 (Const32 [c]) (Const32 [d]))
// cond:
// result: (ConstBool [b2i(int32(c) != int32(d))])
// match: (Lsh32x64 <t> (Lsh32x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Lsh32x64 x (Const64 <t> [c+d]))
{
if v.Args[0].Op != OpConst32 {
goto endf9f3d0814854d2d0879d331e9bdfcae2
t := v.Type
if v.Args[0].Op != OpLsh32x64 {
goto endf96a7c9571797fe61a5b63a4923d7e6e
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst32 {
goto endf9f3d0814854d2d0879d331e9bdfcae2
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto endf96a7c9571797fe61a5b63a4923d7e6e
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto endf96a7c9571797fe61a5b63a4923d7e6e
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
if !(!uaddOvf(c, d)) {
goto endf96a7c9571797fe61a5b63a4923d7e6e
}
v.Op = OpLsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int32(c) != int32(d))
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto endf9f3d0814854d2d0879d331e9bdfcae2
endf9f3d0814854d2d0879d331e9bdfcae2:
goto endf96a7c9571797fe61a5b63a4923d7e6e
endf96a7c9571797fe61a5b63a4923d7e6e:
;
return false
}
func rewriteValuegeneric_OpNeq64(v *Value, config *Config) bool {
func rewriteValuegeneric_OpLsh32x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq64 x x)
// match: (Lsh32x8 <t> x (Const8 [c]))
// cond:
// result: (ConstBool [0])
// result: (Lsh32x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1] != x {
goto end3601ad382705ea12b79d2008c1e5725c
if v.Args[1].Op != OpConst8 {
goto end1759d7c25a5bcda288e34d1d197c0b8f
}
v.Op = OpConstBool
c := v.Args[1].AuxInt
v.Op = OpLsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end1759d7c25a5bcda288e34d1d197c0b8f
end1759d7c25a5bcda288e34d1d197c0b8f:
;
return false
}
func rewriteValuegeneric_OpLsh64x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh64x16 <t> x (Const16 [c]))
// cond:
// result: (Lsh64x64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto enda649fbb5e14490c9eea9616550a76b5c
}
c := v.Args[1].AuxInt
v.Op = OpLsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto enda649fbb5e14490c9eea9616550a76b5c
enda649fbb5e14490c9eea9616550a76b5c:
;
return false
}
func rewriteValuegeneric_OpLsh64x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh64x32 <t> x (Const32 [c]))
// cond:
// result: (Lsh64x64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto end40069675cde851a63cce81b1b02751f9
}
c := v.Args[1].AuxInt
v.Op = OpLsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end40069675cde851a63cce81b1b02751f9
end40069675cde851a63cce81b1b02751f9:
;
return false
}
func rewriteValuegeneric_OpLsh64x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh64x64 (Const64 [c]) (Const64 [d]))
// cond:
// result: (Const64 [c << uint64(d)])
{
if v.Args[0].Op != OpConst64 {
goto end9c157a23e021f659f1568566435ed57b
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto end9c157a23e021f659f1568566435ed57b
}
d := v.Args[1].AuxInt
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c << uint64(d)
return true
}
goto end9c157a23e021f659f1568566435ed57b
end9c157a23e021f659f1568566435ed57b:
;
// match: (Lsh64x64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end9f18ca0556dbb4b50fe888273fab20ca
}
if v.Args[1].AuxInt != 0 {
goto end9f18ca0556dbb4b50fe888273fab20ca
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end9f18ca0556dbb4b50fe888273fab20ca
end9f18ca0556dbb4b50fe888273fab20ca:
;
// match: (Lsh64x64 _ (Const64 [c]))
// cond: uint64(c) >= 64
// result: (Const64 [0])
{
if v.Args[1].Op != OpConst64 {
goto end33da2e0ce5ca3e0554564477ef422402
}
c := v.Args[1].AuxInt
if !(uint64(c) >= 64) {
goto end33da2e0ce5ca3e0554564477ef422402
}
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto end33da2e0ce5ca3e0554564477ef422402
end33da2e0ce5ca3e0554564477ef422402:
;
// match: (Lsh64x64 <t> (Lsh64x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Lsh64x64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpLsh64x64 {
goto end001c62ee580a700ec7b07ccaa3740ac2
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto end001c62ee580a700ec7b07ccaa3740ac2
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto end001c62ee580a700ec7b07ccaa3740ac2
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto end001c62ee580a700ec7b07ccaa3740ac2
}
v.Op = OpLsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto end001c62ee580a700ec7b07ccaa3740ac2
end001c62ee580a700ec7b07ccaa3740ac2:
;
return false
}
func rewriteValuegeneric_OpLsh64x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh64x8 <t> x (Const8 [c]))
// cond:
// result: (Lsh64x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto end4d9224069abdade8e405df343938d932
}
c := v.Args[1].AuxInt
v.Op = OpLsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end4d9224069abdade8e405df343938d932
end4d9224069abdade8e405df343938d932:
;
return false
}
func rewriteValuegeneric_OpLsh8x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh8x16 <t> x (Const16 [c]))
// cond:
// result: (Lsh8x64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end0ad4a82e2eb4c7ca7407d79ec3aa5142
}
c := v.Args[1].AuxInt
v.Op = OpLsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end0ad4a82e2eb4c7ca7407d79ec3aa5142
end0ad4a82e2eb4c7ca7407d79ec3aa5142:
;
return false
}
func rewriteValuegeneric_OpLsh8x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh8x32 <t> x (Const32 [c]))
// cond:
// result: (Lsh8x64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto enddaacda113ecc79fe0621fd22ebc548dd
}
c := v.Args[1].AuxInt
v.Op = OpLsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto enddaacda113ecc79fe0621fd22ebc548dd
enddaacda113ecc79fe0621fd22ebc548dd:
;
return false
}
func rewriteValuegeneric_OpLsh8x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh8x64 (Const8 [c]) (Const64 [d]))
// cond:
// result: (Const8 [int64(int8(c) << uint64(d))])
{
if v.Args[0].Op != OpConst8 {
goto endbc3297ea9642b97eb71f0a9735048d7b
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto endbc3297ea9642b97eb71f0a9735048d7b
}
d := v.Args[1].AuxInt
v.Op = OpConst8
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = int64(int8(c) << uint64(d))
return true
}
goto endbc3297ea9642b97eb71f0a9735048d7b
endbc3297ea9642b97eb71f0a9735048d7b:
;
// match: (Lsh8x64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end715f3db41cccf963e25a20c33f618a04
}
if v.Args[1].AuxInt != 0 {
goto end715f3db41cccf963e25a20c33f618a04
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end715f3db41cccf963e25a20c33f618a04
end715f3db41cccf963e25a20c33f618a04:
;
// match: (Lsh8x64 _ (Const64 [c]))
// cond: uint64(c) >= 8
// result: (Const64 [0])
{
if v.Args[1].Op != OpConst64 {
goto endb6749df4d0cdc0cd9acc627187d73488
}
c := v.Args[1].AuxInt
if !(uint64(c) >= 8) {
goto endb6749df4d0cdc0cd9acc627187d73488
}
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto endb6749df4d0cdc0cd9acc627187d73488
endb6749df4d0cdc0cd9acc627187d73488:
;
// match: (Lsh8x64 <t> (Lsh8x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Lsh8x64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpLsh8x64 {
goto end73a4878b6bbd21c9e22fb99226ef947e
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto end73a4878b6bbd21c9e22fb99226ef947e
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto end73a4878b6bbd21c9e22fb99226ef947e
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto end73a4878b6bbd21c9e22fb99226ef947e
}
v.Op = OpLsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto end73a4878b6bbd21c9e22fb99226ef947e
end73a4878b6bbd21c9e22fb99226ef947e:
;
return false
}
func rewriteValuegeneric_OpLsh8x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Lsh8x8 <t> x (Const8 [c]))
// cond:
// result: (Lsh8x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto end8b770597435467b0c96014624d522b33
}
c := v.Args[1].AuxInt
v.Op = OpLsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end8b770597435467b0c96014624d522b33
end8b770597435467b0c96014624d522b33:
;
return false
}
func rewriteValuegeneric_OpMul16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul16 (Const16 [c]) (Const16 [d]))
// cond:
// result: (Const16 [c*d])
{
if v.Args[0].Op != OpConst16 {
goto ende8dd468add3015aea24531cf3c89ccb7
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst16 {
goto ende8dd468add3015aea24531cf3c89ccb7
}
d := v.Args[1].AuxInt
v.Op = OpConst16
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
return true
}
goto ende8dd468add3015aea24531cf3c89ccb7
ende8dd468add3015aea24531cf3c89ccb7:
;
return false
}
func rewriteValuegeneric_OpMul32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul32 (Const32 [c]) (Const32 [d]))
// cond:
// result: (Const32 [c*d])
{
if v.Args[0].Op != OpConst32 {
goto end60b4523099fa7b55e2e872e05bd497a7
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst32 {
goto end60b4523099fa7b55e2e872e05bd497a7
}
d := v.Args[1].AuxInt
v.Op = OpConst32
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
return true
}
goto end60b4523099fa7b55e2e872e05bd497a7
end60b4523099fa7b55e2e872e05bd497a7:
;
return false
}
func rewriteValuegeneric_OpMul64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul64 (Const64 [c]) (Const64 [d]))
// cond:
// result: (Const64 [c*d])
{
if v.Args[0].Op != OpConst64 {
goto end7aea1048b5d1230974b97f17238380ae
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto end7aea1048b5d1230974b97f17238380ae
}
d := v.Args[1].AuxInt
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
return true
}
goto end7aea1048b5d1230974b97f17238380ae
end7aea1048b5d1230974b97f17238380ae:
;
return false
}
func rewriteValuegeneric_OpMul8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Mul8 (Const8 [c]) (Const8 [d]))
// cond:
// result: (Const8 [c*d])
{
if v.Args[0].Op != OpConst8 {
goto end2f1952fd654c4a62ff00511041728809
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst8 {
goto end2f1952fd654c4a62ff00511041728809
}
d := v.Args[1].AuxInt
v.Op = OpConst8
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c * d
return true
}
goto end2f1952fd654c4a62ff00511041728809
end2f1952fd654c4a62ff00511041728809:
;
return false
}
func rewriteValuegeneric_OpNeq16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq16 x x)
// cond:
// result: (ConstBool [0])
{
x := v.Args[0]
if v.Args[1] != x {
goto ende76a50b524aeb16c7aeccf5f5cc60c06
}
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto ende76a50b524aeb16c7aeccf5f5cc60c06
ende76a50b524aeb16c7aeccf5f5cc60c06:
;
// match: (Neq16 (Const16 <t> [c]) (Add16 (Const16 <t> [d]) x))
// cond:
// result: (Neq16 (Const16 <t> [c-d]) x)
{
if v.Args[0].Op != OpConst16 {
goto end552011bd97e6f92ebc2672aa1843eadd
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd16 {
goto end552011bd97e6f92ebc2672aa1843eadd
}
if v.Args[1].Args[0].Op != OpConst16 {
goto end552011bd97e6f92ebc2672aa1843eadd
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto end552011bd97e6f92ebc2672aa1843eadd
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq16
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
return true
}
goto end552011bd97e6f92ebc2672aa1843eadd
end552011bd97e6f92ebc2672aa1843eadd:
;
// match: (Neq16 x (Const16 <t> [c]))
// cond: x.Op != OpConst16
// result: (Neq16 (Const16 <t> [c]) x)
{
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end0e45958f29e87997f632248aa9ee97e0
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst16) {
goto end0e45958f29e87997f632248aa9ee97e0
}
v.Op = OpNeq16
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
return true
}
goto end0e45958f29e87997f632248aa9ee97e0
end0e45958f29e87997f632248aa9ee97e0:
;
// match: (Neq16 (Const16 [c]) (Const16 [d]))
// cond:
// result: (ConstBool [b2i(int16(c) != int16(d))])
{
if v.Args[0].Op != OpConst16 {
goto end6302c9b645bb191982d28c2f846904d6
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst16 {
goto end6302c9b645bb191982d28c2f846904d6
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int16(c) != int16(d))
return true
}
goto end6302c9b645bb191982d28c2f846904d6
end6302c9b645bb191982d28c2f846904d6:
;
return false
}
func rewriteValuegeneric_OpNeq32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq32 x x)
// cond:
// result: (ConstBool [0])
{
x := v.Args[0]
if v.Args[1] != x {
goto end3713a608cffd29b40ff7c3b3f2585cbb
}
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto end3713a608cffd29b40ff7c3b3f2585cbb
end3713a608cffd29b40ff7c3b3f2585cbb:
;
// match: (Neq32 (Const32 <t> [c]) (Add32 (Const32 <t> [d]) x))
// cond:
// result: (Neq32 (Const32 <t> [c-d]) x)
{
if v.Args[0].Op != OpConst32 {
goto end93fc3b4a3639b965b414891111b16245
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd32 {
goto end93fc3b4a3639b965b414891111b16245
}
if v.Args[1].Args[0].Op != OpConst32 {
goto end93fc3b4a3639b965b414891111b16245
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto end93fc3b4a3639b965b414891111b16245
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq32
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
return true
}
goto end93fc3b4a3639b965b414891111b16245
end93fc3b4a3639b965b414891111b16245:
;
// match: (Neq32 x (Const32 <t> [c]))
// cond: x.Op != OpConst32
// result: (Neq32 (Const32 <t> [c]) x)
{
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto end5376f9ab90e282450f49011d0e0ce236
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst32) {
goto end5376f9ab90e282450f49011d0e0ce236
}
v.Op = OpNeq32
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
return true
}
goto end5376f9ab90e282450f49011d0e0ce236
end5376f9ab90e282450f49011d0e0ce236:
;
// match: (Neq32 (Const32 [c]) (Const32 [d]))
// cond:
// result: (ConstBool [b2i(int32(c) != int32(d))])
{
if v.Args[0].Op != OpConst32 {
goto endf9f3d0814854d2d0879d331e9bdfcae2
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst32 {
goto endf9f3d0814854d2d0879d331e9bdfcae2
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int32(c) != int32(d))
return true
}
goto endf9f3d0814854d2d0879d331e9bdfcae2
endf9f3d0814854d2d0879d331e9bdfcae2:
;
return false
}
func rewriteValuegeneric_OpNeq64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq64 x x)
// cond:
// result: (ConstBool [0])
{
x := v.Args[0]
if v.Args[1] != x {
goto end3601ad382705ea12b79d2008c1e5725c
}
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto end3601ad382705ea12b79d2008c1e5725c
end3601ad382705ea12b79d2008c1e5725c:
;
// match: (Neq64 (Const64 <t> [c]) (Add64 (Const64 <t> [d]) x))
// cond:
// result: (Neq64 (Const64 <t> [c-d]) x)
{
if v.Args[0].Op != OpConst64 {
goto enda3d39cad13a557a2aa6d086f43596c1b
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd64 {
goto enda3d39cad13a557a2aa6d086f43596c1b
}
if v.Args[1].Args[0].Op != OpConst64 {
goto enda3d39cad13a557a2aa6d086f43596c1b
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto enda3d39cad13a557a2aa6d086f43596c1b
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
return true
}
goto enda3d39cad13a557a2aa6d086f43596c1b
enda3d39cad13a557a2aa6d086f43596c1b:
;
// match: (Neq64 x (Const64 <t> [c]))
// cond: x.Op != OpConst64
// result: (Neq64 (Const64 <t> [c]) x)
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end0936a57de20373ca6cacb9506ddde708
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst64) {
goto end0936a57de20373ca6cacb9506ddde708
}
v.Op = OpNeq64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
return true
}
goto end0936a57de20373ca6cacb9506ddde708
end0936a57de20373ca6cacb9506ddde708:
;
// match: (Neq64 (Const64 [c]) (Const64 [d]))
// cond:
// result: (ConstBool [b2i(int64(c) != int64(d))])
{
if v.Args[0].Op != OpConst64 {
goto endf07433ecd3c150b1b75e943aa44a7203
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto endf07433ecd3c150b1b75e943aa44a7203
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int64(c) != int64(d))
return true
}
goto endf07433ecd3c150b1b75e943aa44a7203
endf07433ecd3c150b1b75e943aa44a7203:
;
return false
}
func rewriteValuegeneric_OpNeq8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq8 x x)
// cond:
// result: (ConstBool [0])
{
x := v.Args[0]
if v.Args[1] != x {
goto end09a0deaf3c42627d0d2d3efa96e30745
}
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto end09a0deaf3c42627d0d2d3efa96e30745
end09a0deaf3c42627d0d2d3efa96e30745:
;
// match: (Neq8 (Const8 <t> [c]) (Add8 (Const8 <t> [d]) x))
// cond:
// result: (Neq8 (Const8 <t> [c-d]) x)
{
if v.Args[0].Op != OpConst8 {
goto endc8f853c610c460c887cbfdca958e3691
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd8 {
goto endc8f853c610c460c887cbfdca958e3691
}
if v.Args[1].Args[0].Op != OpConst8 {
goto endc8f853c610c460c887cbfdca958e3691
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto endc8f853c610c460c887cbfdca958e3691
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq8
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, t)
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
return true
}
goto endc8f853c610c460c887cbfdca958e3691
endc8f853c610c460c887cbfdca958e3691:
;
// match: (Neq8 x (Const8 <t> [c]))
// cond: x.Op != OpConst8
// result: (Neq8 (Const8 <t> [c]) x)
{
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto end04dc0ae2b08cf0447b50e5b8ef469252
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst8) {
goto end04dc0ae2b08cf0447b50e5b8ef469252
}
v.Op = OpNeq8
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, t)
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
return true
}
goto end04dc0ae2b08cf0447b50e5b8ef469252
end04dc0ae2b08cf0447b50e5b8ef469252:
;
// match: (Neq8 (Const8 [c]) (Const8 [d]))
// cond:
// result: (ConstBool [b2i(int8(c) != int8(d))])
{
if v.Args[0].Op != OpConst8 {
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst8 {
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int8(c) != int8(d))
return true
}
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
end72ebdaf2de9b3aa57cf0cb8e068b5f9c:
;
return false
}
func rewriteValuegeneric_OpNeqInter(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (NeqInter x y)
// cond:
// result: (NeqPtr (ITab x) (ITab y))
{
x := v.Args[0]
y := v.Args[1]
v.Op = OpNeqPtr
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpITab, config.fe.TypeBytePtr())
v0.AddArg(x)
v.AddArg(v0)
v1 := b.NewValue0(v.Line, OpITab, config.fe.TypeBytePtr())
v1.AddArg(y)
v.AddArg(v1)
return true
}
goto end17b2333bf57e9fe81a671be02f9c4c14
end17b2333bf57e9fe81a671be02f9c4c14:
;
return false
}
func rewriteValuegeneric_OpNeqPtr(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (NeqPtr p (ConstNil))
// cond:
// result: (IsNonNil p)
{
p := v.Args[0]
if v.Args[1].Op != OpConstNil {
goto endba798520b4d41172b110347158c44791
}
v.Op = OpIsNonNil
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(p)
return true
}
goto endba798520b4d41172b110347158c44791
endba798520b4d41172b110347158c44791:
;
// match: (NeqPtr (ConstNil) p)
// cond:
// result: (IsNonNil p)
{
if v.Args[0].Op != OpConstNil {
goto enddd95e9c3606d9fd48034f1a703561e45
}
p := v.Args[1]
v.Op = OpIsNonNil
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(p)
return true
}
goto enddd95e9c3606d9fd48034f1a703561e45
enddd95e9c3606d9fd48034f1a703561e45:
;
return false
}
func rewriteValuegeneric_OpNeqSlice(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (NeqSlice x y)
// cond:
// result: (NeqPtr (SlicePtr x) (SlicePtr y))
{
x := v.Args[0]
y := v.Args[1]
v.Op = OpNeqPtr
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpSlicePtr, config.fe.TypeBytePtr())
v0.AddArg(x)
v.AddArg(v0)
v1 := b.NewValue0(v.Line, OpSlicePtr, config.fe.TypeBytePtr())
v1.AddArg(y)
v.AddArg(v1)
return true
}
goto endc6bc83c506e491236ca66ea1081231a2
endc6bc83c506e491236ca66ea1081231a2:
;
return false
}
func rewriteValuegeneric_OpOr16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or16 x x)
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1] != x {
goto end47a2f25fd31a76807aced3e2b126acdc
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end47a2f25fd31a76807aced3e2b126acdc
end47a2f25fd31a76807aced3e2b126acdc:
;
return false
}
func rewriteValuegeneric_OpOr32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or32 x x)
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1] != x {
goto end231e283e568e90bd9a3e6a4fa328c8a4
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end231e283e568e90bd9a3e6a4fa328c8a4
end231e283e568e90bd9a3e6a4fa328c8a4:
;
return false
}
func rewriteValuegeneric_OpOr64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or64 x x)
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1] != x {
goto end6b0efc212016dc97d0e3939db04c81d9
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end6b0efc212016dc97d0e3939db04c81d9
end6b0efc212016dc97d0e3939db04c81d9:
;
return false
}
func rewriteValuegeneric_OpOr8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or8 x x)
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1] != x {
goto end05295dbfafd6869af79b4daee9fda000
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end05295dbfafd6869af79b4daee9fda000
end05295dbfafd6869af79b4daee9fda000:
;
return false
}
func rewriteValuegeneric_OpPtrIndex(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (PtrIndex <t> ptr idx)
// cond: config.PtrSize == 4
// result: (AddPtr ptr (Mul32 <config.fe.TypeInt()> idx (Const32 <config.fe.TypeInt()> [t.Elem().Size()])))
{
t := v.Type
ptr := v.Args[0]
idx := v.Args[1]
if !(config.PtrSize == 4) {
goto endd902622aaa1e7545b5a2a0c08b47d287
}
v.Op = OpAddPtr
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(ptr)
v0 := b.NewValue0(v.Line, OpMul32, config.fe.TypeInt())
v0.AddArg(idx)
v1 := b.NewValue0(v.Line, OpConst32, config.fe.TypeInt())
v1.AuxInt = t.Elem().Size()
v0.AddArg(v1)
v.AddArg(v0)
return true
}
goto endd902622aaa1e7545b5a2a0c08b47d287
endd902622aaa1e7545b5a2a0c08b47d287:
;
// match: (PtrIndex <t> ptr idx)
// cond: config.PtrSize == 8
// result: (AddPtr ptr (Mul64 <config.fe.TypeInt()> idx (Const64 <config.fe.TypeInt()> [t.Elem().Size()])))
{
t := v.Type
ptr := v.Args[0]
idx := v.Args[1]
if !(config.PtrSize == 8) {
goto end47a5f1d1b158914fa383de024bbe3b08
}
v.Op = OpAddPtr
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(ptr)
v0 := b.NewValue0(v.Line, OpMul64, config.fe.TypeInt())
v0.AddArg(idx)
v1 := b.NewValue0(v.Line, OpConst64, config.fe.TypeInt())
v1.AuxInt = t.Elem().Size()
v0.AddArg(v1)
v.AddArg(v0)
return true
}
goto end47a5f1d1b158914fa383de024bbe3b08
end47a5f1d1b158914fa383de024bbe3b08:
;
return false
}
func rewriteValuegeneric_OpRsh16Ux16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16Ux16 <t> x (Const16 [c]))
// cond:
// result: (Rsh16Ux64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto endd981df40f353104ef828d13ad4ccdf02
}
c := v.Args[1].AuxInt
v.Op = OpRsh16Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto endd981df40f353104ef828d13ad4ccdf02
endd981df40f353104ef828d13ad4ccdf02:
;
return false
}
func rewriteValuegeneric_OpRsh16Ux32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16Ux32 <t> x (Const32 [c]))
// cond:
// result: (Rsh16Ux64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto ende0be9ee562725206dcf96d3e5750b5ea
}
c := v.Args[1].AuxInt
v.Op = OpRsh16Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto ende0be9ee562725206dcf96d3e5750b5ea
ende0be9ee562725206dcf96d3e5750b5ea:
;
return false
}
func rewriteValuegeneric_OpRsh16Ux64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16Ux64 (Const16 [c]) (Const64 [d]))
// cond:
// result: (Const16 [int64(uint16(c) >> uint64(d))])
{
if v.Args[0].Op != OpConst16 {
goto ended17f40375fb44bcbaf2d87161c5ed3c
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto ended17f40375fb44bcbaf2d87161c5ed3c
}
d := v.Args[1].AuxInt
v.Op = OpConst16
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = int64(uint16(c) >> uint64(d))
return true
}
goto ended17f40375fb44bcbaf2d87161c5ed3c
ended17f40375fb44bcbaf2d87161c5ed3c:
;
// match: (Rsh16Ux64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end752d1b5a60f87afa7e40febbf1bce309
}
if v.Args[1].AuxInt != 0 {
goto end752d1b5a60f87afa7e40febbf1bce309
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end752d1b5a60f87afa7e40febbf1bce309
end752d1b5a60f87afa7e40febbf1bce309:
;
// match: (Rsh16Ux64 _ (Const64 [c]))
// cond: uint64(c) >= 16
// result: (Const64 [0])
{
if v.Args[1].Op != OpConst64 {
goto endca5c7ae2e51f2ae32486c2b1a3033b77
}
c := v.Args[1].AuxInt
if !(uint64(c) >= 16) {
goto endca5c7ae2e51f2ae32486c2b1a3033b77
}
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto endca5c7ae2e51f2ae32486c2b1a3033b77
endca5c7ae2e51f2ae32486c2b1a3033b77:
;
// match: (Rsh16Ux64 <t> (Rsh16Ux64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh16Ux64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpRsh16Ux64 {
goto end56f2c0034c9fbe651abb36fb640af465
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto end56f2c0034c9fbe651abb36fb640af465
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto end56f2c0034c9fbe651abb36fb640af465
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto end56f2c0034c9fbe651abb36fb640af465
}
v.Op = OpRsh16Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto end56f2c0034c9fbe651abb36fb640af465
end56f2c0034c9fbe651abb36fb640af465:
;
return false
}
func rewriteValuegeneric_OpRsh16Ux8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16Ux8 <t> x (Const8 [c]))
// cond:
// result: (Rsh16Ux64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto end20d4667094c32c71bac4e0805dab85c9
}
c := v.Args[1].AuxInt
v.Op = OpRsh16Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end20d4667094c32c71bac4e0805dab85c9
end20d4667094c32c71bac4e0805dab85c9:
;
return false
}
func rewriteValuegeneric_OpRsh16x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16x16 <t> x (Const16 [c]))
// cond:
// result: (Rsh16x64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end1b501c7ae2fe58ad3a88b467f2d95389
}
c := v.Args[1].AuxInt
v.Op = OpRsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end1b501c7ae2fe58ad3a88b467f2d95389
end1b501c7ae2fe58ad3a88b467f2d95389:
;
return false
}
func rewriteValuegeneric_OpRsh16x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16x32 <t> x (Const32 [c]))
// cond:
// result: (Rsh16x64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto end4d3a41113d2d0b09924bf5759ca49cab
}
c := v.Args[1].AuxInt
v.Op = OpRsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end4d3a41113d2d0b09924bf5759ca49cab
end4d3a41113d2d0b09924bf5759ca49cab:
;
return false
}
func rewriteValuegeneric_OpRsh16x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16x64 (Const16 [c]) (Const64 [d]))
// cond:
// result: (Const16 [int64(int16(c) >> uint64(d))])
{
if v.Args[0].Op != OpConst16 {
goto end8f05fede35a3d2f687fcd4a5829a25ad
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto end8f05fede35a3d2f687fcd4a5829a25ad
}
d := v.Args[1].AuxInt
v.Op = OpConst16
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = int64(int16(c) >> uint64(d))
return true
}
goto end8f05fede35a3d2f687fcd4a5829a25ad
end8f05fede35a3d2f687fcd4a5829a25ad:
;
// match: (Rsh16x64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end750fafe01fcc689d953101d53efc19ab
}
if v.Args[1].AuxInt != 0 {
goto end750fafe01fcc689d953101d53efc19ab
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end750fafe01fcc689d953101d53efc19ab
end750fafe01fcc689d953101d53efc19ab:
;
// match: (Rsh16x64 <t> (Rsh16x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh16x64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpRsh16x64 {
goto endf425eff9e05aad27194af957e3383c76
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto endf425eff9e05aad27194af957e3383c76
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto endf425eff9e05aad27194af957e3383c76
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto endf425eff9e05aad27194af957e3383c76
}
v.Op = OpRsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto endf425eff9e05aad27194af957e3383c76
endf425eff9e05aad27194af957e3383c76:
;
return false
}
func rewriteValuegeneric_OpRsh16x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh16x8 <t> x (Const8 [c]))
// cond:
// result: (Rsh16x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto end0b5e274d62a3ae8df9f4089756c6a9d4
}
c := v.Args[1].AuxInt
v.Op = OpRsh16x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end0b5e274d62a3ae8df9f4089756c6a9d4
end0b5e274d62a3ae8df9f4089756c6a9d4:
;
return false
}
func rewriteValuegeneric_OpRsh32Ux16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32Ux16 <t> x (Const16 [c]))
// cond:
// result: (Rsh32Ux64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end8d8f9f3e2e1f7a5e9a186fb792fc40a8
}
c := v.Args[1].AuxInt
v.Op = OpRsh32Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end8d8f9f3e2e1f7a5e9a186fb792fc40a8
end8d8f9f3e2e1f7a5e9a186fb792fc40a8:
;
return false
}
func rewriteValuegeneric_OpRsh32Ux32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32Ux32 <t> x (Const32 [c]))
// cond:
// result: (Rsh32Ux64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto endd23d060f74e00f34cc967b6fb9a4d320
}
c := v.Args[1].AuxInt
v.Op = OpRsh32Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto endd23d060f74e00f34cc967b6fb9a4d320
endd23d060f74e00f34cc967b6fb9a4d320:
;
return false
}
func rewriteValuegeneric_OpRsh32Ux64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32Ux64 (Const32 [c]) (Const64 [d]))
// cond:
// result: (Const32 [int64(uint32(c) >> uint64(d))])
{
if v.Args[0].Op != OpConst32 {
goto enda101e6b765d7ecffd9b7410c9dc3be82
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto enda101e6b765d7ecffd9b7410c9dc3be82
}
d := v.Args[1].AuxInt
v.Op = OpConst32
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = int64(uint32(c) >> uint64(d))
return true
}
goto enda101e6b765d7ecffd9b7410c9dc3be82
enda101e6b765d7ecffd9b7410c9dc3be82:
;
// match: (Rsh32Ux64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end162e4e182a665d4e6f0d85fe131e7288
}
if v.Args[1].AuxInt != 0 {
goto end162e4e182a665d4e6f0d85fe131e7288
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end162e4e182a665d4e6f0d85fe131e7288
end162e4e182a665d4e6f0d85fe131e7288:
;
// match: (Rsh32Ux64 _ (Const64 [c]))
// cond: uint64(c) >= 32
// result: (Const64 [0])
{
if v.Args[1].Op != OpConst64 {
goto endca322c370839b4264b219ee042a6ab33
}
c := v.Args[1].AuxInt
if !(uint64(c) >= 32) {
goto endca322c370839b4264b219ee042a6ab33
}
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto endca322c370839b4264b219ee042a6ab33
endca322c370839b4264b219ee042a6ab33:
;
// match: (Rsh32Ux64 <t> (Rsh32Ux64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh32Ux64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpRsh32Ux64 {
goto end2e502d68a32663142684194adbe6c297
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto end2e502d68a32663142684194adbe6c297
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto end2e502d68a32663142684194adbe6c297
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto end2e502d68a32663142684194adbe6c297
}
v.Op = OpRsh32Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto end2e502d68a32663142684194adbe6c297
end2e502d68a32663142684194adbe6c297:
;
return false
}
func rewriteValuegeneric_OpRsh32Ux8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32Ux8 <t> x (Const8 [c]))
// cond:
// result: (Rsh32Ux64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto end967cea80158afaffb783f6da7aa898ca
}
c := v.Args[1].AuxInt
v.Op = OpRsh32Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end967cea80158afaffb783f6da7aa898ca
end967cea80158afaffb783f6da7aa898ca:
;
return false
}
func rewriteValuegeneric_OpRsh32x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32x16 <t> x (Const16 [c]))
// cond:
// result: (Rsh32x64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end6a62ebdcc98ea2e3214559214708d26a
}
c := v.Args[1].AuxInt
v.Op = OpRsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end6a62ebdcc98ea2e3214559214708d26a
end6a62ebdcc98ea2e3214559214708d26a:
;
return false
}
func rewriteValuegeneric_OpRsh32x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32x32 <t> x (Const32 [c]))
// cond:
// result: (Rsh32x64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto end6e3b467acdca74f58e9177fb42a1968b
}
c := v.Args[1].AuxInt
v.Op = OpRsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end6e3b467acdca74f58e9177fb42a1968b
end6e3b467acdca74f58e9177fb42a1968b:
;
return false
}
func rewriteValuegeneric_OpRsh32x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32x64 (Const32 [c]) (Const64 [d]))
// cond:
// result: (Const32 [int64(int32(c) >> uint64(d))])
{
if v.Args[0].Op != OpConst32 {
goto end7e4b8c499cffe1fef73a16e6be54d4d2
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto end7e4b8c499cffe1fef73a16e6be54d4d2
}
d := v.Args[1].AuxInt
v.Op = OpConst32
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = int64(int32(c) >> uint64(d))
return true
}
goto end3601ad382705ea12b79d2008c1e5725c
end3601ad382705ea12b79d2008c1e5725c:
goto end7e4b8c499cffe1fef73a16e6be54d4d2
end7e4b8c499cffe1fef73a16e6be54d4d2:
;
// match: (Neq64 (Const64 <t> [c]) (Add64 (Const64 <t> [d]) x))
// match: (Rsh32x64 x (Const64 [0]))
// cond:
// result: (Neq64 (Const64 <t> [c-d]) x)
// result: x
{
if v.Args[0].Op != OpConst64 {
goto enda3d39cad13a557a2aa6d086f43596c1b
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end72da2611eaaffe407efa1cc45c23ade3
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd64 {
goto enda3d39cad13a557a2aa6d086f43596c1b
if v.Args[1].AuxInt != 0 {
goto end72da2611eaaffe407efa1cc45c23ade3
}
if v.Args[1].Args[0].Op != OpConst64 {
goto enda3d39cad13a557a2aa6d086f43596c1b
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto enda3d39cad13a557a2aa6d086f43596c1b
goto end72da2611eaaffe407efa1cc45c23ade3
end72da2611eaaffe407efa1cc45c23ade3:
;
// match: (Rsh32x64 <t> (Rsh32x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh32x64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpRsh32x64 {
goto endadb415be78ee46a8a4135ec50df772b0
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq64
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto endadb415be78ee46a8a4135ec50df772b0
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto endadb415be78ee46a8a4135ec50df772b0
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto endadb415be78ee46a8a4135ec50df772b0
}
v.Op = OpRsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
v0.Type = t
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto enda3d39cad13a557a2aa6d086f43596c1b
enda3d39cad13a557a2aa6d086f43596c1b:
goto endadb415be78ee46a8a4135ec50df772b0
endadb415be78ee46a8a4135ec50df772b0:
;
// match: (Neq64 x (Const64 <t> [c]))
// cond: x.Op != OpConst64
// result: (Neq64 (Const64 <t> [c]) x)
return false
}
func rewriteValuegeneric_OpRsh32x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh32x8 <t> x (Const8 [c]))
// cond:
// result: (Rsh32x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end0936a57de20373ca6cacb9506ddde708
if v.Args[1].Op != OpConst8 {
goto end7b59b42c5c68a2d55be469a0c086dd8b
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst64) {
goto end0936a57de20373ca6cacb9506ddde708
v.Op = OpRsh32x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
v.Op = OpNeq64
goto end7b59b42c5c68a2d55be469a0c086dd8b
end7b59b42c5c68a2d55be469a0c086dd8b:
;
return false
}
func rewriteValuegeneric_OpRsh64Ux16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh64Ux16 <t> x (Const16 [c]))
// cond:
// result: (Rsh64Ux64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end733d85a7b599bcba969ca1cb4bdb9e48
}
c := v.Args[1].AuxInt
v.Op = OpRsh64Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
v0.Type = t
v0.AuxInt = c
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end733d85a7b599bcba969ca1cb4bdb9e48
end733d85a7b599bcba969ca1cb4bdb9e48:
;
return false
}
func rewriteValuegeneric_OpRsh64Ux32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh64Ux32 <t> x (Const32 [c]))
// cond:
// result: (Rsh64Ux64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto endeac7b34169de1fb0393b833e65b9bb19
}
c := v.Args[1].AuxInt
v.Op = OpRsh64Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end0936a57de20373ca6cacb9506ddde708
end0936a57de20373ca6cacb9506ddde708:
goto endeac7b34169de1fb0393b833e65b9bb19
endeac7b34169de1fb0393b833e65b9bb19:
;
// match: (Neq64 (Const64 [c]) (Const64 [d]))
return false
}
func rewriteValuegeneric_OpRsh64Ux64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh64Ux64 (Const64 [c]) (Const64 [d]))
// cond:
// result: (ConstBool [b2i(int64(c) != int64(d))])
// result: (Const64 [int64(uint64(c) >> uint64(d))])
{
if v.Args[0].Op != OpConst64 {
goto endf07433ecd3c150b1b75e943aa44a7203
goto end102f4cfd7979a2aa222d52c34ac6802d
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto endf07433ecd3c150b1b75e943aa44a7203
goto end102f4cfd7979a2aa222d52c34ac6802d
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int64(c) != int64(d))
v.AuxInt = int64(uint64(c) >> uint64(d))
return true
}
goto endf07433ecd3c150b1b75e943aa44a7203
endf07433ecd3c150b1b75e943aa44a7203:
goto end102f4cfd7979a2aa222d52c34ac6802d
end102f4cfd7979a2aa222d52c34ac6802d:
;
// match: (Rsh64Ux64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end5ad037b910698f2847df90177c23a6ac
}
if v.Args[1].AuxInt != 0 {
goto end5ad037b910698f2847df90177c23a6ac
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto end5ad037b910698f2847df90177c23a6ac
end5ad037b910698f2847df90177c23a6ac:
;
// match: (Rsh64Ux64 _ (Const64 [c]))
// cond: uint64(c) >= 64
// result: (Const64 [0])
{
if v.Args[1].Op != OpConst64 {
goto end16ea16aa61862207ea64e514369d608b
}
c := v.Args[1].AuxInt
if !(uint64(c) >= 64) {
goto end16ea16aa61862207ea64e514369d608b
}
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = 0
return true
}
goto end16ea16aa61862207ea64e514369d608b
end16ea16aa61862207ea64e514369d608b:
;
// match: (Rsh64Ux64 <t> (Rsh64Ux64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh64Ux64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpRsh64Ux64 {
goto end32bfdb1b4ccc23a5cd62fc0348ebd877
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto end32bfdb1b4ccc23a5cd62fc0348ebd877
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto end32bfdb1b4ccc23a5cd62fc0348ebd877
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto end32bfdb1b4ccc23a5cd62fc0348ebd877
}
v.Op = OpRsh64Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto end32bfdb1b4ccc23a5cd62fc0348ebd877
end32bfdb1b4ccc23a5cd62fc0348ebd877:
;
return false
}
func rewriteValuegeneric_OpNeq8(v *Value, config *Config) bool {
func rewriteValuegeneric_OpRsh64Ux8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Neq8 x x)
// match: (Rsh64Ux8 <t> x (Const8 [c]))
// cond:
// result: (ConstBool [0])
// result: (Rsh64Ux64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1] != x {
goto end09a0deaf3c42627d0d2d3efa96e30745
if v.Args[1].Op != OpConst8 {
goto ende3d8090a67a52dbcd24b52ee32c9d7f0
}
v.Op = OpConstBool
c := v.Args[1].AuxInt
v.Op = OpRsh64Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto ende3d8090a67a52dbcd24b52ee32c9d7f0
ende3d8090a67a52dbcd24b52ee32c9d7f0:
;
return false
}
func rewriteValuegeneric_OpRsh64x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh64x16 <t> x (Const16 [c]))
// cond:
// result: (Rsh64x64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto endd5151d0bfc38c55ae6ae6836014df3bc
}
c := v.Args[1].AuxInt
v.Op = OpRsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end09a0deaf3c42627d0d2d3efa96e30745
end09a0deaf3c42627d0d2d3efa96e30745:
goto endd5151d0bfc38c55ae6ae6836014df3bc
endd5151d0bfc38c55ae6ae6836014df3bc:
;
// match: (Neq8 (Const8 <t> [c]) (Add8 (Const8 <t> [d]) x))
return false
}
func rewriteValuegeneric_OpRsh64x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh64x32 <t> x (Const32 [c]))
// cond:
// result: (Neq8 (Const8 <t> [c-d]) x)
// result: (Rsh64x64 x (Const64 <t> [int64(uint32(c))]))
{
if v.Args[0].Op != OpConst8 {
goto endc8f853c610c460c887cbfdca958e3691
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst32 {
goto end0f2dbca5c7d6b100890c94a97bf0de7c
}
c := v.Args[1].AuxInt
v.Op = OpRsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end0f2dbca5c7d6b100890c94a97bf0de7c
end0f2dbca5c7d6b100890c94a97bf0de7c:
;
return false
}
func rewriteValuegeneric_OpRsh64x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh64x64 (Const64 [c]) (Const64 [d]))
// cond:
// result: (Const64 [c >> uint64(d)])
{
if v.Args[0].Op != OpConst64 {
goto endfa4609d6bea8a3e3d3a777b1968c97d9
}
t := v.Args[0].Type
c := v.Args[0].AuxInt
if v.Args[1].Op != OpAdd8 {
goto endc8f853c610c460c887cbfdca958e3691
if v.Args[1].Op != OpConst64 {
goto endfa4609d6bea8a3e3d3a777b1968c97d9
}
if v.Args[1].Args[0].Op != OpConst8 {
goto endc8f853c610c460c887cbfdca958e3691
d := v.Args[1].AuxInt
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = c >> uint64(d)
return true
}
if v.Args[1].Args[0].Type != v.Args[0].Type {
goto endc8f853c610c460c887cbfdca958e3691
goto endfa4609d6bea8a3e3d3a777b1968c97d9
endfa4609d6bea8a3e3d3a777b1968c97d9:
;
// match: (Rsh64x64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto ende62e0c67d3f04eb221646371a2a91d05
}
if v.Args[1].AuxInt != 0 {
goto ende62e0c67d3f04eb221646371a2a91d05
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
return true
}
goto ende62e0c67d3f04eb221646371a2a91d05
ende62e0c67d3f04eb221646371a2a91d05:
;
// match: (Rsh64x64 <t> (Rsh64x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh64x64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpRsh64x64 {
goto endd3e8ea66dc3ad0bc393001d6babb7160
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto endd3e8ea66dc3ad0bc393001d6babb7160
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto endd3e8ea66dc3ad0bc393001d6babb7160
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto endd3e8ea66dc3ad0bc393001d6babb7160
}
d := v.Args[1].Args[0].AuxInt
x := v.Args[1].Args[1]
v.Op = OpNeq8
v.Op = OpRsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
v0.Type = t
v0.AuxInt = c - d
v.AddArg(v0)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto endc8f853c610c460c887cbfdca958e3691
endc8f853c610c460c887cbfdca958e3691:
goto endd3e8ea66dc3ad0bc393001d6babb7160
endd3e8ea66dc3ad0bc393001d6babb7160:
;
// match: (Neq8 x (Const8 <t> [c]))
// cond: x.Op != OpConst8
// result: (Neq8 (Const8 <t> [c]) x)
return false
}
func rewriteValuegeneric_OpRsh64x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh64x8 <t> x (Const8 [c]))
// cond:
// result: (Rsh64x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto end04dc0ae2b08cf0447b50e5b8ef469252
goto end1a9e5a89849344396210da7c7ec810be
}
t := v.Args[1].Type
c := v.Args[1].AuxInt
if !(x.Op != OpConst8) {
goto end04dc0ae2b08cf0447b50e5b8ef469252
}
v.Op = OpNeq8
v.Op = OpRsh64x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
v0.Type = t
v0.AuxInt = c
v.AddArg(v0)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end04dc0ae2b08cf0447b50e5b8ef469252
end04dc0ae2b08cf0447b50e5b8ef469252:
goto end1a9e5a89849344396210da7c7ec810be
end1a9e5a89849344396210da7c7ec810be:
;
// match: (Neq8 (Const8 [c]) (Const8 [d]))
return false
}
func rewriteValuegeneric_OpRsh8Ux16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh8Ux16 <t> x (Const16 [c]))
// cond:
// result: (ConstBool [b2i(int8(c) != int8(d))])
// result: (Rsh8Ux64 x (Const64 <t> [int64(uint16(c))]))
{
if v.Args[0].Op != OpConst8 {
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst8 {
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
t := v.Type
x := v.Args[0]
if v.Args[1].Op != OpConst16 {
goto end7acc015610273092e9efcce2949ee0f9
}
d := v.Args[1].AuxInt
v.Op = OpConstBool
c := v.Args[1].AuxInt
v.Op = OpRsh8Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = b2i(int8(c) != int8(d))
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
end72ebdaf2de9b3aa57cf0cb8e068b5f9c:
goto end7acc015610273092e9efcce2949ee0f9
end7acc015610273092e9efcce2949ee0f9:
;
return false
}
func rewriteValuegeneric_OpNeqInter(v *Value, config *Config) bool {
func rewriteValuegeneric_OpRsh8Ux32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (NeqInter x y)
// match: (Rsh8Ux32 <t> x (Const32 [c]))
// cond:
// result: (NeqPtr (ITab x) (ITab y))
// result: (Rsh8Ux64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
y := v.Args[1]
v.Op = OpNeqPtr
if v.Args[1].Op != OpConst32 {
goto end27e9b4472e085b653a105b1d67554ce8
}
c := v.Args[1].AuxInt
v.Op = OpRsh8Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpITab, config.fe.TypeBytePtr())
v0.AddArg(x)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
v1 := b.NewValue0(v.Line, OpITab, config.fe.TypeBytePtr())
v1.AddArg(y)
v.AddArg(v1)
return true
}
goto end17b2333bf57e9fe81a671be02f9c4c14
end17b2333bf57e9fe81a671be02f9c4c14:
goto end27e9b4472e085b653a105b1d67554ce8
end27e9b4472e085b653a105b1d67554ce8:
;
return false
}
func rewriteValuegeneric_OpNeqPtr(v *Value, config *Config) bool {
func rewriteValuegeneric_OpRsh8Ux64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (NeqPtr p (ConstNil))
// match: (Rsh8Ux64 (Const8 [c]) (Const64 [d]))
// cond:
// result: (IsNonNil p)
// result: (Const8 [int64(uint8(c) >> uint64(d))])
{
p := v.Args[0]
if v.Args[1].Op != OpConstNil {
goto endba798520b4d41172b110347158c44791
if v.Args[0].Op != OpConst8 {
goto enddd166e450d81ba7b466d61d2fbec178c
}
v.Op = OpIsNonNil
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto enddd166e450d81ba7b466d61d2fbec178c
}
d := v.Args[1].AuxInt
v.Op = OpConst8
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(p)
v.AuxInt = int64(uint8(c) >> uint64(d))
return true
}
goto endba798520b4d41172b110347158c44791
endba798520b4d41172b110347158c44791:
goto enddd166e450d81ba7b466d61d2fbec178c
enddd166e450d81ba7b466d61d2fbec178c:
;
// match: (NeqPtr (ConstNil) p)
// match: (Rsh8Ux64 x (Const64 [0]))
// cond:
// result: (IsNonNil p)
// result: x
{
if v.Args[0].Op != OpConstNil {
goto enddd95e9c3606d9fd48034f1a703561e45
x := v.Args[0]
if v.Args[1].Op != OpConst64 {
goto end570cb1d9db3c7bebd85e485eeb2c0969
}
p := v.Args[1]
v.Op = OpIsNonNil
if v.Args[1].AuxInt != 0 {
goto end570cb1d9db3c7bebd85e485eeb2c0969
}
v.Op = OpCopy
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(p)
v.Type = x.Type
v.AddArg(x)
return true
}
goto enddd95e9c3606d9fd48034f1a703561e45
enddd95e9c3606d9fd48034f1a703561e45:
goto end570cb1d9db3c7bebd85e485eeb2c0969
end570cb1d9db3c7bebd85e485eeb2c0969:
;
return false
}
func rewriteValuegeneric_OpNeqSlice(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (NeqSlice x y)
// cond:
// result: (NeqPtr (SlicePtr x) (SlicePtr y))
// match: (Rsh8Ux64 _ (Const64 [c]))
// cond: uint64(c) >= 8
// result: (Const64 [0])
{
x := v.Args[0]
y := v.Args[1]
v.Op = OpNeqPtr
if v.Args[1].Op != OpConst64 {
goto endb63e1a7d1d91716ca0d9d74215361323
}
c := v.Args[1].AuxInt
if !(uint64(c) >= 8) {
goto endb63e1a7d1d91716ca0d9d74215361323
}
v.Op = OpConst64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpSlicePtr, config.fe.TypeBytePtr())
v0.AddArg(x)
v.AuxInt = 0
return true
}
goto endb63e1a7d1d91716ca0d9d74215361323
endb63e1a7d1d91716ca0d9d74215361323:
;
// match: (Rsh8Ux64 <t> (Rsh8Ux64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh8Ux64 x (Const64 <t> [c+d]))
{
t := v.Type
if v.Args[0].Op != OpRsh8Ux64 {
goto endee8824b7071ed1a6dba4fcbaab98229e
}
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto endee8824b7071ed1a6dba4fcbaab98229e
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto endee8824b7071ed1a6dba4fcbaab98229e
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto endee8824b7071ed1a6dba4fcbaab98229e
}
v.Op = OpRsh8Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
v1 := b.NewValue0(v.Line, OpSlicePtr, config.fe.TypeBytePtr())
v1.AddArg(y)
v.AddArg(v1)
return true
}
goto endc6bc83c506e491236ca66ea1081231a2
endc6bc83c506e491236ca66ea1081231a2:
goto endee8824b7071ed1a6dba4fcbaab98229e
endee8824b7071ed1a6dba4fcbaab98229e:
;
return false
}
func rewriteValuegeneric_OpOr16(v *Value, config *Config) bool {
func rewriteValuegeneric_OpRsh8Ux8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or16 x x)
// match: (Rsh8Ux8 <t> x (Const8 [c]))
// cond:
// result: x
// result: (Rsh8Ux64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1] != x {
goto end47a2f25fd31a76807aced3e2b126acdc
if v.Args[1].Op != OpConst8 {
goto ended7e4f4d9ab89dc26e6649d466577930
}
v.Op = OpCopy
c := v.Args[1].AuxInt
v.Op = OpRsh8Ux64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end47a2f25fd31a76807aced3e2b126acdc
end47a2f25fd31a76807aced3e2b126acdc:
goto ended7e4f4d9ab89dc26e6649d466577930
ended7e4f4d9ab89dc26e6649d466577930:
;
return false
}
func rewriteValuegeneric_OpOr32(v *Value, config *Config) bool {
func rewriteValuegeneric_OpRsh8x16(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or32 x x)
// match: (Rsh8x16 <t> x (Const16 [c]))
// cond:
// result: x
// result: (Rsh8x64 x (Const64 <t> [int64(uint16(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1] != x {
goto end231e283e568e90bd9a3e6a4fa328c8a4
if v.Args[1].Op != OpConst16 {
goto end136bef6f60180bc8b4befbfc370af7ef
}
v.Op = OpCopy
c := v.Args[1].AuxInt
v.Op = OpRsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint16(c))
v.AddArg(v0)
return true
}
goto end231e283e568e90bd9a3e6a4fa328c8a4
end231e283e568e90bd9a3e6a4fa328c8a4:
goto end136bef6f60180bc8b4befbfc370af7ef
end136bef6f60180bc8b4befbfc370af7ef:
;
return false
}
func rewriteValuegeneric_OpOr64(v *Value, config *Config) bool {
func rewriteValuegeneric_OpRsh8x32(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or64 x x)
// match: (Rsh8x32 <t> x (Const32 [c]))
// cond:
// result: x
// result: (Rsh8x64 x (Const64 <t> [int64(uint32(c))]))
{
t := v.Type
x := v.Args[0]
if v.Args[1] != x {
goto end6b0efc212016dc97d0e3939db04c81d9
if v.Args[1].Op != OpConst32 {
goto end2ef95c222a7c552fa9cc86e36196644e
}
v.Op = OpCopy
c := v.Args[1].AuxInt
v.Op = OpRsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.Type = x.Type
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint32(c))
v.AddArg(v0)
return true
}
goto end6b0efc212016dc97d0e3939db04c81d9
end6b0efc212016dc97d0e3939db04c81d9:
goto end2ef95c222a7c552fa9cc86e36196644e
end2ef95c222a7c552fa9cc86e36196644e:
;
return false
}
func rewriteValuegeneric_OpOr8(v *Value, config *Config) bool {
func rewriteValuegeneric_OpRsh8x64(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Or8 x x)
// match: (Rsh8x64 (Const8 [c]) (Const64 [d]))
// cond:
// result: (Const8 [int64(int8(c) >> uint64(d))])
{
if v.Args[0].Op != OpConst8 {
goto end3b90206d75365466dfd1368e5b69db35
}
c := v.Args[0].AuxInt
if v.Args[1].Op != OpConst64 {
goto end3b90206d75365466dfd1368e5b69db35
}
d := v.Args[1].AuxInt
v.Op = OpConst8
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AuxInt = int64(int8(c) >> uint64(d))
return true
}
goto end3b90206d75365466dfd1368e5b69db35
end3b90206d75365466dfd1368e5b69db35:
;
// match: (Rsh8x64 x (Const64 [0]))
// cond:
// result: x
{
x := v.Args[0]
if v.Args[1] != x {
goto end05295dbfafd6869af79b4daee9fda000
if v.Args[1].Op != OpConst64 {
goto end1e664cc720a11d1c769de8081cfa1de4
}
if v.Args[1].AuxInt != 0 {
goto end1e664cc720a11d1c769de8081cfa1de4
}
v.Op = OpCopy
v.AuxInt = 0
......@@ -3749,65 +5981,69 @@ func rewriteValuegeneric_OpOr8(v *Value, config *Config) bool {
v.AddArg(x)
return true
}
goto end05295dbfafd6869af79b4daee9fda000
end05295dbfafd6869af79b4daee9fda000:
goto end1e664cc720a11d1c769de8081cfa1de4
end1e664cc720a11d1c769de8081cfa1de4:
;
return false
}
func rewriteValuegeneric_OpPtrIndex(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (PtrIndex <t> ptr idx)
// cond: config.PtrSize == 4
// result: (AddPtr ptr (Mul32 <config.fe.TypeInt()> idx (Const32 <config.fe.TypeInt()> [t.Elem().Size()])))
// match: (Rsh8x64 <t> (Rsh8x64 x (Const64 [c])) (Const64 [d]))
// cond: !uaddOvf(c,d)
// result: (Rsh8x64 x (Const64 <t> [c+d]))
{
t := v.Type
ptr := v.Args[0]
idx := v.Args[1]
if !(config.PtrSize == 4) {
goto endd902622aaa1e7545b5a2a0c08b47d287
if v.Args[0].Op != OpRsh8x64 {
goto end6408685a7276af7e76ec086f359c942c
}
v.Op = OpAddPtr
x := v.Args[0].Args[0]
if v.Args[0].Args[1].Op != OpConst64 {
goto end6408685a7276af7e76ec086f359c942c
}
c := v.Args[0].Args[1].AuxInt
if v.Args[1].Op != OpConst64 {
goto end6408685a7276af7e76ec086f359c942c
}
d := v.Args[1].AuxInt
if !(!uaddOvf(c, d)) {
goto end6408685a7276af7e76ec086f359c942c
}
v.Op = OpRsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(ptr)
v0 := b.NewValue0(v.Line, OpMul32, config.fe.TypeInt())
v0.AddArg(idx)
v1 := b.NewValue0(v.Line, OpConst32, config.fe.TypeInt())
v1.AuxInt = t.Elem().Size()
v0.AddArg(v1)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = c + d
v.AddArg(v0)
return true
}
goto endd902622aaa1e7545b5a2a0c08b47d287
endd902622aaa1e7545b5a2a0c08b47d287:
goto end6408685a7276af7e76ec086f359c942c
end6408685a7276af7e76ec086f359c942c:
;
// match: (PtrIndex <t> ptr idx)
// cond: config.PtrSize == 8
// result: (AddPtr ptr (Mul64 <config.fe.TypeInt()> idx (Const64 <config.fe.TypeInt()> [t.Elem().Size()])))
return false
}
func rewriteValuegeneric_OpRsh8x8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (Rsh8x8 <t> x (Const8 [c]))
// cond:
// result: (Rsh8x64 x (Const64 <t> [int64(uint8(c))]))
{
t := v.Type
ptr := v.Args[0]
idx := v.Args[1]
if !(config.PtrSize == 8) {
goto end47a5f1d1b158914fa383de024bbe3b08
x := v.Args[0]
if v.Args[1].Op != OpConst8 {
goto endae44f60f364cddd8903763dd921a007e
}
v.Op = OpAddPtr
c := v.Args[1].AuxInt
v.Op = OpRsh8x64
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v.AddArg(ptr)
v0 := b.NewValue0(v.Line, OpMul64, config.fe.TypeInt())
v0.AddArg(idx)
v1 := b.NewValue0(v.Line, OpConst64, config.fe.TypeInt())
v1.AuxInt = t.Elem().Size()
v0.AddArg(v1)
v.AddArg(x)
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = int64(uint8(c))
v.AddArg(v0)
return true
}
goto end47a5f1d1b158914fa383de024bbe3b08
end47a5f1d1b158914fa383de024bbe3b08:
goto endae44f60f364cddd8903763dd921a007e
endae44f60f364cddd8903763dd921a007e:
;
return false
}
......@@ -4652,8 +6888,7 @@ end5c6fab95c9dbeff5973119096bfd4e78:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst16, t)
v0.AuxInt = -c
v.AddArg(v0)
v.AddArg(x)
......@@ -4770,8 +7005,7 @@ end7623799db780e1bcc42c6ea0df9c49d3:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst32, t)
v0.AuxInt = -c
v.AddArg(v0)
v.AddArg(x)
......@@ -4888,8 +7122,7 @@ end5a84a285ff0ff48b8ad3c64b15e3459f:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst64, t)
v0.AuxInt = -c
v.AddArg(v0)
v.AddArg(x)
......@@ -5006,8 +7239,7 @@ endc00ea11c7535529e211710574f5cff24:
v.AuxInt = 0
v.Aux = nil
v.resetArgs()
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
v0.Type = t
v0 := b.NewValue0(v.Line, OpConst8, t)
v0.AuxInt = -c
v.AddArg(v0)
v.AddArg(x)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment