Repository: yberreby/rgo Branch: master Commit: 06295d288670 Files: 28 Total size: 989.0 KB Directory structure: gitextract_6x5ebcjo/ ├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── Cargo.toml ├── README.md ├── benches/ │ └── parse.rs ├── misc/ │ ├── log.md │ └── selector-inconsistency.md ├── src/ │ ├── ast/ │ │ ├── expressions.rs │ │ ├── mod.rs │ │ ├── statements.rs │ │ └── types.rs │ ├── lexer/ │ │ ├── mod.rs │ │ └── test.rs │ ├── lib.rs │ ├── main.rs │ ├── parser/ │ │ ├── error.rs │ │ ├── mod.rs │ │ └── test.rs │ ├── pos.rs │ └── token.rs └── tests/ ├── data/ │ └── pass/ │ ├── arithConst_ssa.go │ ├── hello.go │ ├── precedence.go │ ├── rewriteAMD64.go │ ├── simplest.go │ └── viper.go └── runner.rs ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ target callgrind.out.* /tmp ================================================ FILE: .travis.yml ================================================ language: rust rust: - nightly - beta - stable notifications: email: false ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing You can find sections of the code in need of attention by exploring GitHub issues, and/or with the help of grep: ``` shell $ grep -RE 'XXX|TODO|FIXME|unimplemented' src ``` Contributions are encouraged, but to maintain a high level of quality, we ask that you follow the guidelines laid out in this document. ## Guidelines **Run tests** with `cargo test` after your committing your changes. We use [`rustfmt`](https://github.com/rust-lang-nursery/rustfmt) to maintain a consistent style throughout the project. Please run the latest version of `rustfmt` on your code before submitting a PR. Put tests for a module in a separate file named `test.rs`, and import them like so from the module you want to test: ```rust #[cfg(test)] mod test; ``` Rebase your changes on top of `origin/master` before submitting a PR, to keep your branch up-to-date. When in doubt, [refer to the Go spec](https://golang.org/ref/spec). ### Git Best Practices We want to keep the git history as clean as possible. If you need to make changes to a Pull Request after submitting it, please include them in your previous commit(s) and force-push instead of adding new commits. You can do so by staging your changes and running `git commit --amend`. If the `master` branch is updated while your PR is open, **do not merge it** into your feature branch. Instead, rebase your branch on top of `origin/master` and force-push to your fork. Where possible, please avoid mixing up many unrelated changes in single PR; prefer making several smaller PRs instead. If you have to change many things in a single PR, try to separate them into semantically meaningul commits. This is not a hard rule, but it is preferred. ================================================ FILE: Cargo.toml ================================================ [package] authors = ["Yohai Berreby (yberreby) "] description = "A work-in-progress Go compiler toolchain." license = "MIT/Apache-2.0" name = "rgo" repository = "https://github.com/yberreby/rgo" version = "0.1.0" [dependencies] convenience = "0.1.0" env_logger = "0.3.3" lazy_static = "0.2.0" log = "0.3.6" num = "0.1" quick-error = "1.0.0" time = "0.1.35" [dependencies.clippy] optional = true version = "0.0.63" [dev-dependencies] colored = "1.2.0" convenience = "0.1.0" [features] default = [] [profile] [profile.dev] debug = true [profile.release] debug = true [[test]] harness = false name = "runner" [[bin]] name = "rgo" doc = false path = "src/main.rs" ================================================ FILE: README.md ================================================ # rgo (stalled) [![Build Status](https://travis-ci.org/yberreby/rgo.svg?branch=master)](https://travis-ci.org/yberreby/rgo) `rgo` was a work-in-progress Go compiler, written in Rust. This was primarily a fun learning project. I chose Go as the source language because C compilers have been written over and over, and I wanted to do something new. Go's spec is pretty simple, so it seemed like a good choice. The fact that is has a GC also made implementing a compiler for it more challenging and, therefore, more interesting. Additionally, Go's reference implementation uses a custom backend for optimization and codegen, while `rgo` was to use LLVM for optimization and machine code generation. ## License Copyright (c) 2016 The `rgo` Project Developers. Licensed under either of * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) * [MIT license](http://opensource.org/licenses/MIT) at your option. ### Contribution Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. ================================================ FILE: benches/parse.rs ================================================ #![feature(test)] /// Utility macro to bench test files one by one. macro_rules! bench_lex { ($name:ident, $path:expr) => { #[allow(non_snake_case)] mod $name { extern crate convenience; extern crate test; extern crate rgo; use self::test::Bencher; use std::path::Path; use std::path::PathBuf; fn test_path>(path: P) -> PathBuf { let mut new = PathBuf::from(env!("CARGO_MANIFEST_DIR")); new.push("tests"); new.push("data"); new.push(path.as_ref()); new } #[bench] fn bench_lex(b: &mut Bencher) { let src = convenience::read_file(test_path($path)).unwrap(); b.bytes = src.len() as u64; b.iter(|| { rgo::lexer::tokenize(&src); }); } } } } bench_lex!(viper, "pass/viper.go"); bench_lex!(hello, "pass/hello.go"); bench_lex!(arithConst_ssa, "pass/arithConst_ssa.go"); bench_lex!(rewriteAMD64, "pass/rewriteAMD64.go"); ================================================ FILE: misc/log.md ================================================ # Log This is the log file for the `rgo` project. I (@yberreby) write my thoughts down periodically. I hope this will help understand the history of the project as it grows and time passes. ## Sun Mar 27 - Starting the journey I've always wanted to write a compiler or an interpreter - *something* that takes code and turns it into something runnable. Lisp has been reimplemented again and again, and was too simple. C compilers are also commonplace, AND the language is, well, not a joy to work with. So I chose Go. I dislike many of the language's design choices but it seemed like a good fit. To my knowledge, there is no reimplementation of the Go compiler in Rust or similar languages, so I decided to write one. There's an additional challenge: I know very, very little Go. As of writing, I've only written a few hundred lines of Go, and found two bugs in the viper package. So I'm learning more Go by writing a compiler for it :) I'm starting with parsing. I have received no formal education on compilers, but as far as I know, the first step toward building a compiler is to parse the source code into an Abstract Syntax Tree, or AST. To do that, I'm using the [Go Specification](https://golang.org/ref/spec) to look up the syntax of various constructs and translating that into a bunch of Rust structs and enums. This is somewhat tedious, but I'm learning a few things about Go's syntax along the way. ## Wed Mar 30 19:18 - Thoughts on testing A *critical* part of a complex system like a compiler is testing, so we'll want to write a lot of tests to cover as much surface as possible. There are three main things we want to test: - lexical analysis - parsing - translation If all three phases works correctly, we have are likely to produce a correct program. Now, we would only test the *output* of the program, because in most cases, if either lexical analysis or parsing produce incorrect results or fail, the output of the compiled program will be wrong. The advantage of this approach is that it's easier to write tests for a handful of big, complex programs than for a myriad of very small programs. The disadvantage is that in case there's a failure, it's much harder to track it down to the piece of code that is responsible. I think it is best to combine the two approaches: integration tests that only care about the output, and unit tests that care only about a very small part of the code. Lexing should be very easy to test; parsing, a bit harder, as AFAIK it requires more context (e.g. `foo` can be a package name, a package alias, a constant, a function parameter...). ## Thu Mar 31 15:16 - Next steps The lexer can now tokenize a "Hello, rgo" program properly! Next steps: integer literals (very easy); semicolon; various compound tokens. ## Sun Apr 3 12:12 - Whitespace When I started writing the lexer, I've made the decision to tokenize *all* whitespace, in order to decouple lexing from semicolon insertion. Unfortunately, this led to an unnecessarily verbose token string (e.g. `PACKAGE, WHITESPACE, IDENT("main")` - the `WHITESPACE` token is 100% useless AFAICT), as well as the unability to distinguish insignificant whitespace, such as ten spaces one after the other, from significant whitespace (newlines). I've just changed that: insignificant whitespace is now ignored, and contiguous blocks of significant whitespace are tokenized as a single `WHITESPACE` token. We'll see how well this works out in practice, but I feel good about this change. ## Sun Apr 3 15:23 - Done & Next steps `test-data/viper.go` can now be tokenized without panicking! Next steps: In lexer: float, complex/imaginary, raw string and rune literals. Then, the parser. First goal: parsing a "Hello, rgo" program. Then write unit tests for various constructs. Then integration tests using complex source files from big Go projects. ## Sun Apr 10 10:59:15 - Done & Next steps Package clauses and import declarations can now be parsed. String literal parsing is _very_ hackish, though: interpreted strings are not actually interpreted, but treated like raw strings. This is bad. Added a "progress.md" file that will help me keep track of what I need to do next. ## Fri Apr 15 13:45 - Progress report and some notes - we need a _lot_ of tests, that make sure to trigger every corner case under the sun. A good idea may be to reuse Go's test suite, but I'm not sure how hard that would be. What _is_ certain is that correctness is a priority. - the lexer does not handle complex numbers, runes, floats, hexadecimal integers... but kind-of works for simple programs. - the parser has been substantially improved but I dislike the complexity of token pattern matching. Ideally we'd have a nice, float hierachy of tokens, but then we lose some type safety... - I still have no idea how I'll go about generating LLVM IR. I'm also not sure whether the visitor pattern will be useful, and if it is, how to implement it since my AST is basically a deeply nested hierarchy of structs and enums. - Writing a compiler is fun! I don't know how far I'll take this, but so far, it has been an extremely valuable experience. I encourage anyone who's reading this and still hesitating to try, if only for the experience they will gain. ================================================ FILE: misc/selector-inconsistency.md ================================================ https://play.golang.org/p/Xne3T3CL7d ```go package main import ( "go/ast" "go/parser" "go/token" ) func main() { // src is the input for which we want to print the AST. src := ` package main func foo(x (func(a ...interface{}) (n int, err error))) {} func main() { println("Hello, World!") foo(fmt.Println) } ` // Create the AST by parsing src. fset := token.NewFileSet() // positions are relative to fset f, err := parser.ParseFile(fset, "", src, 0) if err != nil { panic(err) } // Print the AST. ast.Print(fset, f) } ``` Excerpt from the output: ``` 1: *ast.ExprStmt { 160 . . . . . . X: *ast.CallExpr { 161 . . . . . . . Fun: *ast.Ident { 162 . . . . . . . . NamePos: 8:2 163 . . . . . . . . Name: "foo" 164 . . . . . . . . Obj: *(obj @ 11) 165 . . . . . . . } 166 . . . . . . . Lparen: 8:5 167 . . . . . . . Args: []ast.Expr (len = 1) { 168 . . . . . . . . 0: *ast.SelectorExpr { 169 . . . . . . . . . X: *ast.Ident { 170 . . . . . . . . . . NamePos: 8:6 171 . . . . . . . . . . Name: "fmt" 172 . . . . . . . . . } 173 . . . . . . . . . Sel: *ast.Ident { 174 . . . . . . . . . . NamePos: 8:10 175 . . . . . . . . . . Name: "Println" 176 . . . . . . . . . } 177 . . . . . . . . } 178 . . . . . . . } 179 . . . . . . . Ellipsis: - 180 . . . . . . . Rparen: 8:17 181 . . . . . . } 182 . . . . . } ``` MethodExpr < SelectorExpr, basically. I thought the Go AST would differentiate between method expressions (`Type.MethodName`) and selector expressions (`someExpr.someField`, `foo().bar`...), but it doesn't, because treating them as the same thing makes compilation easier... ================================================ FILE: src/ast/expressions.rs ================================================ use lexer::TokenKind; use token::Spanned; use super::{Arguments, Conversion, Type, Ident, MaybeQualifiedIdent, Literal}; // Expr = UnaryExpr | Expr binary_op Expr . // UnaryExpr = PrimaryExpr | unary_op UnaryExpr . // // binary_op = "||" | "&&" | rel_op | add_op | mul_op . // rel_op = "==" | "!=" | "<" | "<=" | ">" | ">=" . // add_op = "+" | "-" | "|" | "^" . // mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" . // // unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" . // I went for a strongly-typed approach here: instead of having one giant, flat `Expr` enum, I // chose a deeply nested hierarchy. // // Advantage: more type-safety. // Disadvantages: // - takes up more space because Rust doesn't collapse nested enum tags // - more verbose #[derive(Debug, Clone, PartialEq, Eq)] pub enum Expr { Unary(UnaryExpr), Binary(BinaryExpr), } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum BinaryOperator { Add, Sub, Mul, Div, Rem, BitAnd, BitOr, BitXor, BitClear, LeftShift, RightShift, Equals, NotEqual, LessThan, LessThanOrEqual, GreaterThan, GreaterThanOrEqual, LogAnd, LogOr, } impl BinaryOperator { pub fn from_token_kind(tok: TokenKind) -> Option { use self::BinaryOperator::*; Some(match tok { TokenKind::Plus => Add, TokenKind::Minus => Sub, TokenKind::Star => Mul, TokenKind::Slash => Div, TokenKind::Percent => Rem, TokenKind::And => BitAnd, TokenKind::Or => BitOr, TokenKind::Caret => BitXor, TokenKind::BitClear => BitClear, TokenKind::Lshift => LeftShift, TokenKind::Rshift => RightShift, TokenKind::Equals => Equals, TokenKind::NotEqual => NotEqual, TokenKind::LessThan => LessThan, TokenKind::LessThanOrEqual => LessThanOrEqual, TokenKind::GreaterThan => GreaterThan, TokenKind::GreaterThanOrEqual => GreaterThanOrEqual, TokenKind::AndAnd => LogAnd, TokenKind::OrOr => LogOr, _ => return None, }) } pub fn from_token_kind_assign_op(tok: TokenKind) -> Option { use self::BinaryOperator::*; Some(match tok { TokenKind::PlusAssign => Add, TokenKind::MinusAssign => Sub, TokenKind::StarAssign => Mul, TokenKind::SlashAssign => Div, TokenKind::PercentAssign => Rem, TokenKind::AndAssign => BitAnd, TokenKind::OrAssign => BitOr, TokenKind::CaretAssign => BitXor, TokenKind::BitClearAssign => BitClear, TokenKind::LshiftAssign => LeftShift, TokenKind::RshiftAssign => RightShift, _ => return None, }) } pub fn precedence(self) -> i32 { use self::BinaryOperator::*; match self { Mul | Div | Rem | LeftShift | RightShift | BitAnd | BitClear => 5, Add | Sub | BitOr | BitXor => 4, Equals | NotEqual | LessThan | LessThanOrEqual | GreaterThan | GreaterThanOrEqual => 3, LogAnd => 2, LogOr => 1, } } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct BinaryExpr { pub lhs: Box>, pub op: BinaryOperator, pub rhs: Box>, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum UnaryExpr { Primary(Box), UnaryOperation(UnaryOperation), } #[derive(Debug, Clone, PartialEq, Eq)] pub struct UnaryOperation { pub operator: UnaryOperator, // TODO: type safety pub operand: Box>, } // TODO /// A unary operator. /// /// ## Grammar /// /// ```ignore /// unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub enum UnaryOperator { Plus, Minus, Not, Xor, Deref, And, ChanReceive, } impl UnaryOperator { pub fn from_token_kind(k: TokenKind) -> Option { use self::UnaryOperator::*; Some(match k { TokenKind::Plus => Plus, TokenKind::Minus => Minus, TokenKind::Not => Not, TokenKind::Caret => Xor, TokenKind::Star => Deref, TokenKind::And => And, TokenKind::Arrow => ChanReceive, _ => return None, }) } } // pub enum // Primary expressions. // PrimaryExpr = // Operand | // Conversion | // PrimaryExpr Selector | // PrimaryExpr Index | // PrimaryExpr Slice | // PrimaryExpr TypeAssertion | // PrimaryExpr Arguments . // // Selector = "." identifier . // Index = "[" Expr "]" . // Slice = "[" ( [ Expr ] ":" [ Expr ] ) | // ( [ Expr ] ":" Expr ":" Expr ) // "]" . // TypeAssertion = "." "(" Type ")" . // Arguments = "(" [ ( ExprList | Type [ "," ExprList ] ) [ "..." ] [ "," ] ] ")". // Conversion = Type "(" Expression [ "," ] ")" . /// Primary expressions are the operands for unary and binary expressions. #[derive(Debug, Clone, PartialEq, Eq)] pub enum PrimaryExpr { Operand(Operand), Conversion(Conversion), SelectorExpr(SelectorExpr), Indexing(IndexExpr), Slicing(SliceExpr), TypeAssertion(TypeAssertion), FuncCall(FuncCall), } /// Operands denote the elementary values in an expression. An operand may be a literal, a /// (possibly qualified) non-blank identifier denoting a constant, variable, or function, a method /// expression yielding a function, or a parenthesized expression. // XXX/FIXME/TODO: not finished. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Operand { /// A literal. Lit(Literal), /// An identifier denoting a constant, a variable or a function. MaybeQualifiedIdent(MaybeQualifiedIdent), /// A method expression. MethodExpr(MethodExpr), /// A parenthesized expression. Expr(Expr), } /// A selector expression. /// /// ## Grammar /// /// ```ignore /// SelectorExpr = PrimaryExpr "." identifier . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct SelectorExpr { pub operand: Box, pub selector: Ident, } /// An index expression. /// /// ## Grammar /// /// ```ignore /// IndexExpr = PrimaryExpr "[" Expression "]" . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct IndexExpr { pub operand: Box>, pub index: Spanned, } /// A slice expression. /// /// ## Grammar /// /// ```ignore /// SliceExpr = PrimaryExpr "[" ( [ Expression ] ":" [ Expression ] ) | /// ( [ Expression ] ":" Expression ":" Expression ) /// "]" . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct SliceExpr { pub operand: Box>, pub slicing: Slicing, } // XXX: naming // From the Go spec: // // For an array, pointer to array, or slice a (but not a string), the primary expression // // a[low : high : max] // // constructs a slice of the same type, and with the same length and elements as the simple slice // expression a[low : high]. Additionally, it controls the resulting slice's capacity by setting it // to max - low. Only the first index may be omitted; it defaults to 0. After slicing the array a #[derive(Debug, Clone, PartialEq, Eq)] pub struct Slicing { pub low: Spanned, pub high: Spanned, pub max: Option>, } /// A TypeAssertion contains the expression whose type is being asserted. /// This superficially differs from the grammar in the Go spec. // XXX: wrap both fields in Spanned #[derive(Debug, Clone, PartialEq, Eq)] pub struct TypeAssertion { /// The expression whose type is being asserted. pub expr: Box, /// The 'target type'. /// If None, we're in a type switch (`x.(type)` - with the literal `type` keyword). pub typ: Option, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct FuncCall { pub callee: Box>, pub args: Arguments, } /// A method expression. /// /// If M is in the method set of type T, T.M is a function that is callable as a regular function /// with the same arguments as M prefixed by an additional argument that is the receiver of the /// method. /// /// ## Grammar /// /// ```ignore /// MethodExpr = ReceiverType "." MethodName . /// ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct MethodExpr { /// Receiver type. pub receiver: Type, /// Name of the method. pub name: String, } ================================================ FILE: src/ast/mod.rs ================================================ //! The Abstract Syntax Tree. //! //! If you want to learn more, it is recommended to read the [Go language //! specification](https://golang.org/ref/spec). //! //! This module needs attention. mod types; mod statements; mod expressions; use num::bigint::BigInt; use num::BigRational; use token::Spanned; pub use self::types::*; pub use self::statements::*; pub use self::expressions::*; // XXX: We may want to intern strings later on. // XXX: should we use aliases? Or resolve them in doc comments? pub type Ident = String; pub type TypeName = MaybeQualifiedIdent; pub type MethodName = Ident; /// A complete source file. /// /// ## Grammar /// /// ```ignore /// SourceFile = PackageClause ";" { ImportDecl ";" } { TopLevelDecl ";" } . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct SourceFile { /// Name of the package this file belongs to. pub package: Ident, /// All import declarations in this file. pub import_decls: Vec>, /// All top-level declarations in this file. pub top_level_decls: Vec, } /// An import declaration. /// Contains a list of "import specs". /// /// ## Grammar /// /// ```ignore /// ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) . /// ``` /// /// Example: /// /// ``` go /// import ( /// "fmt" /// "io/ioutil" /// ) /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct ImportDecl { pub specs: Vec>, } /// An import spec. /// /// This can only appear in an import declaration (AFAIK). /// /// ## Grammar /// /// ```ignore /// ImportSpec = [ "." | PackageName ] ImportPath . /// ImportPath = string_lit . /// ``` /// /// Example: /// /// ```ignore /// m "lib/math" /// ``` /// /// This imports `lib/math` as `m`. #[derive(Debug, Clone, PartialEq, Eq)] pub struct ImportSpec { pub kind: ImportKind, pub path: Spanned>, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum ImportKind { /// Regular import: the kind you encounter most often. Normal, /// Aliased import: defines an alias for the imported package. Alias(String), /// Glob import: all the package's exported identifiers will be declared in the importing /// source file. Glob, } #[derive(Debug, Clone, PartialEq, Eq)] /// A top-level declaration - i.e. a declaration that may appear immediately after import /// declarations. pub enum TopLevelDecl { Statement(DeclStmt), Func(FuncDecl), Method(MethodDecl), } // From the Go spec: // // FunctionDecl = "func" FunctionName ( Function | Signature ) . // FunctionName = identifier . // Function = Signature FunctionBody . // FunctionBody = Block . #[derive(Debug, Clone, PartialEq, Eq)] pub struct FuncDecl { // XXX: functions with same name but different origins, how do we handle them? pub name: Spanned, pub signature: FuncSignature, pub body: Option, } /// A function signature: return type(s) and argument types. #[derive(Debug, Clone, PartialEq, Eq)] pub struct FuncSignature { pub parameters: Parameters, // Yes, the result of a function is a `Parameters` struct. pub result: Parameters, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Parameters { pub decls: Vec, } impl Parameters { /// Create an empty parameter list. pub fn empty() -> Parameters { Parameters { decls: Vec::new() } } /// Create a parameter list containing a single, unnamed type. pub fn from_single_type(t: Type) -> Parameters { Parameters { decls: vec![ParameterDecl { identifiers: vec![], typ: t, variadic: false, }], } } } // TODO: variadic functions. #[derive(Debug, Clone, PartialEq, Eq)] pub struct ParameterDecl { pub identifiers: Vec, /// The type assigned to every identifier in this declaration. pub typ: Type, // XXX: review this. // ONLY the last ParameterDecl of a Parameters struct may be variadic. // And only if it's part of _input_ parameters. pub variadic: bool, } // XXX: types need attention. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Type { Plain(MaybeQualifiedIdent), Literal(Box), } #[derive(Debug, Clone, PartialEq, Eq)] pub enum TypeLiteral { Array(ArrayType), Struct(StructType), Pointer(PointerType), Func(FuncType), Interface(InterfaceType), Slice(SliceType), Map(MapType), Chan(ChanType), } #[derive(Debug, Clone, PartialEq, Eq)] pub enum Literal { Basic(BasicLit), Composite(CompositeLit), Func(FuncLit), } /// A _potentially_ qualified identifier (e.g. `math.Sin`, but also `someUnqualifiedIdent`). /// /// "A qualified identifier is an identifier qualified with a package name prefix." #[derive(Debug, Clone, PartialEq, Eq)] pub struct MaybeQualifiedIdent { pub package: Option, pub name: Ident, } /// A constant declaration binds a list of identifiers (the names of the constants) to the values /// of a list of constant expressions. /// /// ## Grammar /// /// ```ignore /// ConstDecl = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) . /// ``` /// /// Example: `const Pi float64 = 3.14159265358979323846` #[derive(Debug, Clone, PartialEq, Eq)] pub struct ConstDecl { pub specs: Vec, } // TODO: docs /// ## Grammar /// /// ```ignore /// ConstSpec = IdentifierList [ [ Type ] "=" ExpressionList ] . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct ConstSpec { pub idents: Vec>, pub inner: Option, } // XXX: naming #[derive(Debug, Clone, PartialEq, Eq)] pub struct ConstSpecInner { pub typ: Option, pub exprs: Vec, } /// A method is a function with a receiver. A method declaration binds an identifier, the method /// name, to a method, and associates the method with the receiver's base type. /// /// ## Grammar /// /// ```ignore /// MethodDecl = "func" Receiver MethodName ( Function | Signature ) . /// Receiver = Parameters . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct MethodDecl { pub receiver: Parameters, pub name: Spanned, pub signature: FuncSignature, pub body: Option, } /// A type declaration binds an identifier, the type name, to a new type that has the same /// underlying type as an existing type, and operations defined for the existing type are also /// defined for the new type. /// /// ## Grammar /// /// ```ignore /// TypeDecl = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) . /// TypeSpec = identifier Type . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct TypeDecl { pub specs: Vec>, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct TypeSpec { pub ident: Spanned, pub typ: Spanned, } /// A variable declaration creates one or more variables, binds corresponding identifiers to them, /// and gives each a type and an initial value. /// /// ## Grammar /// /// ```ignore /// VarDecl = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct VarDecl { pub specs: Vec>, } /// ## Grammar /// /// ```ignore /// VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct VarSpec { pub idents: Vec>, pub typ: Option, pub exprs: Vec>, } /// Conversions are expressions of the form T(x) where T is a type and x is an expression that can /// be converted to type T. /// /// ## Grammar /// /// ```ignore /// Conversion = Type "(" Expression [ "," ] ")" . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct Conversion { /// The type to convert to. pub typ: Spanned, /// The expression being converted. pub expr: Spanned, } // ShortVarDecl = IdentifierList ":=" ExpressionList . #[derive(Debug, Clone, PartialEq, Eq)] pub struct ShortVarDecl { pub lhs: Vec>, pub rhs: Vec>, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Block(pub Vec); // XXX/FIXME: review and fix this. #[derive(Debug, Clone, PartialEq, Eq)] pub enum BasicLit { Int(BigInt), Float(BigRational), Imaginary(BigRational), Rune(char), Str(Vec), } /// Composite literals construct values for structs, arrays, slices, and maps and create a new /// value each time they are evaluated. They consist of the type of the literal followed by a /// brace-bound list of elements. Each element may optionally be preceded by a corresponding key. /// /// ## Grammar /// /// ```ignore /// CompositeLit = LiteralType LiteralValue . /// LiteralType = StructType | ArrayType | "[" "..." "]" ElementType | /// SliceType | MapType | TypeName . /// LiteralValue = "{" [ ElementList [ "," ] ] "}" . /// ElementList = KeyedElement { "," KeyedElement } . /// KeyedElement = [ Key ":" ] Element . /// Key = FieldName | Expression | LiteralValue . /// FieldName = identifier . /// Element = Expression | LiteralValue . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct CompositeLit { pub typ: Spanned, pub val: LiteralValue, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum LiteralType { Struct(StructType), Array(ArrayType), // FIXME: MISSING: `[...]int` array (computes size at compile time) Slice(SliceType), Map(MapType), Type(MaybeQualifiedIdent), } #[derive(Debug, Clone, PartialEq, Eq)] pub struct LiteralValue { pub elems: Vec, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct KeyedElem { pub key: Option>, pub elem: Spanned, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum Key { FieldName(Ident), Expr(Expr), LiteralValue(LiteralValue), } #[derive(Debug, Clone, PartialEq, Eq)] pub enum Elem { Expr(Expr), LiteralValue(LiteralValue), } /// A function literal represents an anonymous function. /// /// ## Grammar /// /// ```ignore /// FunctionLit = "func" Function . /// Function = Signature FunctionBody . /// FunctionBody = Block . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct FuncLit { pub signature: FuncSignature, pub body: Block, } #[derive(Debug, Clone, PartialEq, Eq)] /// A list of arguments being passed to a function. /// /// Arguments can't just be a list of expressions, because Go has a built-in generic generic /// functions: `make` and `new`, and these functions take a **type** instead of an expression /// as their first argument. pub struct Arguments { pub typ: Option>, pub expressions: Vec>, } ================================================ FILE: src/ast/statements.rs ================================================ use super::{Block, Expr, ShortVarDecl, ConstDecl, TypeDecl, VarDecl, BinaryOperator}; use token::Spanned; // Statement = // Declaration | LabeledStmt | SimpleStmt | // GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt | // FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt | // DeferStmt . // // SimpleStmt = EmptyStmt | ExprStmt | SendStmt | IncDecStmt | Assignment | ShortVarDecl . #[derive(Debug, Clone, PartialEq, Eq)] pub enum Statement { Decl(DeclStmt), Labeled(LabeledStmt), Simple(SimpleStmt), Go(GoStmt), Return(ReturnStmt), Break(BreakStmt), Continue(ContinueStmt), Goto(GotoStmt), Fallthrough(FallthroughStmt), Block(Block), If(IfStmt), Switch(SwitchStmt), Select(SelectStmt), For(ForStmt), Defer(DeferStmt), Empty(EmptyStmt), } macro_rules! enum_from_impl { ($enum_type:ident, $(($enum_variant:ident, $inner_type:ty)),*) => { $( impl From<$inner_type> for $enum_type { fn from(x: $inner_type) -> $enum_type { $enum_type::$enum_variant(x) } } )* } } enum_from_impl!(Statement, (Decl, DeclStmt), (Labeled, LabeledStmt), (Simple, SimpleStmt), (Go, GoStmt), (Return, ReturnStmt), (Break, BreakStmt), (Continue, ContinueStmt), (Goto, GotoStmt), (Fallthrough, FallthroughStmt), (Block, Block), (If, IfStmt), (Switch, SwitchStmt), (Select, SelectStmt), (For, ForStmt), (Defer, DeferStmt), (Empty, EmptyStmt)); /// A simple statement. #[derive(Debug, Clone, PartialEq, Eq)] pub enum SimpleStmt { EmptyStmt, Expr(Spanned), Send(SendStmt), IncDec(IncDecStmt), Assignment(Assignment), ShortVarDecl(ShortVarDecl), } #[derive(Debug, Clone, PartialEq, Eq)] pub struct LabeledStmt; /// A "go" statement starts the execution of a function call as an independent concurrent thread of /// control, or goroutine, within the same address space. #[derive(Debug, Clone, PartialEq, Eq)] pub struct GoStmt { /// The function or method call being started. pub call: Spanned, } /// A "defer" statement invokes a function whose execution is deferred to the moment the /// surrounding function returns, either because the surrounding function executed a return /// statement, reached the end of its function body, or because the corresponding goroutine is /// panicking. #[derive(Debug, Clone, PartialEq, Eq)] pub struct DeferStmt { /// The function or method call being deferred. pub call: Spanned, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ReturnStmt { /// The expression being returned. pub expr: Spanned, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct BreakStmt { /// An optional label referring to an enclosing "for", "switch", or "select". pub label: Option>, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ContinueStmt { /// An optional label referring to an enclosing "for", "switch", or "select". pub label: Option>, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct GotoStmt { pub label: Spanned, } /// "Fallthrough" statements contain no associated data! #[derive(Debug, Clone, PartialEq, Eq)] pub struct FallthroughStmt; /// "If" statements specify the conditional execution of two branches according to the value of a /// boolean expression. If the expression evaluates to true, the "if" branch is executed, /// otherwise, if present, the "else" branch is executed. /// /// The expression may be preceded by a simple statement, which executes before the expression is /// evaluated. #[derive(Debug, Clone, PartialEq, Eq)] pub struct IfStmt { pub before_stmt: Option>, pub condition: Spanned, pub block: Block, pub opt_else: Option>, } /// The "else" portion of an if statement. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Else { /// `else if { ... }` If(IfStmt), /// `else { ... }` Block(Block), } #[derive(Debug, Clone, PartialEq, Eq)] pub struct SwitchStmt; #[derive(Debug, Clone, PartialEq, Eq)] pub struct SelectStmt; #[derive(Debug, Clone, PartialEq, Eq)] pub struct ForStmt { /// The "header" is the part of of a `for` that comes before the body. pub header: ForHeader, pub body: Block, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum ForHeader { Condition(Expr), ForClause(ForClause), RangeClause(RangeClause), } // Grammar: // // ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] . // InitStmt = SimpleStmt . // PostStmt = SimpleStmt . // Condition = Expression . #[derive(Debug, Clone, PartialEq, Eq)] pub struct ForClause { pub init: Option, pub condition: Option, pub post: Option, } // RangeClause = [ ExpressionList "=" | IdentifierList ":=" ] "range" Expression . #[derive(Debug, Clone, PartialEq, Eq)] pub struct RangeClause { /// The iteration variables. pub iter_vars: IterVars, /// The range expression. pub expr: Spanned, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum IterVars { Exprs(Vec>), Idents(Vec>), } // SendStmt = Channel "<-" Expression . // Channel = Expression . #[derive(Debug, Clone, PartialEq, Eq)] pub struct SendStmt { pub channel: Spanned, pub expr: Spanned, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct IncDecStmt { pub expr: Spanned, pub is_dec: bool, // false for ++, true for -- } // Assignment = ExpressionList assign_op ExpressionList . // assign_op = [ add_op | mul_op ] "=" . #[derive(Debug, Clone, PartialEq, Eq)] pub struct Assignment { pub lhs: Vec>, pub rhs: Vec>, // binary operation used in assign op // XXX: add method to BinaryOperator to check if is a valid assign_op operation pub op: Option, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct EmptyStmt; // Declaration = ConstDecl | TypeDecl | VarDecl . /// A statement declaration. #[derive(Debug, Clone, PartialEq, Eq)] pub enum DeclStmt { Const(ConstDecl), TypeDecl(TypeDecl), VarDecl(VarDecl), } ================================================ FILE: src/ast/types.rs ================================================ use super::*; /// An array type. /// /// ## Grammar /// /// ```ignore /// ArrayType = "[" ArrayLength "]" ElementType . /// ArrayLength = Expression . /// ElementType = Type . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct ArrayType { pub len: Expr, pub element_type: Type, } /// A struct type. /// /// ## Grammar /// /// ```ignore /// StructType = "struct" "{" { FieldDecl ";" } "}" . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct StructType { pub field_decls: Vec, } /// An inner field decl. /// /// ## Grammar /// /// ```ignore /// FieldDecl = (IdentifierList Type | AnonymousField) [ Tag ] . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct FieldDecl { pub inner: InnerFieldDecl, pub tag: Option>, // Go string literal; TODO proper wrapper type } /// An InnerFieldDecl. /// /// ## Grammar /// /// ```ignore /// AnonymousField = [ "*" ] TypeName . /// Tag = string_lit . /// TypeName = identifier | QualifiedIdent . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub enum InnerFieldDecl { Named { idents: Vec, typ: Type, }, Anonymous { is_ptr: bool, type_name: MaybeQualifiedIdent, }, } /// A type which is a pointer to a base type. #[derive(Debug, Clone, PartialEq, Eq)] pub struct PointerType(pub Type); /// A function type denotes the set of all functions with the same parameter and result types. The /// value of an uninitialized variable of function type is nil. /// /// ## Grammar /// /// ```ignore /// FunctionType = "func" Signature . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct FuncType { pub signature: FuncSignature, } /// An interface type specifies a method set called its interface. /// /// ## Grammar /// /// ```ignore /// InterfaceType = "interface" "{" { MethodSpec ";" } "}" . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct InterfaceType { pub specs: Vec, } /// An interface method spec. /// /// ## Grammar /// /// ```ignore /// MethodSpec = MethodName Signature | InterfaceTypeName . /// MethodName = identifier . /// InterfaceTypeName = TypeName . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct MethodSpec { pub name: Ident, pub method: InnerMethodSpec, } // XXX: naming things is hard #[derive(Debug, Clone, PartialEq, Eq)] pub enum InnerMethodSpec { Signature(FuncSignature), InterfaceName(TypeName), } /// A slice type denotes the set of all slices of arrays of its element type. /// /// ## Grammar /// /// ```ignore /// SliceType = "[" "]" ElementType . /// ElementType = Type . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct SliceType { pub element_type: Type, } /// A map is an unordered group of elements of one type, called the element type, indexed by a set /// of unique keys of another type, called the key type. /// ## Grammar /// /// ```ignore /// MapType = "map" "[" KeyType "]" ElementType . /// KeyType = Type . /// ElementType = Type . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct MapType { pub key_type: Type, pub element_type: Type, } /// A channel provides a mechanism for concurrently executing functions to communicate by sending /// and receiving values of a specified element type. /// /// ## Grammar /// /// ```ignore /// ChannelType = ( "chan" | "chan" "<-" | "<-" "chan" ) ElementType . /// ElementType = Type . /// ``` #[derive(Debug, Clone, PartialEq, Eq)] pub struct ChanType { pub element_type: Type, pub direction: ChanDirection, } /// The optional <- operator specifies the **channel direction**, send or receive. If no direction /// is given, the channel is bidirectional. #[derive(Debug, Clone, PartialEq, Eq)] pub enum ChanDirection { /// No arrow. Bidirectional, /// Arrow on the right: `chan<-` Send, /// Arrow on the left: `<-chan` Receive, } ================================================ FILE: src/lexer/mod.rs ================================================ //! # Lexer //! //! A `Lexer` parses a source string into a list of tokens, which may later be used to construct an //! Abstract Syntax Tree. //! //! ## Notes //! //! - We want meaningful errors from the start. That means printing the line and column number on //! error, returning `Result`s instead of panicking (later on, we may use unwinding to speed up //! lexical analysis in non-erroneous cases). //! //! - It is unclear whether we should operator on Unicode `char`, or plain bytes `u8`. `char`s are //! more convenient to display and offer a clean API; bytes are (most likely) faster to work with. //! //! - I'm not sure what the best way to store tokens is. A slice into the original source, an //! interned string...? Probably an interned string, this is what rustc uses and it speeds up //! comparisons, which are going to be very frequent. Probably reduces allocations, too - and we're //! allocating a _lot_. We'd have to benchmark to be sure. use std::iter::Iterator; pub use token::*; #[cfg(test)] mod test; pub struct Lexer<'src> { /// Byte offset from the start of the source string. offset: usize, /// The source string. src: &'src str, /// The last character to be read. current_char: Option, /// The kind of token we read last. Used for automatic semicolon insertion. last_token_kind: Option, } impl<'src> Lexer<'src> { /// Create a new Lexer from the given source string. pub fn new(s: &str) -> Lexer { // Initialize the lexer with the first character of the source string. let first_char = s.chars().next(); Lexer { src: s, offset: 0, current_char: first_char, last_token_kind: None, } } /// 'eat' one character. /// This is a _very_ hot function. fn bump(&mut self) { self.offset += self.current_char.unwrap().len_utf8(); if self.offset < self.src.len() { let ch = char_at(&self.src, self.offset); self.current_char = Some(ch); } else { self.current_char = None; } } /// Return the next character **without** bumping. /// Useful for lookahead. fn next_char(&self) -> Option { let next_offset = self.offset + 1; if next_offset < self.src.len() { let ch = char_at(&self.src, next_offset); Some(ch) } else { None } } /// Scan a number literal (integer or float). /// /// The literal "0" is considered octal, [as in /// C++](http://stackoverflow.com/a/6895543/2754323). fn scan_number(&mut self) -> Token { // Integer literal grammar: // // int_lit = decimal_lit | octal_lit | hex_lit . // decimal_lit = ( "1" … "9" ) { decimal_digit } . // octal_lit = "0" { octal_digit } . // hex_lit = "0" ( "x" | "X" ) hex_digit { hex_digit } . let start = self.offset; // If we have a hexadecimal, treat it specially. if self.current_char == Some('0') && (self.next_char() == Some('x') || self.next_char() == Some('x')) { self.bump(); self.bump(); while let Some(c) = self.current_char { if c.is_digit(16) { self.bump(); } else { break; } } return Token { value: Some(self.src[start..self.offset].into()), kind: TokenKind::Hex, }; } let has_leading_zero = self.current_char == Some('0'); let mut had_e = false; let mut had_dot = false; 'outer: while let Some(c) = self.current_char { if c.is_digit(10) { self.bump(); } else if !had_e && (c == 'e' || c == 'E') { self.bump(); had_e = true; if self.current_char == Some('+') || self.current_char == Some('-') { self.bump(); } } else if !had_e && !had_dot && c == '.' { self.bump(); had_dot = true; } else if c == 'i' { self.bump(); return Token { value: Some(self.src[start..self.offset].into()), kind: TokenKind::Imaginary, }; } else { break; } } let s = &self.src[start..self.offset]; let kind = if had_e || had_dot { TokenKind::Float } else if has_leading_zero { TokenKind::Octal } else { TokenKind::Decimal }; Token { value: Some(s.into()), kind: kind, } } /// Skip whitespace and comments, returning whether at least one newline was encountered. fn skip_whitespace_and_comments(&mut self) -> bool { let mut contains_newline = false; while let Some(c) = self.current_char { if c == '\n' { contains_newline = true; } // Are we at the start of a general comment (`/* ... */`)? if c == '/' && self.next_char() == Some('*') { // Skip the '/*'. self.bump(); self.bump(); // Skip the comment body. while let Some(c) = self.current_char { if c == '*' && self.next_char() == Some('/') { break; } else { self.bump(); } } // Skip the '*/'. self.bump(); self.bump(); // Resume whitespace skipping. continue; } else if c == '/' && self.next_char() == Some('/') { while let Some(c) = self.current_char { if c == '\n' { break; } else { self.bump(); } } // Resume whitespace skipping. // Since we have not bumped past the newline character, // the next iteration of the loop will catch it. continue; } if c.is_whitespace() { self.bump(); } else { break; } } contains_newline } fn scan_ident(&mut self) -> &str { let start = self.offset; while let Some(c) = self.current_char { if can_continue_identifier(c) { self.bump(); } else { break; } } &self.src[start..self.offset] } fn scan_ident_or_keyword(&mut self) -> Token { let ident = self.scan_ident(); let mut value = None; use token::TokenKind::*; let kind = match &*ident { "break" => Break, "case" => Case, "chan" => Chan, "const" => Const, "continue" => Continue, "default" => Default, "defer" => Defer, "else" => Else, "fallthrough" => Fallthrough, "for" => For, "func" => Func, "go" => Go, "goto" => Goto, "if" => If, "import" => Import, "interface" => Interface, "map" => Map, "package" => Package, "range" => Range, "return" => Return, "select" => Select, "struct" => Struct, "switch" => Switch, "type" => Type, "var" => Var, // XXX(perf): unnecessary alloc. _ => { value = Some(ident.into()); TokenKind::Ident } }; Token { kind: kind, value: value, } } /// Return the next token, if any. fn next_token_inner(&mut self) -> Option { // Whitespace and comment handling. let contains_newline = self.skip_whitespace_and_comments(); // Automatic semicolon insertion in the simplest case (newline + token that may terminate a // statement). // // The Go Spec also says that a semicolon may be omitted before a closing ")" or "}". // This case is _not_ handled by the lexer, but by the parser, as it requires too much // context. if contains_newline && may_terminate_statement(self.last_token_kind) { return Some(Token { kind: TokenKind::Semicolon, value: None, }); } // Check for EOF after whitespace handling. let c = match self.current_char { Some(c) => c, None => return None, }; let kind = match c { // Single-character tokens. '(' => { self.bump(); TokenKind::LParen } ')' => { self.bump(); TokenKind::RParen } '{' => { self.bump(); TokenKind::LBrace } '}' => { self.bump(); TokenKind::RBrace } '[' => { self.bump(); TokenKind::LBracket } ']' => { self.bump(); TokenKind::RBracket } ',' => { self.bump(); TokenKind::Comma } ';' => { self.bump(); TokenKind::Semicolon } // More complex tokens. '.' => { if self.next_char().map(|x| x.is_digit(10)) == Some(true) { return Some(self.scan_number()); } self.bump(); // Look for an ellipsis ('...'). if self.current_char == Some('.') && self.next_char() == Some('.') { self.bump(); self.bump(); TokenKind::Ellipsis } else { TokenKind::Dot } } ':' => { self.bump(); if self.current_char == Some('=') { self.bump(); TokenKind::ColonAssign } else { TokenKind::Colon } } '=' => { self.bump(); if self.current_char == Some('=') { self.bump(); TokenKind::Equals } else { TokenKind::Assign } } '+' => { self.bump(); match self.current_char { Some('+') => { self.bump(); TokenKind::Increment } Some('=') => { self.bump(); TokenKind::PlusAssign } _ => TokenKind::Plus, } } '-' => { self.bump(); match self.current_char { Some('-') => { self.bump(); TokenKind::Decrement } Some('=') => { self.bump(); TokenKind::MinusAssign } _ => TokenKind::Minus, } } '*' => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::StarAssign } _ => TokenKind::Star, } } '/' => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::SlashAssign } _ => TokenKind::Slash, } } '<' => { self.bump(); match self.current_char { Some('<') => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::LshiftAssign } _ => TokenKind::Lshift, } } Some('=') => { self.bump(); TokenKind::LessThanOrEqual } Some('-') => { self.bump(); TokenKind::Arrow } _ => TokenKind::LessThan, } } '>' => { self.bump(); match self.current_char { Some('>') => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::RshiftAssign } _ => TokenKind::Rshift, } } Some('=') => { self.bump(); TokenKind::GreaterThanOrEqual } _ => TokenKind::GreaterThan, } } '|' => { self.bump(); match self.current_char { Some('|') => { self.bump(); TokenKind::OrOr } Some('=') => { self.bump(); TokenKind::OrAssign } _ => TokenKind::Or, } } '&' => { self.bump(); match self.current_char { Some('&') => { self.bump(); TokenKind::AndAnd } Some('=') => { self.bump(); TokenKind::AndAssign } Some('^') => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::BitClearAssign } _ => TokenKind::BitClear, } } _ => TokenKind::And, } } '!' => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::NotEqual } _ => TokenKind::Not, } } '^' => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::CaretAssign } _ => TokenKind::Caret, } } '%' => { self.bump(); match self.current_char { Some('=') => { self.bump(); TokenKind::PercentAssign } _ => TokenKind::Percent, } } // Scan integer. c if c.is_digit(10) => return Some(self.scan_number()), c if can_start_identifier(c) => return Some(self.scan_ident_or_keyword()), // Start of _interpreted_ string literal. '"' => return Some(self.scan_interpreted_str_lit()), '`' => return Some(self.scan_raw_str_lit()), '\'' => return Some(self.scan_rune_lit()), c => panic!("unexpected start of token: '{}'", c), }; Some(Token { kind: kind, value: None, }) } fn scan_rune_lit(&mut self) -> Token { self.bump(); let start = self.offset; while let Some(c) = self.current_char { // If we encounter a backslash escape, we just skip past the '\' and the // following character. if c == '\\' { self.bump(); self.bump(); } else if c == '\'' { break; } else { self.bump(); } } let s = &self.src[start..self.offset]; // Skip the quote _after_ slicing so that it isn't included // in the slice. self.bump(); Token { value: Some(s.into()), kind: TokenKind::Rune, } } fn scan_interpreted_str_lit(&mut self) -> Token { self.bump(); let start = self.offset; while let Some(c) = self.current_char { // If we encounter a backslash escape, we just skip past the '\' and the // following character. if c == '\\' { self.bump(); self.bump(); } else if c == '"' { break; } else { self.bump(); } } let s = &self.src[start..self.offset]; // Skip the quote _after_ slicing so that it isn't included // in the slice. self.bump(); Token { // XXX(perf): alloc. value: Some(s.into()), kind: TokenKind::Str, } } fn scan_raw_str_lit(&mut self) -> Token { // Bump past the opening backtrick. self.bump(); let start = self.offset; while let Some(c) = self.current_char { // Raw strings are pretty simple, because we don't have to handle escapes. if c == '`' { break; } else { self.bump(); } } let s = &self.src[start..self.offset]; // Skip the backtick _after_ slicing so that it isn't included // in the slice. self.bump(); Token { // XXX(perf): alloc. value: Some(s.into()), kind: TokenKind::StrRaw, } } } impl<'src> Iterator for Lexer<'src> { type Item = TokenAndSpan; fn next(&mut self) -> Option { let start = self.offset as u32; let t = self.next_token_inner(); self.last_token_kind = t.as_ref().map(|t| t.kind); t.map(|t| { TokenAndSpan { token: t, span: Span { start: start, end: self.offset as u32, }, } }) } } /// Convenience function to collect all the tokens from a string. pub fn tokenize(s: &str) -> Vec { let lexer = Lexer::new(s); lexer.collect() } // ===== // Utility functions. // // XXX(perf): expensive checks on Unicode chars (is_alphabetic(), is_numeric()) in these functions. // ===== fn can_start_identifier(c: char) -> bool { c.is_alphabetic() || c == '_' } fn can_continue_identifier(c: char) -> bool { c.is_alphabetic() || c.is_numeric() || c == '_' } fn char_at(s: &str, byte: usize) -> char { s[byte..].chars().next().unwrap() } // For automatic semicolon insertion. fn may_terminate_statement(t: Option) -> bool { // A non-existent token may not terminate a line. let t = match t { Some(t) => t, None => return false, }; // From the Go spec: // // When the input is broken into tokens, a semicolon is automatically inserted into the // token stream immediately after a line's final token if that token is: // - an identifier // - an integer, floating-point, imaginary, rune, or string literal // - one of the keywords break, continue, fallthrough, or return // - one of the operators and delimiters ++, --, ), ], or } use token::TokenKind::*; match t { Ident => true, Increment | Decrement | Break | Continue | Fallthrough | Return | RParen | RBracket | RBrace => true, t if t.is_literal() => true, _ => false, } } ================================================ FILE: src/lexer/test.rs ================================================ use super::{Token, TokenKind, tokenize}; use token::TokenKind::*; // XXX: use the full TokenKind::* path, or `use TokenKind::*`? fn assert_tokens(code: &str, expect: &[(TokenKind, Option<&str>)]) { let got = tokenize(code); // If the assertion fails, having a log message will be very useful. println!("got:\n{:#?}", got); println!("\nexpected:\n{:#?}", expect); assert_eq!(got.len(), expect.len()); for (got_t, expect_t) in got.iter().zip(expect) { let nt = Token { kind: expect_t.0, value: expect_t.1.map(|s| s.to_owned()), }; assert_eq!(got_t.token, nt); } } fn assert_token(code: &str, expect_kind: TokenKind, expect_value: Option<&str>) { assert_tokens(code, &[(expect_kind, expect_value)]); } #[test] fn test_numerical_tokens() { // Integer Literals assert_token("42", Decimal, Some("42")); assert_token("0600", Octal, Some("0600")); assert_token("0xBadFace", Hex, Some("0xBadFace")); assert_token("170141183460469231731687303715884105727", Decimal, Some("170141183460469231731687303715884105727")); let float_tests = ["0.", "72.40", "072.40", "2.71828", "1.e+0", "6.67428e-11", "1E6", ".25", ".12345E+5"]; for t in &float_tests { assert_token(t, Float, Some(t)); } let imaginary_tests = ["0i", "011i", "0.i", "2.71828i", "1.e+0i", "6.67428e-11i", "1E6i", ".25i", ".12345E+5i"]; for t in &imaginary_tests { assert_token(t, Imaginary, Some(t)); } } #[test] fn test_text_literals() { assert_token("'a'", Rune, Some("a")); assert_token("'\\n'", Rune, Some("\\n")); assert_token("'\\''", Rune, Some("\\'")); assert_token("\"Hello!\"", Str, Some("Hello!")); assert_token("\"\\n\\n\"", Str, Some("\\n\\n")); assert_token("\"\\\"\"", Str, Some("\\\"")); assert_token("`Hello!`", StrRaw, Some("Hello!")); assert_token("`\\n\\n`", StrRaw, Some("\\n\\n")); assert_token("`\\\"`", StrRaw, Some("\\\"")); assert_token(r##""\\\"oqdz""##, Str, Some("\\\\\\\"oqdz")); } /// Test 'simple' tokens (tokens that do not contain a value). #[test] fn tokenize_simple() { let pairs = vec![("(", TokenKind::LParen), (")", TokenKind::RParen), ("{", TokenKind::LBrace), ("}", TokenKind::RBrace), ("[", TokenKind::LBracket), ("]", TokenKind::RBracket), (",", TokenKind::Comma), (";", TokenKind::Semicolon), (".", TokenKind::Dot), ("...", TokenKind::Ellipsis), ("|", TokenKind::Or), ("||", TokenKind::OrOr), ("|=", TokenKind::OrAssign), ("!", TokenKind::Not), ("!=", TokenKind::NotEqual), ("^", TokenKind::Caret), ("^=", TokenKind::CaretAssign), ("%", TokenKind::Percent), ("%=", TokenKind::PercentAssign), ("&", TokenKind::And), ("&&", TokenKind::AndAnd), ("&=", TokenKind::AndAssign), ("&^", TokenKind::BitClear), ("&^=", TokenKind::BitClearAssign), ("&", TokenKind::And), ("&&", TokenKind::AndAnd), ("&=", TokenKind::AndAssign), ("&^", TokenKind::BitClear), ("&^=", TokenKind::BitClearAssign), ("+", TokenKind::Plus), ("++", TokenKind::Increment), ("+=", TokenKind::PlusAssign), ("-", TokenKind::Minus), ("--", TokenKind::Decrement), ("-=", TokenKind::MinusAssign), (":", TokenKind::Colon), (":=", TokenKind::ColonAssign), ("<", TokenKind::LessThan), ("<-", TokenKind::Arrow), ("<=", TokenKind::LessThanOrEqual), ("<<", TokenKind::Lshift), ("<<=", TokenKind::LshiftAssign), (">", TokenKind::GreaterThan), (">=", TokenKind::GreaterThanOrEqual), (">>", TokenKind::Rshift), (">>=", TokenKind::RshiftAssign), ("*", TokenKind::Star), ("*=", TokenKind::StarAssign), ("=", TokenKind::Assign), ("==", TokenKind::Equals), ("/", TokenKind::Slash), ("/=", TokenKind::SlashAssign), ]; for (src, kind) in pairs { assert_token(src, kind, None); } } #[test] fn tokenize_comments() { assert_tokens("// Hello, this is a comment", &[]); assert_tokens("foo /* this is a general comment */ := 2", &[(Ident, Some("foo")), (ColonAssign, None), (Decimal, Some("2"))]); } #[test] fn tokenize_ident() { let test_ident = |s| { assert_tokens(s, &[(TokenKind::Ident, Some(s))]); }; // XXX: add quickcheck test? test_ident("foo"); } #[test] fn tokenize_keywords() { let pairs = [("break", TokenKind::Break), ("case", TokenKind::Case), ("chan", TokenKind::Chan), ("const", TokenKind::Const), ("continue", TokenKind::Continue), ("default", TokenKind::Default), ("defer", TokenKind::Defer), ("else", TokenKind::Else), ("fallthrough", TokenKind::Fallthrough), ("for", TokenKind::For), ("func", TokenKind::Func), ("go", TokenKind::Go), ("goto", TokenKind::Goto), ("if", TokenKind::If), ("import", TokenKind::Import), ("interface", TokenKind::Interface), ("map", TokenKind::Map), ("package", TokenKind::Package), ("range", TokenKind::Range), ("return", TokenKind::Return), ("select", TokenKind::Select), ("struct", TokenKind::Struct), ("switch", TokenKind::Switch), ("type", TokenKind::Type), ("var", TokenKind::Var)]; for &(s, k) in &pairs { assert_token(s, k, None); } } #[test] fn tokenize_mixed_whitespace() { assert_tokens(" \t \t ", &[]); } #[test] fn tokenize_package_declaration() { assert_tokens("package main", &[(TokenKind::Package, None), (TokenKind::Ident, Some("main"))]); } #[test] fn tokenize_plain_interpreted_str() { assert_token("\"hello\"", TokenKind::Str, Some("hello")); } #[test] fn tokenize_simple_import() { assert_tokens("import \"fmt\"", &[(TokenKind::Import, None), (TokenKind::Str, Some("fmt"))]); } #[test] fn tokenize_simple_assignment() { assert_tokens("someVar := 23 + 45", &[(TokenKind::Ident, Some("someVar")), (TokenKind::ColonAssign, None), (TokenKind::Decimal, Some("23")), (TokenKind::Plus, None), (TokenKind::Decimal, Some("45"))]); } #[test] fn tokenize_hello() { let src = r#"package main import "fmt" func main() { fmt.Println("Hello, rgo") } "#; let expected = [(TokenKind::Package, None), (TokenKind::Ident, Some("main")), (TokenKind::Semicolon, None), (TokenKind::Import, None), (TokenKind::Str, Some("fmt")), (TokenKind::Semicolon, None), (TokenKind::Func, None), (TokenKind::Ident, Some("main")), (TokenKind::LParen, None), (TokenKind::RParen, None), (TokenKind::LBrace, None), (TokenKind::Ident, Some("fmt")), (TokenKind::Dot, None), (TokenKind::Ident, Some("Println")), (TokenKind::LParen, None), (TokenKind::Str, Some("Hello, rgo")), (TokenKind::RParen, None), (TokenKind::Semicolon, None), (TokenKind::RBrace, None), (TokenKind::Semicolon, None)]; assert_tokens(src, &expected); } // ===== // Comments // ===== #[test] fn tokenize_simple_assignment_with_inline_comment() { assert_tokens("someVar /* someVar is a variable; and I'm a COMMENT! */ := 23 + 45", &[(TokenKind::Ident, Some("someVar")), (TokenKind::ColonAssign, None), (TokenKind::Decimal, Some("23")), (TokenKind::Plus, None), (TokenKind::Decimal, Some("45"))]); } #[test] fn tokenize_hello_with_comments() { let src = r#"// This is a line comment. // And another! // All of these should be treated as a single contiguous whitespace block. // Even this one! package main import "fmt" func main() { fmt.Println("Hello, rgo") } "#; let expected = [(TokenKind::Package, None), (TokenKind::Ident, Some("main")), (TokenKind::Semicolon, None), (TokenKind::Import, None), (TokenKind::Str, Some("fmt")), (TokenKind::Semicolon, None), (TokenKind::Func, None), (TokenKind::Ident, Some("main")), (TokenKind::LParen, None), (TokenKind::RParen, None), (TokenKind::LBrace, None), (TokenKind::Ident, Some("fmt")), (TokenKind::Dot, None), (TokenKind::Ident, Some("Println")), (TokenKind::LParen, None), (TokenKind::Str, Some("Hello, rgo")), (TokenKind::RParen, None), (TokenKind::Semicolon, None), (TokenKind::RBrace, None), (TokenKind::Semicolon, None)]; assert_tokens(src, &expected); } ================================================ FILE: src/lib.rs ================================================ #![cfg_attr(feature="clippy", feature(plugin))] #![cfg_attr(feature="clippy", plugin(clippy))] #[macro_use] extern crate log; // XXX: do we still need this? #[macro_use] extern crate lazy_static; #[macro_use] extern crate quick_error; extern crate num; mod pos; pub use self::pos::Position; pub mod token; pub mod ast; pub mod lexer; pub mod parser; pub use parser::Parser; pub fn parse(src: &str) -> ast::SourceFile { let lexer = lexer::Lexer::new(src).collect(); parser::parse_tokens(lexer) } ================================================ FILE: src/main.rs ================================================ extern crate convenience; extern crate rgo; #[macro_use] extern crate log; extern crate env_logger; extern crate time; use convenience::read_file; use std::env; use time::PreciseTime; fn main() { env_logger::init().unwrap(); // 0th arg is the program path. let src_file = env::args().nth(1).unwrap(); info!("Source file: {}", src_file); let s = read_file(&src_file).expect("failed to read file"); let start = PreciseTime::now(); let tokens = rgo::lexer::tokenize(&s); println!("Lexing: {} µs", start.to(PreciseTime::now()).num_microseconds().unwrap()); let ast: rgo::ast::SourceFile = rgo::parser::parse_tokens(tokens); println!("AST:\n{:?}", ast); } ================================================ FILE: src/parser/error.rs ================================================ use std::fmt; use token::{Span, Token, TokenKind}; pub type PResult = ::std::result::Result; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Error { pub span: Span, pub kind: ErrorKind, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum ErrorKind { UnexpectedToken { found: Token, expected: Vec, }, Other { msg: String, }, } impl ErrorKind { pub fn unexpected_token(expected: Vec, found: Token) -> ErrorKind { ErrorKind::UnexpectedToken { found: found, expected: expected, } } // XXX: potential code bloat due to monomorphisation, unless inlined. But we don't want to // inline cold functions... so it could be best to remove all generics here and // #[inline(never)]. pub fn other>(msg: T) -> ErrorKind { ErrorKind::Other { msg: msg.into() } } } impl fmt::Display for ErrorKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { ErrorKind::UnexpectedToken { ref found, ref expected } => { try!(write!(f, "expected ")); if expected.len() > 2 { try!(write!(f, "one of ")); let mut sep = " "; for tk in expected { try!(write!(f, "\"{}\"{}", tk, sep)); sep = ", "; } } else { try!(write!(f, "\"{}\" ", expected[0])); } write!(f, "found \"{}\"", found) } ErrorKind::Other { ref msg } => write!(f, "{}", msg), } } } ================================================ FILE: src/parser/mod.rs ================================================ use std::iter::Peekable; use num::bigint::BigInt; use num::BigRational; use token::*; use ast; #[cfg(test)] mod test; mod error; pub use self::error::{PResult, Error, ErrorKind}; macro_rules! span { ($s:expr, $x:expr) => {{ let start_off = $s.span.start; let val = $x; let end_off = $s.prev_end_offset; Spanned::new(Span {start: start_off, end: end_off}, val) }} } macro_rules! try_span { ($s:expr, $x:expr) => { span!($s, try!($x)) } } pub struct Parser> { /// Our source of tokens. /// Users can choose to read all the tokens up-front, or to read them lazily. reader: Peekable, /// The current token. token: Token, /// The span of the current token. span: Span, /// Byte offset of the end of the most recently consumed token. prev_end_offset: u32, /// (XXX) Seems to indicate the current level of nesting when parsing expressions. expression_level: u32, } impl> Parser { pub fn new(mut it: R) -> Parser { // TODO: handle missing tok gracefully. let first_tok_and_pos = it.next().expect("missing first token"); debug!("first_tok_and_pos: {:?}", first_tok_and_pos); Parser { token: first_tok_and_pos.token, span: first_tok_and_pos.span, prev_end_offset: first_tok_and_pos.span.end, reader: it.peekable(), // In the Go code, the initial value of `exprLev` implicitly defaults to 0. expression_level: 0, } } /// Parse the tokens into a SourceFile (AST). pub fn parse(mut self) -> PResult { let package_name = try!(self.parse_package_clause()); let import_decls = try!(self.parse_import_decls()); let top_level_decls = try!(self.parse_top_level_decls()); Ok(ast::SourceFile { package: package_name, import_decls: import_decls, top_level_decls: top_level_decls, }) } // === Utility functions === /// Build a parse error. #[cold] #[inline(never)] fn err(&self, kind: ErrorKind) -> Error { Error { span: self.span, kind: kind, } } /// Advance the parser by one token. fn bump(&mut self) { trace!("current token: {:?}", self.token); trace!("current span: {:?}", self.span); trace!("bump"); let next = self.reader.next(); self.prev_end_offset = self.span.end; if let Some(TokenAndSpan { span, token }) = next { self.token = token; self.span = span; } else { // XXX what span to set? self.token = Token { kind: TokenKind::Eof, value: None, }; } } /// Advance the parser by one token and return the bumped token. fn bump_and_get(&mut self) -> Token { // XXX(perf): clone; cloning is needed to let bump() see the previous token. let old_token = self.token.clone(); self.bump(); old_token } /// Consume the next token, asserting its kind is equal to `expected`. fn eat(&mut self, expected: TokenKind) -> PResult<()> { if self.token.kind != expected { return Err(self.err(ErrorKind::unexpected_token(vec![expected], self.token.clone()))); } self.bump(); Ok(()) } fn eat_and_get(&mut self, expected: TokenKind) -> PResult<(Token)> { if self.token.kind != expected { return Err(self.err(ErrorKind::unexpected_token(vec![expected], self.token.clone()))); } Ok(self.bump_and_get()) } // === parse_*() functions === /// Parse a package clause (e.g. `package main`). fn parse_package_clause(&mut self) -> PResult { trace!("parse_package_clause"); try!(self.eat(TokenKind::Package)); let package_name = try!(self.parse_ident()); try!(self.eat(TokenKind::Semicolon)); Ok(package_name) } /// Parse any number of import declarations. fn parse_import_decls(&mut self) -> PResult>> { trace!("parse_import_decls"); let mut decls = Vec::new(); loop { match self.token.kind { TokenKind::Import => { decls.push(try_span!(self, self.parse_import_decl())); } _ => return Ok(decls), } } } /// Parse an import declaration, which is made up of one or more import specs. /// Simple example with a single spec: `import "fmt"`. fn parse_import_decl(&mut self) -> PResult { trace!("parse_import_decl"); // Grammar: // // ``` // ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) . // ``` try!(self.eat(TokenKind::Import)); let mut specs = Vec::new(); match self.token.kind { // Long import declaration. TokenKind::LParen => { self.bump(); // There may be multiple `ImportSpec`s in a single "long" import declaration. loop { match self.token.kind { // XXX: Should we _know_ that import specs always start with a string // literal? I'm not sure. TokenKind::RParen => { break; } _ => { specs.push(try_span!(self, self.parse_import_spec())); } } } } // Short import (single ImportSpec). _ => specs.push(try_span!(self, self.parse_import_spec())), } try!(self.eat(TokenKind::Semicolon)); Ok(ast::ImportDecl { specs: specs }) } /// Parse an "import spec". fn parse_import_spec(&mut self) -> PResult { trace!("parse_import_spec"); // Grammar: // // ``` // ImportSpec = [ "." | PackageName ] ImportPath . // ``` // Does this package spec define an alias? let kind = match self.token.kind { // Glob import. TokenKind::Dot => { self.bump(); ast::ImportKind::Glob } TokenKind::Ident => ast::ImportKind::Alias(self.bump_and_get().value.unwrap()), _ => ast::ImportKind::Normal, }; // The next token MUST be a string literal (interpreted or raw). let path = try_span!(self, self.parse_string_lit()); Ok(ast::ImportSpec { path: path, kind: kind, }) } /// Parse any number of top-level declarations (see TopLevelDecl docs). // Grammar: // // TopLevelDecl = Declaration | FunctionDecl | MethodDecl . fn parse_top_level_decls(&mut self) -> PResult> { trace!("parse_top_level_decls"); let mut decls = Vec::new(); // FIXME: no loop + unfinished! match self.token.kind { // FunctionDecl TokenKind::Func => { let fd = try!(self.parse_func_decl()); decls.push(ast::TopLevelDecl::Func(fd)); } _ => { let e = ErrorKind::unexpected_token(vec![TokenKind::Func], self.token.clone()); return Err(self.err(e)); } } Ok(decls) } /// Parse a full function declaration (including signature, name, and block). fn parse_func_decl(&mut self) -> PResult { trace!("parse_func_decl"); // Grammar: // FunctionDecl = "func" FunctionName ( Function | Signature ) . // FunctionName = identifier . // Function = Signature FunctionBody . // FunctionBody = Block . try!(self.eat(TokenKind::Func)); let name = try_span!(self, self.parse_ident()); let signature = try!(self.parse_func_signature()); let body = match self.token.kind { // This function has a body, parse it. TokenKind::LBrace => Some(try!(self.parse_block())), // No body. _ => None, }; try!(self.eat(TokenKind::Semicolon)); Ok(ast::FuncDecl { name: name, signature: signature, body: body, }) } /// Parse a function _signature_ - i.e., just the parameter and result types of a func. fn parse_func_signature(&mut self) -> PResult { trace!("parse_func_signature"); // Grammar: // // Signature = Parameters [ Result ] . // Result = Parameters | Type . // // Example signature: // // (int, int, float64) (float64, *[]int) // // The parameters and the result of a function have a similar grammar, // however there's a small difference. The Go spec says: // // "Parameter and result lists are always parenthesized except that if there is exactly one // unnamed result it may be written as an unparenthesized type." let parameters = try!(self.parse_func_params()); let result = match self.token.kind { // An opening parenthesis! We can parse an output parameter list. TokenKind::LParen => try!(self.parse_func_params()), // Brace = no return type, but a body. We don't care about the body in this function. // Semicolon = no return type and no body. TokenKind::LBrace | TokenKind::Semicolon => ast::Parameters::empty(), // Otherwise, a single, unnamed return type. _ => ast::Parameters::from_single_type(try!(self.parse_type())), }; Ok(ast::FuncSignature { parameters: parameters, result: result, }) } /// Parse function parameters, as defined by the Go grammar. /// /// This may be used to parse the return types of a function if they are prefixed with a /// parenthesis, and follow the same grammar as input parameters. /// Parameters may be named or unnamed. fn parse_func_params(&mut self) -> PResult { trace!("parse_func_params"); // Grammar: // // Parameters = "(" [ ParameterList [ "," ] ] ")" . // ParameterList = ParameterDecl { "," ParameterDecl } . // ParameterDecl = [ IdentifierList ] [ "..." ] Type . try!(self.eat(TokenKind::LParen)); let mut decls = Vec::new(); // The parameter list is optional. match self.token.kind { TokenKind::Ident | TokenKind::Ellipsis => { decls.push(try!(self.parse_parameter_decl())); while let TokenKind::Comma = self.token.kind { try!(self.eat(TokenKind::Comma)); decls.push(try!(self.parse_parameter_decl())); } } _ => {} } try!(self.eat(TokenKind::RParen)); // XXX: do we _need_ Parameters to be a type by itself? Ok(ast::Parameters { decls: decls }) } /// Parse a "parameter decl". fn parse_parameter_decl(&mut self) -> PResult { trace!("parse_parameter_decl"); // Grammar: // ParameterDecl = [ IdentifierList ] [ "..." ] Type . let mut idents = Vec::new(); let mut variadic = false; // The identifier list is optional. if let TokenKind::Ident = self.token.kind { // Grammar: // IdentifierList = identifier { "," identifier } . idents.push(try!(self.parse_ident())); while let TokenKind::Comma = self.token.kind { try!(self.eat(TokenKind::Comma)); idents.push(try!(self.parse_ident())); } } // So is the ellipsis that indicates a variadic func. if let TokenKind::Ellipsis = self.token.kind { try!(self.eat(TokenKind::Ellipsis)); variadic = true; } // The type is mandatory. let typ = try!(self.parse_type()); Ok(ast::ParameterDecl { identifiers: idents, typ: typ, variadic: variadic, }) } /// Parse a single type (e.g. `[]string`). // XXX: type declarations can be very complex; this function needs attention. fn parse_type(&mut self) -> PResult { trace!("parse_type"); // Grammar: // // Type = TypeName | TypeLit | "(" Type ")" . // TypeName = identifier | QualifiedIdent . // TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType | // SliceType | MapType | ChannelType . // TypeName = a (potentially qualified with a module path) identifier // TypeLit = more complex type, this is where it gets interesting match self.token.kind { // A Type may be surrounded in parentheses, in which case we simply eat the // parentheses and recurse. TokenKind::LParen => { try!(self.eat(TokenKind::LParen)); let typ = try!(self.parse_type()); try!(self.eat(TokenKind::RParen)); Ok(typ) } // If a Type starts with an identifier, it can only be a TypeName. TokenKind::Ident => { let id = try!(self.parse_maybe_qualified_ident()); Ok(ast::Type::Plain(id)) } _ => unimplemented!(), } } fn parse_maybe_qualified_ident(&mut self) -> PResult { let part1 = try!(self.parse_ident()); let name; let package; match self.token.kind { // This is a qualified identifier. // XXX: should we move that to a new function? // Qualified idents can only appear in: // - types (that's what we're parsing) // - operands. TokenKind::Dot => { // XXX: I don't like this pattern. try!(self.eat(TokenKind::Dot)); let part2 = try!(self.parse_ident()); package = Some(part1); name = part2; } // Not qualified? Doesn't matter. _ => { name = part1; package = None; } } Ok(ast::MaybeQualifiedIdent { package: package, name: name, }) } fn parse_block(&mut self) -> PResult { trace!("parse_block"); // Grammar: // Block = "{" StatementList "}" . // StatementList = { Statement ";" } . try!(self.eat(TokenKind::LBrace)); let mut statements = Vec::new(); while self.token.kind.can_start_statement() { statements.push(try!(self.parse_statement())); try!(self.eat(TokenKind::Semicolon)); } try!(self.eat(TokenKind::RBrace)); Ok(ast::Block(statements)) } // XXX: needs thorough review. fn parse_statement(&mut self) -> PResult { trace!("parse_statement"); // Statement = // Declaration | LabeledStmt | SimpleStmt | // GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt | // FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt | // DeferStmt . // // SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment | // ShortVarDecl . use token::TokenKind::*; Ok(match self.token.kind { Type | Var | Const => try!(self.parse_decl_stmt()).into(), Go => try!(self.parse_go_stmt()).into(), Defer => try!(self.parse_defer_stmt()).into(), Return => try!(self.parse_return_stmt()).into(), If => try!(self.parse_if_stmt()).into(), Switch => try!(self.parse_switch_stmt()).into(), Select => try!(self.parse_select_stmt()).into(), For => try!(self.parse_for_stmt()).into(), Break => try!(self.parse_break_stmt()).into(), Continue => try!(self.parse_continue_stmt()).into(), Goto => try!(self.parse_goto_stmt()).into(), Fallthrough => try!(self.parse_fallthrough_stmt()).into(), LBrace => try!(self.parse_block()).into(), RBrace => { // a semicolon may be omitted before a closing "}" ast::EmptyStmt.into() } // All simple statements start with something expression-like. t if t.can_start_expr() => try!(self.parse_simple_stmt()).into(), _ => panic!("unexpected token"), }) } fn parse_go_stmt(&mut self) -> PResult { trace!("parse_go_stmt"); try!(self.eat(TokenKind::Go)); Ok(ast::GoStmt { call: try_span!(self, self.parse_expr()) }) } fn parse_break_stmt(&mut self) -> PResult { trace!("parse_break_stmt"); try!(self.eat(TokenKind::Break)); let label = if self.token.kind == TokenKind::Semicolon { None } else { Some(try_span!(self, self.parse_ident())) }; Ok(ast::BreakStmt { label: label }) } fn parse_continue_stmt(&mut self) -> PResult { trace!("parse_continue_stmt"); try!(self.eat(TokenKind::Continue)); let label = if self.token.kind == TokenKind::Semicolon { None } else { Some(try_span!(self, self.parse_ident())) }; Ok(ast::ContinueStmt { label: label }) } fn parse_goto_stmt(&mut self) -> PResult { trace!("parse_goto_stmt"); try!(self.eat(TokenKind::Goto)); Ok(ast::GotoStmt { label: try_span!(self, self.parse_ident()) }) } fn parse_fallthrough_stmt(&mut self) -> PResult { trace!("parse_fallthrough_stmt"); try!(self.eat(TokenKind::Fallthrough)); Ok(ast::FallthroughStmt) } fn parse_defer_stmt(&mut self) -> PResult { trace!("parse_defer_stmt"); try!(self.eat(TokenKind::Defer)); Ok(ast::DeferStmt { call: try_span!(self, self.parse_expr()) }) } fn parse_return_stmt(&mut self) -> PResult { trace!("parse_return_stmt"); try!(self.eat(TokenKind::Return)); Ok(ast::ReturnStmt { expr: try_span!(self, self.parse_expr()) }) } fn parse_if_stmt(&mut self) -> PResult { // IfStmt = "if" [ SimpleStmt ";" ] Expression Block [ "else" ( IfStmt | Block ) ] . trace!("parse_if_stmt"); try!(self.eat(TokenKind::If)); let stmt = try_span!(self, self.parse_simple_stmt()); let before_stmt; let condition; if self.token.kind == TokenKind::Semicolon { // We have a complex if statment. self.bump(); before_stmt = Some(stmt); condition = try_span!(self, self.parse_expr()); } else { // We have a simple if statment. // What we just parsed must be an ExprStmt representing the condition. if let ast::SimpleStmt::Expr(expr) = stmt.item { condition = expr; } else { return Err(Error { span: stmt.span, kind: ErrorKind::other("invalid expression as if condition"), }); } before_stmt = None; } let block = try!(self.parse_block()); let opt_else = if self.token.kind == TokenKind::Else { self.bump(); Some(Box::new(match self.token.kind { TokenKind::LBrace => ast::Else::Block(try!(self.parse_block())), TokenKind::If => ast::Else::If(try!(self.parse_if_stmt())), _ => { let expected = vec![TokenKind::LBrace, TokenKind::If]; return Err(self.err(ErrorKind::unexpected_token(expected, self.token.clone()))); } })) } else { None }; Ok(ast::IfStmt { before_stmt: before_stmt, condition: condition, block: block, opt_else: opt_else, }) } fn parse_switch_stmt(&mut self) -> PResult { trace!("parse_switch_stmt"); unimplemented!() } fn parse_select_stmt(&mut self) -> PResult { trace!("parse_select_stmt"); unimplemented!() } fn parse_for_stmt(&mut self) -> PResult { // ForStmt = "for" [ Condition | ForClause | RangeClause ] Block . // Condition = Expression . // // ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] . // InitStmt = SimpleStmt . // PostStmt = SimpleStmt . // // RangeClause = [ ExpressionList "=" | IdentifierList ":=" ] "range" Expression . trace!("parse_for_stmt"); try!(self.eat(TokenKind::For)); Ok(ast::ForStmt { header: try!(self.parse_for_header()), body: try!(self.parse_block()), }) } fn parse_for_header(&mut self) -> PResult { trace!("parse_for_header"); unimplemented!() } fn expr_list_to_ident_list(&self, exprs: &Vec>) -> PResult>> { trace!("expr_list_to_ident_list"); // XXX: better errors let mut idents = Vec::new(); use ast::{Expr, UnaryExpr, PrimaryExpr, Operand}; for expr in exprs { if let Expr::Unary(UnaryExpr::Primary(x)) = expr.item.clone() { if let PrimaryExpr::Operand(Operand::MaybeQualifiedIdent(mqident)) = *x { if mqident.package.is_some() { return Err(Error { kind: ErrorKind::other("expected unqualified ident"), span: expr.span, }); } idents.push(Spanned::new(expr.span, mqident.name)); continue; } } // didn't successfully turn the expr into an ident return Err(Error { kind: ErrorKind::other("expected ident"), span: expr.span, }); } Ok(idents) } fn parse_simple_stmt(&mut self) -> PResult { // SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment | // ShortVarDecl . // // EmptyStmt = . // ExpressionStmt = Expression . // SendStmt = Channel "<-" Expression . // Channel = Expression . // IncDecStmt = Expression ( "++" | "--" ) . // Assignment = ExpressionList assign_op ExpressionList . // assign_op = [ add_op | mul_op ] "=" . // // ShortVarDecl = IdentifierList ":=" ExpressionList . trace!("parse_simple_stmt"); let exprs = try!(self.parse_expr_list()); if self.token.kind.is_assign_op() { let op = ast::BinaryOperator::from_token_kind_assign_op(self.bump_and_get().kind); return Ok(ast::SimpleStmt::Assignment(ast::Assignment { lhs: exprs, rhs: try!(self.parse_expr_list()), op: op, })); } if self.token.kind == TokenKind::ColonAssign { let idents = try!(self.expr_list_to_ident_list(&exprs)); return Ok(ast::SimpleStmt::ShortVarDecl(ast::ShortVarDecl { lhs: idents, rhs: try!(self.parse_expr_list()), })); } let expr; // Now we have no possible SimpleStmt types left that start with a list of exprs. if exprs.len() > 1 { return Err(self.err( ErrorKind::unexpected_token(vec![TokenKind::Assign], self.token.clone()) )); } else if exprs.len() == 1 { // move exprs to prevent access later and avoid cloning expr = exprs.into_iter().next().unwrap(); } else { panic!("BUG"); } match self.token.kind { TokenKind::Arrow => { self.bump(); Ok(ast::SimpleStmt::Send(ast::SendStmt { channel: expr, expr: try_span!(self, self.parse_expr()), })) } TokenKind::Increment => { self.bump(); Ok(ast::SimpleStmt::IncDec(ast::IncDecStmt { expr: expr, is_dec: false, })) } TokenKind::Decrement => { self.bump(); Ok(ast::SimpleStmt::IncDec(ast::IncDecStmt { expr: expr, is_dec: true, })) } TokenKind::Semicolon => Ok(ast::SimpleStmt::Expr(expr)), _ => { let expected = vec![TokenKind::Arrow, TokenKind::Increment, TokenKind::Decrement, TokenKind::Assign]; Err(self.err(ErrorKind::unexpected_token(expected, self.token.clone()))) } } } fn parse_decl_stmt(&mut self) -> PResult { trace!("parse_decl_stmt"); unimplemented!() } // XXX: error msg fn parse_expr(&mut self) -> PResult { trace!("parse_expr"); self.parse_potential_binary_expr(0) } fn parse_expr_list(&mut self) -> PResult>> { // ExpressionList = Expression { "," Expression } . trace!("parse_expr_list"); let mut res = Vec::new(); res.push(try_span!(self, self.parse_expr())); while self.token.kind == TokenKind::Comma { self.bump(); res.push(try_span!(self, self.parse_expr())); } Ok(res) } /// Parse a unary *expression*, which can be a primary expression OR a unary *operation*. // XXX: too much repetition, could probably be shortened fn parse_unary_expr(&mut self) -> PResult { // UnaryExpr = PrimaryExpr | unary_op UnaryExpr . trace!("parse_unary_expr"); match self.token.kind { // kind: unary operator TokenKind::Plus | TokenKind::Minus | TokenKind::Not | TokenKind::Caret | TokenKind::And => { let op = ast::UnaryOperator::from_token_kind(self.token.kind).expect("BUG"); self.bump(); let x = try_span!(self, self.parse_unary_expr()); Ok(ast::UnaryExpr::UnaryOperation(ast::UnaryOperation { operator: op, operand: Box::new(x), })) } // channel receive operation TokenKind::Arrow => { self.bump(); let x = try_span!(self, self.parse_unary_expr()); Ok(ast::UnaryExpr::UnaryOperation(ast::UnaryOperation { operator: ast::UnaryOperator::ChanReceive, operand: Box::new(x), })) } // deref expression - star op TokenKind::Star => { self.bump(); let x = try_span!(self, self.parse_unary_expr()); Ok(ast::UnaryExpr::UnaryOperation(ast::UnaryOperation { operator: ast::UnaryOperator::Deref, operand: Box::new(x), })) } // No operator, this can only be a primary expression. _ => { let x = try!(self.parse_primary_expr()); Ok(ast::UnaryExpr::Primary(Box::new(x))) } } } fn parse_selector(&mut self, x: ast::PrimaryExpr) -> PResult { // ~ "assert x is an expr or a type... and not a "raw type" such as // [...]T". // I have _no_ idea what the author meant by that. let selector = try!(self.parse_ident()); // Here's how things look at this point: // // value.fieldOrMethod // ^ ^ // | | // | | // `x` `selector` // // We had already parsed the value (`x`), encountered a dot, and // immediately knew we had to look for an identifier - a plain // identifier, which cannot be qualified. This identifier is // `selector`. Ok(ast::SelectorExpr { operand: Box::new(x), selector: selector, }) } fn parse_type_assertion(&mut self, x: ast::PrimaryExpr) -> PResult { // So now `x` _has_ to be an expression, and not a _type_. According to // the original Go source. Don't ask me! // x.(T) // ^ // | // | // left paren try!(self.eat(TokenKind::LParen)); // XXX: left off spanning for now. let typ; // There's a catch. Type switches. Look at this code: // // someVal.(type) // // This is the _literal_ `type` keyword. Not a placeholder. A keyword. // It indicates a special kind of switch that compares to types instead // of values. if self.token.kind == TokenKind::Type { typ = None; self.bump(); } else { typ = Some(try!(self.parse_type())); } try!(self.eat(TokenKind::RParen)); Ok(ast::TypeAssertion { expr: Box::new(x), typ: typ, }) } // XXX: straight, unidiomatic port from Go source. // Well... almost. I tried to clean up a bit. // This method (and the corresponding smaller methods) is really complicated. It needs careful // review, and a lot of testing. fn parse_primary_expr(&mut self) -> PResult { trace!("parse_primary_expr"); // Parse the first part of the expression, which may be a literal, a (potentially // qualified) identifier, a method expression (= `SomeType.MethodName` - returns a // function), or any expression if it is parenthesized. // // Operand = Literal | OperandName | MethodExpr | "(" Expression ")" . // let mut x = ast::PrimaryExpr::Operand(try!(self.parse_operand())); 'L: loop { match self.token.kind { TokenKind::Dot => { self.bump(); match self.token.kind { TokenKind::Ident => { // XXX: Selector ~= MethodExpr?... x = ast::PrimaryExpr::SelectorExpr(try!(self.parse_selector(x))); } TokenKind::LParen => { x = ast::PrimaryExpr::TypeAssertion(try!(self.parse_type_assertion(x))); } _ => { // XXX: the Go parser signals the error and keeps going, here. // XXX: needs better diagnostic to explain we were looking for a // selector or a type assertion. let expected = vec![TokenKind::Ident, TokenKind::LParen]; return Err(self.err( ErrorKind::unexpected_token(expected, self.token.clone()) )); } } } TokenKind::LBracket => { // ~"x must be an expression, not a type" x = try!(self.parse_index_or_slice(x)); } TokenKind::LParen => { // ~"x must be an expression or a type, but NOT a 'raw type'"...? // `x(x)` could be `T(x)` (conversion) or `f(x)` (function call). x = try!(self.parse_call_or_conversion(x)); } TokenKind::LBrace => unimplemented!(), _ => break 'L, } } Ok(x) } // XXX XXX XXX: Straight, untested, stupid port from the Go source. fn parse_operand(&mut self) -> PResult { trace!("parse_operand"); let ret = match self.token.kind { TokenKind::Ident => { let id = try!(self.parse_maybe_qualified_ident()); ast::Operand::MaybeQualifiedIdent(id) } token_kind if token_kind.can_start_basic_lit() => { let lit = try!(self.parse_basic_lit()); ast::Operand::Lit(ast::Literal::Basic(lit)) } TokenKind::LParen => { // "(" Expr ")" // // Skip past the LParen. self.bump(); self.expression_level += 1; let expr = try!(self.parse_expr()); self.expression_level -= 1; try!(self.eat(TokenKind::RParen)); ast::Operand::Expr(expr) } TokenKind::Func => { let fl = try!(self.parse_func_lit()); ast::Operand::Lit(ast::Literal::Func(fl)) } _ => { let method_expr = try!(self.parse_method_expr()); ast::Operand::MethodExpr(method_expr) } }; Ok(ret) } fn parse_method_expr(&mut self) -> PResult { unimplemented!() } fn parse_func_lit(&mut self) -> PResult { Ok(ast::FuncLit { signature: try!(self.parse_func_signature()), body: try!(self.parse_block()), }) } fn parse_index_or_slice(&mut self, x: ast::PrimaryExpr) -> PResult { unimplemented!() } fn parse_call_or_conversion(&mut self, x: ast::PrimaryExpr) -> PResult { unimplemented!() } fn parse_basic_lit(&mut self) -> PResult { // BasicLit = int_lit | float_lit | imaginary_lit | rune_lit | string_lit . trace!("parse_basic_lit"); use token::TokenKind::*; match self.token.kind { Decimal | Octal | Hex => Ok(ast::BasicLit::Int(try!(self.parse_int_lit()))), Str | StrRaw => Ok(ast::BasicLit::Str(try!(self.parse_string_lit()))), Float => { let value = self.bump_and_get() .value .expect("BUG: missing value in float literal"); Ok(ast::BasicLit::Float(try!(self.interpret_float_lit(&value[..], "float literal")))) } Imaginary => { let value = self.bump_and_get() .value .expect("BUG: missing value in imaginary literal"); assert!(value.chars().last().unwrap() == 'i', "BUG: imaginary literal token does not end with i"); let value_ref = value.trim_right_matches('i'); Ok(ast::BasicLit::Imaginary(try!(self.interpret_float_lit(value_ref, "imaginary literal")))) } Rune => Ok(ast::BasicLit::Rune(try!(self.parse_rune_lit()))), _ => { let expected = vec![Decimal, Octal, Hex, Float, Imaginary, Rune, Str, StrRaw]; return Err(self.err(ErrorKind::unexpected_token(expected, self.token.clone()))); } } } fn parse_rune_lit(&mut self) -> PResult { // rune_lit = "'" ( unicode_value | byte_value ) "'" . trace!("parse_rune_lit"); let value = try!(self.eat_and_get(TokenKind::Rune)) .value .expect("BUG: missing value in rune literal"); let mut char_indices = value.char_indices().peekable(); let result; let (_, c) = char_indices.next().unwrap(); if c == '\\' { let &(_, pc) = char_indices.peek().expect("BUG: rune lit containing only \\"); // First check to see if we have a simple escape. if let Some(escape_byte) = self.get_simple_escape(pc) { char_indices.next(); result = escape_byte as char; } else if pc == '\'' { char_indices.next(); // \' is only valid in runes result = '\''; } else if pc == 'x' { char_indices.next(); result = try!(self.interpret_hex_escape(&mut char_indices)) as char; } else if pc == 'u' || pc == 'U' { char_indices.next(); result = try!(self.interpret_unicode_escape(pc == 'U', &mut char_indices)); } else if pc.is_digit(8) { result = try!(self.interpret_octal_escape(&mut char_indices)) as char; } else { let msg = format!("unknown escape sequence: {}", pc); return Err(self.err(ErrorKind::other(msg))); } } else if c == '\n' { return Err(self.err(ErrorKind::other("newline in rune literal"))); } else { result = c; } if char_indices.next().is_none() { Ok(result) } else { Err(self.err(ErrorKind::other("multiple characters in rune literal"))) } } /// Interpret the value of a float/imaginary literal and return the result as a BigRational. /// If this method is being used to parse an imaginary lit, don't include the trailing `i`. fn interpret_float_lit(&mut self, value: &str, token_name: &str) -> PResult { // float_lit = decimals "." [ decimals ] [ exponent ] | // decimals exponent | // "." decimals [ exponent ] . // decimals = decimal_digit { decimal_digit } . // exponent = ( "e" | "E" ) [ "+" | "-" ] decimals . trace!("interpret_float_lit"); let mut res = BigRational::from_integer(BigInt::from(0u8)); let mut chars = value.chars().peekable(); let mut parse_exponent = false; let mut digits_after_dot = 0u32; // the number of digits after the dot we are while let Some(c) = chars.next() { if c == '.' { digits_after_dot = 1; } else if c == 'e' || c == 'E' { parse_exponent = true; break; } else { let digit = c.to_digit(10).expect("BUG: invalid char in float/imag lit"); let digit_value = BigRational::from_integer(BigInt::from(digit)); if digits_after_dot == 0 { res = res * BigRational::from_integer(BigInt::from(10u8)); res = res + BigRational::from_integer(BigInt::from(digit)); } else { res = res + digit_value / BigRational::from_integer(BigInt::from(10u32.pow(digits_after_dot))); digits_after_dot += 1; } } } if parse_exponent { let mut negative = false; if let Some(&c) = chars.peek() { if c == '+' { chars.next(); } else if c == '-' { negative = true; chars.next(); } } else { // Empty exponent return Err(self.err(ErrorKind::other(format!("malformed {} exponent", token_name)))); } let mut exponent = 0; while let Some(c) = chars.next() { exponent *= 10; exponent += c.to_digit(10).expect("BUG: invalid char in float/imag lit exponent"); } for _ in 0..exponent { if negative { res = res / BigRational::from_integer(BigInt::from(10u8)); } else { res = res * BigRational::from_integer(BigInt::from(10u8)); } } } Ok(res) } fn parse_int_lit(&mut self) -> PResult { // int_lit = decimal_lit | octal_lit | hex_lit . // decimal_lit = ( "1" … "9" ) { decimal_digit } . // octal_lit = "0" { octal_digit } . // hex_lit = "0" ( "x" | "X" ) hex_digit { hex_digit } . trace!("parse_int_lit"); match self.token.kind { TokenKind::Decimal => { let value = self.bump_and_get().value.expect("BUG: missing value in decimal lit"); Ok(try!(self.interpret_int(&value[..], 10, "decimal literal"))) } TokenKind::Octal => { let value = self.bump_and_get().value.expect("BUG: missing value in octal lit"); assert_eq!(value.chars().next(), Some('0')); Ok(try!(self.interpret_int(&value[1..], 8, "octal literal"))) } TokenKind::Hex => { let value = self.bump_and_get().value.expect("BUG: missing value in hex lit"); assert!(value.starts_with("0x") || value.starts_with("0X")); Ok(try!(self.interpret_int(&value[2..], 16, "hex literal"))) } _ => { return Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Decimal, TokenKind::Octal, TokenKind::Hex], self.token.clone()))); } } } /// Interpret the value of an int literal and return the result as a BigInt, using the provided /// base. /// /// Use `token_name` to specify what type of literal this is, for error messages. To /// parse an octal or hex literal, do not pass the `0` or `0x` prefixes. fn interpret_int(&mut self, lit: &str, base: u32, token_name: &str) -> PResult { trace!("interpret_int"); let mut res = BigInt::from(0u8); for c in lit.chars() { if let Some(d) = c.to_digit(base) { res = res * BigInt::from(base); res = res + BigInt::from(d); } else { let msg = format!("invalid character in {}: {}", token_name, c); return Err(self.err(ErrorKind::other(msg))); } } Ok(res) } // This is pretty much a straight port from the official Go source. fn parse_potential_binary_expr(&mut self, prec1: i32) -> PResult { // Grammar: // Expression binary_op Expression trace!("parse_potential_binary_expr"); let a = try_span!(self, self.parse_unary_expr()); let mut x = Spanned::new(a.span, ast::Expr::Unary(a.item)); loop { let bin_op_kind = match ast::BinaryOperator::from_token_kind(self.token.kind) { Some(x) => x, // The current token is not a binary operator. None => return Ok(x.item), }; let precedence = bin_op_kind.precedence(); if precedence < prec1 { return Ok(x.item); } self.bump(); let y = try_span!(self, self.parse_potential_binary_expr(precedence + 1)); let binop_span = Span { start: x.span.start, end: y.span.end, }; x = Spanned::new(binop_span, ast::Expr::Binary(ast::BinaryExpr { lhs: Box::new(x), op: bin_op_kind, rhs: Box::new(y), })); } } /// Parse an identifier. // XXX: come back later. String interning and all that. fn parse_ident(&mut self) -> PResult { trace!("parse_ident"); match self.token.kind { TokenKind::Ident => { Ok(self.bump_and_get() .value .clone() .expect("BUG: missing value in identifier token")) } _ => { Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Ident], self.token.clone()))) } } } /// Parse a string literal, whether interpreted or raw. /// This is useful because one will often expect a string literal without caring about its /// kind. fn parse_string_lit(&mut self) -> PResult> { trace!("parse_string_lit"); // Grammar: // // ``` // string_lit = raw_string_lit | interpreted_string_lit . // raw_string_lit = "`" { unicode_char | newline } "`" . // interpreted_string_lit = `"` { unicode_value | byte_value } `"` . // ``` match self.token.kind { TokenKind::Str => { // Interpret the string. let raw_val = self.bump_and_get().value.expect("BUG: missing Str value"); Ok(try!(self.interpret_string_lit(raw_val))) } TokenKind::StrRaw => { // Only interpreting that needs to be done is removing carriage returns. let raw_val = self.bump_and_get().value.expect("BUG: missing StrRaw value"); let mut byte_vec = raw_val.into_bytes(); byte_vec.retain(|&c| c != b'\r'); Ok(byte_vec) } _ => { Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Str, TokenKind::StrRaw], self.token.clone()))) } } } fn interpret_unicode_escape(&self, long: bool, chars: &mut Iterator) -> PResult { let num_digits = if long { 8 } else { 4 }; let mut value = 0u32; for _ in 0..num_digits { if let Some((_, c)) = chars.next() { if let Some(number) = c.to_digit(16) { value *= 16; value += number; } else { let msg = format!("illegal character in unicode escape: '{}'", c); return Err(self.err(ErrorKind::other(msg))); } } else { let msg = "unexpected end of string in unicode escape"; return Err(self.err(ErrorKind::other(msg))); } } return if let Some(value_char) = ::std::char::from_u32(value) { Ok(value_char) } else { let msg = format!("escape sequence is invalid unicode codepoint: {:#x}", value); Err(self.err(ErrorKind::other(msg))) }; } fn interpret_octal_escape(&self, chars: &mut Iterator) -> PResult { let mut value = 0u16; for _ in 0..3 { if let Some((_, c)) = chars.next() { if let Some(number) = c.to_digit(8) { value *= 8; value += number as u16; } else { let msg = format!("illegal character in octal escape: '{}'", c); return Err(self.err(ErrorKind::other(msg))); } } else { let msg = "unexpected end of string in octal escape"; return Err(self.err(ErrorKind::other(msg))); } } return if value > 255 { let msg = format!("illegal octal escape value > 255: {}", value); Err(self.err(ErrorKind::other(msg))) } else { Ok(value as u8) }; } fn interpret_hex_escape(&self, chars: &mut Iterator) -> PResult { let mut value = 0u8; for _ in 0..2 { if let Some((_, c)) = chars.next() { if let Some(number) = c.to_digit(16) { value *= 16; value += number as u8; } else { let msg = format!("illegal character in hex escape: '{}'", c); return Err(self.err(ErrorKind::other(msg))); } } else { let msg = "unexpected end of string in hex escape"; return Err(self.err(ErrorKind::other(msg))); } } Ok(value) } fn get_simple_escape(&self, c: char) -> Option { // The escapes are roughly sorted by most common first. // XXX: actually find out exact ordering // XXX(perf): .find() on a static array _will_ be slower than a match. let simple_escapes = [('\\', b'\\'), ('n', b'\n'), ('t', b'\t'), ('v', b'\x0b'), ('r', b'\r'), ('b', b'\x08'), ('f', b'\x0c'), ('a', b'\x07')]; return if let Some(escape) = simple_escapes.iter().find(|escape| escape.0 == c) { Some(escape.1) } else { None }; } /// Interpret a string literal, converting escape patterns to bytes. /// Note that it returns a Vec rather than a String. This is because Go string literals /// are allowed to contain invalid ASCII/UTF-8 through the use of octal and hex escapes. fn interpret_string_lit(&mut self, lit: String) -> PResult> { let mut result = Vec::new(); let mut char_indices = lit.char_indices().peekable(); while let Some((offset, c)) = char_indices.next() { if c == '\\' { // A string literal with a value ending with \ shouldn't get past the lexer. let &(_, pc) = char_indices.peek() .expect("unexpected end of string: this is a bug!"); // First check to see if we have a simple escape. if let Some(escape_byte) = self.get_simple_escape(pc) { char_indices.next(); result.push(escape_byte); } else if pc == '"' { char_indices.next(); // \" is only valid in strings result.push(b'"'); } else if pc == 'x' { char_indices.next(); let byte = try!(self.interpret_hex_escape(&mut char_indices)); result.push(byte); } else if pc == 'u' || pc == 'U' { char_indices.next(); let value_char = try!(self.interpret_unicode_escape(pc == 'U', &mut char_indices)); let mut tmp = String::with_capacity(4); tmp.push(value_char); result.extend_from_slice(tmp.as_bytes()); } else if pc.is_digit(8) { let byte = try!(self.interpret_octal_escape(&mut char_indices)); result.push(byte); } else { let msg = format!("unknown escape sequence: {}", pc); return Err(self.err(ErrorKind::other(msg))); } } else if c == '\n' { let msg = format!("newline in string"); return Err(self.err(ErrorKind::other(msg))); } else { let orig_str = &lit[offset..offset + c.len_utf8()]; result.extend_from_slice(orig_str.as_bytes()); } } Ok(result) } } pub fn parse_tokens(tokens: Vec) -> ast::SourceFile { let parser = Parser::new(tokens.into_iter()); // XXX: unwrapping parser.parse().unwrap() } ================================================ FILE: src/parser/test.rs ================================================ use super::*; use std::str::FromStr; use lexer; use ast; use num::bigint::BigInt; use num::BigRational; // String literals fn assert_interpret_string_eq(lit: &str, expect: Vec) { let tokens = lexer::tokenize(format!("\"{}\"", lit).as_ref()); assert_eq!(tokens.len(), 1); let mut p = Parser::new(tokens.into_iter()); let got = p.interpret_string_lit(lit.to_owned()).unwrap(); assert_eq!(expect, got); } fn assert_interpret_string_valid(lit: &str) { let tokens = lexer::tokenize(format!("\"{}\"", lit).as_ref()); assert_eq!(tokens.len(), 1); let mut p = Parser::new(tokens.into_iter()); p.interpret_string_lit(lit.to_owned()).unwrap(); } #[test] fn test_interpret_strings() { let string_tests = [("hello", "hello"), ("newline \\n", "newline \n"), ("\\\"", "\""), ("日本語", "日本語"), ("\\u65e5本\\U00008a9e", "日本語"), ("\\u65e5\\u672c\\u8a9e", "日本語"), ("\\U000065e5\\U0000672c\\U00008a9e", "日本語"), ("\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e", "日本語"), ("\\150", "h")]; for t in &string_tests { assert_interpret_string_eq(t.0, t.1.into()); } assert_interpret_string_eq("\\xff\\u00FF", vec![255, 195, 191]); } #[test] #[should_panic] fn test_interpret_string_illegal_surrogate_half() { assert_interpret_string_valid("\\uD800"); } #[test] #[should_panic] fn test_interpret_string_invalid_codepoint() { assert_interpret_string_valid("\\U00110000"); } // Rune literals fn assert_interpret_rune_eq(lit: &str, expect: char) { let tokens = lexer::tokenize(format!("'{}'", lit).as_ref()); assert_eq!(tokens.len(), 1); let mut p = Parser::new(tokens.into_iter()); let got = p.parse_rune_lit().unwrap(); assert_eq!(expect, got); } fn assert_interpret_rune_valid(lit: &str) { let tokens = lexer::tokenize(format!("'{}'", lit).as_ref()); assert_eq!(tokens.len(), 1); let mut p = Parser::new(tokens.into_iter()); p.parse_rune_lit().unwrap(); } #[test] fn test_interpret_runes() { let rune_tests = [("a", 'a'), ("ä", 'ä'), ("本", '本'), ("\\t", '\t'), ("\\000", '\0'), ("\\007", '\x07'), ("\\377", '\u{00ff}'), ("\\x07", '\x07'), ("\\xff", '\u{00ff}'), ("\\u12e4", '\u{12e4}'), ("\\U00101234", '\u{101234}'), ("\\'", '\'')]; for &(lit, expect) in &rune_tests { assert_interpret_rune_eq(lit, expect); } } #[test] #[should_panic] fn test_interpret_rune_too_many_characters() { assert_interpret_rune_valid("aa"); } #[test] #[should_panic] fn test_interpret_rune_too_few_hex_digits() { assert_interpret_rune_valid("\\xa"); } #[test] #[should_panic] fn test_interpret_rune_too_few_octal_digits() { assert_interpret_rune_valid("\\0"); } #[test] #[should_panic] fn test_interpret_rune_surrogate_half() { assert_interpret_rune_valid("\\uDFFF"); } #[test] #[should_panic] fn test_interpret_rune_invalid_codepoint() { assert_interpret_rune_valid("\\u00110000"); } // Int literals fn assert_interpret_int_eq(lit: &str, expect: BigInt) { let tokens = lexer::tokenize(lit); assert_eq!(tokens.len(), 1); let mut p = Parser::new(tokens.into_iter()); let got = p.parse_int_lit().unwrap(); assert_eq!(expect, got); } #[test] fn test_interpret_ints() { assert_interpret_int_eq("42", BigInt::from(42)); assert_interpret_int_eq("0600", BigInt::from(0o600)); assert_interpret_int_eq("0xBadFace", BigInt::from(0xbadface)); assert_interpret_int_eq("170141183460469231731687303715884105727", BigInt::from_str("170141183460469231731687303715884105727").unwrap()); } // Float/imaginary literals fn assert_interpret_float_eq(lit: &str, expect: BigRational) { let tokens = lexer::tokenize(format!("{}", lit).as_ref()); assert_eq!(tokens.len(), 1); let mut p = Parser::new(tokens.into_iter()); let got = p.parse_basic_lit().unwrap(); if let ast::BasicLit::Float(val) = got { assert_eq!(expect, val); } else { panic!(format!("expected float basic lit, found {:?}", got)); } } fn assert_interpret_imaginary_eq(lit: &str, expect: BigRational) { let tokens = lexer::tokenize(lit); assert_eq!(tokens.len(), 1); let mut p = Parser::new(tokens.into_iter()); let got = p.parse_basic_lit().unwrap(); if let ast::BasicLit::Imaginary(val) = got { assert_eq!(expect, val); } else { panic!(format!("expected imaginary basic lit, found {:?}", got)); } } fn bigrat_from_int(value: u64) -> BigRational { BigRational::from_integer(BigInt::from(value)) } fn bigrat_from_ints(numerator: u64, denominator: u64) -> BigRational { BigRational::from_integer(BigInt::from(numerator)) / BigRational::from_integer(BigInt::from(denominator)) } #[test] fn test_interpret_floats() { let float_tests = [("13e0", bigrat_from_int(13)), ("13e4", bigrat_from_int(130000)), ("13E4", bigrat_from_int(130000)), ("13e+4", bigrat_from_int(130000)), ("130000e-4", bigrat_from_int(13)), ("1.5", bigrat_from_ints(3, 2)), ("0.", bigrat_from_int(0)), ("72.40", bigrat_from_ints(724, 10)), ("072.40", bigrat_from_ints(724, 10)), ("2.71828", bigrat_from_ints(271828, 100000)), ("1.e+0", bigrat_from_int(1)), ("6.67428e-11", bigrat_from_ints(667428, 10000000000000000)), ("1E6", bigrat_from_int(1000000)), (".25", bigrat_from_ints(25, 100)), (".12345E+5", bigrat_from_int(12345))]; for t in &float_tests { assert_interpret_float_eq(t.0, t.1.clone()); } } #[test] fn test_interpret_imaginaries() { let float_tests = [("0i", bigrat_from_int(0)), ("011i", bigrat_from_int(11)), ("0.i", bigrat_from_int(0)), ("2.71828i", bigrat_from_ints(271828, 100000)), ("1.e+0i", bigrat_from_int(1)), ("6.67428e-11i", bigrat_from_ints(667428, 10000000000000000)), ("1E6i", bigrat_from_int(1000000)), (".25i", bigrat_from_ints(25, 100)), (".12345E+5i", bigrat_from_int(12345))]; for t in &float_tests { assert_interpret_imaginary_eq(t.0, t.1.clone()); } } ================================================ FILE: src/pos.rs ================================================ #[derive(Debug, Clone, PartialEq, Eq)] pub struct Position { /// 1-indexed row. pub row: usize, /// 1-indexed column. pub column: usize, } impl Position { pub fn start() -> Position { Position { row: 1, column: 1, } } } ================================================ FILE: src/token.rs ================================================ use std::fmt; use self::TokenKind::*; #[derive(Debug, Clone, PartialEq, Eq)] pub struct TokenAndSpan { pub token: Token, pub span: Span, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Span { pub start: u32, pub end: u32, } pub trait Spanner { fn span(&self) -> Span; } impl Spanner for Span { fn span(&self) -> Span { *self } } /// Returns a new span from the start of the first element to the end of the last element. /// This is useful in cases like the following: /// ``` /// var a, b, c, d, e, f, g int /// ``` /// We have `Vec>` for all the variable names, so we can get a span of the whole list. /// /// If the vector is empty, this returns a default `Span`. impl Spanner for Vec { fn span(&self) -> Span { if self.is_empty() { // XXX return Span { start: 0, end: 0 }; } Span { start: self.first().unwrap().span().start, end: self.last().unwrap().span().end, } } } /// Simply get the span embedded in this `Spanned`. impl Spanner for Spanned { fn span(&self) -> Span { self.span } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Spanned { pub span: Span, pub item: T, } impl Spanned { pub fn new(span: Span, item: T) -> Spanned { Spanned { span: span, item: item, } } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Token { pub kind: TokenKind, pub value: Option, } impl fmt::Display for Token { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // If the token contains a value, display it. match self.value { Some(ref v) => write!(f, "{}({})", self, v), None => write!(f, "{}", self), } } } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum TokenKind { /// Identifier. Ident, // Delimiters. /// ( LParen, /// ) RParen, /// [ LBracket, /// ] RBracket, /// { LBrace, /// } RBrace, // Literals. /// Decimal integer literal. Decimal, /// Octal integer literal. Octal, /// Hex integer literal. Hex, /// Floating-point literal. Float, /// Imaginary literal (e.g. `6.67428e-11i`). Imaginary, /// Rune literal (e.g. `'本'`, `'\U00101234'`). Rune, /// Interpreted string literal. Str, /// Raw string literal. StrRaw, // Keywords. Break, Case, Chan, Const, Continue, Default, Defer, Else, Fallthrough, For, Func, Go, Goto, If, Import, Interface, Map, Package, Range, Return, Select, Struct, Switch, Type, Var, // Operators. /// + Plus, /// - Minus, /// * Star, /// / Slash, /// % Percent, /// & And, /// | Or, /// ^ Caret, /// << Lshift, /// >> Rshift, /// &^ BitClear, /// && AndAnd, /// || OrOr, /// == Equals, /// != NotEqual, /// < LessThan, /// > GreaterThan, /// <= LessThanOrEqual, /// >= GreaterThanOrEqual, /// ++ Increment, /// -- Decrement, /// += PlusAssign, /// -= MinusAssign, /// *= StarAssign, /// /= SlashAssign, /// %= PercentAssign, /// &= AndAssign, /// |= OrAssign, /// ^= CaretAssign, /// <<= LshiftAssign, /// >>= RshiftAssign, /// &^= BitClearAssign, /// ! Not, /// = Assign, /// := ColonAssign, /// <- Arrow, // Misc. /// ... Ellipsis, /// , Comma, /// . Dot, /// ; Semicolon, /// : Colon, /// End of file Eof, } impl fmt::Display for TokenKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // We're using the derived Debug impl for simplicity. // It displays the name of each variant as written in the enum declaration. fmt::Debug::fmt(self, f) } } impl TokenKind { pub fn precedence(self) -> i32 { // Precedence Operator // 5 * / % << >> & &^ // 4 + - | ^ // 3 == != < <= > >= // 2 && // 1 || match self { Star | Slash | Percent | Lshift | Rshift | And | BitClear => 5, Plus | Minus | Or | Caret => 4, Equals | NotEqual | LessThan | LessThanOrEqual | GreaterThan | GreaterThanOrEqual => 3, AndAnd => 2, OrOr => 1, _ => panic!("BUG: calling .precedence() on a token which is not a binary operator"), } } pub fn is_ident(self) -> bool { self == Ident } pub fn is_unary_op(self) -> bool { // unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" . match self { Plus | Minus | Not | Caret | Star | And | Arrow => true, _ => false, } } pub fn is_assign_op(self) -> bool { // assign_op = [ add_op | mul_op ] "=" . // add_op = "+" | "-" | "|" | "^" . // mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" . match self { Assign | PlusAssign | MinusAssign | OrAssign | CaretAssign | StarAssign | SlashAssign | PercentAssign | LshiftAssign | RshiftAssign | AndAssign | BitClearAssign => true, _ => false, } } pub fn is_literal(self) -> bool { match self { Str | StrRaw | Decimal | Octal | Hex | Float | Imaginary | Rune => true, _ => false, } } pub fn can_start_statement(self) -> bool { // Grammar: // Statement = // Declaration | LabeledStmt | SimpleStmt | // GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt | // FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt | // DeferStmt . // // SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment | // ShortVarDecl . if self.can_start_decl() || self.can_start_labeled_stmt() || self.can_start_simple_stmt() || self.can_start_go_stmt() || self.can_start_block() { return true; } match self { Return | Break | Continue | Goto | Fallthrough | If | // XXX/TODO: make sure that this is correct. Switch | Select | For | Defer => true, _ => false, } } pub fn can_start_block(self) -> bool { self == LBrace } pub fn can_start_return_stmt(self) -> bool { self == Return } pub fn can_start_labeled_stmt(self) -> bool { // LabeledStmt = Label ":" Statement . // Label = identifier . self.is_ident() } pub fn can_start_go_stmt(self) -> bool { self == Go } pub fn can_start_decl(self) -> bool { trace!("can_start_decl"); // Declaration = ConstDecl | TypeDecl | VarDecl . self == Const || self == Type || self == Var } pub fn can_start_simple_stmt(self) -> bool { self == Semicolon || self.can_start_expr() || self.can_start_send_stmt() || self.can_start_inc_dec_stmt() || self.can_start_assignment() || self.can_start_short_var_decl() } pub fn can_start_expr(self) -> bool { // Expression = UnaryExpr | Expression binary_op Expression . // UnaryExpr = PrimaryExpr | unary_op UnaryExpr . // // binary_op = "||" | "&&" | rel_op | add_op | mul_op . // rel_op = "==" | "!=" | "<" | "<=" | ">" | ">=" . // add_op = "+" | "-" | "|" | "^" . // mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" . // // unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" . // // // PrimaryExpr = // Operand | // Conversion | // PrimaryExpr Selector | // PrimaryExpr Index | // PrimaryExpr Slice | // PrimaryExpr TypeAssertion | // PrimaryExpr Arguments . // // Selector = "." identifier . // Index = "[" Expression "]" . // Slice = "[" ( [ Expression ] ":" [ Expression ] ) | // ( [ Expression ] ":" Expression ":" Expression ) // "]" . // TypeAssertion = "." "(" Type ")" . // Arguments = "(" [ ( ExpressionList | Type [ "," ExpressionList ] ) [ "..." ] [ "," // ] ] ")" . // // Conversion = Type "(" Expression [ "," ] ")" . // // MethodExpr = ReceiverType "." MethodName . // ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" . // XXX/TODO: review this code - critical. self.can_start_unary_expr() } pub fn can_start_unary_expr(self) -> bool { self.can_start_primary_expr() || self.is_unary_op() } pub fn can_start_primary_expr(self) -> bool { self.can_start_operand() || self.can_start_conversion() } pub fn can_start_operand(self) -> bool { // Operand = Literal | OperandName | MethodExpr | "(" Expression ")" . // OperandName = identifier | QualifiedIdent. // MethodExpr = ReceiverType "." MethodName . // ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" . // // QualifiedIdent starts with an identifier. // So does MethodExpr. self.can_start_lit() || self.is_ident() || self == LParen } pub fn can_start_conversion(self) -> bool { self.can_start_type() } pub fn can_start_type(self) -> bool { // Type = TypeName | TypeLit | "(" Type ")" . // TypeName = identifier | QualifiedIdent . // TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType | // SliceType | MapType | ChannelType . self.is_ident() || self.can_start_type_lit() || self == LParen } pub fn can_start_type_lit(self) -> bool { // TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType | // SliceType | MapType | ChannelType . self.can_start_array_type() || self.can_start_struct_type() || self.can_start_pointer_type() || self.can_start_func_type() || self.can_start_interface_type() || self.can_start_slice_type() || self.can_start_map_type() || self.can_start_chan_type() } pub fn can_start_pointer_type(self) -> bool { self == Star } pub fn can_start_func_type(self) -> bool { // FunctionType = "func" Signature . self == Func } pub fn can_start_interface_type(self) -> bool { // InterfaceType = "interface" "{" { MethodSpec ";" } "}" . self == Interface } pub fn can_start_chan_type(self) -> bool { // ChannelType = ( "chan" | "chan" "<-" | "<-" "chan" ) ElementType . self == Chan || self == Arrow } pub fn can_start_lit(self) -> bool { // Literal = BasicLit | CompositeLit | FunctionLit . // BasicLit = int_lit | float_lit | imaginary_lit | rune_lit | string_lit . self.can_start_basic_lit() || self.can_start_composite_lit() || self.can_start_func_lit() } pub fn can_start_basic_lit(self) -> bool { self.is_literal() } pub fn can_start_composite_lit(self) -> bool { // CompositeLit = LiteralType LiteralValue . self.can_start_lit_type() } pub fn can_start_lit_type(self) -> bool { // LiteralType = StructType | ArrayType | "[" "..." "]" ElementType | // SliceType | MapType | TypeName . self.can_start_struct_type() || self.can_start_array_type() || self == RBracket || self.can_start_slice_type() || self.can_start_map_type() || self.is_ident() } pub fn can_start_func_lit(self) -> bool { // FunctionLit = "func" Function . self == Func } pub fn can_start_struct_type(self) -> bool { self == Struct } pub fn can_start_array_type(self) -> bool { self == RBracket } pub fn can_start_slice_type(self) -> bool { self == RBracket } pub fn can_start_map_type(self) -> bool { self == Map } pub fn can_start_send_stmt(self) -> bool { // SendStmt = Channel "<-" Expression . // Channel = Expression . self.can_start_expr() } pub fn can_start_inc_dec_stmt(self) -> bool { // IncDecStmt = Expression ( "++" | "--" ) . self.can_start_expr() } pub fn can_start_assignment(self) -> bool { // Assignment = ExpressionList assign_op ExpressionList . // ExpressionList = Expression { "," Expression } . self.can_start_expr() } pub fn can_start_short_var_decl(self) -> bool { // ShortVarDecl = IdentifierList ":=" ExpressionList . // IdentifierList = identifier { "," identifier } . self.is_ident() } } ================================================ FILE: tests/data/pass/arithConst_ssa.go ================================================ package main import "fmt" //go:noinline func add_uint64_0_ssa(a uint64) uint64 { return a + 0 } //go:noinline func add_0_uint64_ssa(a uint64) uint64 { return 0 + a } //go:noinline func add_uint64_1_ssa(a uint64) uint64 { return a + 1 } //go:noinline func add_1_uint64_ssa(a uint64) uint64 { return 1 + a } //go:noinline func add_uint64_4294967296_ssa(a uint64) uint64 { return a + 4294967296 } //go:noinline func add_4294967296_uint64_ssa(a uint64) uint64 { return 4294967296 + a } //go:noinline func add_uint64_18446744073709551615_ssa(a uint64) uint64 { return a + 18446744073709551615 } //go:noinline func add_18446744073709551615_uint64_ssa(a uint64) uint64 { return 18446744073709551615 + a } //go:noinline func sub_uint64_0_ssa(a uint64) uint64 { return a - 0 } //go:noinline func sub_0_uint64_ssa(a uint64) uint64 { return 0 - a } //go:noinline func sub_uint64_1_ssa(a uint64) uint64 { return a - 1 } //go:noinline func sub_1_uint64_ssa(a uint64) uint64 { return 1 - a } //go:noinline func sub_uint64_4294967296_ssa(a uint64) uint64 { return a - 4294967296 } //go:noinline func sub_4294967296_uint64_ssa(a uint64) uint64 { return 4294967296 - a } //go:noinline func sub_uint64_18446744073709551615_ssa(a uint64) uint64 { return a - 18446744073709551615 } //go:noinline func sub_18446744073709551615_uint64_ssa(a uint64) uint64 { return 18446744073709551615 - a } //go:noinline func div_0_uint64_ssa(a uint64) uint64 { return 0 / a } //go:noinline func div_uint64_1_ssa(a uint64) uint64 { return a / 1 } //go:noinline func div_1_uint64_ssa(a uint64) uint64 { return 1 / a } //go:noinline func div_uint64_4294967296_ssa(a uint64) uint64 { return a / 4294967296 } //go:noinline func div_4294967296_uint64_ssa(a uint64) uint64 { return 4294967296 / a } //go:noinline func div_uint64_18446744073709551615_ssa(a uint64) uint64 { return a / 18446744073709551615 } //go:noinline func div_18446744073709551615_uint64_ssa(a uint64) uint64 { return 18446744073709551615 / a } //go:noinline func mul_uint64_0_ssa(a uint64) uint64 { return a * 0 } //go:noinline func mul_0_uint64_ssa(a uint64) uint64 { return 0 * a } //go:noinline func mul_uint64_1_ssa(a uint64) uint64 { return a * 1 } //go:noinline func mul_1_uint64_ssa(a uint64) uint64 { return 1 * a } //go:noinline func mul_uint64_4294967296_ssa(a uint64) uint64 { return a * 4294967296 } //go:noinline func mul_4294967296_uint64_ssa(a uint64) uint64 { return 4294967296 * a } //go:noinline func mul_uint64_18446744073709551615_ssa(a uint64) uint64 { return a * 18446744073709551615 } //go:noinline func mul_18446744073709551615_uint64_ssa(a uint64) uint64 { return 18446744073709551615 * a } //go:noinline func lsh_uint64_0_ssa(a uint64) uint64 { return a << 0 } //go:noinline func lsh_0_uint64_ssa(a uint64) uint64 { return 0 << a } //go:noinline func lsh_uint64_1_ssa(a uint64) uint64 { return a << 1 } //go:noinline func lsh_1_uint64_ssa(a uint64) uint64 { return 1 << a } //go:noinline func lsh_uint64_4294967296_ssa(a uint64) uint64 { return a << 4294967296 } //go:noinline func lsh_4294967296_uint64_ssa(a uint64) uint64 { return 4294967296 << a } //go:noinline func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 { return a << 18446744073709551615 } //go:noinline func lsh_18446744073709551615_uint64_ssa(a uint64) uint64 { return 18446744073709551615 << a } //go:noinline func rsh_uint64_0_ssa(a uint64) uint64 { return a >> 0 } //go:noinline func rsh_0_uint64_ssa(a uint64) uint64 { return 0 >> a } //go:noinline func rsh_uint64_1_ssa(a uint64) uint64 { return a >> 1 } //go:noinline func rsh_1_uint64_ssa(a uint64) uint64 { return 1 >> a } //go:noinline func rsh_uint64_4294967296_ssa(a uint64) uint64 { return a >> 4294967296 } //go:noinline func rsh_4294967296_uint64_ssa(a uint64) uint64 { return 4294967296 >> a } //go:noinline func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 { return a >> 18446744073709551615 } //go:noinline func rsh_18446744073709551615_uint64_ssa(a uint64) uint64 { return 18446744073709551615 >> a } //go:noinline func mod_0_uint64_ssa(a uint64) uint64 { return 0 % a } //go:noinline func mod_uint64_1_ssa(a uint64) uint64 { return a % 1 } //go:noinline func mod_1_uint64_ssa(a uint64) uint64 { return 1 % a } //go:noinline func mod_uint64_4294967296_ssa(a uint64) uint64 { return a % 4294967296 } //go:noinline func mod_4294967296_uint64_ssa(a uint64) uint64 { return 4294967296 % a } //go:noinline func mod_uint64_18446744073709551615_ssa(a uint64) uint64 { return a % 18446744073709551615 } //go:noinline func mod_18446744073709551615_uint64_ssa(a uint64) uint64 { return 18446744073709551615 % a } //go:noinline func add_int64_Neg9223372036854775808_ssa(a int64) int64 { return a + -9223372036854775808 } //go:noinline func add_Neg9223372036854775808_int64_ssa(a int64) int64 { return -9223372036854775808 + a } //go:noinline func add_int64_Neg9223372036854775807_ssa(a int64) int64 { return a + -9223372036854775807 } //go:noinline func add_Neg9223372036854775807_int64_ssa(a int64) int64 { return -9223372036854775807 + a } //go:noinline func add_int64_Neg4294967296_ssa(a int64) int64 { return a + -4294967296 } //go:noinline func add_Neg4294967296_int64_ssa(a int64) int64 { return -4294967296 + a } //go:noinline func add_int64_Neg1_ssa(a int64) int64 { return a + -1 } //go:noinline func add_Neg1_int64_ssa(a int64) int64 { return -1 + a } //go:noinline func add_int64_0_ssa(a int64) int64 { return a + 0 } //go:noinline func add_0_int64_ssa(a int64) int64 { return 0 + a } //go:noinline func add_int64_1_ssa(a int64) int64 { return a + 1 } //go:noinline func add_1_int64_ssa(a int64) int64 { return 1 + a } //go:noinline func add_int64_4294967296_ssa(a int64) int64 { return a + 4294967296 } //go:noinline func add_4294967296_int64_ssa(a int64) int64 { return 4294967296 + a } //go:noinline func add_int64_9223372036854775806_ssa(a int64) int64 { return a + 9223372036854775806 } //go:noinline func add_9223372036854775806_int64_ssa(a int64) int64 { return 9223372036854775806 + a } //go:noinline func add_int64_9223372036854775807_ssa(a int64) int64 { return a + 9223372036854775807 } //go:noinline func add_9223372036854775807_int64_ssa(a int64) int64 { return 9223372036854775807 + a } //go:noinline func sub_int64_Neg9223372036854775808_ssa(a int64) int64 { return a - -9223372036854775808 } //go:noinline func sub_Neg9223372036854775808_int64_ssa(a int64) int64 { return -9223372036854775808 - a } //go:noinline func sub_int64_Neg9223372036854775807_ssa(a int64) int64 { return a - -9223372036854775807 } //go:noinline func sub_Neg9223372036854775807_int64_ssa(a int64) int64 { return -9223372036854775807 - a } //go:noinline func sub_int64_Neg4294967296_ssa(a int64) int64 { return a - -4294967296 } //go:noinline func sub_Neg4294967296_int64_ssa(a int64) int64 { return -4294967296 - a } //go:noinline func sub_int64_Neg1_ssa(a int64) int64 { return a - -1 } //go:noinline func sub_Neg1_int64_ssa(a int64) int64 { return -1 - a } //go:noinline func sub_int64_0_ssa(a int64) int64 { return a - 0 } //go:noinline func sub_0_int64_ssa(a int64) int64 { return 0 - a } //go:noinline func sub_int64_1_ssa(a int64) int64 { return a - 1 } //go:noinline func sub_1_int64_ssa(a int64) int64 { return 1 - a } //go:noinline func sub_int64_4294967296_ssa(a int64) int64 { return a - 4294967296 } //go:noinline func sub_4294967296_int64_ssa(a int64) int64 { return 4294967296 - a } //go:noinline func sub_int64_9223372036854775806_ssa(a int64) int64 { return a - 9223372036854775806 } //go:noinline func sub_9223372036854775806_int64_ssa(a int64) int64 { return 9223372036854775806 - a } //go:noinline func sub_int64_9223372036854775807_ssa(a int64) int64 { return a - 9223372036854775807 } //go:noinline func sub_9223372036854775807_int64_ssa(a int64) int64 { return 9223372036854775807 - a } //go:noinline func div_int64_Neg9223372036854775808_ssa(a int64) int64 { return a / -9223372036854775808 } //go:noinline func div_Neg9223372036854775808_int64_ssa(a int64) int64 { return -9223372036854775808 / a } //go:noinline func div_int64_Neg9223372036854775807_ssa(a int64) int64 { return a / -9223372036854775807 } //go:noinline func div_Neg9223372036854775807_int64_ssa(a int64) int64 { return -9223372036854775807 / a } //go:noinline func div_int64_Neg4294967296_ssa(a int64) int64 { return a / -4294967296 } //go:noinline func div_Neg4294967296_int64_ssa(a int64) int64 { return -4294967296 / a } //go:noinline func div_int64_Neg1_ssa(a int64) int64 { return a / -1 } //go:noinline func div_Neg1_int64_ssa(a int64) int64 { return -1 / a } //go:noinline func div_0_int64_ssa(a int64) int64 { return 0 / a } //go:noinline func div_int64_1_ssa(a int64) int64 { return a / 1 } //go:noinline func div_1_int64_ssa(a int64) int64 { return 1 / a } //go:noinline func div_int64_4294967296_ssa(a int64) int64 { return a / 4294967296 } //go:noinline func div_4294967296_int64_ssa(a int64) int64 { return 4294967296 / a } //go:noinline func div_int64_9223372036854775806_ssa(a int64) int64 { return a / 9223372036854775806 } //go:noinline func div_9223372036854775806_int64_ssa(a int64) int64 { return 9223372036854775806 / a } //go:noinline func div_int64_9223372036854775807_ssa(a int64) int64 { return a / 9223372036854775807 } //go:noinline func div_9223372036854775807_int64_ssa(a int64) int64 { return 9223372036854775807 / a } //go:noinline func mul_int64_Neg9223372036854775808_ssa(a int64) int64 { return a * -9223372036854775808 } //go:noinline func mul_Neg9223372036854775808_int64_ssa(a int64) int64 { return -9223372036854775808 * a } //go:noinline func mul_int64_Neg9223372036854775807_ssa(a int64) int64 { return a * -9223372036854775807 } //go:noinline func mul_Neg9223372036854775807_int64_ssa(a int64) int64 { return -9223372036854775807 * a } //go:noinline func mul_int64_Neg4294967296_ssa(a int64) int64 { return a * -4294967296 } //go:noinline func mul_Neg4294967296_int64_ssa(a int64) int64 { return -4294967296 * a } //go:noinline func mul_int64_Neg1_ssa(a int64) int64 { return a * -1 } //go:noinline func mul_Neg1_int64_ssa(a int64) int64 { return -1 * a } //go:noinline func mul_int64_0_ssa(a int64) int64 { return a * 0 } //go:noinline func mul_0_int64_ssa(a int64) int64 { return 0 * a } //go:noinline func mul_int64_1_ssa(a int64) int64 { return a * 1 } //go:noinline func mul_1_int64_ssa(a int64) int64 { return 1 * a } //go:noinline func mul_int64_4294967296_ssa(a int64) int64 { return a * 4294967296 } //go:noinline func mul_4294967296_int64_ssa(a int64) int64 { return 4294967296 * a } //go:noinline func mul_int64_9223372036854775806_ssa(a int64) int64 { return a * 9223372036854775806 } //go:noinline func mul_9223372036854775806_int64_ssa(a int64) int64 { return 9223372036854775806 * a } //go:noinline func mul_int64_9223372036854775807_ssa(a int64) int64 { return a * 9223372036854775807 } //go:noinline func mul_9223372036854775807_int64_ssa(a int64) int64 { return 9223372036854775807 * a } //go:noinline func mod_int64_Neg9223372036854775808_ssa(a int64) int64 { return a % -9223372036854775808 } //go:noinline func mod_Neg9223372036854775808_int64_ssa(a int64) int64 { return -9223372036854775808 % a } //go:noinline func mod_int64_Neg9223372036854775807_ssa(a int64) int64 { return a % -9223372036854775807 } //go:noinline func mod_Neg9223372036854775807_int64_ssa(a int64) int64 { return -9223372036854775807 % a } //go:noinline func mod_int64_Neg4294967296_ssa(a int64) int64 { return a % -4294967296 } //go:noinline func mod_Neg4294967296_int64_ssa(a int64) int64 { return -4294967296 % a } //go:noinline func mod_int64_Neg1_ssa(a int64) int64 { return a % -1 } //go:noinline func mod_Neg1_int64_ssa(a int64) int64 { return -1 % a } //go:noinline func mod_0_int64_ssa(a int64) int64 { return 0 % a } //go:noinline func mod_int64_1_ssa(a int64) int64 { return a % 1 } //go:noinline func mod_1_int64_ssa(a int64) int64 { return 1 % a } //go:noinline func mod_int64_4294967296_ssa(a int64) int64 { return a % 4294967296 } //go:noinline func mod_4294967296_int64_ssa(a int64) int64 { return 4294967296 % a } //go:noinline func mod_int64_9223372036854775806_ssa(a int64) int64 { return a % 9223372036854775806 } //go:noinline func mod_9223372036854775806_int64_ssa(a int64) int64 { return 9223372036854775806 % a } //go:noinline func mod_int64_9223372036854775807_ssa(a int64) int64 { return a % 9223372036854775807 } //go:noinline func mod_9223372036854775807_int64_ssa(a int64) int64 { return 9223372036854775807 % a } //go:noinline func add_uint32_0_ssa(a uint32) uint32 { return a + 0 } //go:noinline func add_0_uint32_ssa(a uint32) uint32 { return 0 + a } //go:noinline func add_uint32_1_ssa(a uint32) uint32 { return a + 1 } //go:noinline func add_1_uint32_ssa(a uint32) uint32 { return 1 + a } //go:noinline func add_uint32_4294967295_ssa(a uint32) uint32 { return a + 4294967295 } //go:noinline func add_4294967295_uint32_ssa(a uint32) uint32 { return 4294967295 + a } //go:noinline func sub_uint32_0_ssa(a uint32) uint32 { return a - 0 } //go:noinline func sub_0_uint32_ssa(a uint32) uint32 { return 0 - a } //go:noinline func sub_uint32_1_ssa(a uint32) uint32 { return a - 1 } //go:noinline func sub_1_uint32_ssa(a uint32) uint32 { return 1 - a } //go:noinline func sub_uint32_4294967295_ssa(a uint32) uint32 { return a - 4294967295 } //go:noinline func sub_4294967295_uint32_ssa(a uint32) uint32 { return 4294967295 - a } //go:noinline func div_0_uint32_ssa(a uint32) uint32 { return 0 / a } //go:noinline func div_uint32_1_ssa(a uint32) uint32 { return a / 1 } //go:noinline func div_1_uint32_ssa(a uint32) uint32 { return 1 / a } //go:noinline func div_uint32_4294967295_ssa(a uint32) uint32 { return a / 4294967295 } //go:noinline func div_4294967295_uint32_ssa(a uint32) uint32 { return 4294967295 / a } //go:noinline func mul_uint32_0_ssa(a uint32) uint32 { return a * 0 } //go:noinline func mul_0_uint32_ssa(a uint32) uint32 { return 0 * a } //go:noinline func mul_uint32_1_ssa(a uint32) uint32 { return a * 1 } //go:noinline func mul_1_uint32_ssa(a uint32) uint32 { return 1 * a } //go:noinline func mul_uint32_4294967295_ssa(a uint32) uint32 { return a * 4294967295 } //go:noinline func mul_4294967295_uint32_ssa(a uint32) uint32 { return 4294967295 * a } //go:noinline func lsh_uint32_0_ssa(a uint32) uint32 { return a << 0 } //go:noinline func lsh_0_uint32_ssa(a uint32) uint32 { return 0 << a } //go:noinline func lsh_uint32_1_ssa(a uint32) uint32 { return a << 1 } //go:noinline func lsh_1_uint32_ssa(a uint32) uint32 { return 1 << a } //go:noinline func lsh_uint32_4294967295_ssa(a uint32) uint32 { return a << 4294967295 } //go:noinline func lsh_4294967295_uint32_ssa(a uint32) uint32 { return 4294967295 << a } //go:noinline func rsh_uint32_0_ssa(a uint32) uint32 { return a >> 0 } //go:noinline func rsh_0_uint32_ssa(a uint32) uint32 { return 0 >> a } //go:noinline func rsh_uint32_1_ssa(a uint32) uint32 { return a >> 1 } //go:noinline func rsh_1_uint32_ssa(a uint32) uint32 { return 1 >> a } //go:noinline func rsh_uint32_4294967295_ssa(a uint32) uint32 { return a >> 4294967295 } //go:noinline func rsh_4294967295_uint32_ssa(a uint32) uint32 { return 4294967295 >> a } //go:noinline func mod_0_uint32_ssa(a uint32) uint32 { return 0 % a } //go:noinline func mod_uint32_1_ssa(a uint32) uint32 { return a % 1 } //go:noinline func mod_1_uint32_ssa(a uint32) uint32 { return 1 % a } //go:noinline func mod_uint32_4294967295_ssa(a uint32) uint32 { return a % 4294967295 } //go:noinline func mod_4294967295_uint32_ssa(a uint32) uint32 { return 4294967295 % a } //go:noinline func add_int32_Neg2147483648_ssa(a int32) int32 { return a + -2147483648 } //go:noinline func add_Neg2147483648_int32_ssa(a int32) int32 { return -2147483648 + a } //go:noinline func add_int32_Neg2147483647_ssa(a int32) int32 { return a + -2147483647 } //go:noinline func add_Neg2147483647_int32_ssa(a int32) int32 { return -2147483647 + a } //go:noinline func add_int32_Neg1_ssa(a int32) int32 { return a + -1 } //go:noinline func add_Neg1_int32_ssa(a int32) int32 { return -1 + a } //go:noinline func add_int32_0_ssa(a int32) int32 { return a + 0 } //go:noinline func add_0_int32_ssa(a int32) int32 { return 0 + a } //go:noinline func add_int32_1_ssa(a int32) int32 { return a + 1 } //go:noinline func add_1_int32_ssa(a int32) int32 { return 1 + a } //go:noinline func add_int32_2147483647_ssa(a int32) int32 { return a + 2147483647 } //go:noinline func add_2147483647_int32_ssa(a int32) int32 { return 2147483647 + a } //go:noinline func sub_int32_Neg2147483648_ssa(a int32) int32 { return a - -2147483648 } //go:noinline func sub_Neg2147483648_int32_ssa(a int32) int32 { return -2147483648 - a } //go:noinline func sub_int32_Neg2147483647_ssa(a int32) int32 { return a - -2147483647 } //go:noinline func sub_Neg2147483647_int32_ssa(a int32) int32 { return -2147483647 - a } //go:noinline func sub_int32_Neg1_ssa(a int32) int32 { return a - -1 } //go:noinline func sub_Neg1_int32_ssa(a int32) int32 { return -1 - a } //go:noinline func sub_int32_0_ssa(a int32) int32 { return a - 0 } //go:noinline func sub_0_int32_ssa(a int32) int32 { return 0 - a } //go:noinline func sub_int32_1_ssa(a int32) int32 { return a - 1 } //go:noinline func sub_1_int32_ssa(a int32) int32 { return 1 - a } //go:noinline func sub_int32_2147483647_ssa(a int32) int32 { return a - 2147483647 } //go:noinline func sub_2147483647_int32_ssa(a int32) int32 { return 2147483647 - a } //go:noinline func div_int32_Neg2147483648_ssa(a int32) int32 { return a / -2147483648 } //go:noinline func div_Neg2147483648_int32_ssa(a int32) int32 { return -2147483648 / a } //go:noinline func div_int32_Neg2147483647_ssa(a int32) int32 { return a / -2147483647 } //go:noinline func div_Neg2147483647_int32_ssa(a int32) int32 { return -2147483647 / a } //go:noinline func div_int32_Neg1_ssa(a int32) int32 { return a / -1 } //go:noinline func div_Neg1_int32_ssa(a int32) int32 { return -1 / a } //go:noinline func div_0_int32_ssa(a int32) int32 { return 0 / a } //go:noinline func div_int32_1_ssa(a int32) int32 { return a / 1 } //go:noinline func div_1_int32_ssa(a int32) int32 { return 1 / a } //go:noinline func div_int32_2147483647_ssa(a int32) int32 { return a / 2147483647 } //go:noinline func div_2147483647_int32_ssa(a int32) int32 { return 2147483647 / a } //go:noinline func mul_int32_Neg2147483648_ssa(a int32) int32 { return a * -2147483648 } //go:noinline func mul_Neg2147483648_int32_ssa(a int32) int32 { return -2147483648 * a } //go:noinline func mul_int32_Neg2147483647_ssa(a int32) int32 { return a * -2147483647 } //go:noinline func mul_Neg2147483647_int32_ssa(a int32) int32 { return -2147483647 * a } //go:noinline func mul_int32_Neg1_ssa(a int32) int32 { return a * -1 } //go:noinline func mul_Neg1_int32_ssa(a int32) int32 { return -1 * a } //go:noinline func mul_int32_0_ssa(a int32) int32 { return a * 0 } //go:noinline func mul_0_int32_ssa(a int32) int32 { return 0 * a } //go:noinline func mul_int32_1_ssa(a int32) int32 { return a * 1 } //go:noinline func mul_1_int32_ssa(a int32) int32 { return 1 * a } //go:noinline func mul_int32_2147483647_ssa(a int32) int32 { return a * 2147483647 } //go:noinline func mul_2147483647_int32_ssa(a int32) int32 { return 2147483647 * a } //go:noinline func mod_int32_Neg2147483648_ssa(a int32) int32 { return a % -2147483648 } //go:noinline func mod_Neg2147483648_int32_ssa(a int32) int32 { return -2147483648 % a } //go:noinline func mod_int32_Neg2147483647_ssa(a int32) int32 { return a % -2147483647 } //go:noinline func mod_Neg2147483647_int32_ssa(a int32) int32 { return -2147483647 % a } //go:noinline func mod_int32_Neg1_ssa(a int32) int32 { return a % -1 } //go:noinline func mod_Neg1_int32_ssa(a int32) int32 { return -1 % a } //go:noinline func mod_0_int32_ssa(a int32) int32 { return 0 % a } //go:noinline func mod_int32_1_ssa(a int32) int32 { return a % 1 } //go:noinline func mod_1_int32_ssa(a int32) int32 { return 1 % a } //go:noinline func mod_int32_2147483647_ssa(a int32) int32 { return a % 2147483647 } //go:noinline func mod_2147483647_int32_ssa(a int32) int32 { return 2147483647 % a } //go:noinline func add_uint16_0_ssa(a uint16) uint16 { return a + 0 } //go:noinline func add_0_uint16_ssa(a uint16) uint16 { return 0 + a } //go:noinline func add_uint16_1_ssa(a uint16) uint16 { return a + 1 } //go:noinline func add_1_uint16_ssa(a uint16) uint16 { return 1 + a } //go:noinline func add_uint16_65535_ssa(a uint16) uint16 { return a + 65535 } //go:noinline func add_65535_uint16_ssa(a uint16) uint16 { return 65535 + a } //go:noinline func sub_uint16_0_ssa(a uint16) uint16 { return a - 0 } //go:noinline func sub_0_uint16_ssa(a uint16) uint16 { return 0 - a } //go:noinline func sub_uint16_1_ssa(a uint16) uint16 { return a - 1 } //go:noinline func sub_1_uint16_ssa(a uint16) uint16 { return 1 - a } //go:noinline func sub_uint16_65535_ssa(a uint16) uint16 { return a - 65535 } //go:noinline func sub_65535_uint16_ssa(a uint16) uint16 { return 65535 - a } //go:noinline func div_0_uint16_ssa(a uint16) uint16 { return 0 / a } //go:noinline func div_uint16_1_ssa(a uint16) uint16 { return a / 1 } //go:noinline func div_1_uint16_ssa(a uint16) uint16 { return 1 / a } //go:noinline func div_uint16_65535_ssa(a uint16) uint16 { return a / 65535 } //go:noinline func div_65535_uint16_ssa(a uint16) uint16 { return 65535 / a } //go:noinline func mul_uint16_0_ssa(a uint16) uint16 { return a * 0 } //go:noinline func mul_0_uint16_ssa(a uint16) uint16 { return 0 * a } //go:noinline func mul_uint16_1_ssa(a uint16) uint16 { return a * 1 } //go:noinline func mul_1_uint16_ssa(a uint16) uint16 { return 1 * a } //go:noinline func mul_uint16_65535_ssa(a uint16) uint16 { return a * 65535 } //go:noinline func mul_65535_uint16_ssa(a uint16) uint16 { return 65535 * a } //go:noinline func lsh_uint16_0_ssa(a uint16) uint16 { return a << 0 } //go:noinline func lsh_0_uint16_ssa(a uint16) uint16 { return 0 << a } //go:noinline func lsh_uint16_1_ssa(a uint16) uint16 { return a << 1 } //go:noinline func lsh_1_uint16_ssa(a uint16) uint16 { return 1 << a } //go:noinline func lsh_uint16_65535_ssa(a uint16) uint16 { return a << 65535 } //go:noinline func lsh_65535_uint16_ssa(a uint16) uint16 { return 65535 << a } //go:noinline func rsh_uint16_0_ssa(a uint16) uint16 { return a >> 0 } //go:noinline func rsh_0_uint16_ssa(a uint16) uint16 { return 0 >> a } //go:noinline func rsh_uint16_1_ssa(a uint16) uint16 { return a >> 1 } //go:noinline func rsh_1_uint16_ssa(a uint16) uint16 { return 1 >> a } //go:noinline func rsh_uint16_65535_ssa(a uint16) uint16 { return a >> 65535 } //go:noinline func rsh_65535_uint16_ssa(a uint16) uint16 { return 65535 >> a } //go:noinline func mod_0_uint16_ssa(a uint16) uint16 { return 0 % a } //go:noinline func mod_uint16_1_ssa(a uint16) uint16 { return a % 1 } //go:noinline func mod_1_uint16_ssa(a uint16) uint16 { return 1 % a } //go:noinline func mod_uint16_65535_ssa(a uint16) uint16 { return a % 65535 } //go:noinline func mod_65535_uint16_ssa(a uint16) uint16 { return 65535 % a } //go:noinline func add_int16_Neg32768_ssa(a int16) int16 { return a + -32768 } //go:noinline func add_Neg32768_int16_ssa(a int16) int16 { return -32768 + a } //go:noinline func add_int16_Neg32767_ssa(a int16) int16 { return a + -32767 } //go:noinline func add_Neg32767_int16_ssa(a int16) int16 { return -32767 + a } //go:noinline func add_int16_Neg1_ssa(a int16) int16 { return a + -1 } //go:noinline func add_Neg1_int16_ssa(a int16) int16 { return -1 + a } //go:noinline func add_int16_0_ssa(a int16) int16 { return a + 0 } //go:noinline func add_0_int16_ssa(a int16) int16 { return 0 + a } //go:noinline func add_int16_1_ssa(a int16) int16 { return a + 1 } //go:noinline func add_1_int16_ssa(a int16) int16 { return 1 + a } //go:noinline func add_int16_32766_ssa(a int16) int16 { return a + 32766 } //go:noinline func add_32766_int16_ssa(a int16) int16 { return 32766 + a } //go:noinline func add_int16_32767_ssa(a int16) int16 { return a + 32767 } //go:noinline func add_32767_int16_ssa(a int16) int16 { return 32767 + a } //go:noinline func sub_int16_Neg32768_ssa(a int16) int16 { return a - -32768 } //go:noinline func sub_Neg32768_int16_ssa(a int16) int16 { return -32768 - a } //go:noinline func sub_int16_Neg32767_ssa(a int16) int16 { return a - -32767 } //go:noinline func sub_Neg32767_int16_ssa(a int16) int16 { return -32767 - a } //go:noinline func sub_int16_Neg1_ssa(a int16) int16 { return a - -1 } //go:noinline func sub_Neg1_int16_ssa(a int16) int16 { return -1 - a } //go:noinline func sub_int16_0_ssa(a int16) int16 { return a - 0 } //go:noinline func sub_0_int16_ssa(a int16) int16 { return 0 - a } //go:noinline func sub_int16_1_ssa(a int16) int16 { return a - 1 } //go:noinline func sub_1_int16_ssa(a int16) int16 { return 1 - a } //go:noinline func sub_int16_32766_ssa(a int16) int16 { return a - 32766 } //go:noinline func sub_32766_int16_ssa(a int16) int16 { return 32766 - a } //go:noinline func sub_int16_32767_ssa(a int16) int16 { return a - 32767 } //go:noinline func sub_32767_int16_ssa(a int16) int16 { return 32767 - a } //go:noinline func div_int16_Neg32768_ssa(a int16) int16 { return a / -32768 } //go:noinline func div_Neg32768_int16_ssa(a int16) int16 { return -32768 / a } //go:noinline func div_int16_Neg32767_ssa(a int16) int16 { return a / -32767 } //go:noinline func div_Neg32767_int16_ssa(a int16) int16 { return -32767 / a } //go:noinline func div_int16_Neg1_ssa(a int16) int16 { return a / -1 } //go:noinline func div_Neg1_int16_ssa(a int16) int16 { return -1 / a } //go:noinline func div_0_int16_ssa(a int16) int16 { return 0 / a } //go:noinline func div_int16_1_ssa(a int16) int16 { return a / 1 } //go:noinline func div_1_int16_ssa(a int16) int16 { return 1 / a } //go:noinline func div_int16_32766_ssa(a int16) int16 { return a / 32766 } //go:noinline func div_32766_int16_ssa(a int16) int16 { return 32766 / a } //go:noinline func div_int16_32767_ssa(a int16) int16 { return a / 32767 } //go:noinline func div_32767_int16_ssa(a int16) int16 { return 32767 / a } //go:noinline func mul_int16_Neg32768_ssa(a int16) int16 { return a * -32768 } //go:noinline func mul_Neg32768_int16_ssa(a int16) int16 { return -32768 * a } //go:noinline func mul_int16_Neg32767_ssa(a int16) int16 { return a * -32767 } //go:noinline func mul_Neg32767_int16_ssa(a int16) int16 { return -32767 * a } //go:noinline func mul_int16_Neg1_ssa(a int16) int16 { return a * -1 } //go:noinline func mul_Neg1_int16_ssa(a int16) int16 { return -1 * a } //go:noinline func mul_int16_0_ssa(a int16) int16 { return a * 0 } //go:noinline func mul_0_int16_ssa(a int16) int16 { return 0 * a } //go:noinline func mul_int16_1_ssa(a int16) int16 { return a * 1 } //go:noinline func mul_1_int16_ssa(a int16) int16 { return 1 * a } //go:noinline func mul_int16_32766_ssa(a int16) int16 { return a * 32766 } //go:noinline func mul_32766_int16_ssa(a int16) int16 { return 32766 * a } //go:noinline func mul_int16_32767_ssa(a int16) int16 { return a * 32767 } //go:noinline func mul_32767_int16_ssa(a int16) int16 { return 32767 * a } //go:noinline func mod_int16_Neg32768_ssa(a int16) int16 { return a % -32768 } //go:noinline func mod_Neg32768_int16_ssa(a int16) int16 { return -32768 % a } //go:noinline func mod_int16_Neg32767_ssa(a int16) int16 { return a % -32767 } //go:noinline func mod_Neg32767_int16_ssa(a int16) int16 { return -32767 % a } //go:noinline func mod_int16_Neg1_ssa(a int16) int16 { return a % -1 } //go:noinline func mod_Neg1_int16_ssa(a int16) int16 { return -1 % a } //go:noinline func mod_0_int16_ssa(a int16) int16 { return 0 % a } //go:noinline func mod_int16_1_ssa(a int16) int16 { return a % 1 } //go:noinline func mod_1_int16_ssa(a int16) int16 { return 1 % a } //go:noinline func mod_int16_32766_ssa(a int16) int16 { return a % 32766 } //go:noinline func mod_32766_int16_ssa(a int16) int16 { return 32766 % a } //go:noinline func mod_int16_32767_ssa(a int16) int16 { return a % 32767 } //go:noinline func mod_32767_int16_ssa(a int16) int16 { return 32767 % a } //go:noinline func add_uint8_0_ssa(a uint8) uint8 { return a + 0 } //go:noinline func add_0_uint8_ssa(a uint8) uint8 { return 0 + a } //go:noinline func add_uint8_1_ssa(a uint8) uint8 { return a + 1 } //go:noinline func add_1_uint8_ssa(a uint8) uint8 { return 1 + a } //go:noinline func add_uint8_255_ssa(a uint8) uint8 { return a + 255 } //go:noinline func add_255_uint8_ssa(a uint8) uint8 { return 255 + a } //go:noinline func sub_uint8_0_ssa(a uint8) uint8 { return a - 0 } //go:noinline func sub_0_uint8_ssa(a uint8) uint8 { return 0 - a } //go:noinline func sub_uint8_1_ssa(a uint8) uint8 { return a - 1 } //go:noinline func sub_1_uint8_ssa(a uint8) uint8 { return 1 - a } //go:noinline func sub_uint8_255_ssa(a uint8) uint8 { return a - 255 } //go:noinline func sub_255_uint8_ssa(a uint8) uint8 { return 255 - a } //go:noinline func div_0_uint8_ssa(a uint8) uint8 { return 0 / a } //go:noinline func div_uint8_1_ssa(a uint8) uint8 { return a / 1 } //go:noinline func div_1_uint8_ssa(a uint8) uint8 { return 1 / a } //go:noinline func div_uint8_255_ssa(a uint8) uint8 { return a / 255 } //go:noinline func div_255_uint8_ssa(a uint8) uint8 { return 255 / a } //go:noinline func mul_uint8_0_ssa(a uint8) uint8 { return a * 0 } //go:noinline func mul_0_uint8_ssa(a uint8) uint8 { return 0 * a } //go:noinline func mul_uint8_1_ssa(a uint8) uint8 { return a * 1 } //go:noinline func mul_1_uint8_ssa(a uint8) uint8 { return 1 * a } //go:noinline func mul_uint8_255_ssa(a uint8) uint8 { return a * 255 } //go:noinline func mul_255_uint8_ssa(a uint8) uint8 { return 255 * a } //go:noinline func lsh_uint8_0_ssa(a uint8) uint8 { return a << 0 } //go:noinline func lsh_0_uint8_ssa(a uint8) uint8 { return 0 << a } //go:noinline func lsh_uint8_1_ssa(a uint8) uint8 { return a << 1 } //go:noinline func lsh_1_uint8_ssa(a uint8) uint8 { return 1 << a } //go:noinline func lsh_uint8_255_ssa(a uint8) uint8 { return a << 255 } //go:noinline func lsh_255_uint8_ssa(a uint8) uint8 { return 255 << a } //go:noinline func rsh_uint8_0_ssa(a uint8) uint8 { return a >> 0 } //go:noinline func rsh_0_uint8_ssa(a uint8) uint8 { return 0 >> a } //go:noinline func rsh_uint8_1_ssa(a uint8) uint8 { return a >> 1 } //go:noinline func rsh_1_uint8_ssa(a uint8) uint8 { return 1 >> a } //go:noinline func rsh_uint8_255_ssa(a uint8) uint8 { return a >> 255 } //go:noinline func rsh_255_uint8_ssa(a uint8) uint8 { return 255 >> a } //go:noinline func mod_0_uint8_ssa(a uint8) uint8 { return 0 % a } //go:noinline func mod_uint8_1_ssa(a uint8) uint8 { return a % 1 } //go:noinline func mod_1_uint8_ssa(a uint8) uint8 { return 1 % a } //go:noinline func mod_uint8_255_ssa(a uint8) uint8 { return a % 255 } //go:noinline func mod_255_uint8_ssa(a uint8) uint8 { return 255 % a } //go:noinline func add_int8_Neg128_ssa(a int8) int8 { return a + -128 } //go:noinline func add_Neg128_int8_ssa(a int8) int8 { return -128 + a } //go:noinline func add_int8_Neg127_ssa(a int8) int8 { return a + -127 } //go:noinline func add_Neg127_int8_ssa(a int8) int8 { return -127 + a } //go:noinline func add_int8_Neg1_ssa(a int8) int8 { return a + -1 } //go:noinline func add_Neg1_int8_ssa(a int8) int8 { return -1 + a } //go:noinline func add_int8_0_ssa(a int8) int8 { return a + 0 } //go:noinline func add_0_int8_ssa(a int8) int8 { return 0 + a } //go:noinline func add_int8_1_ssa(a int8) int8 { return a + 1 } //go:noinline func add_1_int8_ssa(a int8) int8 { return 1 + a } //go:noinline func add_int8_126_ssa(a int8) int8 { return a + 126 } //go:noinline func add_126_int8_ssa(a int8) int8 { return 126 + a } //go:noinline func add_int8_127_ssa(a int8) int8 { return a + 127 } //go:noinline func add_127_int8_ssa(a int8) int8 { return 127 + a } //go:noinline func sub_int8_Neg128_ssa(a int8) int8 { return a - -128 } //go:noinline func sub_Neg128_int8_ssa(a int8) int8 { return -128 - a } //go:noinline func sub_int8_Neg127_ssa(a int8) int8 { return a - -127 } //go:noinline func sub_Neg127_int8_ssa(a int8) int8 { return -127 - a } //go:noinline func sub_int8_Neg1_ssa(a int8) int8 { return a - -1 } //go:noinline func sub_Neg1_int8_ssa(a int8) int8 { return -1 - a } //go:noinline func sub_int8_0_ssa(a int8) int8 { return a - 0 } //go:noinline func sub_0_int8_ssa(a int8) int8 { return 0 - a } //go:noinline func sub_int8_1_ssa(a int8) int8 { return a - 1 } //go:noinline func sub_1_int8_ssa(a int8) int8 { return 1 - a } //go:noinline func sub_int8_126_ssa(a int8) int8 { return a - 126 } //go:noinline func sub_126_int8_ssa(a int8) int8 { return 126 - a } //go:noinline func sub_int8_127_ssa(a int8) int8 { return a - 127 } //go:noinline func sub_127_int8_ssa(a int8) int8 { return 127 - a } //go:noinline func div_int8_Neg128_ssa(a int8) int8 { return a / -128 } //go:noinline func div_Neg128_int8_ssa(a int8) int8 { return -128 / a } //go:noinline func div_int8_Neg127_ssa(a int8) int8 { return a / -127 } //go:noinline func div_Neg127_int8_ssa(a int8) int8 { return -127 / a } //go:noinline func div_int8_Neg1_ssa(a int8) int8 { return a / -1 } //go:noinline func div_Neg1_int8_ssa(a int8) int8 { return -1 / a } //go:noinline func div_0_int8_ssa(a int8) int8 { return 0 / a } //go:noinline func div_int8_1_ssa(a int8) int8 { return a / 1 } //go:noinline func div_1_int8_ssa(a int8) int8 { return 1 / a } //go:noinline func div_int8_126_ssa(a int8) int8 { return a / 126 } //go:noinline func div_126_int8_ssa(a int8) int8 { return 126 / a } //go:noinline func div_int8_127_ssa(a int8) int8 { return a / 127 } //go:noinline func div_127_int8_ssa(a int8) int8 { return 127 / a } //go:noinline func mul_int8_Neg128_ssa(a int8) int8 { return a * -128 } //go:noinline func mul_Neg128_int8_ssa(a int8) int8 { return -128 * a } //go:noinline func mul_int8_Neg127_ssa(a int8) int8 { return a * -127 } //go:noinline func mul_Neg127_int8_ssa(a int8) int8 { return -127 * a } //go:noinline func mul_int8_Neg1_ssa(a int8) int8 { return a * -1 } //go:noinline func mul_Neg1_int8_ssa(a int8) int8 { return -1 * a } //go:noinline func mul_int8_0_ssa(a int8) int8 { return a * 0 } //go:noinline func mul_0_int8_ssa(a int8) int8 { return 0 * a } //go:noinline func mul_int8_1_ssa(a int8) int8 { return a * 1 } //go:noinline func mul_1_int8_ssa(a int8) int8 { return 1 * a } //go:noinline func mul_int8_126_ssa(a int8) int8 { return a * 126 } //go:noinline func mul_126_int8_ssa(a int8) int8 { return 126 * a } //go:noinline func mul_int8_127_ssa(a int8) int8 { return a * 127 } //go:noinline func mul_127_int8_ssa(a int8) int8 { return 127 * a } //go:noinline func mod_int8_Neg128_ssa(a int8) int8 { return a % -128 } //go:noinline func mod_Neg128_int8_ssa(a int8) int8 { return -128 % a } //go:noinline func mod_int8_Neg127_ssa(a int8) int8 { return a % -127 } //go:noinline func mod_Neg127_int8_ssa(a int8) int8 { return -127 % a } //go:noinline func mod_int8_Neg1_ssa(a int8) int8 { return a % -1 } //go:noinline func mod_Neg1_int8_ssa(a int8) int8 { return -1 % a } //go:noinline func mod_0_int8_ssa(a int8) int8 { return 0 % a } //go:noinline func mod_int8_1_ssa(a int8) int8 { return a % 1 } //go:noinline func mod_1_int8_ssa(a int8) int8 { return 1 % a } //go:noinline func mod_int8_126_ssa(a int8) int8 { return a % 126 } //go:noinline func mod_126_int8_ssa(a int8) int8 { return 126 % a } //go:noinline func mod_int8_127_ssa(a int8) int8 { return a % 127 } //go:noinline func mod_127_int8_ssa(a int8) int8 { return 127 % a } var failed bool func main() { if got := add_0_uint64_ssa(0); got != 0 { fmt.Printf("add_uint64 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint64_0_ssa(0); got != 0 { fmt.Printf("add_uint64 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_uint64_ssa(1); got != 1 { fmt.Printf("add_uint64 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint64_0_ssa(1); got != 1 { fmt.Printf("add_uint64 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_uint64_ssa(4294967296); got != 4294967296 { fmt.Printf("add_uint64 0%s4294967296 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_uint64_0_ssa(4294967296); got != 4294967296 { fmt.Printf("add_uint64 4294967296%s0 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_0_uint64_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("add_uint64 0%s18446744073709551615 = %d, wanted 18446744073709551615\n", `+`, got) failed = true } if got := add_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("add_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `+`, got) failed = true } if got := add_1_uint64_ssa(0); got != 1 { fmt.Printf("add_uint64 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint64_1_ssa(0); got != 1 { fmt.Printf("add_uint64 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_uint64_ssa(1); got != 2 { fmt.Printf("add_uint64 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_uint64_1_ssa(1); got != 2 { fmt.Printf("add_uint64 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_uint64_ssa(4294967296); got != 4294967297 { fmt.Printf("add_uint64 1%s4294967296 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_uint64_1_ssa(4294967296); got != 4294967297 { fmt.Printf("add_uint64 4294967296%s1 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_1_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("add_uint64 1%s18446744073709551615 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint64_1_ssa(18446744073709551615); got != 0 { fmt.Printf("add_uint64 18446744073709551615%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_4294967296_uint64_ssa(0); got != 4294967296 { fmt.Printf("add_uint64 4294967296%s0 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_uint64_4294967296_ssa(0); got != 4294967296 { fmt.Printf("add_uint64 0%s4294967296 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_4294967296_uint64_ssa(1); got != 4294967297 { fmt.Printf("add_uint64 4294967296%s1 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_uint64_4294967296_ssa(1); got != 4294967297 { fmt.Printf("add_uint64 1%s4294967296 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_4294967296_uint64_ssa(4294967296); got != 8589934592 { fmt.Printf("add_uint64 4294967296%s4294967296 = %d, wanted 8589934592\n", `+`, got) failed = true } if got := add_uint64_4294967296_ssa(4294967296); got != 8589934592 { fmt.Printf("add_uint64 4294967296%s4294967296 = %d, wanted 8589934592\n", `+`, got) failed = true } if got := add_4294967296_uint64_ssa(18446744073709551615); got != 4294967295 { fmt.Printf("add_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_uint64_4294967296_ssa(18446744073709551615); got != 4294967295 { fmt.Printf("add_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { fmt.Printf("add_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `+`, got) failed = true } if got := add_uint64_18446744073709551615_ssa(0); got != 18446744073709551615 { fmt.Printf("add_uint64 0%s18446744073709551615 = %d, wanted 18446744073709551615\n", `+`, got) failed = true } if got := add_18446744073709551615_uint64_ssa(1); got != 0 { fmt.Printf("add_uint64 18446744073709551615%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint64_18446744073709551615_ssa(1); got != 0 { fmt.Printf("add_uint64 1%s18446744073709551615 = %d, wanted 0\n", `+`, got) failed = true } if got := add_18446744073709551615_uint64_ssa(4294967296); got != 4294967295 { fmt.Printf("add_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_uint64_18446744073709551615_ssa(4294967296); got != 4294967295 { fmt.Printf("add_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_18446744073709551615_uint64_ssa(18446744073709551615); got != 18446744073709551614 { fmt.Printf("add_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 18446744073709551614\n", `+`, got) failed = true } if got := add_uint64_18446744073709551615_ssa(18446744073709551615); got != 18446744073709551614 { fmt.Printf("add_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 18446744073709551614\n", `+`, got) failed = true } if got := sub_0_uint64_ssa(0); got != 0 { fmt.Printf("sub_uint64 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint64_0_ssa(0); got != 0 { fmt.Printf("sub_uint64 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_uint64_ssa(1); got != 18446744073709551615 { fmt.Printf("sub_uint64 0%s1 = %d, wanted 18446744073709551615\n", `-`, got) failed = true } if got := sub_uint64_0_ssa(1); got != 1 { fmt.Printf("sub_uint64 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_uint64_ssa(4294967296); got != 18446744069414584320 { fmt.Printf("sub_uint64 0%s4294967296 = %d, wanted 18446744069414584320\n", `-`, got) failed = true } if got := sub_uint64_0_ssa(4294967296); got != 4294967296 { fmt.Printf("sub_uint64 4294967296%s0 = %d, wanted 4294967296\n", `-`, got) failed = true } if got := sub_0_uint64_ssa(18446744073709551615); got != 1 { fmt.Printf("sub_uint64 0%s18446744073709551615 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("sub_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `-`, got) failed = true } if got := sub_1_uint64_ssa(0); got != 1 { fmt.Printf("sub_uint64 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint64_1_ssa(0); got != 18446744073709551615 { fmt.Printf("sub_uint64 0%s1 = %d, wanted 18446744073709551615\n", `-`, got) failed = true } if got := sub_1_uint64_ssa(1); got != 0 { fmt.Printf("sub_uint64 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint64_1_ssa(1); got != 0 { fmt.Printf("sub_uint64 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_uint64_ssa(4294967296); got != 18446744069414584321 { fmt.Printf("sub_uint64 1%s4294967296 = %d, wanted 18446744069414584321\n", `-`, got) failed = true } if got := sub_uint64_1_ssa(4294967296); got != 4294967295 { fmt.Printf("sub_uint64 4294967296%s1 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_1_uint64_ssa(18446744073709551615); got != 2 { fmt.Printf("sub_uint64 1%s18446744073709551615 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_uint64_1_ssa(18446744073709551615); got != 18446744073709551614 { fmt.Printf("sub_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551614\n", `-`, got) failed = true } if got := sub_4294967296_uint64_ssa(0); got != 4294967296 { fmt.Printf("sub_uint64 4294967296%s0 = %d, wanted 4294967296\n", `-`, got) failed = true } if got := sub_uint64_4294967296_ssa(0); got != 18446744069414584320 { fmt.Printf("sub_uint64 0%s4294967296 = %d, wanted 18446744069414584320\n", `-`, got) failed = true } if got := sub_4294967296_uint64_ssa(1); got != 4294967295 { fmt.Printf("sub_uint64 4294967296%s1 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_uint64_4294967296_ssa(1); got != 18446744069414584321 { fmt.Printf("sub_uint64 1%s4294967296 = %d, wanted 18446744069414584321\n", `-`, got) failed = true } if got := sub_4294967296_uint64_ssa(4294967296); got != 0 { fmt.Printf("sub_uint64 4294967296%s4294967296 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("sub_uint64 4294967296%s4294967296 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_4294967296_uint64_ssa(18446744073709551615); got != 4294967297 { fmt.Printf("sub_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967297\n", `-`, got) failed = true } if got := sub_uint64_4294967296_ssa(18446744073709551615); got != 18446744069414584319 { fmt.Printf("sub_uint64 18446744073709551615%s4294967296 = %d, wanted 18446744069414584319\n", `-`, got) failed = true } if got := sub_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { fmt.Printf("sub_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `-`, got) failed = true } if got := sub_uint64_18446744073709551615_ssa(0); got != 1 { fmt.Printf("sub_uint64 0%s18446744073709551615 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_18446744073709551615_uint64_ssa(1); got != 18446744073709551614 { fmt.Printf("sub_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551614\n", `-`, got) failed = true } if got := sub_uint64_18446744073709551615_ssa(1); got != 2 { fmt.Printf("sub_uint64 1%s18446744073709551615 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_18446744073709551615_uint64_ssa(4294967296); got != 18446744069414584319 { fmt.Printf("sub_uint64 18446744073709551615%s4294967296 = %d, wanted 18446744069414584319\n", `-`, got) failed = true } if got := sub_uint64_18446744073709551615_ssa(4294967296); got != 4294967297 { fmt.Printf("sub_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967297\n", `-`, got) failed = true } if got := sub_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("sub_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 { fmt.Printf("sub_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `-`, got) failed = true } if got := div_0_uint64_ssa(1); got != 0 { fmt.Printf("div_uint64 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_uint64_ssa(4294967296); got != 0 { fmt.Printf("div_uint64 0%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint64_1_ssa(0); got != 0 { fmt.Printf("div_uint64 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_uint64_ssa(1); got != 1 { fmt.Printf("div_uint64 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint64_1_ssa(1); got != 1 { fmt.Printf("div_uint64 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_uint64_ssa(4294967296); got != 0 { fmt.Printf("div_uint64 1%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint64_1_ssa(4294967296); got != 4294967296 { fmt.Printf("div_uint64 4294967296%s1 = %d, wanted 4294967296\n", `/`, got) failed = true } if got := div_1_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("div_uint64 1%s18446744073709551615 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint64_1_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("div_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551615\n", `/`, got) failed = true } if got := div_uint64_4294967296_ssa(0); got != 0 { fmt.Printf("div_uint64 0%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_4294967296_uint64_ssa(1); got != 4294967296 { fmt.Printf("div_uint64 4294967296%s1 = %d, wanted 4294967296\n", `/`, got) failed = true } if got := div_uint64_4294967296_ssa(1); got != 0 { fmt.Printf("div_uint64 1%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_4294967296_uint64_ssa(4294967296); got != 1 { fmt.Printf("div_uint64 4294967296%s4294967296 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint64_4294967296_ssa(4294967296); got != 1 { fmt.Printf("div_uint64 4294967296%s4294967296 = %d, wanted 1\n", `/`, got) failed = true } if got := div_4294967296_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("div_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint64_4294967296_ssa(18446744073709551615); got != 4294967295 { fmt.Printf("div_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `/`, got) failed = true } if got := div_uint64_18446744073709551615_ssa(0); got != 0 { fmt.Printf("div_uint64 0%s18446744073709551615 = %d, wanted 0\n", `/`, got) failed = true } if got := div_18446744073709551615_uint64_ssa(1); got != 18446744073709551615 { fmt.Printf("div_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551615\n", `/`, got) failed = true } if got := div_uint64_18446744073709551615_ssa(1); got != 0 { fmt.Printf("div_uint64 1%s18446744073709551615 = %d, wanted 0\n", `/`, got) failed = true } if got := div_18446744073709551615_uint64_ssa(4294967296); got != 4294967295 { fmt.Printf("div_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `/`, got) failed = true } if got := div_uint64_18446744073709551615_ssa(4294967296); got != 0 { fmt.Printf("div_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `/`, got) failed = true } if got := div_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 { fmt.Printf("div_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint64_18446744073709551615_ssa(18446744073709551615); got != 1 { fmt.Printf("div_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_0_uint64_ssa(0); got != 0 { fmt.Printf("mul_uint64 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_0_ssa(0); got != 0 { fmt.Printf("mul_uint64 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint64_ssa(1); got != 0 { fmt.Printf("mul_uint64 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_0_ssa(1); got != 0 { fmt.Printf("mul_uint64 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint64_ssa(4294967296); got != 0 { fmt.Printf("mul_uint64 0%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_0_ssa(4294967296); got != 0 { fmt.Printf("mul_uint64 4294967296%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("mul_uint64 0%s18446744073709551615 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_0_ssa(18446744073709551615); got != 0 { fmt.Printf("mul_uint64 18446744073709551615%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint64_ssa(0); got != 0 { fmt.Printf("mul_uint64 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_1_ssa(0); got != 0 { fmt.Printf("mul_uint64 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint64_ssa(1); got != 1 { fmt.Printf("mul_uint64 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint64_1_ssa(1); got != 1 { fmt.Printf("mul_uint64 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_uint64_ssa(4294967296); got != 4294967296 { fmt.Printf("mul_uint64 1%s4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_uint64_1_ssa(4294967296); got != 4294967296 { fmt.Printf("mul_uint64 4294967296%s1 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_1_uint64_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("mul_uint64 1%s18446744073709551615 = %d, wanted 18446744073709551615\n", `*`, got) failed = true } if got := mul_uint64_1_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("mul_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551615\n", `*`, got) failed = true } if got := mul_4294967296_uint64_ssa(0); got != 0 { fmt.Printf("mul_uint64 4294967296%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_4294967296_ssa(0); got != 0 { fmt.Printf("mul_uint64 0%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_4294967296_uint64_ssa(1); got != 4294967296 { fmt.Printf("mul_uint64 4294967296%s1 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_uint64_4294967296_ssa(1); got != 4294967296 { fmt.Printf("mul_uint64 1%s4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_4294967296_uint64_ssa(4294967296); got != 0 { fmt.Printf("mul_uint64 4294967296%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("mul_uint64 4294967296%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_4294967296_uint64_ssa(18446744073709551615); got != 18446744069414584320 { fmt.Printf("mul_uint64 4294967296%s18446744073709551615 = %d, wanted 18446744069414584320\n", `*`, got) failed = true } if got := mul_uint64_4294967296_ssa(18446744073709551615); got != 18446744069414584320 { fmt.Printf("mul_uint64 18446744073709551615%s4294967296 = %d, wanted 18446744069414584320\n", `*`, got) failed = true } if got := mul_18446744073709551615_uint64_ssa(0); got != 0 { fmt.Printf("mul_uint64 18446744073709551615%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint64_18446744073709551615_ssa(0); got != 0 { fmt.Printf("mul_uint64 0%s18446744073709551615 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_18446744073709551615_uint64_ssa(1); got != 18446744073709551615 { fmt.Printf("mul_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551615\n", `*`, got) failed = true } if got := mul_uint64_18446744073709551615_ssa(1); got != 18446744073709551615 { fmt.Printf("mul_uint64 1%s18446744073709551615 = %d, wanted 18446744073709551615\n", `*`, got) failed = true } if got := mul_18446744073709551615_uint64_ssa(4294967296); got != 18446744069414584320 { fmt.Printf("mul_uint64 18446744073709551615%s4294967296 = %d, wanted 18446744069414584320\n", `*`, got) failed = true } if got := mul_uint64_18446744073709551615_ssa(4294967296); got != 18446744069414584320 { fmt.Printf("mul_uint64 4294967296%s18446744073709551615 = %d, wanted 18446744069414584320\n", `*`, got) failed = true } if got := mul_18446744073709551615_uint64_ssa(18446744073709551615); got != 1 { fmt.Printf("mul_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint64_18446744073709551615_ssa(18446744073709551615); got != 1 { fmt.Printf("mul_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 1\n", `*`, got) failed = true } if got := lsh_0_uint64_ssa(0); got != 0 { fmt.Printf("lsh_uint64 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_0_ssa(0); got != 0 { fmt.Printf("lsh_uint64 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_0_uint64_ssa(1); got != 0 { fmt.Printf("lsh_uint64 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_0_ssa(1); got != 1 { fmt.Printf("lsh_uint64 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_0_uint64_ssa(4294967296); got != 0 { fmt.Printf("lsh_uint64 0%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_0_ssa(4294967296); got != 4294967296 { fmt.Printf("lsh_uint64 4294967296%s0 = %d, wanted 4294967296\n", `<<`, got) failed = true } if got := lsh_0_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("lsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("lsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `<<`, got) failed = true } if got := lsh_1_uint64_ssa(0); got != 1 { fmt.Printf("lsh_uint64 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_uint64_1_ssa(0); got != 0 { fmt.Printf("lsh_uint64 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_1_uint64_ssa(1); got != 2 { fmt.Printf("lsh_uint64 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_uint64_1_ssa(1); got != 2 { fmt.Printf("lsh_uint64 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_1_uint64_ssa(4294967296); got != 0 { fmt.Printf("lsh_uint64 1%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_1_ssa(4294967296); got != 8589934592 { fmt.Printf("lsh_uint64 4294967296%s1 = %d, wanted 8589934592\n", `<<`, got) failed = true } if got := lsh_1_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("lsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_1_ssa(18446744073709551615); got != 18446744073709551614 { fmt.Printf("lsh_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551614\n", `<<`, got) failed = true } if got := lsh_4294967296_uint64_ssa(0); got != 4294967296 { fmt.Printf("lsh_uint64 4294967296%s0 = %d, wanted 4294967296\n", `<<`, got) failed = true } if got := lsh_uint64_4294967296_ssa(0); got != 0 { fmt.Printf("lsh_uint64 0%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_4294967296_uint64_ssa(1); got != 8589934592 { fmt.Printf("lsh_uint64 4294967296%s1 = %d, wanted 8589934592\n", `<<`, got) failed = true } if got := lsh_uint64_4294967296_ssa(1); got != 0 { fmt.Printf("lsh_uint64 1%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_4294967296_uint64_ssa(4294967296); got != 0 { fmt.Printf("lsh_uint64 4294967296%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("lsh_uint64 4294967296%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_4294967296_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("lsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_4294967296_ssa(18446744073709551615); got != 0 { fmt.Printf("lsh_uint64 18446744073709551615%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { fmt.Printf("lsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `<<`, got) failed = true } if got := lsh_uint64_18446744073709551615_ssa(0); got != 0 { fmt.Printf("lsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_18446744073709551615_uint64_ssa(1); got != 18446744073709551614 { fmt.Printf("lsh_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551614\n", `<<`, got) failed = true } if got := lsh_uint64_18446744073709551615_ssa(1); got != 0 { fmt.Printf("lsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_18446744073709551615_uint64_ssa(4294967296); got != 0 { fmt.Printf("lsh_uint64 18446744073709551615%s4294967296 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_18446744073709551615_ssa(4294967296); got != 0 { fmt.Printf("lsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("lsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 { fmt.Printf("lsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `<<`, got) failed = true } if got := rsh_0_uint64_ssa(0); got != 0 { fmt.Printf("rsh_uint64 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_0_ssa(0); got != 0 { fmt.Printf("rsh_uint64 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_0_uint64_ssa(1); got != 0 { fmt.Printf("rsh_uint64 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_0_ssa(1); got != 1 { fmt.Printf("rsh_uint64 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_0_uint64_ssa(4294967296); got != 0 { fmt.Printf("rsh_uint64 0%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_0_ssa(4294967296); got != 4294967296 { fmt.Printf("rsh_uint64 4294967296%s0 = %d, wanted 4294967296\n", `>>`, got) failed = true } if got := rsh_0_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("rsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 { fmt.Printf("rsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `>>`, got) failed = true } if got := rsh_1_uint64_ssa(0); got != 1 { fmt.Printf("rsh_uint64 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_uint64_1_ssa(0); got != 0 { fmt.Printf("rsh_uint64 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint64_ssa(1); got != 0 { fmt.Printf("rsh_uint64 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_1_ssa(1); got != 0 { fmt.Printf("rsh_uint64 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint64_ssa(4294967296); got != 0 { fmt.Printf("rsh_uint64 1%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_1_ssa(4294967296); got != 2147483648 { fmt.Printf("rsh_uint64 4294967296%s1 = %d, wanted 2147483648\n", `>>`, got) failed = true } if got := rsh_1_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("rsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_1_ssa(18446744073709551615); got != 9223372036854775807 { fmt.Printf("rsh_uint64 18446744073709551615%s1 = %d, wanted 9223372036854775807\n", `>>`, got) failed = true } if got := rsh_4294967296_uint64_ssa(0); got != 4294967296 { fmt.Printf("rsh_uint64 4294967296%s0 = %d, wanted 4294967296\n", `>>`, got) failed = true } if got := rsh_uint64_4294967296_ssa(0); got != 0 { fmt.Printf("rsh_uint64 0%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_4294967296_uint64_ssa(1); got != 2147483648 { fmt.Printf("rsh_uint64 4294967296%s1 = %d, wanted 2147483648\n", `>>`, got) failed = true } if got := rsh_uint64_4294967296_ssa(1); got != 0 { fmt.Printf("rsh_uint64 1%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_4294967296_uint64_ssa(4294967296); got != 0 { fmt.Printf("rsh_uint64 4294967296%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("rsh_uint64 4294967296%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_4294967296_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("rsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_4294967296_ssa(18446744073709551615); got != 0 { fmt.Printf("rsh_uint64 18446744073709551615%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 { fmt.Printf("rsh_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `>>`, got) failed = true } if got := rsh_uint64_18446744073709551615_ssa(0); got != 0 { fmt.Printf("rsh_uint64 0%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_18446744073709551615_uint64_ssa(1); got != 9223372036854775807 { fmt.Printf("rsh_uint64 18446744073709551615%s1 = %d, wanted 9223372036854775807\n", `>>`, got) failed = true } if got := rsh_uint64_18446744073709551615_ssa(1); got != 0 { fmt.Printf("rsh_uint64 1%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_18446744073709551615_uint64_ssa(4294967296); got != 0 { fmt.Printf("rsh_uint64 18446744073709551615%s4294967296 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_18446744073709551615_ssa(4294967296); got != 0 { fmt.Printf("rsh_uint64 4294967296%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("rsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 { fmt.Printf("rsh_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `>>`, got) failed = true } if got := mod_0_uint64_ssa(1); got != 0 { fmt.Printf("mod_uint64 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_uint64_ssa(4294967296); got != 0 { fmt.Printf("mod_uint64 0%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint64_1_ssa(0); got != 0 { fmt.Printf("mod_uint64 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint64_ssa(1); got != 0 { fmt.Printf("mod_uint64 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint64_1_ssa(1); got != 0 { fmt.Printf("mod_uint64 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint64_ssa(4294967296); got != 1 { fmt.Printf("mod_uint64 1%s4294967296 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_uint64_1_ssa(4294967296); got != 0 { fmt.Printf("mod_uint64 4294967296%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint64_ssa(18446744073709551615); got != 1 { fmt.Printf("mod_uint64 1%s18446744073709551615 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_uint64_1_ssa(18446744073709551615); got != 0 { fmt.Printf("mod_uint64 18446744073709551615%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint64_4294967296_ssa(0); got != 0 { fmt.Printf("mod_uint64 0%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967296_uint64_ssa(1); got != 0 { fmt.Printf("mod_uint64 4294967296%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint64_4294967296_ssa(1); got != 1 { fmt.Printf("mod_uint64 1%s4294967296 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_4294967296_uint64_ssa(4294967296); got != 0 { fmt.Printf("mod_uint64 4294967296%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("mod_uint64 4294967296%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967296_uint64_ssa(18446744073709551615); got != 4294967296 { fmt.Printf("mod_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_uint64_4294967296_ssa(18446744073709551615); got != 4294967295 { fmt.Printf("mod_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `%`, got) failed = true } if got := mod_uint64_18446744073709551615_ssa(0); got != 0 { fmt.Printf("mod_uint64 0%s18446744073709551615 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_18446744073709551615_uint64_ssa(1); got != 0 { fmt.Printf("mod_uint64 18446744073709551615%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint64_18446744073709551615_ssa(1); got != 1 { fmt.Printf("mod_uint64 1%s18446744073709551615 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_18446744073709551615_uint64_ssa(4294967296); got != 4294967295 { fmt.Printf("mod_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `%`, got) failed = true } if got := mod_uint64_18446744073709551615_ssa(4294967296); got != 4294967296 { fmt.Printf("mod_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 { fmt.Printf("mod_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 { fmt.Printf("mod_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `%`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("add_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 0 { fmt.Printf("add_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != 1 { fmt.Printf("add_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != 1 { fmt.Printf("add_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(-4294967296); got != 9223372032559808512 { fmt.Printf("add_int64 -9223372036854775808%s-4294967296 = %d, wanted 9223372032559808512\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(-4294967296); got != 9223372032559808512 { fmt.Printf("add_int64 -4294967296%s-9223372036854775808 = %d, wanted 9223372032559808512\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(-1); got != 9223372036854775807 { fmt.Printf("add_int64 -9223372036854775808%s-1 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(-1); got != 9223372036854775807 { fmt.Printf("add_int64 -1%s-9223372036854775808 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(0); got != -9223372036854775808 { fmt.Printf("add_int64 -9223372036854775808%s0 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(0); got != -9223372036854775808 { fmt.Printf("add_int64 0%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(1); got != -9223372036854775807 { fmt.Printf("add_int64 -9223372036854775808%s1 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(1); got != -9223372036854775807 { fmt.Printf("add_int64 1%s-9223372036854775808 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(4294967296); got != -9223372032559808512 { fmt.Printf("add_int64 -9223372036854775808%s4294967296 = %d, wanted -9223372032559808512\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(4294967296); got != -9223372032559808512 { fmt.Printf("add_int64 4294967296%s-9223372036854775808 = %d, wanted -9223372032559808512\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(9223372036854775806); got != -2 { fmt.Printf("add_int64 -9223372036854775808%s9223372036854775806 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(9223372036854775806); got != -2 { fmt.Printf("add_int64 9223372036854775806%s-9223372036854775808 = %d, wanted -2\n", `+`, got) failed = true } if got := add_Neg9223372036854775808_int64_ssa(9223372036854775807); got != -1 { fmt.Printf("add_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775808_ssa(9223372036854775807); got != -1 { fmt.Printf("add_int64 9223372036854775807%s-9223372036854775808 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != 1 { fmt.Printf("add_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != 1 { fmt.Printf("add_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 2 { fmt.Printf("add_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 2 { fmt.Printf("add_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 2\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(-4294967296); got != 9223372032559808513 { fmt.Printf("add_int64 -9223372036854775807%s-4294967296 = %d, wanted 9223372032559808513\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(-4294967296); got != 9223372032559808513 { fmt.Printf("add_int64 -4294967296%s-9223372036854775807 = %d, wanted 9223372032559808513\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(-1); got != -9223372036854775808 { fmt.Printf("add_int64 -9223372036854775807%s-1 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(-1); got != -9223372036854775808 { fmt.Printf("add_int64 -1%s-9223372036854775807 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(0); got != -9223372036854775807 { fmt.Printf("add_int64 -9223372036854775807%s0 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(0); got != -9223372036854775807 { fmt.Printf("add_int64 0%s-9223372036854775807 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775806 { fmt.Printf("add_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775806\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(1); got != -9223372036854775806 { fmt.Printf("add_int64 1%s-9223372036854775807 = %d, wanted -9223372036854775806\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(4294967296); got != -9223372032559808511 { fmt.Printf("add_int64 -9223372036854775807%s4294967296 = %d, wanted -9223372032559808511\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(4294967296); got != -9223372032559808511 { fmt.Printf("add_int64 4294967296%s-9223372036854775807 = %d, wanted -9223372032559808511\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(9223372036854775806); got != -1 { fmt.Printf("add_int64 -9223372036854775807%s9223372036854775806 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(9223372036854775806); got != -1 { fmt.Printf("add_int64 9223372036854775806%s-9223372036854775807 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg9223372036854775807_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("add_int64 -9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_Neg9223372036854775807_ssa(9223372036854775807); got != 0 { fmt.Printf("add_int64 9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(-9223372036854775808); got != 9223372032559808512 { fmt.Printf("add_int64 -4294967296%s-9223372036854775808 = %d, wanted 9223372032559808512\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(-9223372036854775808); got != 9223372032559808512 { fmt.Printf("add_int64 -9223372036854775808%s-4294967296 = %d, wanted 9223372032559808512\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(-9223372036854775807); got != 9223372032559808513 { fmt.Printf("add_int64 -4294967296%s-9223372036854775807 = %d, wanted 9223372032559808513\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(-9223372036854775807); got != 9223372032559808513 { fmt.Printf("add_int64 -9223372036854775807%s-4294967296 = %d, wanted 9223372032559808513\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(-4294967296); got != -8589934592 { fmt.Printf("add_int64 -4294967296%s-4294967296 = %d, wanted -8589934592\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(-4294967296); got != -8589934592 { fmt.Printf("add_int64 -4294967296%s-4294967296 = %d, wanted -8589934592\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(-1); got != -4294967297 { fmt.Printf("add_int64 -4294967296%s-1 = %d, wanted -4294967297\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(-1); got != -4294967297 { fmt.Printf("add_int64 -1%s-4294967296 = %d, wanted -4294967297\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(0); got != -4294967296 { fmt.Printf("add_int64 -4294967296%s0 = %d, wanted -4294967296\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(0); got != -4294967296 { fmt.Printf("add_int64 0%s-4294967296 = %d, wanted -4294967296\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(1); got != -4294967295 { fmt.Printf("add_int64 -4294967296%s1 = %d, wanted -4294967295\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(1); got != -4294967295 { fmt.Printf("add_int64 1%s-4294967296 = %d, wanted -4294967295\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(4294967296); got != 0 { fmt.Printf("add_int64 -4294967296%s4294967296 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(4294967296); got != 0 { fmt.Printf("add_int64 4294967296%s-4294967296 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(9223372036854775806); got != 9223372032559808510 { fmt.Printf("add_int64 -4294967296%s9223372036854775806 = %d, wanted 9223372032559808510\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(9223372036854775806); got != 9223372032559808510 { fmt.Printf("add_int64 9223372036854775806%s-4294967296 = %d, wanted 9223372032559808510\n", `+`, got) failed = true } if got := add_Neg4294967296_int64_ssa(9223372036854775807); got != 9223372032559808511 { fmt.Printf("add_int64 -4294967296%s9223372036854775807 = %d, wanted 9223372032559808511\n", `+`, got) failed = true } if got := add_int64_Neg4294967296_ssa(9223372036854775807); got != 9223372032559808511 { fmt.Printf("add_int64 9223372036854775807%s-4294967296 = %d, wanted 9223372032559808511\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(-9223372036854775808); got != 9223372036854775807 { fmt.Printf("add_int64 -1%s-9223372036854775808 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(-9223372036854775808); got != 9223372036854775807 { fmt.Printf("add_int64 -9223372036854775808%s-1 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(-9223372036854775807); got != -9223372036854775808 { fmt.Printf("add_int64 -1%s-9223372036854775807 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(-9223372036854775807); got != -9223372036854775808 { fmt.Printf("add_int64 -9223372036854775807%s-1 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(-4294967296); got != -4294967297 { fmt.Printf("add_int64 -1%s-4294967296 = %d, wanted -4294967297\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(-4294967296); got != -4294967297 { fmt.Printf("add_int64 -4294967296%s-1 = %d, wanted -4294967297\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(-1); got != -2 { fmt.Printf("add_int64 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(-1); got != -2 { fmt.Printf("add_int64 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(0); got != -1 { fmt.Printf("add_int64 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(0); got != -1 { fmt.Printf("add_int64 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(1); got != 0 { fmt.Printf("add_int64 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(1); got != 0 { fmt.Printf("add_int64 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(4294967296); got != 4294967295 { fmt.Printf("add_int64 -1%s4294967296 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(4294967296); got != 4294967295 { fmt.Printf("add_int64 4294967296%s-1 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(9223372036854775806); got != 9223372036854775805 { fmt.Printf("add_int64 -1%s9223372036854775806 = %d, wanted 9223372036854775805\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(9223372036854775806); got != 9223372036854775805 { fmt.Printf("add_int64 9223372036854775806%s-1 = %d, wanted 9223372036854775805\n", `+`, got) failed = true } if got := add_Neg1_int64_ssa(9223372036854775807); got != 9223372036854775806 { fmt.Printf("add_int64 -1%s9223372036854775807 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_int64_Neg1_ssa(9223372036854775807); got != 9223372036854775806 { fmt.Printf("add_int64 9223372036854775807%s-1 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_0_int64_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("add_int64 0%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_int64_0_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("add_int64 -9223372036854775808%s0 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_0_int64_ssa(-9223372036854775807); got != -9223372036854775807 { fmt.Printf("add_int64 0%s-9223372036854775807 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_int64_0_ssa(-9223372036854775807); got != -9223372036854775807 { fmt.Printf("add_int64 -9223372036854775807%s0 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_0_int64_ssa(-4294967296); got != -4294967296 { fmt.Printf("add_int64 0%s-4294967296 = %d, wanted -4294967296\n", `+`, got) failed = true } if got := add_int64_0_ssa(-4294967296); got != -4294967296 { fmt.Printf("add_int64 -4294967296%s0 = %d, wanted -4294967296\n", `+`, got) failed = true } if got := add_0_int64_ssa(-1); got != -1 { fmt.Printf("add_int64 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int64_0_ssa(-1); got != -1 { fmt.Printf("add_int64 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_0_int64_ssa(0); got != 0 { fmt.Printf("add_int64 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_0_ssa(0); got != 0 { fmt.Printf("add_int64 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_int64_ssa(1); got != 1 { fmt.Printf("add_int64 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int64_0_ssa(1); got != 1 { fmt.Printf("add_int64 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_int64_ssa(4294967296); got != 4294967296 { fmt.Printf("add_int64 0%s4294967296 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_int64_0_ssa(4294967296); got != 4294967296 { fmt.Printf("add_int64 4294967296%s0 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_0_int64_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("add_int64 0%s9223372036854775806 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_int64_0_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("add_int64 9223372036854775806%s0 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_0_int64_ssa(9223372036854775807); got != 9223372036854775807 { fmt.Printf("add_int64 0%s9223372036854775807 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_int64_0_ssa(9223372036854775807); got != 9223372036854775807 { fmt.Printf("add_int64 9223372036854775807%s0 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_1_int64_ssa(-9223372036854775808); got != -9223372036854775807 { fmt.Printf("add_int64 1%s-9223372036854775808 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_int64_1_ssa(-9223372036854775808); got != -9223372036854775807 { fmt.Printf("add_int64 -9223372036854775808%s1 = %d, wanted -9223372036854775807\n", `+`, got) failed = true } if got := add_1_int64_ssa(-9223372036854775807); got != -9223372036854775806 { fmt.Printf("add_int64 1%s-9223372036854775807 = %d, wanted -9223372036854775806\n", `+`, got) failed = true } if got := add_int64_1_ssa(-9223372036854775807); got != -9223372036854775806 { fmt.Printf("add_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775806\n", `+`, got) failed = true } if got := add_1_int64_ssa(-4294967296); got != -4294967295 { fmt.Printf("add_int64 1%s-4294967296 = %d, wanted -4294967295\n", `+`, got) failed = true } if got := add_int64_1_ssa(-4294967296); got != -4294967295 { fmt.Printf("add_int64 -4294967296%s1 = %d, wanted -4294967295\n", `+`, got) failed = true } if got := add_1_int64_ssa(-1); got != 0 { fmt.Printf("add_int64 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_1_ssa(-1); got != 0 { fmt.Printf("add_int64 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_1_int64_ssa(0); got != 1 { fmt.Printf("add_int64 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int64_1_ssa(0); got != 1 { fmt.Printf("add_int64 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_int64_ssa(1); got != 2 { fmt.Printf("add_int64 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int64_1_ssa(1); got != 2 { fmt.Printf("add_int64 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_int64_ssa(4294967296); got != 4294967297 { fmt.Printf("add_int64 1%s4294967296 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_int64_1_ssa(4294967296); got != 4294967297 { fmt.Printf("add_int64 4294967296%s1 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_1_int64_ssa(9223372036854775806); got != 9223372036854775807 { fmt.Printf("add_int64 1%s9223372036854775806 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_int64_1_ssa(9223372036854775806); got != 9223372036854775807 { fmt.Printf("add_int64 9223372036854775806%s1 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_1_int64_ssa(9223372036854775807); got != -9223372036854775808 { fmt.Printf("add_int64 1%s9223372036854775807 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_int64_1_ssa(9223372036854775807); got != -9223372036854775808 { fmt.Printf("add_int64 9223372036854775807%s1 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(-9223372036854775808); got != -9223372032559808512 { fmt.Printf("add_int64 4294967296%s-9223372036854775808 = %d, wanted -9223372032559808512\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(-9223372036854775808); got != -9223372032559808512 { fmt.Printf("add_int64 -9223372036854775808%s4294967296 = %d, wanted -9223372032559808512\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(-9223372036854775807); got != -9223372032559808511 { fmt.Printf("add_int64 4294967296%s-9223372036854775807 = %d, wanted -9223372032559808511\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(-9223372036854775807); got != -9223372032559808511 { fmt.Printf("add_int64 -9223372036854775807%s4294967296 = %d, wanted -9223372032559808511\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(-4294967296); got != 0 { fmt.Printf("add_int64 4294967296%s-4294967296 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(-4294967296); got != 0 { fmt.Printf("add_int64 -4294967296%s4294967296 = %d, wanted 0\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(-1); got != 4294967295 { fmt.Printf("add_int64 4294967296%s-1 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(-1); got != 4294967295 { fmt.Printf("add_int64 -1%s4294967296 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(0); got != 4294967296 { fmt.Printf("add_int64 4294967296%s0 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(0); got != 4294967296 { fmt.Printf("add_int64 0%s4294967296 = %d, wanted 4294967296\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(1); got != 4294967297 { fmt.Printf("add_int64 4294967296%s1 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(1); got != 4294967297 { fmt.Printf("add_int64 1%s4294967296 = %d, wanted 4294967297\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(4294967296); got != 8589934592 { fmt.Printf("add_int64 4294967296%s4294967296 = %d, wanted 8589934592\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(4294967296); got != 8589934592 { fmt.Printf("add_int64 4294967296%s4294967296 = %d, wanted 8589934592\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(9223372036854775806); got != -9223372032559808514 { fmt.Printf("add_int64 4294967296%s9223372036854775806 = %d, wanted -9223372032559808514\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(9223372036854775806); got != -9223372032559808514 { fmt.Printf("add_int64 9223372036854775806%s4294967296 = %d, wanted -9223372032559808514\n", `+`, got) failed = true } if got := add_4294967296_int64_ssa(9223372036854775807); got != -9223372032559808513 { fmt.Printf("add_int64 4294967296%s9223372036854775807 = %d, wanted -9223372032559808513\n", `+`, got) failed = true } if got := add_int64_4294967296_ssa(9223372036854775807); got != -9223372032559808513 { fmt.Printf("add_int64 9223372036854775807%s4294967296 = %d, wanted -9223372032559808513\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(-9223372036854775808); got != -2 { fmt.Printf("add_int64 9223372036854775806%s-9223372036854775808 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(-9223372036854775808); got != -2 { fmt.Printf("add_int64 -9223372036854775808%s9223372036854775806 = %d, wanted -2\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(-9223372036854775807); got != -1 { fmt.Printf("add_int64 9223372036854775806%s-9223372036854775807 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(-9223372036854775807); got != -1 { fmt.Printf("add_int64 -9223372036854775807%s9223372036854775806 = %d, wanted -1\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(-4294967296); got != 9223372032559808510 { fmt.Printf("add_int64 9223372036854775806%s-4294967296 = %d, wanted 9223372032559808510\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(-4294967296); got != 9223372032559808510 { fmt.Printf("add_int64 -4294967296%s9223372036854775806 = %d, wanted 9223372032559808510\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(-1); got != 9223372036854775805 { fmt.Printf("add_int64 9223372036854775806%s-1 = %d, wanted 9223372036854775805\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(-1); got != 9223372036854775805 { fmt.Printf("add_int64 -1%s9223372036854775806 = %d, wanted 9223372036854775805\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(0); got != 9223372036854775806 { fmt.Printf("add_int64 9223372036854775806%s0 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(0); got != 9223372036854775806 { fmt.Printf("add_int64 0%s9223372036854775806 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(1); got != 9223372036854775807 { fmt.Printf("add_int64 9223372036854775806%s1 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(1); got != 9223372036854775807 { fmt.Printf("add_int64 1%s9223372036854775806 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(4294967296); got != -9223372032559808514 { fmt.Printf("add_int64 9223372036854775806%s4294967296 = %d, wanted -9223372032559808514\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(4294967296); got != -9223372032559808514 { fmt.Printf("add_int64 4294967296%s9223372036854775806 = %d, wanted -9223372032559808514\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(9223372036854775806); got != -4 { fmt.Printf("add_int64 9223372036854775806%s9223372036854775806 = %d, wanted -4\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(9223372036854775806); got != -4 { fmt.Printf("add_int64 9223372036854775806%s9223372036854775806 = %d, wanted -4\n", `+`, got) failed = true } if got := add_9223372036854775806_int64_ssa(9223372036854775807); got != -3 { fmt.Printf("add_int64 9223372036854775806%s9223372036854775807 = %d, wanted -3\n", `+`, got) failed = true } if got := add_int64_9223372036854775806_ssa(9223372036854775807); got != -3 { fmt.Printf("add_int64 9223372036854775807%s9223372036854775806 = %d, wanted -3\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(-9223372036854775808); got != -1 { fmt.Printf("add_int64 9223372036854775807%s-9223372036854775808 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(-9223372036854775808); got != -1 { fmt.Printf("add_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -1\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("add_int64 9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(-9223372036854775807); got != 0 { fmt.Printf("add_int64 -9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(-4294967296); got != 9223372032559808511 { fmt.Printf("add_int64 9223372036854775807%s-4294967296 = %d, wanted 9223372032559808511\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(-4294967296); got != 9223372032559808511 { fmt.Printf("add_int64 -4294967296%s9223372036854775807 = %d, wanted 9223372032559808511\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(-1); got != 9223372036854775806 { fmt.Printf("add_int64 9223372036854775807%s-1 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(-1); got != 9223372036854775806 { fmt.Printf("add_int64 -1%s9223372036854775807 = %d, wanted 9223372036854775806\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(0); got != 9223372036854775807 { fmt.Printf("add_int64 9223372036854775807%s0 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(0); got != 9223372036854775807 { fmt.Printf("add_int64 0%s9223372036854775807 = %d, wanted 9223372036854775807\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(1); got != -9223372036854775808 { fmt.Printf("add_int64 9223372036854775807%s1 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(1); got != -9223372036854775808 { fmt.Printf("add_int64 1%s9223372036854775807 = %d, wanted -9223372036854775808\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(4294967296); got != -9223372032559808513 { fmt.Printf("add_int64 9223372036854775807%s4294967296 = %d, wanted -9223372032559808513\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(4294967296); got != -9223372032559808513 { fmt.Printf("add_int64 4294967296%s9223372036854775807 = %d, wanted -9223372032559808513\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(9223372036854775806); got != -3 { fmt.Printf("add_int64 9223372036854775807%s9223372036854775806 = %d, wanted -3\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(9223372036854775806); got != -3 { fmt.Printf("add_int64 9223372036854775806%s9223372036854775807 = %d, wanted -3\n", `+`, got) failed = true } if got := add_9223372036854775807_int64_ssa(9223372036854775807); got != -2 { fmt.Printf("add_int64 9223372036854775807%s9223372036854775807 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int64_9223372036854775807_ssa(9223372036854775807); got != -2 { fmt.Printf("add_int64 9223372036854775807%s9223372036854775807 = %d, wanted -2\n", `+`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("sub_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 0 { fmt.Printf("sub_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != -1 { fmt.Printf("sub_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != 1 { fmt.Printf("sub_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(-4294967296); got != -9223372032559808512 { fmt.Printf("sub_int64 -9223372036854775808%s-4294967296 = %d, wanted -9223372032559808512\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(-4294967296); got != 9223372032559808512 { fmt.Printf("sub_int64 -4294967296%s-9223372036854775808 = %d, wanted 9223372032559808512\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(-1); got != -9223372036854775807 { fmt.Printf("sub_int64 -9223372036854775808%s-1 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(-1); got != 9223372036854775807 { fmt.Printf("sub_int64 -1%s-9223372036854775808 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(0); got != -9223372036854775808 { fmt.Printf("sub_int64 -9223372036854775808%s0 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(0); got != -9223372036854775808 { fmt.Printf("sub_int64 0%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(1); got != 9223372036854775807 { fmt.Printf("sub_int64 -9223372036854775808%s1 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(1); got != -9223372036854775807 { fmt.Printf("sub_int64 1%s-9223372036854775808 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(4294967296); got != 9223372032559808512 { fmt.Printf("sub_int64 -9223372036854775808%s4294967296 = %d, wanted 9223372032559808512\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(4294967296); got != -9223372032559808512 { fmt.Printf("sub_int64 4294967296%s-9223372036854775808 = %d, wanted -9223372032559808512\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(9223372036854775806); got != 2 { fmt.Printf("sub_int64 -9223372036854775808%s9223372036854775806 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(9223372036854775806); got != -2 { fmt.Printf("sub_int64 9223372036854775806%s-9223372036854775808 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_Neg9223372036854775808_int64_ssa(9223372036854775807); got != 1 { fmt.Printf("sub_int64 -9223372036854775808%s9223372036854775807 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775808_ssa(9223372036854775807); got != -1 { fmt.Printf("sub_int64 9223372036854775807%s-9223372036854775808 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != 1 { fmt.Printf("sub_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != -1 { fmt.Printf("sub_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("sub_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 0 { fmt.Printf("sub_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(-4294967296); got != -9223372032559808511 { fmt.Printf("sub_int64 -9223372036854775807%s-4294967296 = %d, wanted -9223372032559808511\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(-4294967296); got != 9223372032559808511 { fmt.Printf("sub_int64 -4294967296%s-9223372036854775807 = %d, wanted 9223372032559808511\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(-1); got != -9223372036854775806 { fmt.Printf("sub_int64 -9223372036854775807%s-1 = %d, wanted -9223372036854775806\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(-1); got != 9223372036854775806 { fmt.Printf("sub_int64 -1%s-9223372036854775807 = %d, wanted 9223372036854775806\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(0); got != -9223372036854775807 { fmt.Printf("sub_int64 -9223372036854775807%s0 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(0); got != 9223372036854775807 { fmt.Printf("sub_int64 0%s-9223372036854775807 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775808 { fmt.Printf("sub_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(1); got != -9223372036854775808 { fmt.Printf("sub_int64 1%s-9223372036854775807 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(4294967296); got != 9223372032559808513 { fmt.Printf("sub_int64 -9223372036854775807%s4294967296 = %d, wanted 9223372032559808513\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(4294967296); got != -9223372032559808513 { fmt.Printf("sub_int64 4294967296%s-9223372036854775807 = %d, wanted -9223372032559808513\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(9223372036854775806); got != 3 { fmt.Printf("sub_int64 -9223372036854775807%s9223372036854775806 = %d, wanted 3\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(9223372036854775806); got != -3 { fmt.Printf("sub_int64 9223372036854775806%s-9223372036854775807 = %d, wanted -3\n", `-`, got) failed = true } if got := sub_Neg9223372036854775807_int64_ssa(9223372036854775807); got != 2 { fmt.Printf("sub_int64 -9223372036854775807%s9223372036854775807 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int64_Neg9223372036854775807_ssa(9223372036854775807); got != -2 { fmt.Printf("sub_int64 9223372036854775807%s-9223372036854775807 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(-9223372036854775808); got != 9223372032559808512 { fmt.Printf("sub_int64 -4294967296%s-9223372036854775808 = %d, wanted 9223372032559808512\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(-9223372036854775808); got != -9223372032559808512 { fmt.Printf("sub_int64 -9223372036854775808%s-4294967296 = %d, wanted -9223372032559808512\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(-9223372036854775807); got != 9223372032559808511 { fmt.Printf("sub_int64 -4294967296%s-9223372036854775807 = %d, wanted 9223372032559808511\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(-9223372036854775807); got != -9223372032559808511 { fmt.Printf("sub_int64 -9223372036854775807%s-4294967296 = %d, wanted -9223372032559808511\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(-4294967296); got != 0 { fmt.Printf("sub_int64 -4294967296%s-4294967296 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(-4294967296); got != 0 { fmt.Printf("sub_int64 -4294967296%s-4294967296 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(-1); got != -4294967295 { fmt.Printf("sub_int64 -4294967296%s-1 = %d, wanted -4294967295\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(-1); got != 4294967295 { fmt.Printf("sub_int64 -1%s-4294967296 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(0); got != -4294967296 { fmt.Printf("sub_int64 -4294967296%s0 = %d, wanted -4294967296\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(0); got != 4294967296 { fmt.Printf("sub_int64 0%s-4294967296 = %d, wanted 4294967296\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(1); got != -4294967297 { fmt.Printf("sub_int64 -4294967296%s1 = %d, wanted -4294967297\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(1); got != 4294967297 { fmt.Printf("sub_int64 1%s-4294967296 = %d, wanted 4294967297\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(4294967296); got != -8589934592 { fmt.Printf("sub_int64 -4294967296%s4294967296 = %d, wanted -8589934592\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(4294967296); got != 8589934592 { fmt.Printf("sub_int64 4294967296%s-4294967296 = %d, wanted 8589934592\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(9223372036854775806); got != 9223372032559808514 { fmt.Printf("sub_int64 -4294967296%s9223372036854775806 = %d, wanted 9223372032559808514\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(9223372036854775806); got != -9223372032559808514 { fmt.Printf("sub_int64 9223372036854775806%s-4294967296 = %d, wanted -9223372032559808514\n", `-`, got) failed = true } if got := sub_Neg4294967296_int64_ssa(9223372036854775807); got != 9223372032559808513 { fmt.Printf("sub_int64 -4294967296%s9223372036854775807 = %d, wanted 9223372032559808513\n", `-`, got) failed = true } if got := sub_int64_Neg4294967296_ssa(9223372036854775807); got != -9223372032559808513 { fmt.Printf("sub_int64 9223372036854775807%s-4294967296 = %d, wanted -9223372032559808513\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(-9223372036854775808); got != 9223372036854775807 { fmt.Printf("sub_int64 -1%s-9223372036854775808 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(-9223372036854775808); got != -9223372036854775807 { fmt.Printf("sub_int64 -9223372036854775808%s-1 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(-9223372036854775807); got != 9223372036854775806 { fmt.Printf("sub_int64 -1%s-9223372036854775807 = %d, wanted 9223372036854775806\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(-9223372036854775807); got != -9223372036854775806 { fmt.Printf("sub_int64 -9223372036854775807%s-1 = %d, wanted -9223372036854775806\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(-4294967296); got != 4294967295 { fmt.Printf("sub_int64 -1%s-4294967296 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(-4294967296); got != -4294967295 { fmt.Printf("sub_int64 -4294967296%s-1 = %d, wanted -4294967295\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(-1); got != 0 { fmt.Printf("sub_int64 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(-1); got != 0 { fmt.Printf("sub_int64 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(0); got != -1 { fmt.Printf("sub_int64 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(0); got != 1 { fmt.Printf("sub_int64 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(1); got != -2 { fmt.Printf("sub_int64 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(1); got != 2 { fmt.Printf("sub_int64 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(4294967296); got != -4294967297 { fmt.Printf("sub_int64 -1%s4294967296 = %d, wanted -4294967297\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(4294967296); got != 4294967297 { fmt.Printf("sub_int64 4294967296%s-1 = %d, wanted 4294967297\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(9223372036854775806); got != -9223372036854775807 { fmt.Printf("sub_int64 -1%s9223372036854775806 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(9223372036854775806); got != 9223372036854775807 { fmt.Printf("sub_int64 9223372036854775806%s-1 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_Neg1_int64_ssa(9223372036854775807); got != -9223372036854775808 { fmt.Printf("sub_int64 -1%s9223372036854775807 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_int64_Neg1_ssa(9223372036854775807); got != -9223372036854775808 { fmt.Printf("sub_int64 9223372036854775807%s-1 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_0_int64_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("sub_int64 0%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_int64_0_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("sub_int64 -9223372036854775808%s0 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_0_int64_ssa(-9223372036854775807); got != 9223372036854775807 { fmt.Printf("sub_int64 0%s-9223372036854775807 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_0_ssa(-9223372036854775807); got != -9223372036854775807 { fmt.Printf("sub_int64 -9223372036854775807%s0 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_0_int64_ssa(-4294967296); got != 4294967296 { fmt.Printf("sub_int64 0%s-4294967296 = %d, wanted 4294967296\n", `-`, got) failed = true } if got := sub_int64_0_ssa(-4294967296); got != -4294967296 { fmt.Printf("sub_int64 -4294967296%s0 = %d, wanted -4294967296\n", `-`, got) failed = true } if got := sub_0_int64_ssa(-1); got != 1 { fmt.Printf("sub_int64 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int64_0_ssa(-1); got != -1 { fmt.Printf("sub_int64 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_0_int64_ssa(0); got != 0 { fmt.Printf("sub_int64 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_0_ssa(0); got != 0 { fmt.Printf("sub_int64 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_int64_ssa(1); got != -1 { fmt.Printf("sub_int64 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int64_0_ssa(1); got != 1 { fmt.Printf("sub_int64 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_int64_ssa(4294967296); got != -4294967296 { fmt.Printf("sub_int64 0%s4294967296 = %d, wanted -4294967296\n", `-`, got) failed = true } if got := sub_int64_0_ssa(4294967296); got != 4294967296 { fmt.Printf("sub_int64 4294967296%s0 = %d, wanted 4294967296\n", `-`, got) failed = true } if got := sub_0_int64_ssa(9223372036854775806); got != -9223372036854775806 { fmt.Printf("sub_int64 0%s9223372036854775806 = %d, wanted -9223372036854775806\n", `-`, got) failed = true } if got := sub_int64_0_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("sub_int64 9223372036854775806%s0 = %d, wanted 9223372036854775806\n", `-`, got) failed = true } if got := sub_0_int64_ssa(9223372036854775807); got != -9223372036854775807 { fmt.Printf("sub_int64 0%s9223372036854775807 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_0_ssa(9223372036854775807); got != 9223372036854775807 { fmt.Printf("sub_int64 9223372036854775807%s0 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_1_int64_ssa(-9223372036854775808); got != -9223372036854775807 { fmt.Printf("sub_int64 1%s-9223372036854775808 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_1_ssa(-9223372036854775808); got != 9223372036854775807 { fmt.Printf("sub_int64 -9223372036854775808%s1 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_1_int64_ssa(-9223372036854775807); got != -9223372036854775808 { fmt.Printf("sub_int64 1%s-9223372036854775807 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_int64_1_ssa(-9223372036854775807); got != -9223372036854775808 { fmt.Printf("sub_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_1_int64_ssa(-4294967296); got != 4294967297 { fmt.Printf("sub_int64 1%s-4294967296 = %d, wanted 4294967297\n", `-`, got) failed = true } if got := sub_int64_1_ssa(-4294967296); got != -4294967297 { fmt.Printf("sub_int64 -4294967296%s1 = %d, wanted -4294967297\n", `-`, got) failed = true } if got := sub_1_int64_ssa(-1); got != 2 { fmt.Printf("sub_int64 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int64_1_ssa(-1); got != -2 { fmt.Printf("sub_int64 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_1_int64_ssa(0); got != 1 { fmt.Printf("sub_int64 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int64_1_ssa(0); got != -1 { fmt.Printf("sub_int64 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_1_int64_ssa(1); got != 0 { fmt.Printf("sub_int64 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_1_ssa(1); got != 0 { fmt.Printf("sub_int64 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_int64_ssa(4294967296); got != -4294967295 { fmt.Printf("sub_int64 1%s4294967296 = %d, wanted -4294967295\n", `-`, got) failed = true } if got := sub_int64_1_ssa(4294967296); got != 4294967295 { fmt.Printf("sub_int64 4294967296%s1 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_1_int64_ssa(9223372036854775806); got != -9223372036854775805 { fmt.Printf("sub_int64 1%s9223372036854775806 = %d, wanted -9223372036854775805\n", `-`, got) failed = true } if got := sub_int64_1_ssa(9223372036854775806); got != 9223372036854775805 { fmt.Printf("sub_int64 9223372036854775806%s1 = %d, wanted 9223372036854775805\n", `-`, got) failed = true } if got := sub_1_int64_ssa(9223372036854775807); got != -9223372036854775806 { fmt.Printf("sub_int64 1%s9223372036854775807 = %d, wanted -9223372036854775806\n", `-`, got) failed = true } if got := sub_int64_1_ssa(9223372036854775807); got != 9223372036854775806 { fmt.Printf("sub_int64 9223372036854775807%s1 = %d, wanted 9223372036854775806\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(-9223372036854775808); got != -9223372032559808512 { fmt.Printf("sub_int64 4294967296%s-9223372036854775808 = %d, wanted -9223372032559808512\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(-9223372036854775808); got != 9223372032559808512 { fmt.Printf("sub_int64 -9223372036854775808%s4294967296 = %d, wanted 9223372032559808512\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(-9223372036854775807); got != -9223372032559808513 { fmt.Printf("sub_int64 4294967296%s-9223372036854775807 = %d, wanted -9223372032559808513\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(-9223372036854775807); got != 9223372032559808513 { fmt.Printf("sub_int64 -9223372036854775807%s4294967296 = %d, wanted 9223372032559808513\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(-4294967296); got != 8589934592 { fmt.Printf("sub_int64 4294967296%s-4294967296 = %d, wanted 8589934592\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(-4294967296); got != -8589934592 { fmt.Printf("sub_int64 -4294967296%s4294967296 = %d, wanted -8589934592\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(-1); got != 4294967297 { fmt.Printf("sub_int64 4294967296%s-1 = %d, wanted 4294967297\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(-1); got != -4294967297 { fmt.Printf("sub_int64 -1%s4294967296 = %d, wanted -4294967297\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(0); got != 4294967296 { fmt.Printf("sub_int64 4294967296%s0 = %d, wanted 4294967296\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(0); got != -4294967296 { fmt.Printf("sub_int64 0%s4294967296 = %d, wanted -4294967296\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(1); got != 4294967295 { fmt.Printf("sub_int64 4294967296%s1 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(1); got != -4294967295 { fmt.Printf("sub_int64 1%s4294967296 = %d, wanted -4294967295\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(4294967296); got != 0 { fmt.Printf("sub_int64 4294967296%s4294967296 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("sub_int64 4294967296%s4294967296 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(9223372036854775806); got != -9223372032559808510 { fmt.Printf("sub_int64 4294967296%s9223372036854775806 = %d, wanted -9223372032559808510\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(9223372036854775806); got != 9223372032559808510 { fmt.Printf("sub_int64 9223372036854775806%s4294967296 = %d, wanted 9223372032559808510\n", `-`, got) failed = true } if got := sub_4294967296_int64_ssa(9223372036854775807); got != -9223372032559808511 { fmt.Printf("sub_int64 4294967296%s9223372036854775807 = %d, wanted -9223372032559808511\n", `-`, got) failed = true } if got := sub_int64_4294967296_ssa(9223372036854775807); got != 9223372032559808511 { fmt.Printf("sub_int64 9223372036854775807%s4294967296 = %d, wanted 9223372032559808511\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(-9223372036854775808); got != -2 { fmt.Printf("sub_int64 9223372036854775806%s-9223372036854775808 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(-9223372036854775808); got != 2 { fmt.Printf("sub_int64 -9223372036854775808%s9223372036854775806 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(-9223372036854775807); got != -3 { fmt.Printf("sub_int64 9223372036854775806%s-9223372036854775807 = %d, wanted -3\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(-9223372036854775807); got != 3 { fmt.Printf("sub_int64 -9223372036854775807%s9223372036854775806 = %d, wanted 3\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(-4294967296); got != -9223372032559808514 { fmt.Printf("sub_int64 9223372036854775806%s-4294967296 = %d, wanted -9223372032559808514\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(-4294967296); got != 9223372032559808514 { fmt.Printf("sub_int64 -4294967296%s9223372036854775806 = %d, wanted 9223372032559808514\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(-1); got != 9223372036854775807 { fmt.Printf("sub_int64 9223372036854775806%s-1 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(-1); got != -9223372036854775807 { fmt.Printf("sub_int64 -1%s9223372036854775806 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(0); got != 9223372036854775806 { fmt.Printf("sub_int64 9223372036854775806%s0 = %d, wanted 9223372036854775806\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(0); got != -9223372036854775806 { fmt.Printf("sub_int64 0%s9223372036854775806 = %d, wanted -9223372036854775806\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(1); got != 9223372036854775805 { fmt.Printf("sub_int64 9223372036854775806%s1 = %d, wanted 9223372036854775805\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(1); got != -9223372036854775805 { fmt.Printf("sub_int64 1%s9223372036854775806 = %d, wanted -9223372036854775805\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(4294967296); got != 9223372032559808510 { fmt.Printf("sub_int64 9223372036854775806%s4294967296 = %d, wanted 9223372032559808510\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(4294967296); got != -9223372032559808510 { fmt.Printf("sub_int64 4294967296%s9223372036854775806 = %d, wanted -9223372032559808510\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("sub_int64 9223372036854775806%s9223372036854775806 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(9223372036854775806); got != 0 { fmt.Printf("sub_int64 9223372036854775806%s9223372036854775806 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_9223372036854775806_int64_ssa(9223372036854775807); got != -1 { fmt.Printf("sub_int64 9223372036854775806%s9223372036854775807 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int64_9223372036854775806_ssa(9223372036854775807); got != 1 { fmt.Printf("sub_int64 9223372036854775807%s9223372036854775806 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(-9223372036854775808); got != -1 { fmt.Printf("sub_int64 9223372036854775807%s-9223372036854775808 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(-9223372036854775808); got != 1 { fmt.Printf("sub_int64 -9223372036854775808%s9223372036854775807 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(-9223372036854775807); got != -2 { fmt.Printf("sub_int64 9223372036854775807%s-9223372036854775807 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(-9223372036854775807); got != 2 { fmt.Printf("sub_int64 -9223372036854775807%s9223372036854775807 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(-4294967296); got != -9223372032559808513 { fmt.Printf("sub_int64 9223372036854775807%s-4294967296 = %d, wanted -9223372032559808513\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(-4294967296); got != 9223372032559808513 { fmt.Printf("sub_int64 -4294967296%s9223372036854775807 = %d, wanted 9223372032559808513\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(-1); got != -9223372036854775808 { fmt.Printf("sub_int64 9223372036854775807%s-1 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(-1); got != -9223372036854775808 { fmt.Printf("sub_int64 -1%s9223372036854775807 = %d, wanted -9223372036854775808\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(0); got != 9223372036854775807 { fmt.Printf("sub_int64 9223372036854775807%s0 = %d, wanted 9223372036854775807\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(0); got != -9223372036854775807 { fmt.Printf("sub_int64 0%s9223372036854775807 = %d, wanted -9223372036854775807\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(1); got != 9223372036854775806 { fmt.Printf("sub_int64 9223372036854775807%s1 = %d, wanted 9223372036854775806\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(1); got != -9223372036854775806 { fmt.Printf("sub_int64 1%s9223372036854775807 = %d, wanted -9223372036854775806\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(4294967296); got != 9223372032559808511 { fmt.Printf("sub_int64 9223372036854775807%s4294967296 = %d, wanted 9223372032559808511\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(4294967296); got != -9223372032559808511 { fmt.Printf("sub_int64 4294967296%s9223372036854775807 = %d, wanted -9223372032559808511\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(9223372036854775806); got != 1 { fmt.Printf("sub_int64 9223372036854775807%s9223372036854775806 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(9223372036854775806); got != -1 { fmt.Printf("sub_int64 9223372036854775806%s9223372036854775807 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_9223372036854775807_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("sub_int64 9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int64_9223372036854775807_ssa(9223372036854775807); got != 0 { fmt.Printf("sub_int64 9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `-`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 1 { fmt.Printf("div_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 1 { fmt.Printf("div_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != 1 { fmt.Printf("div_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != 0 { fmt.Printf("div_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(-4294967296); got != 2147483648 { fmt.Printf("div_int64 -9223372036854775808%s-4294967296 = %d, wanted 2147483648\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(-4294967296); got != 0 { fmt.Printf("div_int64 -4294967296%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(-1); got != -9223372036854775808 { fmt.Printf("div_int64 -9223372036854775808%s-1 = %d, wanted -9223372036854775808\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(-1); got != 0 { fmt.Printf("div_int64 -1%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(0); got != 0 { fmt.Printf("div_int64 0%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(1); got != -9223372036854775808 { fmt.Printf("div_int64 -9223372036854775808%s1 = %d, wanted -9223372036854775808\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(1); got != 0 { fmt.Printf("div_int64 1%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(4294967296); got != -2147483648 { fmt.Printf("div_int64 -9223372036854775808%s4294967296 = %d, wanted -2147483648\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(4294967296); got != 0 { fmt.Printf("div_int64 4294967296%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(9223372036854775806); got != -1 { fmt.Printf("div_int64 -9223372036854775808%s9223372036854775806 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 9223372036854775806%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775808_int64_ssa(9223372036854775807); got != -1 { fmt.Printf("div_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775808_ssa(9223372036854775807); got != 0 { fmt.Printf("div_int64 9223372036854775807%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != 1 { fmt.Printf("div_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 1 { fmt.Printf("div_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 1 { fmt.Printf("div_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(-4294967296); got != 2147483647 { fmt.Printf("div_int64 -9223372036854775807%s-4294967296 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(-4294967296); got != 0 { fmt.Printf("div_int64 -4294967296%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(-1); got != 9223372036854775807 { fmt.Printf("div_int64 -9223372036854775807%s-1 = %d, wanted 9223372036854775807\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(-1); got != 0 { fmt.Printf("div_int64 -1%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(0); got != 0 { fmt.Printf("div_int64 0%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775807 { fmt.Printf("div_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775807\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(1); got != 0 { fmt.Printf("div_int64 1%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(4294967296); got != -2147483647 { fmt.Printf("div_int64 -9223372036854775807%s4294967296 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(4294967296); got != 0 { fmt.Printf("div_int64 4294967296%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(9223372036854775806); got != -1 { fmt.Printf("div_int64 -9223372036854775807%s9223372036854775806 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 9223372036854775806%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg9223372036854775807_int64_ssa(9223372036854775807); got != -1 { fmt.Printf("div_int64 -9223372036854775807%s9223372036854775807 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_Neg9223372036854775807_ssa(9223372036854775807); got != -1 { fmt.Printf("div_int64 9223372036854775807%s-9223372036854775807 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 -4294967296%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(-9223372036854775808); got != 2147483648 { fmt.Printf("div_int64 -9223372036854775808%s-4294967296 = %d, wanted 2147483648\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("div_int64 -4294967296%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(-9223372036854775807); got != 2147483647 { fmt.Printf("div_int64 -9223372036854775807%s-4294967296 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(-4294967296); got != 1 { fmt.Printf("div_int64 -4294967296%s-4294967296 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(-4294967296); got != 1 { fmt.Printf("div_int64 -4294967296%s-4294967296 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(-1); got != 4294967296 { fmt.Printf("div_int64 -4294967296%s-1 = %d, wanted 4294967296\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(-1); got != 0 { fmt.Printf("div_int64 -1%s-4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(0); got != 0 { fmt.Printf("div_int64 0%s-4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(1); got != -4294967296 { fmt.Printf("div_int64 -4294967296%s1 = %d, wanted -4294967296\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(1); got != 0 { fmt.Printf("div_int64 1%s-4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(4294967296); got != -1 { fmt.Printf("div_int64 -4294967296%s4294967296 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(4294967296); got != -1 { fmt.Printf("div_int64 4294967296%s-4294967296 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 -4294967296%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(9223372036854775806); got != -2147483647 { fmt.Printf("div_int64 9223372036854775806%s-4294967296 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_Neg4294967296_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("div_int64 -4294967296%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg4294967296_ssa(9223372036854775807); got != -2147483647 { fmt.Printf("div_int64 9223372036854775807%s-4294967296 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 -1%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("div_int64 -9223372036854775808%s-1 = %d, wanted -9223372036854775808\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("div_int64 -1%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(-9223372036854775807); got != 9223372036854775807 { fmt.Printf("div_int64 -9223372036854775807%s-1 = %d, wanted 9223372036854775807\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(-4294967296); got != 0 { fmt.Printf("div_int64 -1%s-4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(-4294967296); got != 4294967296 { fmt.Printf("div_int64 -4294967296%s-1 = %d, wanted 4294967296\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(-1); got != 1 { fmt.Printf("div_int64 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(-1); got != 1 { fmt.Printf("div_int64 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(0); got != 0 { fmt.Printf("div_int64 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(1); got != -1 { fmt.Printf("div_int64 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(1); got != -1 { fmt.Printf("div_int64 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(4294967296); got != 0 { fmt.Printf("div_int64 -1%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(4294967296); got != -4294967296 { fmt.Printf("div_int64 4294967296%s-1 = %d, wanted -4294967296\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 -1%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(9223372036854775806); got != -9223372036854775806 { fmt.Printf("div_int64 9223372036854775806%s-1 = %d, wanted -9223372036854775806\n", `/`, got) failed = true } if got := div_Neg1_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("div_int64 -1%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_Neg1_ssa(9223372036854775807); got != -9223372036854775807 { fmt.Printf("div_int64 9223372036854775807%s-1 = %d, wanted -9223372036854775807\n", `/`, got) failed = true } if got := div_0_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 0%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("div_int64 0%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int64_ssa(-4294967296); got != 0 { fmt.Printf("div_int64 0%s-4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int64_ssa(-1); got != 0 { fmt.Printf("div_int64 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int64_ssa(1); got != 0 { fmt.Printf("div_int64 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int64_ssa(4294967296); got != 0 { fmt.Printf("div_int64 0%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 0%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("div_int64 0%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 1%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_1_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("div_int64 -9223372036854775808%s1 = %d, wanted -9223372036854775808\n", `/`, got) failed = true } if got := div_1_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("div_int64 1%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_1_ssa(-9223372036854775807); got != -9223372036854775807 { fmt.Printf("div_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775807\n", `/`, got) failed = true } if got := div_1_int64_ssa(-4294967296); got != 0 { fmt.Printf("div_int64 1%s-4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_1_ssa(-4294967296); got != -4294967296 { fmt.Printf("div_int64 -4294967296%s1 = %d, wanted -4294967296\n", `/`, got) failed = true } if got := div_1_int64_ssa(-1); got != -1 { fmt.Printf("div_int64 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_1_ssa(-1); got != -1 { fmt.Printf("div_int64 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_1_ssa(0); got != 0 { fmt.Printf("div_int64 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int64_ssa(1); got != 1 { fmt.Printf("div_int64 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_1_ssa(1); got != 1 { fmt.Printf("div_int64 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_int64_ssa(4294967296); got != 0 { fmt.Printf("div_int64 1%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_1_ssa(4294967296); got != 4294967296 { fmt.Printf("div_int64 4294967296%s1 = %d, wanted 4294967296\n", `/`, got) failed = true } if got := div_1_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 1%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_1_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("div_int64 9223372036854775806%s1 = %d, wanted 9223372036854775806\n", `/`, got) failed = true } if got := div_1_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("div_int64 1%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_1_ssa(9223372036854775807); got != 9223372036854775807 { fmt.Printf("div_int64 9223372036854775807%s1 = %d, wanted 9223372036854775807\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 4294967296%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(-9223372036854775808); got != -2147483648 { fmt.Printf("div_int64 -9223372036854775808%s4294967296 = %d, wanted -2147483648\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("div_int64 4294967296%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(-9223372036854775807); got != -2147483647 { fmt.Printf("div_int64 -9223372036854775807%s4294967296 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(-4294967296); got != -1 { fmt.Printf("div_int64 4294967296%s-4294967296 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(-4294967296); got != -1 { fmt.Printf("div_int64 -4294967296%s4294967296 = %d, wanted -1\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(-1); got != -4294967296 { fmt.Printf("div_int64 4294967296%s-1 = %d, wanted -4294967296\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(-1); got != 0 { fmt.Printf("div_int64 -1%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(0); got != 0 { fmt.Printf("div_int64 0%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(1); got != 4294967296 { fmt.Printf("div_int64 4294967296%s1 = %d, wanted 4294967296\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(1); got != 0 { fmt.Printf("div_int64 1%s4294967296 = %d, wanted 0\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(4294967296); got != 1 { fmt.Printf("div_int64 4294967296%s4294967296 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(4294967296); got != 1 { fmt.Printf("div_int64 4294967296%s4294967296 = %d, wanted 1\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 4294967296%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(9223372036854775806); got != 2147483647 { fmt.Printf("div_int64 9223372036854775806%s4294967296 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_4294967296_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("div_int64 4294967296%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_4294967296_ssa(9223372036854775807); got != 2147483647 { fmt.Printf("div_int64 9223372036854775807%s4294967296 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 9223372036854775806%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(-9223372036854775808); got != -1 { fmt.Printf("div_int64 -9223372036854775808%s9223372036854775806 = %d, wanted -1\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("div_int64 9223372036854775806%s-9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(-9223372036854775807); got != -1 { fmt.Printf("div_int64 -9223372036854775807%s9223372036854775806 = %d, wanted -1\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(-4294967296); got != -2147483647 { fmt.Printf("div_int64 9223372036854775806%s-4294967296 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(-4294967296); got != 0 { fmt.Printf("div_int64 -4294967296%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(-1); got != -9223372036854775806 { fmt.Printf("div_int64 9223372036854775806%s-1 = %d, wanted -9223372036854775806\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(-1); got != 0 { fmt.Printf("div_int64 -1%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(0); got != 0 { fmt.Printf("div_int64 0%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(1); got != 9223372036854775806 { fmt.Printf("div_int64 9223372036854775806%s1 = %d, wanted 9223372036854775806\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(1); got != 0 { fmt.Printf("div_int64 1%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(4294967296); got != 2147483647 { fmt.Printf("div_int64 9223372036854775806%s4294967296 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(4294967296); got != 0 { fmt.Printf("div_int64 4294967296%s9223372036854775806 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(9223372036854775806); got != 1 { fmt.Printf("div_int64 9223372036854775806%s9223372036854775806 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(9223372036854775806); got != 1 { fmt.Printf("div_int64 9223372036854775806%s9223372036854775806 = %d, wanted 1\n", `/`, got) failed = true } if got := div_9223372036854775806_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("div_int64 9223372036854775806%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_9223372036854775806_ssa(9223372036854775807); got != 1 { fmt.Printf("div_int64 9223372036854775807%s9223372036854775806 = %d, wanted 1\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("div_int64 9223372036854775807%s-9223372036854775808 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(-9223372036854775808); got != -1 { fmt.Printf("div_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -1\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(-9223372036854775807); got != -1 { fmt.Printf("div_int64 9223372036854775807%s-9223372036854775807 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(-9223372036854775807); got != -1 { fmt.Printf("div_int64 -9223372036854775807%s9223372036854775807 = %d, wanted -1\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(-4294967296); got != -2147483647 { fmt.Printf("div_int64 9223372036854775807%s-4294967296 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(-4294967296); got != 0 { fmt.Printf("div_int64 -4294967296%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(-1); got != -9223372036854775807 { fmt.Printf("div_int64 9223372036854775807%s-1 = %d, wanted -9223372036854775807\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(-1); got != 0 { fmt.Printf("div_int64 -1%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(0); got != 0 { fmt.Printf("div_int64 0%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(1); got != 9223372036854775807 { fmt.Printf("div_int64 9223372036854775807%s1 = %d, wanted 9223372036854775807\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(1); got != 0 { fmt.Printf("div_int64 1%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(4294967296); got != 2147483647 { fmt.Printf("div_int64 9223372036854775807%s4294967296 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(4294967296); got != 0 { fmt.Printf("div_int64 4294967296%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(9223372036854775806); got != 1 { fmt.Printf("div_int64 9223372036854775807%s9223372036854775806 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(9223372036854775806); got != 0 { fmt.Printf("div_int64 9223372036854775806%s9223372036854775807 = %d, wanted 0\n", `/`, got) failed = true } if got := div_9223372036854775807_int64_ssa(9223372036854775807); got != 1 { fmt.Printf("div_int64 9223372036854775807%s9223372036854775807 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int64_9223372036854775807_ssa(9223372036854775807); got != 1 { fmt.Printf("div_int64 9223372036854775807%s9223372036854775807 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 -4294967296%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(-1); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s-1 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(-1); got != -9223372036854775808 { fmt.Printf("mul_int64 -1%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(1); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s1 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(1); got != -9223372036854775808 { fmt.Printf("mul_int64 1%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 4294967296%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s9223372036854775806 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(9223372036854775806); got != 0 { fmt.Printf("mul_int64 9223372036854775806%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg9223372036854775808_int64_ssa(9223372036854775807); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775808_ssa(9223372036854775807); got != -9223372036854775808 { fmt.Printf("mul_int64 9223372036854775807%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 1 { fmt.Printf("mul_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 1 { fmt.Printf("mul_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(-4294967296); got != -4294967296 { fmt.Printf("mul_int64 -9223372036854775807%s-4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(-4294967296); got != -4294967296 { fmt.Printf("mul_int64 -4294967296%s-9223372036854775807 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(-1); got != 9223372036854775807 { fmt.Printf("mul_int64 -9223372036854775807%s-1 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(-1); got != 9223372036854775807 { fmt.Printf("mul_int64 -1%s-9223372036854775807 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 -9223372036854775807%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s-9223372036854775807 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(1); got != -9223372036854775807 { fmt.Printf("mul_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(1); got != -9223372036854775807 { fmt.Printf("mul_int64 1%s-9223372036854775807 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(4294967296); got != 4294967296 { fmt.Printf("mul_int64 -9223372036854775807%s4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(4294967296); got != 4294967296 { fmt.Printf("mul_int64 4294967296%s-9223372036854775807 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("mul_int64 -9223372036854775807%s9223372036854775806 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s-9223372036854775807 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_Neg9223372036854775807_int64_ssa(9223372036854775807); got != -1 { fmt.Printf("mul_int64 -9223372036854775807%s9223372036854775807 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int64_Neg9223372036854775807_ssa(9223372036854775807); got != -1 { fmt.Printf("mul_int64 9223372036854775807%s-9223372036854775807 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 -4294967296%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(-9223372036854775807); got != -4294967296 { fmt.Printf("mul_int64 -4294967296%s-9223372036854775807 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(-9223372036854775807); got != -4294967296 { fmt.Printf("mul_int64 -9223372036854775807%s-4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 -4294967296%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 -4294967296%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(-1); got != 4294967296 { fmt.Printf("mul_int64 -4294967296%s-1 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(-1); got != 4294967296 { fmt.Printf("mul_int64 -1%s-4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 -4294967296%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(1); got != -4294967296 { fmt.Printf("mul_int64 -4294967296%s1 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(1); got != -4294967296 { fmt.Printf("mul_int64 1%s-4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 -4294967296%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 4294967296%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(9223372036854775806); got != 8589934592 { fmt.Printf("mul_int64 -4294967296%s9223372036854775806 = %d, wanted 8589934592\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(9223372036854775806); got != 8589934592 { fmt.Printf("mul_int64 9223372036854775806%s-4294967296 = %d, wanted 8589934592\n", `*`, got) failed = true } if got := mul_Neg4294967296_int64_ssa(9223372036854775807); got != 4294967296 { fmt.Printf("mul_int64 -4294967296%s9223372036854775807 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg4294967296_ssa(9223372036854775807); got != 4294967296 { fmt.Printf("mul_int64 9223372036854775807%s-4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 -1%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s-1 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(-9223372036854775807); got != 9223372036854775807 { fmt.Printf("mul_int64 -1%s-9223372036854775807 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(-9223372036854775807); got != 9223372036854775807 { fmt.Printf("mul_int64 -9223372036854775807%s-1 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(-4294967296); got != 4294967296 { fmt.Printf("mul_int64 -1%s-4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(-4294967296); got != 4294967296 { fmt.Printf("mul_int64 -4294967296%s-1 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(-1); got != 1 { fmt.Printf("mul_int64 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(-1); got != 1 { fmt.Printf("mul_int64 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(1); got != -1 { fmt.Printf("mul_int64 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(1); got != -1 { fmt.Printf("mul_int64 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(4294967296); got != -4294967296 { fmt.Printf("mul_int64 -1%s4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(4294967296); got != -4294967296 { fmt.Printf("mul_int64 4294967296%s-1 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(9223372036854775806); got != -9223372036854775806 { fmt.Printf("mul_int64 -1%s9223372036854775806 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(9223372036854775806); got != -9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s-1 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_Neg1_int64_ssa(9223372036854775807); got != -9223372036854775807 { fmt.Printf("mul_int64 -1%s9223372036854775807 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_Neg1_ssa(9223372036854775807); got != -9223372036854775807 { fmt.Printf("mul_int64 9223372036854775807%s-1 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_0_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 0%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("mul_int64 0%s-9223372036854775807 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(-9223372036854775807); got != 0 { fmt.Printf("mul_int64 -9223372036854775807%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 0%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 -4294967296%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(-1); got != 0 { fmt.Printf("mul_int64 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(-1); got != 0 { fmt.Printf("mul_int64 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(1); got != 0 { fmt.Printf("mul_int64 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(1); got != 0 { fmt.Printf("mul_int64 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 0%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 4294967296%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("mul_int64 0%s9223372036854775806 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(9223372036854775806); got != 0 { fmt.Printf("mul_int64 9223372036854775806%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("mul_int64 0%s9223372036854775807 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_0_ssa(9223372036854775807); got != 0 { fmt.Printf("mul_int64 9223372036854775807%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int64_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 1%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_1_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s1 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_1_int64_ssa(-9223372036854775807); got != -9223372036854775807 { fmt.Printf("mul_int64 1%s-9223372036854775807 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_1_ssa(-9223372036854775807); got != -9223372036854775807 { fmt.Printf("mul_int64 -9223372036854775807%s1 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_1_int64_ssa(-4294967296); got != -4294967296 { fmt.Printf("mul_int64 1%s-4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_1_ssa(-4294967296); got != -4294967296 { fmt.Printf("mul_int64 -4294967296%s1 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_1_int64_ssa(-1); got != -1 { fmt.Printf("mul_int64 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int64_1_ssa(-1); got != -1 { fmt.Printf("mul_int64 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_1_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_1_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int64_ssa(1); got != 1 { fmt.Printf("mul_int64 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int64_1_ssa(1); got != 1 { fmt.Printf("mul_int64 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_int64_ssa(4294967296); got != 4294967296 { fmt.Printf("mul_int64 1%s4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_1_ssa(4294967296); got != 4294967296 { fmt.Printf("mul_int64 4294967296%s1 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_1_int64_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("mul_int64 1%s9223372036854775806 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_1_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s1 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_1_int64_ssa(9223372036854775807); got != 9223372036854775807 { fmt.Printf("mul_int64 1%s9223372036854775807 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_1_ssa(9223372036854775807); got != 9223372036854775807 { fmt.Printf("mul_int64 9223372036854775807%s1 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 4294967296%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(-9223372036854775807); got != 4294967296 { fmt.Printf("mul_int64 4294967296%s-9223372036854775807 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(-9223372036854775807); got != 4294967296 { fmt.Printf("mul_int64 -9223372036854775807%s4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 4294967296%s-4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(-4294967296); got != 0 { fmt.Printf("mul_int64 -4294967296%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(-1); got != -4294967296 { fmt.Printf("mul_int64 4294967296%s-1 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(-1); got != -4294967296 { fmt.Printf("mul_int64 -1%s4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 4294967296%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(1); got != 4294967296 { fmt.Printf("mul_int64 4294967296%s1 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(1); got != 4294967296 { fmt.Printf("mul_int64 1%s4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 4294967296%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("mul_int64 4294967296%s4294967296 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(9223372036854775806); got != -8589934592 { fmt.Printf("mul_int64 4294967296%s9223372036854775806 = %d, wanted -8589934592\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(9223372036854775806); got != -8589934592 { fmt.Printf("mul_int64 9223372036854775806%s4294967296 = %d, wanted -8589934592\n", `*`, got) failed = true } if got := mul_4294967296_int64_ssa(9223372036854775807); got != -4294967296 { fmt.Printf("mul_int64 4294967296%s9223372036854775807 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_4294967296_ssa(9223372036854775807); got != -4294967296 { fmt.Printf("mul_int64 9223372036854775807%s4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 9223372036854775806%s-9223372036854775808 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(-9223372036854775808); got != 0 { fmt.Printf("mul_int64 -9223372036854775808%s9223372036854775806 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(-9223372036854775807); got != 9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s-9223372036854775807 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(-9223372036854775807); got != 9223372036854775806 { fmt.Printf("mul_int64 -9223372036854775807%s9223372036854775806 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(-4294967296); got != 8589934592 { fmt.Printf("mul_int64 9223372036854775806%s-4294967296 = %d, wanted 8589934592\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(-4294967296); got != 8589934592 { fmt.Printf("mul_int64 -4294967296%s9223372036854775806 = %d, wanted 8589934592\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(-1); got != -9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s-1 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(-1); got != -9223372036854775806 { fmt.Printf("mul_int64 -1%s9223372036854775806 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 9223372036854775806%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s9223372036854775806 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(1); got != 9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s1 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(1); got != 9223372036854775806 { fmt.Printf("mul_int64 1%s9223372036854775806 = %d, wanted 9223372036854775806\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(4294967296); got != -8589934592 { fmt.Printf("mul_int64 9223372036854775806%s4294967296 = %d, wanted -8589934592\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(4294967296); got != -8589934592 { fmt.Printf("mul_int64 4294967296%s9223372036854775806 = %d, wanted -8589934592\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(9223372036854775806); got != 4 { fmt.Printf("mul_int64 9223372036854775806%s9223372036854775806 = %d, wanted 4\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(9223372036854775806); got != 4 { fmt.Printf("mul_int64 9223372036854775806%s9223372036854775806 = %d, wanted 4\n", `*`, got) failed = true } if got := mul_9223372036854775806_int64_ssa(9223372036854775807); got != -9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s9223372036854775807 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_9223372036854775806_ssa(9223372036854775807); got != -9223372036854775806 { fmt.Printf("mul_int64 9223372036854775807%s9223372036854775806 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 9223372036854775807%s-9223372036854775808 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(-9223372036854775808); got != -9223372036854775808 { fmt.Printf("mul_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -9223372036854775808\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(-9223372036854775807); got != -1 { fmt.Printf("mul_int64 9223372036854775807%s-9223372036854775807 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(-9223372036854775807); got != -1 { fmt.Printf("mul_int64 -9223372036854775807%s9223372036854775807 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(-4294967296); got != 4294967296 { fmt.Printf("mul_int64 9223372036854775807%s-4294967296 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(-4294967296); got != 4294967296 { fmt.Printf("mul_int64 -4294967296%s9223372036854775807 = %d, wanted 4294967296\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(-1); got != -9223372036854775807 { fmt.Printf("mul_int64 9223372036854775807%s-1 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(-1); got != -9223372036854775807 { fmt.Printf("mul_int64 -1%s9223372036854775807 = %d, wanted -9223372036854775807\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(0); got != 0 { fmt.Printf("mul_int64 9223372036854775807%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(0); got != 0 { fmt.Printf("mul_int64 0%s9223372036854775807 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(1); got != 9223372036854775807 { fmt.Printf("mul_int64 9223372036854775807%s1 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(1); got != 9223372036854775807 { fmt.Printf("mul_int64 1%s9223372036854775807 = %d, wanted 9223372036854775807\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(4294967296); got != -4294967296 { fmt.Printf("mul_int64 9223372036854775807%s4294967296 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(4294967296); got != -4294967296 { fmt.Printf("mul_int64 4294967296%s9223372036854775807 = %d, wanted -4294967296\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(9223372036854775806); got != -9223372036854775806 { fmt.Printf("mul_int64 9223372036854775807%s9223372036854775806 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(9223372036854775806); got != -9223372036854775806 { fmt.Printf("mul_int64 9223372036854775806%s9223372036854775807 = %d, wanted -9223372036854775806\n", `*`, got) failed = true } if got := mul_9223372036854775807_int64_ssa(9223372036854775807); got != 1 { fmt.Printf("mul_int64 9223372036854775807%s9223372036854775807 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int64_9223372036854775807_ssa(9223372036854775807); got != 1 { fmt.Printf("mul_int64 9223372036854775807%s9223372036854775807 = %d, wanted 1\n", `*`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(-9223372036854775808); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s-9223372036854775808 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(-9223372036854775807); got != -1 { fmt.Printf("mod_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(-9223372036854775807); got != -9223372036854775807 { fmt.Printf("mod_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted -9223372036854775807\n", `%`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(-4294967296); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s-9223372036854775808 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(-1); got != -1 { fmt.Printf("mod_int64 -1%s-9223372036854775808 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s-9223372036854775808 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(1); got != 1 { fmt.Printf("mod_int64 1%s-9223372036854775808 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(4294967296); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s-9223372036854775808 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(9223372036854775806); got != -2 { fmt.Printf("mod_int64 -9223372036854775808%s9223372036854775806 = %d, wanted -2\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("mod_int64 9223372036854775806%s-9223372036854775808 = %d, wanted 9223372036854775806\n", `%`, got) failed = true } if got := mod_Neg9223372036854775808_int64_ssa(9223372036854775807); got != -1 { fmt.Printf("mod_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775808_ssa(9223372036854775807); got != 9223372036854775807 { fmt.Printf("mod_int64 9223372036854775807%s-9223372036854775808 = %d, wanted 9223372036854775807\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(-9223372036854775808); got != -9223372036854775807 { fmt.Printf("mod_int64 -9223372036854775807%s-9223372036854775808 = %d, wanted -9223372036854775807\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(-9223372036854775808); got != -1 { fmt.Printf("mod_int64 -9223372036854775808%s-9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(-9223372036854775807); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(-4294967296); got != -4294967295 { fmt.Printf("mod_int64 -9223372036854775807%s-4294967296 = %d, wanted -4294967295\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(-4294967296); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s-9223372036854775807 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(-1); got != -1 { fmt.Printf("mod_int64 -1%s-9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s-9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(1); got != 1 { fmt.Printf("mod_int64 1%s-9223372036854775807 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(4294967296); got != -4294967295 { fmt.Printf("mod_int64 -9223372036854775807%s4294967296 = %d, wanted -4294967295\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(4294967296); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s-9223372036854775807 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(9223372036854775806); got != -1 { fmt.Printf("mod_int64 -9223372036854775807%s9223372036854775806 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("mod_int64 9223372036854775806%s-9223372036854775807 = %d, wanted 9223372036854775806\n", `%`, got) failed = true } if got := mod_Neg9223372036854775807_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg9223372036854775807_ssa(9223372036854775807); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(-9223372036854775808); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s-9223372036854775808 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(-9223372036854775808); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(-9223372036854775807); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s-9223372036854775807 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(-9223372036854775807); got != -4294967295 { fmt.Printf("mod_int64 -9223372036854775807%s-4294967296 = %d, wanted -4294967295\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 -4294967296%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 -4294967296%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 -4294967296%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(-1); got != -1 { fmt.Printf("mod_int64 -1%s-4294967296 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 -4294967296%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(1); got != 1 { fmt.Printf("mod_int64 1%s-4294967296 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 -4294967296%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 4294967296%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(9223372036854775806); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s9223372036854775806 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(9223372036854775806); got != 4294967294 { fmt.Printf("mod_int64 9223372036854775806%s-4294967296 = %d, wanted 4294967294\n", `%`, got) failed = true } if got := mod_Neg4294967296_int64_ssa(9223372036854775807); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s9223372036854775807 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_int64_Neg4294967296_ssa(9223372036854775807); got != 4294967295 { fmt.Printf("mod_int64 9223372036854775807%s-4294967296 = %d, wanted 4294967295\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(-9223372036854775808); got != -1 { fmt.Printf("mod_int64 -1%s-9223372036854775808 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(-9223372036854775808); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(-9223372036854775807); got != -1 { fmt.Printf("mod_int64 -1%s-9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(-9223372036854775807); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(-4294967296); got != -1 { fmt.Printf("mod_int64 -1%s-4294967296 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 -4294967296%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(-1); got != 0 { fmt.Printf("mod_int64 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(1); got != 0 { fmt.Printf("mod_int64 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(4294967296); got != -1 { fmt.Printf("mod_int64 -1%s4294967296 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 4294967296%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(9223372036854775806); got != -1 { fmt.Printf("mod_int64 -1%s9223372036854775806 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(9223372036854775806); got != 0 { fmt.Printf("mod_int64 9223372036854775806%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int64_ssa(9223372036854775807); got != -1 { fmt.Printf("mod_int64 -1%s9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_Neg1_ssa(9223372036854775807); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(-9223372036854775808); got != 0 { fmt.Printf("mod_int64 0%s-9223372036854775808 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("mod_int64 0%s-9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 0%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 0%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("mod_int64 0%s9223372036854775806 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("mod_int64 0%s9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(-9223372036854775808); got != 1 { fmt.Printf("mod_int64 1%s-9223372036854775808 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int64_1_ssa(-9223372036854775808); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(-9223372036854775807); got != 1 { fmt.Printf("mod_int64 1%s-9223372036854775807 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int64_1_ssa(-9223372036854775807); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(-4294967296); got != 1 { fmt.Printf("mod_int64 1%s-4294967296 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int64_1_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 -4294967296%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_1_ssa(-1); got != 0 { fmt.Printf("mod_int64 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_1_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_1_ssa(1); got != 0 { fmt.Printf("mod_int64 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(4294967296); got != 1 { fmt.Printf("mod_int64 1%s4294967296 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int64_1_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 4294967296%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(9223372036854775806); got != 1 { fmt.Printf("mod_int64 1%s9223372036854775806 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int64_1_ssa(9223372036854775806); got != 0 { fmt.Printf("mod_int64 9223372036854775806%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int64_ssa(9223372036854775807); got != 1 { fmt.Printf("mod_int64 1%s9223372036854775807 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int64_1_ssa(9223372036854775807); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(-9223372036854775808); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s-9223372036854775808 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(-9223372036854775808); got != 0 { fmt.Printf("mod_int64 -9223372036854775808%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(-9223372036854775807); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s-9223372036854775807 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(-9223372036854775807); got != -4294967295 { fmt.Printf("mod_int64 -9223372036854775807%s4294967296 = %d, wanted -4294967295\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 4294967296%s-4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(-4294967296); got != 0 { fmt.Printf("mod_int64 -4294967296%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 4294967296%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(-1); got != -1 { fmt.Printf("mod_int64 -1%s4294967296 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 4294967296%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(1); got != 1 { fmt.Printf("mod_int64 1%s4294967296 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 4294967296%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(4294967296); got != 0 { fmt.Printf("mod_int64 4294967296%s4294967296 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(9223372036854775806); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s9223372036854775806 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(9223372036854775806); got != 4294967294 { fmt.Printf("mod_int64 9223372036854775806%s4294967296 = %d, wanted 4294967294\n", `%`, got) failed = true } if got := mod_4294967296_int64_ssa(9223372036854775807); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s9223372036854775807 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_int64_4294967296_ssa(9223372036854775807); got != 4294967295 { fmt.Printf("mod_int64 9223372036854775807%s4294967296 = %d, wanted 4294967295\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(-9223372036854775808); got != 9223372036854775806 { fmt.Printf("mod_int64 9223372036854775806%s-9223372036854775808 = %d, wanted 9223372036854775806\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(-9223372036854775808); got != -2 { fmt.Printf("mod_int64 -9223372036854775808%s9223372036854775806 = %d, wanted -2\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(-9223372036854775807); got != 9223372036854775806 { fmt.Printf("mod_int64 9223372036854775806%s-9223372036854775807 = %d, wanted 9223372036854775806\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(-9223372036854775807); got != -1 { fmt.Printf("mod_int64 -9223372036854775807%s9223372036854775806 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(-4294967296); got != 4294967294 { fmt.Printf("mod_int64 9223372036854775806%s-4294967296 = %d, wanted 4294967294\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(-4294967296); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s9223372036854775806 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 9223372036854775806%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(-1); got != -1 { fmt.Printf("mod_int64 -1%s9223372036854775806 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s9223372036854775806 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 9223372036854775806%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(1); got != 1 { fmt.Printf("mod_int64 1%s9223372036854775806 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(4294967296); got != 4294967294 { fmt.Printf("mod_int64 9223372036854775806%s4294967296 = %d, wanted 4294967294\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(4294967296); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s9223372036854775806 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(9223372036854775806); got != 0 { fmt.Printf("mod_int64 9223372036854775806%s9223372036854775806 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(9223372036854775806); got != 0 { fmt.Printf("mod_int64 9223372036854775806%s9223372036854775806 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_9223372036854775806_int64_ssa(9223372036854775807); got != 9223372036854775806 { fmt.Printf("mod_int64 9223372036854775806%s9223372036854775807 = %d, wanted 9223372036854775806\n", `%`, got) failed = true } if got := mod_int64_9223372036854775806_ssa(9223372036854775807); got != 1 { fmt.Printf("mod_int64 9223372036854775807%s9223372036854775806 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(-9223372036854775808); got != 9223372036854775807 { fmt.Printf("mod_int64 9223372036854775807%s-9223372036854775808 = %d, wanted 9223372036854775807\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(-9223372036854775808); got != -1 { fmt.Printf("mod_int64 -9223372036854775808%s9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(-9223372036854775807); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s-9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(-9223372036854775807); got != 0 { fmt.Printf("mod_int64 -9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(-4294967296); got != 4294967295 { fmt.Printf("mod_int64 9223372036854775807%s-4294967296 = %d, wanted 4294967295\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(-4294967296); got != -4294967296 { fmt.Printf("mod_int64 -4294967296%s9223372036854775807 = %d, wanted -4294967296\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(-1); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(-1); got != -1 { fmt.Printf("mod_int64 -1%s9223372036854775807 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(0); got != 0 { fmt.Printf("mod_int64 0%s9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(1); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(1); got != 1 { fmt.Printf("mod_int64 1%s9223372036854775807 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(4294967296); got != 4294967295 { fmt.Printf("mod_int64 9223372036854775807%s4294967296 = %d, wanted 4294967295\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(4294967296); got != 4294967296 { fmt.Printf("mod_int64 4294967296%s9223372036854775807 = %d, wanted 4294967296\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(9223372036854775806); got != 1 { fmt.Printf("mod_int64 9223372036854775807%s9223372036854775806 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(9223372036854775806); got != 9223372036854775806 { fmt.Printf("mod_int64 9223372036854775806%s9223372036854775807 = %d, wanted 9223372036854775806\n", `%`, got) failed = true } if got := mod_9223372036854775807_int64_ssa(9223372036854775807); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int64_9223372036854775807_ssa(9223372036854775807); got != 0 { fmt.Printf("mod_int64 9223372036854775807%s9223372036854775807 = %d, wanted 0\n", `%`, got) failed = true } if got := add_0_uint32_ssa(0); got != 0 { fmt.Printf("add_uint32 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint32_0_ssa(0); got != 0 { fmt.Printf("add_uint32 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_uint32_ssa(1); got != 1 { fmt.Printf("add_uint32 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint32_0_ssa(1); got != 1 { fmt.Printf("add_uint32 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_uint32_ssa(4294967295); got != 4294967295 { fmt.Printf("add_uint32 0%s4294967295 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_uint32_0_ssa(4294967295); got != 4294967295 { fmt.Printf("add_uint32 4294967295%s0 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_1_uint32_ssa(0); got != 1 { fmt.Printf("add_uint32 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint32_1_ssa(0); got != 1 { fmt.Printf("add_uint32 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_uint32_ssa(1); got != 2 { fmt.Printf("add_uint32 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_uint32_1_ssa(1); got != 2 { fmt.Printf("add_uint32 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_uint32_ssa(4294967295); got != 0 { fmt.Printf("add_uint32 1%s4294967295 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint32_1_ssa(4294967295); got != 0 { fmt.Printf("add_uint32 4294967295%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_4294967295_uint32_ssa(0); got != 4294967295 { fmt.Printf("add_uint32 4294967295%s0 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_uint32_4294967295_ssa(0); got != 4294967295 { fmt.Printf("add_uint32 0%s4294967295 = %d, wanted 4294967295\n", `+`, got) failed = true } if got := add_4294967295_uint32_ssa(1); got != 0 { fmt.Printf("add_uint32 4294967295%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint32_4294967295_ssa(1); got != 0 { fmt.Printf("add_uint32 1%s4294967295 = %d, wanted 0\n", `+`, got) failed = true } if got := add_4294967295_uint32_ssa(4294967295); got != 4294967294 { fmt.Printf("add_uint32 4294967295%s4294967295 = %d, wanted 4294967294\n", `+`, got) failed = true } if got := add_uint32_4294967295_ssa(4294967295); got != 4294967294 { fmt.Printf("add_uint32 4294967295%s4294967295 = %d, wanted 4294967294\n", `+`, got) failed = true } if got := sub_0_uint32_ssa(0); got != 0 { fmt.Printf("sub_uint32 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint32_0_ssa(0); got != 0 { fmt.Printf("sub_uint32 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_uint32_ssa(1); got != 4294967295 { fmt.Printf("sub_uint32 0%s1 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_uint32_0_ssa(1); got != 1 { fmt.Printf("sub_uint32 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_uint32_ssa(4294967295); got != 1 { fmt.Printf("sub_uint32 0%s4294967295 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint32_0_ssa(4294967295); got != 4294967295 { fmt.Printf("sub_uint32 4294967295%s0 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_1_uint32_ssa(0); got != 1 { fmt.Printf("sub_uint32 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint32_1_ssa(0); got != 4294967295 { fmt.Printf("sub_uint32 0%s1 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_1_uint32_ssa(1); got != 0 { fmt.Printf("sub_uint32 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint32_1_ssa(1); got != 0 { fmt.Printf("sub_uint32 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_uint32_ssa(4294967295); got != 2 { fmt.Printf("sub_uint32 1%s4294967295 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_uint32_1_ssa(4294967295); got != 4294967294 { fmt.Printf("sub_uint32 4294967295%s1 = %d, wanted 4294967294\n", `-`, got) failed = true } if got := sub_4294967295_uint32_ssa(0); got != 4294967295 { fmt.Printf("sub_uint32 4294967295%s0 = %d, wanted 4294967295\n", `-`, got) failed = true } if got := sub_uint32_4294967295_ssa(0); got != 1 { fmt.Printf("sub_uint32 0%s4294967295 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_4294967295_uint32_ssa(1); got != 4294967294 { fmt.Printf("sub_uint32 4294967295%s1 = %d, wanted 4294967294\n", `-`, got) failed = true } if got := sub_uint32_4294967295_ssa(1); got != 2 { fmt.Printf("sub_uint32 1%s4294967295 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_4294967295_uint32_ssa(4294967295); got != 0 { fmt.Printf("sub_uint32 4294967295%s4294967295 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint32_4294967295_ssa(4294967295); got != 0 { fmt.Printf("sub_uint32 4294967295%s4294967295 = %d, wanted 0\n", `-`, got) failed = true } if got := div_0_uint32_ssa(1); got != 0 { fmt.Printf("div_uint32 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_uint32_ssa(4294967295); got != 0 { fmt.Printf("div_uint32 0%s4294967295 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint32_1_ssa(0); got != 0 { fmt.Printf("div_uint32 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_uint32_ssa(1); got != 1 { fmt.Printf("div_uint32 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint32_1_ssa(1); got != 1 { fmt.Printf("div_uint32 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_uint32_ssa(4294967295); got != 0 { fmt.Printf("div_uint32 1%s4294967295 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint32_1_ssa(4294967295); got != 4294967295 { fmt.Printf("div_uint32 4294967295%s1 = %d, wanted 4294967295\n", `/`, got) failed = true } if got := div_uint32_4294967295_ssa(0); got != 0 { fmt.Printf("div_uint32 0%s4294967295 = %d, wanted 0\n", `/`, got) failed = true } if got := div_4294967295_uint32_ssa(1); got != 4294967295 { fmt.Printf("div_uint32 4294967295%s1 = %d, wanted 4294967295\n", `/`, got) failed = true } if got := div_uint32_4294967295_ssa(1); got != 0 { fmt.Printf("div_uint32 1%s4294967295 = %d, wanted 0\n", `/`, got) failed = true } if got := div_4294967295_uint32_ssa(4294967295); got != 1 { fmt.Printf("div_uint32 4294967295%s4294967295 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint32_4294967295_ssa(4294967295); got != 1 { fmt.Printf("div_uint32 4294967295%s4294967295 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_0_uint32_ssa(0); got != 0 { fmt.Printf("mul_uint32 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint32_0_ssa(0); got != 0 { fmt.Printf("mul_uint32 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint32_ssa(1); got != 0 { fmt.Printf("mul_uint32 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint32_0_ssa(1); got != 0 { fmt.Printf("mul_uint32 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint32_ssa(4294967295); got != 0 { fmt.Printf("mul_uint32 0%s4294967295 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint32_0_ssa(4294967295); got != 0 { fmt.Printf("mul_uint32 4294967295%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint32_ssa(0); got != 0 { fmt.Printf("mul_uint32 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint32_1_ssa(0); got != 0 { fmt.Printf("mul_uint32 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint32_ssa(1); got != 1 { fmt.Printf("mul_uint32 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint32_1_ssa(1); got != 1 { fmt.Printf("mul_uint32 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_uint32_ssa(4294967295); got != 4294967295 { fmt.Printf("mul_uint32 1%s4294967295 = %d, wanted 4294967295\n", `*`, got) failed = true } if got := mul_uint32_1_ssa(4294967295); got != 4294967295 { fmt.Printf("mul_uint32 4294967295%s1 = %d, wanted 4294967295\n", `*`, got) failed = true } if got := mul_4294967295_uint32_ssa(0); got != 0 { fmt.Printf("mul_uint32 4294967295%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint32_4294967295_ssa(0); got != 0 { fmt.Printf("mul_uint32 0%s4294967295 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_4294967295_uint32_ssa(1); got != 4294967295 { fmt.Printf("mul_uint32 4294967295%s1 = %d, wanted 4294967295\n", `*`, got) failed = true } if got := mul_uint32_4294967295_ssa(1); got != 4294967295 { fmt.Printf("mul_uint32 1%s4294967295 = %d, wanted 4294967295\n", `*`, got) failed = true } if got := mul_4294967295_uint32_ssa(4294967295); got != 1 { fmt.Printf("mul_uint32 4294967295%s4294967295 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint32_4294967295_ssa(4294967295); got != 1 { fmt.Printf("mul_uint32 4294967295%s4294967295 = %d, wanted 1\n", `*`, got) failed = true } if got := lsh_0_uint32_ssa(0); got != 0 { fmt.Printf("lsh_uint32 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint32_0_ssa(0); got != 0 { fmt.Printf("lsh_uint32 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_0_uint32_ssa(1); got != 0 { fmt.Printf("lsh_uint32 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint32_0_ssa(1); got != 1 { fmt.Printf("lsh_uint32 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_0_uint32_ssa(4294967295); got != 0 { fmt.Printf("lsh_uint32 0%s4294967295 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint32_0_ssa(4294967295); got != 4294967295 { fmt.Printf("lsh_uint32 4294967295%s0 = %d, wanted 4294967295\n", `<<`, got) failed = true } if got := lsh_1_uint32_ssa(0); got != 1 { fmt.Printf("lsh_uint32 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_uint32_1_ssa(0); got != 0 { fmt.Printf("lsh_uint32 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_1_uint32_ssa(1); got != 2 { fmt.Printf("lsh_uint32 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_uint32_1_ssa(1); got != 2 { fmt.Printf("lsh_uint32 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_1_uint32_ssa(4294967295); got != 0 { fmt.Printf("lsh_uint32 1%s4294967295 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint32_1_ssa(4294967295); got != 4294967294 { fmt.Printf("lsh_uint32 4294967295%s1 = %d, wanted 4294967294\n", `<<`, got) failed = true } if got := lsh_4294967295_uint32_ssa(0); got != 4294967295 { fmt.Printf("lsh_uint32 4294967295%s0 = %d, wanted 4294967295\n", `<<`, got) failed = true } if got := lsh_uint32_4294967295_ssa(0); got != 0 { fmt.Printf("lsh_uint32 0%s4294967295 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_4294967295_uint32_ssa(1); got != 4294967294 { fmt.Printf("lsh_uint32 4294967295%s1 = %d, wanted 4294967294\n", `<<`, got) failed = true } if got := lsh_uint32_4294967295_ssa(1); got != 0 { fmt.Printf("lsh_uint32 1%s4294967295 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_4294967295_uint32_ssa(4294967295); got != 0 { fmt.Printf("lsh_uint32 4294967295%s4294967295 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint32_4294967295_ssa(4294967295); got != 0 { fmt.Printf("lsh_uint32 4294967295%s4294967295 = %d, wanted 0\n", `<<`, got) failed = true } if got := rsh_0_uint32_ssa(0); got != 0 { fmt.Printf("rsh_uint32 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint32_0_ssa(0); got != 0 { fmt.Printf("rsh_uint32 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_0_uint32_ssa(1); got != 0 { fmt.Printf("rsh_uint32 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint32_0_ssa(1); got != 1 { fmt.Printf("rsh_uint32 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_0_uint32_ssa(4294967295); got != 0 { fmt.Printf("rsh_uint32 0%s4294967295 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint32_0_ssa(4294967295); got != 4294967295 { fmt.Printf("rsh_uint32 4294967295%s0 = %d, wanted 4294967295\n", `>>`, got) failed = true } if got := rsh_1_uint32_ssa(0); got != 1 { fmt.Printf("rsh_uint32 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_uint32_1_ssa(0); got != 0 { fmt.Printf("rsh_uint32 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint32_ssa(1); got != 0 { fmt.Printf("rsh_uint32 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint32_1_ssa(1); got != 0 { fmt.Printf("rsh_uint32 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint32_ssa(4294967295); got != 0 { fmt.Printf("rsh_uint32 1%s4294967295 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint32_1_ssa(4294967295); got != 2147483647 { fmt.Printf("rsh_uint32 4294967295%s1 = %d, wanted 2147483647\n", `>>`, got) failed = true } if got := rsh_4294967295_uint32_ssa(0); got != 4294967295 { fmt.Printf("rsh_uint32 4294967295%s0 = %d, wanted 4294967295\n", `>>`, got) failed = true } if got := rsh_uint32_4294967295_ssa(0); got != 0 { fmt.Printf("rsh_uint32 0%s4294967295 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_4294967295_uint32_ssa(1); got != 2147483647 { fmt.Printf("rsh_uint32 4294967295%s1 = %d, wanted 2147483647\n", `>>`, got) failed = true } if got := rsh_uint32_4294967295_ssa(1); got != 0 { fmt.Printf("rsh_uint32 1%s4294967295 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_4294967295_uint32_ssa(4294967295); got != 0 { fmt.Printf("rsh_uint32 4294967295%s4294967295 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint32_4294967295_ssa(4294967295); got != 0 { fmt.Printf("rsh_uint32 4294967295%s4294967295 = %d, wanted 0\n", `>>`, got) failed = true } if got := mod_0_uint32_ssa(1); got != 0 { fmt.Printf("mod_uint32 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_uint32_ssa(4294967295); got != 0 { fmt.Printf("mod_uint32 0%s4294967295 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint32_1_ssa(0); got != 0 { fmt.Printf("mod_uint32 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint32_ssa(1); got != 0 { fmt.Printf("mod_uint32 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint32_1_ssa(1); got != 0 { fmt.Printf("mod_uint32 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint32_ssa(4294967295); got != 1 { fmt.Printf("mod_uint32 1%s4294967295 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_uint32_1_ssa(4294967295); got != 0 { fmt.Printf("mod_uint32 4294967295%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint32_4294967295_ssa(0); got != 0 { fmt.Printf("mod_uint32 0%s4294967295 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_4294967295_uint32_ssa(1); got != 0 { fmt.Printf("mod_uint32 4294967295%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint32_4294967295_ssa(1); got != 1 { fmt.Printf("mod_uint32 1%s4294967295 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_4294967295_uint32_ssa(4294967295); got != 0 { fmt.Printf("mod_uint32 4294967295%s4294967295 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint32_4294967295_ssa(4294967295); got != 0 { fmt.Printf("mod_uint32 4294967295%s4294967295 = %d, wanted 0\n", `%`, got) failed = true } if got := add_Neg2147483648_int32_ssa(-2147483648); got != 0 { fmt.Printf("add_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int32_Neg2147483648_ssa(-2147483648); got != 0 { fmt.Printf("add_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg2147483648_int32_ssa(-2147483647); got != 1 { fmt.Printf("add_int32 -2147483648%s-2147483647 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int32_Neg2147483648_ssa(-2147483647); got != 1 { fmt.Printf("add_int32 -2147483647%s-2147483648 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg2147483648_int32_ssa(-1); got != 2147483647 { fmt.Printf("add_int32 -2147483648%s-1 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_int32_Neg2147483648_ssa(-1); got != 2147483647 { fmt.Printf("add_int32 -1%s-2147483648 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_Neg2147483648_int32_ssa(0); got != -2147483648 { fmt.Printf("add_int32 -2147483648%s0 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_int32_Neg2147483648_ssa(0); got != -2147483648 { fmt.Printf("add_int32 0%s-2147483648 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_Neg2147483648_int32_ssa(1); got != -2147483647 { fmt.Printf("add_int32 -2147483648%s1 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_int32_Neg2147483648_ssa(1); got != -2147483647 { fmt.Printf("add_int32 1%s-2147483648 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_Neg2147483648_int32_ssa(2147483647); got != -1 { fmt.Printf("add_int32 -2147483648%s2147483647 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int32_Neg2147483648_ssa(2147483647); got != -1 { fmt.Printf("add_int32 2147483647%s-2147483648 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg2147483647_int32_ssa(-2147483648); got != 1 { fmt.Printf("add_int32 -2147483647%s-2147483648 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int32_Neg2147483647_ssa(-2147483648); got != 1 { fmt.Printf("add_int32 -2147483648%s-2147483647 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg2147483647_int32_ssa(-2147483647); got != 2 { fmt.Printf("add_int32 -2147483647%s-2147483647 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int32_Neg2147483647_ssa(-2147483647); got != 2 { fmt.Printf("add_int32 -2147483647%s-2147483647 = %d, wanted 2\n", `+`, got) failed = true } if got := add_Neg2147483647_int32_ssa(-1); got != -2147483648 { fmt.Printf("add_int32 -2147483647%s-1 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_int32_Neg2147483647_ssa(-1); got != -2147483648 { fmt.Printf("add_int32 -1%s-2147483647 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_Neg2147483647_int32_ssa(0); got != -2147483647 { fmt.Printf("add_int32 -2147483647%s0 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_int32_Neg2147483647_ssa(0); got != -2147483647 { fmt.Printf("add_int32 0%s-2147483647 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_Neg2147483647_int32_ssa(1); got != -2147483646 { fmt.Printf("add_int32 -2147483647%s1 = %d, wanted -2147483646\n", `+`, got) failed = true } if got := add_int32_Neg2147483647_ssa(1); got != -2147483646 { fmt.Printf("add_int32 1%s-2147483647 = %d, wanted -2147483646\n", `+`, got) failed = true } if got := add_Neg2147483647_int32_ssa(2147483647); got != 0 { fmt.Printf("add_int32 -2147483647%s2147483647 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int32_Neg2147483647_ssa(2147483647); got != 0 { fmt.Printf("add_int32 2147483647%s-2147483647 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg1_int32_ssa(-2147483648); got != 2147483647 { fmt.Printf("add_int32 -1%s-2147483648 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_int32_Neg1_ssa(-2147483648); got != 2147483647 { fmt.Printf("add_int32 -2147483648%s-1 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_Neg1_int32_ssa(-2147483647); got != -2147483648 { fmt.Printf("add_int32 -1%s-2147483647 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_int32_Neg1_ssa(-2147483647); got != -2147483648 { fmt.Printf("add_int32 -2147483647%s-1 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_Neg1_int32_ssa(-1); got != -2 { fmt.Printf("add_int32 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int32_Neg1_ssa(-1); got != -2 { fmt.Printf("add_int32 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_Neg1_int32_ssa(0); got != -1 { fmt.Printf("add_int32 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int32_Neg1_ssa(0); got != -1 { fmt.Printf("add_int32 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg1_int32_ssa(1); got != 0 { fmt.Printf("add_int32 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int32_Neg1_ssa(1); got != 0 { fmt.Printf("add_int32 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg1_int32_ssa(2147483647); got != 2147483646 { fmt.Printf("add_int32 -1%s2147483647 = %d, wanted 2147483646\n", `+`, got) failed = true } if got := add_int32_Neg1_ssa(2147483647); got != 2147483646 { fmt.Printf("add_int32 2147483647%s-1 = %d, wanted 2147483646\n", `+`, got) failed = true } if got := add_0_int32_ssa(-2147483648); got != -2147483648 { fmt.Printf("add_int32 0%s-2147483648 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_int32_0_ssa(-2147483648); got != -2147483648 { fmt.Printf("add_int32 -2147483648%s0 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_0_int32_ssa(-2147483647); got != -2147483647 { fmt.Printf("add_int32 0%s-2147483647 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_int32_0_ssa(-2147483647); got != -2147483647 { fmt.Printf("add_int32 -2147483647%s0 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_0_int32_ssa(-1); got != -1 { fmt.Printf("add_int32 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int32_0_ssa(-1); got != -1 { fmt.Printf("add_int32 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_0_int32_ssa(0); got != 0 { fmt.Printf("add_int32 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int32_0_ssa(0); got != 0 { fmt.Printf("add_int32 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_int32_ssa(1); got != 1 { fmt.Printf("add_int32 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int32_0_ssa(1); got != 1 { fmt.Printf("add_int32 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_int32_ssa(2147483647); got != 2147483647 { fmt.Printf("add_int32 0%s2147483647 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_int32_0_ssa(2147483647); got != 2147483647 { fmt.Printf("add_int32 2147483647%s0 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_1_int32_ssa(-2147483648); got != -2147483647 { fmt.Printf("add_int32 1%s-2147483648 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_int32_1_ssa(-2147483648); got != -2147483647 { fmt.Printf("add_int32 -2147483648%s1 = %d, wanted -2147483647\n", `+`, got) failed = true } if got := add_1_int32_ssa(-2147483647); got != -2147483646 { fmt.Printf("add_int32 1%s-2147483647 = %d, wanted -2147483646\n", `+`, got) failed = true } if got := add_int32_1_ssa(-2147483647); got != -2147483646 { fmt.Printf("add_int32 -2147483647%s1 = %d, wanted -2147483646\n", `+`, got) failed = true } if got := add_1_int32_ssa(-1); got != 0 { fmt.Printf("add_int32 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int32_1_ssa(-1); got != 0 { fmt.Printf("add_int32 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_1_int32_ssa(0); got != 1 { fmt.Printf("add_int32 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int32_1_ssa(0); got != 1 { fmt.Printf("add_int32 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_int32_ssa(1); got != 2 { fmt.Printf("add_int32 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int32_1_ssa(1); got != 2 { fmt.Printf("add_int32 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_int32_ssa(2147483647); got != -2147483648 { fmt.Printf("add_int32 1%s2147483647 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_int32_1_ssa(2147483647); got != -2147483648 { fmt.Printf("add_int32 2147483647%s1 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_2147483647_int32_ssa(-2147483648); got != -1 { fmt.Printf("add_int32 2147483647%s-2147483648 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int32_2147483647_ssa(-2147483648); got != -1 { fmt.Printf("add_int32 -2147483648%s2147483647 = %d, wanted -1\n", `+`, got) failed = true } if got := add_2147483647_int32_ssa(-2147483647); got != 0 { fmt.Printf("add_int32 2147483647%s-2147483647 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int32_2147483647_ssa(-2147483647); got != 0 { fmt.Printf("add_int32 -2147483647%s2147483647 = %d, wanted 0\n", `+`, got) failed = true } if got := add_2147483647_int32_ssa(-1); got != 2147483646 { fmt.Printf("add_int32 2147483647%s-1 = %d, wanted 2147483646\n", `+`, got) failed = true } if got := add_int32_2147483647_ssa(-1); got != 2147483646 { fmt.Printf("add_int32 -1%s2147483647 = %d, wanted 2147483646\n", `+`, got) failed = true } if got := add_2147483647_int32_ssa(0); got != 2147483647 { fmt.Printf("add_int32 2147483647%s0 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_int32_2147483647_ssa(0); got != 2147483647 { fmt.Printf("add_int32 0%s2147483647 = %d, wanted 2147483647\n", `+`, got) failed = true } if got := add_2147483647_int32_ssa(1); got != -2147483648 { fmt.Printf("add_int32 2147483647%s1 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_int32_2147483647_ssa(1); got != -2147483648 { fmt.Printf("add_int32 1%s2147483647 = %d, wanted -2147483648\n", `+`, got) failed = true } if got := add_2147483647_int32_ssa(2147483647); got != -2 { fmt.Printf("add_int32 2147483647%s2147483647 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int32_2147483647_ssa(2147483647); got != -2 { fmt.Printf("add_int32 2147483647%s2147483647 = %d, wanted -2\n", `+`, got) failed = true } if got := sub_Neg2147483648_int32_ssa(-2147483648); got != 0 { fmt.Printf("sub_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int32_Neg2147483648_ssa(-2147483648); got != 0 { fmt.Printf("sub_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg2147483648_int32_ssa(-2147483647); got != -1 { fmt.Printf("sub_int32 -2147483648%s-2147483647 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int32_Neg2147483648_ssa(-2147483647); got != 1 { fmt.Printf("sub_int32 -2147483647%s-2147483648 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg2147483648_int32_ssa(-1); got != -2147483647 { fmt.Printf("sub_int32 -2147483648%s-1 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_int32_Neg2147483648_ssa(-1); got != 2147483647 { fmt.Printf("sub_int32 -1%s-2147483648 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_Neg2147483648_int32_ssa(0); got != -2147483648 { fmt.Printf("sub_int32 -2147483648%s0 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_int32_Neg2147483648_ssa(0); got != -2147483648 { fmt.Printf("sub_int32 0%s-2147483648 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_Neg2147483648_int32_ssa(1); got != 2147483647 { fmt.Printf("sub_int32 -2147483648%s1 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_int32_Neg2147483648_ssa(1); got != -2147483647 { fmt.Printf("sub_int32 1%s-2147483648 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_Neg2147483648_int32_ssa(2147483647); got != 1 { fmt.Printf("sub_int32 -2147483648%s2147483647 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int32_Neg2147483648_ssa(2147483647); got != -1 { fmt.Printf("sub_int32 2147483647%s-2147483648 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg2147483647_int32_ssa(-2147483648); got != 1 { fmt.Printf("sub_int32 -2147483647%s-2147483648 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int32_Neg2147483647_ssa(-2147483648); got != -1 { fmt.Printf("sub_int32 -2147483648%s-2147483647 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg2147483647_int32_ssa(-2147483647); got != 0 { fmt.Printf("sub_int32 -2147483647%s-2147483647 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int32_Neg2147483647_ssa(-2147483647); got != 0 { fmt.Printf("sub_int32 -2147483647%s-2147483647 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg2147483647_int32_ssa(-1); got != -2147483646 { fmt.Printf("sub_int32 -2147483647%s-1 = %d, wanted -2147483646\n", `-`, got) failed = true } if got := sub_int32_Neg2147483647_ssa(-1); got != 2147483646 { fmt.Printf("sub_int32 -1%s-2147483647 = %d, wanted 2147483646\n", `-`, got) failed = true } if got := sub_Neg2147483647_int32_ssa(0); got != -2147483647 { fmt.Printf("sub_int32 -2147483647%s0 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_int32_Neg2147483647_ssa(0); got != 2147483647 { fmt.Printf("sub_int32 0%s-2147483647 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_Neg2147483647_int32_ssa(1); got != -2147483648 { fmt.Printf("sub_int32 -2147483647%s1 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_int32_Neg2147483647_ssa(1); got != -2147483648 { fmt.Printf("sub_int32 1%s-2147483647 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_Neg2147483647_int32_ssa(2147483647); got != 2 { fmt.Printf("sub_int32 -2147483647%s2147483647 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int32_Neg2147483647_ssa(2147483647); got != -2 { fmt.Printf("sub_int32 2147483647%s-2147483647 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_Neg1_int32_ssa(-2147483648); got != 2147483647 { fmt.Printf("sub_int32 -1%s-2147483648 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_int32_Neg1_ssa(-2147483648); got != -2147483647 { fmt.Printf("sub_int32 -2147483648%s-1 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_Neg1_int32_ssa(-2147483647); got != 2147483646 { fmt.Printf("sub_int32 -1%s-2147483647 = %d, wanted 2147483646\n", `-`, got) failed = true } if got := sub_int32_Neg1_ssa(-2147483647); got != -2147483646 { fmt.Printf("sub_int32 -2147483647%s-1 = %d, wanted -2147483646\n", `-`, got) failed = true } if got := sub_Neg1_int32_ssa(-1); got != 0 { fmt.Printf("sub_int32 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int32_Neg1_ssa(-1); got != 0 { fmt.Printf("sub_int32 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg1_int32_ssa(0); got != -1 { fmt.Printf("sub_int32 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int32_Neg1_ssa(0); got != 1 { fmt.Printf("sub_int32 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg1_int32_ssa(1); got != -2 { fmt.Printf("sub_int32 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int32_Neg1_ssa(1); got != 2 { fmt.Printf("sub_int32 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_Neg1_int32_ssa(2147483647); got != -2147483648 { fmt.Printf("sub_int32 -1%s2147483647 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_int32_Neg1_ssa(2147483647); got != -2147483648 { fmt.Printf("sub_int32 2147483647%s-1 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_0_int32_ssa(-2147483648); got != -2147483648 { fmt.Printf("sub_int32 0%s-2147483648 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_int32_0_ssa(-2147483648); got != -2147483648 { fmt.Printf("sub_int32 -2147483648%s0 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_0_int32_ssa(-2147483647); got != 2147483647 { fmt.Printf("sub_int32 0%s-2147483647 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_int32_0_ssa(-2147483647); got != -2147483647 { fmt.Printf("sub_int32 -2147483647%s0 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_0_int32_ssa(-1); got != 1 { fmt.Printf("sub_int32 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int32_0_ssa(-1); got != -1 { fmt.Printf("sub_int32 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_0_int32_ssa(0); got != 0 { fmt.Printf("sub_int32 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int32_0_ssa(0); got != 0 { fmt.Printf("sub_int32 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_int32_ssa(1); got != -1 { fmt.Printf("sub_int32 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int32_0_ssa(1); got != 1 { fmt.Printf("sub_int32 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_int32_ssa(2147483647); got != -2147483647 { fmt.Printf("sub_int32 0%s2147483647 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_int32_0_ssa(2147483647); got != 2147483647 { fmt.Printf("sub_int32 2147483647%s0 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_1_int32_ssa(-2147483648); got != -2147483647 { fmt.Printf("sub_int32 1%s-2147483648 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_int32_1_ssa(-2147483648); got != 2147483647 { fmt.Printf("sub_int32 -2147483648%s1 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_1_int32_ssa(-2147483647); got != -2147483648 { fmt.Printf("sub_int32 1%s-2147483647 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_int32_1_ssa(-2147483647); got != -2147483648 { fmt.Printf("sub_int32 -2147483647%s1 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_1_int32_ssa(-1); got != 2 { fmt.Printf("sub_int32 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int32_1_ssa(-1); got != -2 { fmt.Printf("sub_int32 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_1_int32_ssa(0); got != 1 { fmt.Printf("sub_int32 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int32_1_ssa(0); got != -1 { fmt.Printf("sub_int32 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_1_int32_ssa(1); got != 0 { fmt.Printf("sub_int32 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int32_1_ssa(1); got != 0 { fmt.Printf("sub_int32 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_int32_ssa(2147483647); got != -2147483646 { fmt.Printf("sub_int32 1%s2147483647 = %d, wanted -2147483646\n", `-`, got) failed = true } if got := sub_int32_1_ssa(2147483647); got != 2147483646 { fmt.Printf("sub_int32 2147483647%s1 = %d, wanted 2147483646\n", `-`, got) failed = true } if got := sub_2147483647_int32_ssa(-2147483648); got != -1 { fmt.Printf("sub_int32 2147483647%s-2147483648 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int32_2147483647_ssa(-2147483648); got != 1 { fmt.Printf("sub_int32 -2147483648%s2147483647 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_2147483647_int32_ssa(-2147483647); got != -2 { fmt.Printf("sub_int32 2147483647%s-2147483647 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int32_2147483647_ssa(-2147483647); got != 2 { fmt.Printf("sub_int32 -2147483647%s2147483647 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_2147483647_int32_ssa(-1); got != -2147483648 { fmt.Printf("sub_int32 2147483647%s-1 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_int32_2147483647_ssa(-1); got != -2147483648 { fmt.Printf("sub_int32 -1%s2147483647 = %d, wanted -2147483648\n", `-`, got) failed = true } if got := sub_2147483647_int32_ssa(0); got != 2147483647 { fmt.Printf("sub_int32 2147483647%s0 = %d, wanted 2147483647\n", `-`, got) failed = true } if got := sub_int32_2147483647_ssa(0); got != -2147483647 { fmt.Printf("sub_int32 0%s2147483647 = %d, wanted -2147483647\n", `-`, got) failed = true } if got := sub_2147483647_int32_ssa(1); got != 2147483646 { fmt.Printf("sub_int32 2147483647%s1 = %d, wanted 2147483646\n", `-`, got) failed = true } if got := sub_int32_2147483647_ssa(1); got != -2147483646 { fmt.Printf("sub_int32 1%s2147483647 = %d, wanted -2147483646\n", `-`, got) failed = true } if got := sub_2147483647_int32_ssa(2147483647); got != 0 { fmt.Printf("sub_int32 2147483647%s2147483647 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int32_2147483647_ssa(2147483647); got != 0 { fmt.Printf("sub_int32 2147483647%s2147483647 = %d, wanted 0\n", `-`, got) failed = true } if got := div_Neg2147483648_int32_ssa(-2147483648); got != 1 { fmt.Printf("div_int32 -2147483648%s-2147483648 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int32_Neg2147483648_ssa(-2147483648); got != 1 { fmt.Printf("div_int32 -2147483648%s-2147483648 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg2147483648_int32_ssa(-2147483647); got != 1 { fmt.Printf("div_int32 -2147483648%s-2147483647 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int32_Neg2147483648_ssa(-2147483647); got != 0 { fmt.Printf("div_int32 -2147483647%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg2147483648_int32_ssa(-1); got != -2147483648 { fmt.Printf("div_int32 -2147483648%s-1 = %d, wanted -2147483648\n", `/`, got) failed = true } if got := div_int32_Neg2147483648_ssa(-1); got != 0 { fmt.Printf("div_int32 -1%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_Neg2147483648_ssa(0); got != 0 { fmt.Printf("div_int32 0%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg2147483648_int32_ssa(1); got != -2147483648 { fmt.Printf("div_int32 -2147483648%s1 = %d, wanted -2147483648\n", `/`, got) failed = true } if got := div_int32_Neg2147483648_ssa(1); got != 0 { fmt.Printf("div_int32 1%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg2147483648_int32_ssa(2147483647); got != -1 { fmt.Printf("div_int32 -2147483648%s2147483647 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int32_Neg2147483648_ssa(2147483647); got != 0 { fmt.Printf("div_int32 2147483647%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg2147483647_int32_ssa(-2147483648); got != 0 { fmt.Printf("div_int32 -2147483647%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_Neg2147483647_ssa(-2147483648); got != 1 { fmt.Printf("div_int32 -2147483648%s-2147483647 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg2147483647_int32_ssa(-2147483647); got != 1 { fmt.Printf("div_int32 -2147483647%s-2147483647 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int32_Neg2147483647_ssa(-2147483647); got != 1 { fmt.Printf("div_int32 -2147483647%s-2147483647 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg2147483647_int32_ssa(-1); got != 2147483647 { fmt.Printf("div_int32 -2147483647%s-1 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_int32_Neg2147483647_ssa(-1); got != 0 { fmt.Printf("div_int32 -1%s-2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_Neg2147483647_ssa(0); got != 0 { fmt.Printf("div_int32 0%s-2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg2147483647_int32_ssa(1); got != -2147483647 { fmt.Printf("div_int32 -2147483647%s1 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_int32_Neg2147483647_ssa(1); got != 0 { fmt.Printf("div_int32 1%s-2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg2147483647_int32_ssa(2147483647); got != -1 { fmt.Printf("div_int32 -2147483647%s2147483647 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int32_Neg2147483647_ssa(2147483647); got != -1 { fmt.Printf("div_int32 2147483647%s-2147483647 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg1_int32_ssa(-2147483648); got != 0 { fmt.Printf("div_int32 -1%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_Neg1_ssa(-2147483648); got != -2147483648 { fmt.Printf("div_int32 -2147483648%s-1 = %d, wanted -2147483648\n", `/`, got) failed = true } if got := div_Neg1_int32_ssa(-2147483647); got != 0 { fmt.Printf("div_int32 -1%s-2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_Neg1_ssa(-2147483647); got != 2147483647 { fmt.Printf("div_int32 -2147483647%s-1 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_Neg1_int32_ssa(-1); got != 1 { fmt.Printf("div_int32 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int32_Neg1_ssa(-1); got != 1 { fmt.Printf("div_int32 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int32_Neg1_ssa(0); got != 0 { fmt.Printf("div_int32 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg1_int32_ssa(1); got != -1 { fmt.Printf("div_int32 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int32_Neg1_ssa(1); got != -1 { fmt.Printf("div_int32 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg1_int32_ssa(2147483647); got != 0 { fmt.Printf("div_int32 -1%s2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_Neg1_ssa(2147483647); got != -2147483647 { fmt.Printf("div_int32 2147483647%s-1 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_0_int32_ssa(-2147483648); got != 0 { fmt.Printf("div_int32 0%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int32_ssa(-2147483647); got != 0 { fmt.Printf("div_int32 0%s-2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int32_ssa(-1); got != 0 { fmt.Printf("div_int32 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int32_ssa(1); got != 0 { fmt.Printf("div_int32 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int32_ssa(2147483647); got != 0 { fmt.Printf("div_int32 0%s2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int32_ssa(-2147483648); got != 0 { fmt.Printf("div_int32 1%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_1_ssa(-2147483648); got != -2147483648 { fmt.Printf("div_int32 -2147483648%s1 = %d, wanted -2147483648\n", `/`, got) failed = true } if got := div_1_int32_ssa(-2147483647); got != 0 { fmt.Printf("div_int32 1%s-2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_1_ssa(-2147483647); got != -2147483647 { fmt.Printf("div_int32 -2147483647%s1 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_1_int32_ssa(-1); got != -1 { fmt.Printf("div_int32 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int32_1_ssa(-1); got != -1 { fmt.Printf("div_int32 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int32_1_ssa(0); got != 0 { fmt.Printf("div_int32 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int32_ssa(1); got != 1 { fmt.Printf("div_int32 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int32_1_ssa(1); got != 1 { fmt.Printf("div_int32 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_int32_ssa(2147483647); got != 0 { fmt.Printf("div_int32 1%s2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_1_ssa(2147483647); got != 2147483647 { fmt.Printf("div_int32 2147483647%s1 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_2147483647_int32_ssa(-2147483648); got != 0 { fmt.Printf("div_int32 2147483647%s-2147483648 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_2147483647_ssa(-2147483648); got != -1 { fmt.Printf("div_int32 -2147483648%s2147483647 = %d, wanted -1\n", `/`, got) failed = true } if got := div_2147483647_int32_ssa(-2147483647); got != -1 { fmt.Printf("div_int32 2147483647%s-2147483647 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int32_2147483647_ssa(-2147483647); got != -1 { fmt.Printf("div_int32 -2147483647%s2147483647 = %d, wanted -1\n", `/`, got) failed = true } if got := div_2147483647_int32_ssa(-1); got != -2147483647 { fmt.Printf("div_int32 2147483647%s-1 = %d, wanted -2147483647\n", `/`, got) failed = true } if got := div_int32_2147483647_ssa(-1); got != 0 { fmt.Printf("div_int32 -1%s2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int32_2147483647_ssa(0); got != 0 { fmt.Printf("div_int32 0%s2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_2147483647_int32_ssa(1); got != 2147483647 { fmt.Printf("div_int32 2147483647%s1 = %d, wanted 2147483647\n", `/`, got) failed = true } if got := div_int32_2147483647_ssa(1); got != 0 { fmt.Printf("div_int32 1%s2147483647 = %d, wanted 0\n", `/`, got) failed = true } if got := div_2147483647_int32_ssa(2147483647); got != 1 { fmt.Printf("div_int32 2147483647%s2147483647 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int32_2147483647_ssa(2147483647); got != 1 { fmt.Printf("div_int32 2147483647%s2147483647 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_Neg2147483648_int32_ssa(-2147483648); got != 0 { fmt.Printf("mul_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_Neg2147483648_ssa(-2147483648); got != 0 { fmt.Printf("mul_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg2147483648_int32_ssa(-2147483647); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s-2147483647 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_Neg2147483648_ssa(-2147483647); got != -2147483648 { fmt.Printf("mul_int32 -2147483647%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_Neg2147483648_int32_ssa(-1); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s-1 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_Neg2147483648_ssa(-1); got != -2147483648 { fmt.Printf("mul_int32 -1%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_Neg2147483648_int32_ssa(0); got != 0 { fmt.Printf("mul_int32 -2147483648%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_Neg2147483648_ssa(0); got != 0 { fmt.Printf("mul_int32 0%s-2147483648 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg2147483648_int32_ssa(1); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s1 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_Neg2147483648_ssa(1); got != -2147483648 { fmt.Printf("mul_int32 1%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_Neg2147483648_int32_ssa(2147483647); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s2147483647 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_Neg2147483648_ssa(2147483647); got != -2147483648 { fmt.Printf("mul_int32 2147483647%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_Neg2147483647_int32_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 -2147483647%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_Neg2147483647_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s-2147483647 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_Neg2147483647_int32_ssa(-2147483647); got != 1 { fmt.Printf("mul_int32 -2147483647%s-2147483647 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int32_Neg2147483647_ssa(-2147483647); got != 1 { fmt.Printf("mul_int32 -2147483647%s-2147483647 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg2147483647_int32_ssa(-1); got != 2147483647 { fmt.Printf("mul_int32 -2147483647%s-1 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_int32_Neg2147483647_ssa(-1); got != 2147483647 { fmt.Printf("mul_int32 -1%s-2147483647 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_Neg2147483647_int32_ssa(0); got != 0 { fmt.Printf("mul_int32 -2147483647%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_Neg2147483647_ssa(0); got != 0 { fmt.Printf("mul_int32 0%s-2147483647 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg2147483647_int32_ssa(1); got != -2147483647 { fmt.Printf("mul_int32 -2147483647%s1 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_int32_Neg2147483647_ssa(1); got != -2147483647 { fmt.Printf("mul_int32 1%s-2147483647 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_Neg2147483647_int32_ssa(2147483647); got != -1 { fmt.Printf("mul_int32 -2147483647%s2147483647 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int32_Neg2147483647_ssa(2147483647); got != -1 { fmt.Printf("mul_int32 2147483647%s-2147483647 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg1_int32_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 -1%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_Neg1_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s-1 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_Neg1_int32_ssa(-2147483647); got != 2147483647 { fmt.Printf("mul_int32 -1%s-2147483647 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_int32_Neg1_ssa(-2147483647); got != 2147483647 { fmt.Printf("mul_int32 -2147483647%s-1 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_Neg1_int32_ssa(-1); got != 1 { fmt.Printf("mul_int32 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int32_Neg1_ssa(-1); got != 1 { fmt.Printf("mul_int32 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg1_int32_ssa(0); got != 0 { fmt.Printf("mul_int32 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_Neg1_ssa(0); got != 0 { fmt.Printf("mul_int32 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg1_int32_ssa(1); got != -1 { fmt.Printf("mul_int32 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int32_Neg1_ssa(1); got != -1 { fmt.Printf("mul_int32 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg1_int32_ssa(2147483647); got != -2147483647 { fmt.Printf("mul_int32 -1%s2147483647 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_int32_Neg1_ssa(2147483647); got != -2147483647 { fmt.Printf("mul_int32 2147483647%s-1 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_0_int32_ssa(-2147483648); got != 0 { fmt.Printf("mul_int32 0%s-2147483648 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_0_ssa(-2147483648); got != 0 { fmt.Printf("mul_int32 -2147483648%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int32_ssa(-2147483647); got != 0 { fmt.Printf("mul_int32 0%s-2147483647 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_0_ssa(-2147483647); got != 0 { fmt.Printf("mul_int32 -2147483647%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int32_ssa(-1); got != 0 { fmt.Printf("mul_int32 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_0_ssa(-1); got != 0 { fmt.Printf("mul_int32 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int32_ssa(0); got != 0 { fmt.Printf("mul_int32 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_0_ssa(0); got != 0 { fmt.Printf("mul_int32 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int32_ssa(1); got != 0 { fmt.Printf("mul_int32 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_0_ssa(1); got != 0 { fmt.Printf("mul_int32 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int32_ssa(2147483647); got != 0 { fmt.Printf("mul_int32 0%s2147483647 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_0_ssa(2147483647); got != 0 { fmt.Printf("mul_int32 2147483647%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int32_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 1%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_1_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s1 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_1_int32_ssa(-2147483647); got != -2147483647 { fmt.Printf("mul_int32 1%s-2147483647 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_int32_1_ssa(-2147483647); got != -2147483647 { fmt.Printf("mul_int32 -2147483647%s1 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_1_int32_ssa(-1); got != -1 { fmt.Printf("mul_int32 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int32_1_ssa(-1); got != -1 { fmt.Printf("mul_int32 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_1_int32_ssa(0); got != 0 { fmt.Printf("mul_int32 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_1_ssa(0); got != 0 { fmt.Printf("mul_int32 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int32_ssa(1); got != 1 { fmt.Printf("mul_int32 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int32_1_ssa(1); got != 1 { fmt.Printf("mul_int32 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_int32_ssa(2147483647); got != 2147483647 { fmt.Printf("mul_int32 1%s2147483647 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_int32_1_ssa(2147483647); got != 2147483647 { fmt.Printf("mul_int32 2147483647%s1 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_2147483647_int32_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 2147483647%s-2147483648 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_int32_2147483647_ssa(-2147483648); got != -2147483648 { fmt.Printf("mul_int32 -2147483648%s2147483647 = %d, wanted -2147483648\n", `*`, got) failed = true } if got := mul_2147483647_int32_ssa(-2147483647); got != -1 { fmt.Printf("mul_int32 2147483647%s-2147483647 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int32_2147483647_ssa(-2147483647); got != -1 { fmt.Printf("mul_int32 -2147483647%s2147483647 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_2147483647_int32_ssa(-1); got != -2147483647 { fmt.Printf("mul_int32 2147483647%s-1 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_int32_2147483647_ssa(-1); got != -2147483647 { fmt.Printf("mul_int32 -1%s2147483647 = %d, wanted -2147483647\n", `*`, got) failed = true } if got := mul_2147483647_int32_ssa(0); got != 0 { fmt.Printf("mul_int32 2147483647%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int32_2147483647_ssa(0); got != 0 { fmt.Printf("mul_int32 0%s2147483647 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_2147483647_int32_ssa(1); got != 2147483647 { fmt.Printf("mul_int32 2147483647%s1 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_int32_2147483647_ssa(1); got != 2147483647 { fmt.Printf("mul_int32 1%s2147483647 = %d, wanted 2147483647\n", `*`, got) failed = true } if got := mul_2147483647_int32_ssa(2147483647); got != 1 { fmt.Printf("mul_int32 2147483647%s2147483647 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int32_2147483647_ssa(2147483647); got != 1 { fmt.Printf("mul_int32 2147483647%s2147483647 = %d, wanted 1\n", `*`, got) failed = true } if got := mod_Neg2147483648_int32_ssa(-2147483648); got != 0 { fmt.Printf("mod_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg2147483648_ssa(-2147483648); got != 0 { fmt.Printf("mod_int32 -2147483648%s-2147483648 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg2147483648_int32_ssa(-2147483647); got != -1 { fmt.Printf("mod_int32 -2147483648%s-2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_Neg2147483648_ssa(-2147483647); got != -2147483647 { fmt.Printf("mod_int32 -2147483647%s-2147483648 = %d, wanted -2147483647\n", `%`, got) failed = true } if got := mod_Neg2147483648_int32_ssa(-1); got != 0 { fmt.Printf("mod_int32 -2147483648%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg2147483648_ssa(-1); got != -1 { fmt.Printf("mod_int32 -1%s-2147483648 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_Neg2147483648_ssa(0); got != 0 { fmt.Printf("mod_int32 0%s-2147483648 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg2147483648_int32_ssa(1); got != 0 { fmt.Printf("mod_int32 -2147483648%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg2147483648_ssa(1); got != 1 { fmt.Printf("mod_int32 1%s-2147483648 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg2147483648_int32_ssa(2147483647); got != -1 { fmt.Printf("mod_int32 -2147483648%s2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_Neg2147483648_ssa(2147483647); got != 2147483647 { fmt.Printf("mod_int32 2147483647%s-2147483648 = %d, wanted 2147483647\n", `%`, got) failed = true } if got := mod_Neg2147483647_int32_ssa(-2147483648); got != -2147483647 { fmt.Printf("mod_int32 -2147483647%s-2147483648 = %d, wanted -2147483647\n", `%`, got) failed = true } if got := mod_int32_Neg2147483647_ssa(-2147483648); got != -1 { fmt.Printf("mod_int32 -2147483648%s-2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_Neg2147483647_int32_ssa(-2147483647); got != 0 { fmt.Printf("mod_int32 -2147483647%s-2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg2147483647_ssa(-2147483647); got != 0 { fmt.Printf("mod_int32 -2147483647%s-2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg2147483647_int32_ssa(-1); got != 0 { fmt.Printf("mod_int32 -2147483647%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg2147483647_ssa(-1); got != -1 { fmt.Printf("mod_int32 -1%s-2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_Neg2147483647_ssa(0); got != 0 { fmt.Printf("mod_int32 0%s-2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg2147483647_int32_ssa(1); got != 0 { fmt.Printf("mod_int32 -2147483647%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg2147483647_ssa(1); got != 1 { fmt.Printf("mod_int32 1%s-2147483647 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg2147483647_int32_ssa(2147483647); got != 0 { fmt.Printf("mod_int32 -2147483647%s2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg2147483647_ssa(2147483647); got != 0 { fmt.Printf("mod_int32 2147483647%s-2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int32_ssa(-2147483648); got != -1 { fmt.Printf("mod_int32 -1%s-2147483648 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_Neg1_ssa(-2147483648); got != 0 { fmt.Printf("mod_int32 -2147483648%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int32_ssa(-2147483647); got != -1 { fmt.Printf("mod_int32 -1%s-2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_Neg1_ssa(-2147483647); got != 0 { fmt.Printf("mod_int32 -2147483647%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int32_ssa(-1); got != 0 { fmt.Printf("mod_int32 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg1_ssa(-1); got != 0 { fmt.Printf("mod_int32 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg1_ssa(0); got != 0 { fmt.Printf("mod_int32 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int32_ssa(1); got != 0 { fmt.Printf("mod_int32 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_Neg1_ssa(1); got != 0 { fmt.Printf("mod_int32 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int32_ssa(2147483647); got != -1 { fmt.Printf("mod_int32 -1%s2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_Neg1_ssa(2147483647); got != 0 { fmt.Printf("mod_int32 2147483647%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int32_ssa(-2147483648); got != 0 { fmt.Printf("mod_int32 0%s-2147483648 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int32_ssa(-2147483647); got != 0 { fmt.Printf("mod_int32 0%s-2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int32_ssa(-1); got != 0 { fmt.Printf("mod_int32 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int32_ssa(1); got != 0 { fmt.Printf("mod_int32 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int32_ssa(2147483647); got != 0 { fmt.Printf("mod_int32 0%s2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int32_ssa(-2147483648); got != 1 { fmt.Printf("mod_int32 1%s-2147483648 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int32_1_ssa(-2147483648); got != 0 { fmt.Printf("mod_int32 -2147483648%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int32_ssa(-2147483647); got != 1 { fmt.Printf("mod_int32 1%s-2147483647 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int32_1_ssa(-2147483647); got != 0 { fmt.Printf("mod_int32 -2147483647%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int32_ssa(-1); got != 0 { fmt.Printf("mod_int32 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_1_ssa(-1); got != 0 { fmt.Printf("mod_int32 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_1_ssa(0); got != 0 { fmt.Printf("mod_int32 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int32_ssa(1); got != 0 { fmt.Printf("mod_int32 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_1_ssa(1); got != 0 { fmt.Printf("mod_int32 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int32_ssa(2147483647); got != 1 { fmt.Printf("mod_int32 1%s2147483647 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int32_1_ssa(2147483647); got != 0 { fmt.Printf("mod_int32 2147483647%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_2147483647_int32_ssa(-2147483648); got != 2147483647 { fmt.Printf("mod_int32 2147483647%s-2147483648 = %d, wanted 2147483647\n", `%`, got) failed = true } if got := mod_int32_2147483647_ssa(-2147483648); got != -1 { fmt.Printf("mod_int32 -2147483648%s2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_2147483647_int32_ssa(-2147483647); got != 0 { fmt.Printf("mod_int32 2147483647%s-2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_2147483647_ssa(-2147483647); got != 0 { fmt.Printf("mod_int32 -2147483647%s2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_2147483647_int32_ssa(-1); got != 0 { fmt.Printf("mod_int32 2147483647%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_2147483647_ssa(-1); got != -1 { fmt.Printf("mod_int32 -1%s2147483647 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int32_2147483647_ssa(0); got != 0 { fmt.Printf("mod_int32 0%s2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_2147483647_int32_ssa(1); got != 0 { fmt.Printf("mod_int32 2147483647%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_2147483647_ssa(1); got != 1 { fmt.Printf("mod_int32 1%s2147483647 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_2147483647_int32_ssa(2147483647); got != 0 { fmt.Printf("mod_int32 2147483647%s2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int32_2147483647_ssa(2147483647); got != 0 { fmt.Printf("mod_int32 2147483647%s2147483647 = %d, wanted 0\n", `%`, got) failed = true } if got := add_0_uint16_ssa(0); got != 0 { fmt.Printf("add_uint16 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint16_0_ssa(0); got != 0 { fmt.Printf("add_uint16 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_uint16_ssa(1); got != 1 { fmt.Printf("add_uint16 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint16_0_ssa(1); got != 1 { fmt.Printf("add_uint16 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_uint16_ssa(65535); got != 65535 { fmt.Printf("add_uint16 0%s65535 = %d, wanted 65535\n", `+`, got) failed = true } if got := add_uint16_0_ssa(65535); got != 65535 { fmt.Printf("add_uint16 65535%s0 = %d, wanted 65535\n", `+`, got) failed = true } if got := add_1_uint16_ssa(0); got != 1 { fmt.Printf("add_uint16 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint16_1_ssa(0); got != 1 { fmt.Printf("add_uint16 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_uint16_ssa(1); got != 2 { fmt.Printf("add_uint16 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_uint16_1_ssa(1); got != 2 { fmt.Printf("add_uint16 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_uint16_ssa(65535); got != 0 { fmt.Printf("add_uint16 1%s65535 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint16_1_ssa(65535); got != 0 { fmt.Printf("add_uint16 65535%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_65535_uint16_ssa(0); got != 65535 { fmt.Printf("add_uint16 65535%s0 = %d, wanted 65535\n", `+`, got) failed = true } if got := add_uint16_65535_ssa(0); got != 65535 { fmt.Printf("add_uint16 0%s65535 = %d, wanted 65535\n", `+`, got) failed = true } if got := add_65535_uint16_ssa(1); got != 0 { fmt.Printf("add_uint16 65535%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint16_65535_ssa(1); got != 0 { fmt.Printf("add_uint16 1%s65535 = %d, wanted 0\n", `+`, got) failed = true } if got := add_65535_uint16_ssa(65535); got != 65534 { fmt.Printf("add_uint16 65535%s65535 = %d, wanted 65534\n", `+`, got) failed = true } if got := add_uint16_65535_ssa(65535); got != 65534 { fmt.Printf("add_uint16 65535%s65535 = %d, wanted 65534\n", `+`, got) failed = true } if got := sub_0_uint16_ssa(0); got != 0 { fmt.Printf("sub_uint16 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint16_0_ssa(0); got != 0 { fmt.Printf("sub_uint16 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_uint16_ssa(1); got != 65535 { fmt.Printf("sub_uint16 0%s1 = %d, wanted 65535\n", `-`, got) failed = true } if got := sub_uint16_0_ssa(1); got != 1 { fmt.Printf("sub_uint16 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_uint16_ssa(65535); got != 1 { fmt.Printf("sub_uint16 0%s65535 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint16_0_ssa(65535); got != 65535 { fmt.Printf("sub_uint16 65535%s0 = %d, wanted 65535\n", `-`, got) failed = true } if got := sub_1_uint16_ssa(0); got != 1 { fmt.Printf("sub_uint16 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint16_1_ssa(0); got != 65535 { fmt.Printf("sub_uint16 0%s1 = %d, wanted 65535\n", `-`, got) failed = true } if got := sub_1_uint16_ssa(1); got != 0 { fmt.Printf("sub_uint16 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint16_1_ssa(1); got != 0 { fmt.Printf("sub_uint16 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_uint16_ssa(65535); got != 2 { fmt.Printf("sub_uint16 1%s65535 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_uint16_1_ssa(65535); got != 65534 { fmt.Printf("sub_uint16 65535%s1 = %d, wanted 65534\n", `-`, got) failed = true } if got := sub_65535_uint16_ssa(0); got != 65535 { fmt.Printf("sub_uint16 65535%s0 = %d, wanted 65535\n", `-`, got) failed = true } if got := sub_uint16_65535_ssa(0); got != 1 { fmt.Printf("sub_uint16 0%s65535 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_65535_uint16_ssa(1); got != 65534 { fmt.Printf("sub_uint16 65535%s1 = %d, wanted 65534\n", `-`, got) failed = true } if got := sub_uint16_65535_ssa(1); got != 2 { fmt.Printf("sub_uint16 1%s65535 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_65535_uint16_ssa(65535); got != 0 { fmt.Printf("sub_uint16 65535%s65535 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint16_65535_ssa(65535); got != 0 { fmt.Printf("sub_uint16 65535%s65535 = %d, wanted 0\n", `-`, got) failed = true } if got := div_0_uint16_ssa(1); got != 0 { fmt.Printf("div_uint16 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_uint16_ssa(65535); got != 0 { fmt.Printf("div_uint16 0%s65535 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint16_1_ssa(0); got != 0 { fmt.Printf("div_uint16 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_uint16_ssa(1); got != 1 { fmt.Printf("div_uint16 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint16_1_ssa(1); got != 1 { fmt.Printf("div_uint16 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_uint16_ssa(65535); got != 0 { fmt.Printf("div_uint16 1%s65535 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint16_1_ssa(65535); got != 65535 { fmt.Printf("div_uint16 65535%s1 = %d, wanted 65535\n", `/`, got) failed = true } if got := div_uint16_65535_ssa(0); got != 0 { fmt.Printf("div_uint16 0%s65535 = %d, wanted 0\n", `/`, got) failed = true } if got := div_65535_uint16_ssa(1); got != 65535 { fmt.Printf("div_uint16 65535%s1 = %d, wanted 65535\n", `/`, got) failed = true } if got := div_uint16_65535_ssa(1); got != 0 { fmt.Printf("div_uint16 1%s65535 = %d, wanted 0\n", `/`, got) failed = true } if got := div_65535_uint16_ssa(65535); got != 1 { fmt.Printf("div_uint16 65535%s65535 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint16_65535_ssa(65535); got != 1 { fmt.Printf("div_uint16 65535%s65535 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_0_uint16_ssa(0); got != 0 { fmt.Printf("mul_uint16 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint16_0_ssa(0); got != 0 { fmt.Printf("mul_uint16 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint16_ssa(1); got != 0 { fmt.Printf("mul_uint16 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint16_0_ssa(1); got != 0 { fmt.Printf("mul_uint16 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint16_ssa(65535); got != 0 { fmt.Printf("mul_uint16 0%s65535 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint16_0_ssa(65535); got != 0 { fmt.Printf("mul_uint16 65535%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint16_ssa(0); got != 0 { fmt.Printf("mul_uint16 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint16_1_ssa(0); got != 0 { fmt.Printf("mul_uint16 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint16_ssa(1); got != 1 { fmt.Printf("mul_uint16 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint16_1_ssa(1); got != 1 { fmt.Printf("mul_uint16 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_uint16_ssa(65535); got != 65535 { fmt.Printf("mul_uint16 1%s65535 = %d, wanted 65535\n", `*`, got) failed = true } if got := mul_uint16_1_ssa(65535); got != 65535 { fmt.Printf("mul_uint16 65535%s1 = %d, wanted 65535\n", `*`, got) failed = true } if got := mul_65535_uint16_ssa(0); got != 0 { fmt.Printf("mul_uint16 65535%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint16_65535_ssa(0); got != 0 { fmt.Printf("mul_uint16 0%s65535 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_65535_uint16_ssa(1); got != 65535 { fmt.Printf("mul_uint16 65535%s1 = %d, wanted 65535\n", `*`, got) failed = true } if got := mul_uint16_65535_ssa(1); got != 65535 { fmt.Printf("mul_uint16 1%s65535 = %d, wanted 65535\n", `*`, got) failed = true } if got := mul_65535_uint16_ssa(65535); got != 1 { fmt.Printf("mul_uint16 65535%s65535 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint16_65535_ssa(65535); got != 1 { fmt.Printf("mul_uint16 65535%s65535 = %d, wanted 1\n", `*`, got) failed = true } if got := lsh_0_uint16_ssa(0); got != 0 { fmt.Printf("lsh_uint16 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint16_0_ssa(0); got != 0 { fmt.Printf("lsh_uint16 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_0_uint16_ssa(1); got != 0 { fmt.Printf("lsh_uint16 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint16_0_ssa(1); got != 1 { fmt.Printf("lsh_uint16 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_0_uint16_ssa(65535); got != 0 { fmt.Printf("lsh_uint16 0%s65535 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint16_0_ssa(65535); got != 65535 { fmt.Printf("lsh_uint16 65535%s0 = %d, wanted 65535\n", `<<`, got) failed = true } if got := lsh_1_uint16_ssa(0); got != 1 { fmt.Printf("lsh_uint16 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_uint16_1_ssa(0); got != 0 { fmt.Printf("lsh_uint16 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_1_uint16_ssa(1); got != 2 { fmt.Printf("lsh_uint16 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_uint16_1_ssa(1); got != 2 { fmt.Printf("lsh_uint16 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_1_uint16_ssa(65535); got != 0 { fmt.Printf("lsh_uint16 1%s65535 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint16_1_ssa(65535); got != 65534 { fmt.Printf("lsh_uint16 65535%s1 = %d, wanted 65534\n", `<<`, got) failed = true } if got := lsh_65535_uint16_ssa(0); got != 65535 { fmt.Printf("lsh_uint16 65535%s0 = %d, wanted 65535\n", `<<`, got) failed = true } if got := lsh_uint16_65535_ssa(0); got != 0 { fmt.Printf("lsh_uint16 0%s65535 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_65535_uint16_ssa(1); got != 65534 { fmt.Printf("lsh_uint16 65535%s1 = %d, wanted 65534\n", `<<`, got) failed = true } if got := lsh_uint16_65535_ssa(1); got != 0 { fmt.Printf("lsh_uint16 1%s65535 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_65535_uint16_ssa(65535); got != 0 { fmt.Printf("lsh_uint16 65535%s65535 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint16_65535_ssa(65535); got != 0 { fmt.Printf("lsh_uint16 65535%s65535 = %d, wanted 0\n", `<<`, got) failed = true } if got := rsh_0_uint16_ssa(0); got != 0 { fmt.Printf("rsh_uint16 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint16_0_ssa(0); got != 0 { fmt.Printf("rsh_uint16 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_0_uint16_ssa(1); got != 0 { fmt.Printf("rsh_uint16 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint16_0_ssa(1); got != 1 { fmt.Printf("rsh_uint16 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_0_uint16_ssa(65535); got != 0 { fmt.Printf("rsh_uint16 0%s65535 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint16_0_ssa(65535); got != 65535 { fmt.Printf("rsh_uint16 65535%s0 = %d, wanted 65535\n", `>>`, got) failed = true } if got := rsh_1_uint16_ssa(0); got != 1 { fmt.Printf("rsh_uint16 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_uint16_1_ssa(0); got != 0 { fmt.Printf("rsh_uint16 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint16_ssa(1); got != 0 { fmt.Printf("rsh_uint16 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint16_1_ssa(1); got != 0 { fmt.Printf("rsh_uint16 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint16_ssa(65535); got != 0 { fmt.Printf("rsh_uint16 1%s65535 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint16_1_ssa(65535); got != 32767 { fmt.Printf("rsh_uint16 65535%s1 = %d, wanted 32767\n", `>>`, got) failed = true } if got := rsh_65535_uint16_ssa(0); got != 65535 { fmt.Printf("rsh_uint16 65535%s0 = %d, wanted 65535\n", `>>`, got) failed = true } if got := rsh_uint16_65535_ssa(0); got != 0 { fmt.Printf("rsh_uint16 0%s65535 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_65535_uint16_ssa(1); got != 32767 { fmt.Printf("rsh_uint16 65535%s1 = %d, wanted 32767\n", `>>`, got) failed = true } if got := rsh_uint16_65535_ssa(1); got != 0 { fmt.Printf("rsh_uint16 1%s65535 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_65535_uint16_ssa(65535); got != 0 { fmt.Printf("rsh_uint16 65535%s65535 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint16_65535_ssa(65535); got != 0 { fmt.Printf("rsh_uint16 65535%s65535 = %d, wanted 0\n", `>>`, got) failed = true } if got := mod_0_uint16_ssa(1); got != 0 { fmt.Printf("mod_uint16 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_uint16_ssa(65535); got != 0 { fmt.Printf("mod_uint16 0%s65535 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint16_1_ssa(0); got != 0 { fmt.Printf("mod_uint16 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint16_ssa(1); got != 0 { fmt.Printf("mod_uint16 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint16_1_ssa(1); got != 0 { fmt.Printf("mod_uint16 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint16_ssa(65535); got != 1 { fmt.Printf("mod_uint16 1%s65535 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_uint16_1_ssa(65535); got != 0 { fmt.Printf("mod_uint16 65535%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint16_65535_ssa(0); got != 0 { fmt.Printf("mod_uint16 0%s65535 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_65535_uint16_ssa(1); got != 0 { fmt.Printf("mod_uint16 65535%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint16_65535_ssa(1); got != 1 { fmt.Printf("mod_uint16 1%s65535 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_65535_uint16_ssa(65535); got != 0 { fmt.Printf("mod_uint16 65535%s65535 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint16_65535_ssa(65535); got != 0 { fmt.Printf("mod_uint16 65535%s65535 = %d, wanted 0\n", `%`, got) failed = true } if got := add_Neg32768_int16_ssa(-32768); got != 0 { fmt.Printf("add_int16 -32768%s-32768 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int16_Neg32768_ssa(-32768); got != 0 { fmt.Printf("add_int16 -32768%s-32768 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg32768_int16_ssa(-32767); got != 1 { fmt.Printf("add_int16 -32768%s-32767 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int16_Neg32768_ssa(-32767); got != 1 { fmt.Printf("add_int16 -32767%s-32768 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg32768_int16_ssa(-1); got != 32767 { fmt.Printf("add_int16 -32768%s-1 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_int16_Neg32768_ssa(-1); got != 32767 { fmt.Printf("add_int16 -1%s-32768 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_Neg32768_int16_ssa(0); got != -32768 { fmt.Printf("add_int16 -32768%s0 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_int16_Neg32768_ssa(0); got != -32768 { fmt.Printf("add_int16 0%s-32768 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_Neg32768_int16_ssa(1); got != -32767 { fmt.Printf("add_int16 -32768%s1 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_int16_Neg32768_ssa(1); got != -32767 { fmt.Printf("add_int16 1%s-32768 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_Neg32768_int16_ssa(32766); got != -2 { fmt.Printf("add_int16 -32768%s32766 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int16_Neg32768_ssa(32766); got != -2 { fmt.Printf("add_int16 32766%s-32768 = %d, wanted -2\n", `+`, got) failed = true } if got := add_Neg32768_int16_ssa(32767); got != -1 { fmt.Printf("add_int16 -32768%s32767 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int16_Neg32768_ssa(32767); got != -1 { fmt.Printf("add_int16 32767%s-32768 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg32767_int16_ssa(-32768); got != 1 { fmt.Printf("add_int16 -32767%s-32768 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int16_Neg32767_ssa(-32768); got != 1 { fmt.Printf("add_int16 -32768%s-32767 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg32767_int16_ssa(-32767); got != 2 { fmt.Printf("add_int16 -32767%s-32767 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int16_Neg32767_ssa(-32767); got != 2 { fmt.Printf("add_int16 -32767%s-32767 = %d, wanted 2\n", `+`, got) failed = true } if got := add_Neg32767_int16_ssa(-1); got != -32768 { fmt.Printf("add_int16 -32767%s-1 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_int16_Neg32767_ssa(-1); got != -32768 { fmt.Printf("add_int16 -1%s-32767 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_Neg32767_int16_ssa(0); got != -32767 { fmt.Printf("add_int16 -32767%s0 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_int16_Neg32767_ssa(0); got != -32767 { fmt.Printf("add_int16 0%s-32767 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_Neg32767_int16_ssa(1); got != -32766 { fmt.Printf("add_int16 -32767%s1 = %d, wanted -32766\n", `+`, got) failed = true } if got := add_int16_Neg32767_ssa(1); got != -32766 { fmt.Printf("add_int16 1%s-32767 = %d, wanted -32766\n", `+`, got) failed = true } if got := add_Neg32767_int16_ssa(32766); got != -1 { fmt.Printf("add_int16 -32767%s32766 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int16_Neg32767_ssa(32766); got != -1 { fmt.Printf("add_int16 32766%s-32767 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg32767_int16_ssa(32767); got != 0 { fmt.Printf("add_int16 -32767%s32767 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int16_Neg32767_ssa(32767); got != 0 { fmt.Printf("add_int16 32767%s-32767 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg1_int16_ssa(-32768); got != 32767 { fmt.Printf("add_int16 -1%s-32768 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_int16_Neg1_ssa(-32768); got != 32767 { fmt.Printf("add_int16 -32768%s-1 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_Neg1_int16_ssa(-32767); got != -32768 { fmt.Printf("add_int16 -1%s-32767 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_int16_Neg1_ssa(-32767); got != -32768 { fmt.Printf("add_int16 -32767%s-1 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_Neg1_int16_ssa(-1); got != -2 { fmt.Printf("add_int16 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int16_Neg1_ssa(-1); got != -2 { fmt.Printf("add_int16 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_Neg1_int16_ssa(0); got != -1 { fmt.Printf("add_int16 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int16_Neg1_ssa(0); got != -1 { fmt.Printf("add_int16 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg1_int16_ssa(1); got != 0 { fmt.Printf("add_int16 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int16_Neg1_ssa(1); got != 0 { fmt.Printf("add_int16 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg1_int16_ssa(32766); got != 32765 { fmt.Printf("add_int16 -1%s32766 = %d, wanted 32765\n", `+`, got) failed = true } if got := add_int16_Neg1_ssa(32766); got != 32765 { fmt.Printf("add_int16 32766%s-1 = %d, wanted 32765\n", `+`, got) failed = true } if got := add_Neg1_int16_ssa(32767); got != 32766 { fmt.Printf("add_int16 -1%s32767 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_int16_Neg1_ssa(32767); got != 32766 { fmt.Printf("add_int16 32767%s-1 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_0_int16_ssa(-32768); got != -32768 { fmt.Printf("add_int16 0%s-32768 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_int16_0_ssa(-32768); got != -32768 { fmt.Printf("add_int16 -32768%s0 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_0_int16_ssa(-32767); got != -32767 { fmt.Printf("add_int16 0%s-32767 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_int16_0_ssa(-32767); got != -32767 { fmt.Printf("add_int16 -32767%s0 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_0_int16_ssa(-1); got != -1 { fmt.Printf("add_int16 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int16_0_ssa(-1); got != -1 { fmt.Printf("add_int16 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_0_int16_ssa(0); got != 0 { fmt.Printf("add_int16 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int16_0_ssa(0); got != 0 { fmt.Printf("add_int16 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_int16_ssa(1); got != 1 { fmt.Printf("add_int16 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int16_0_ssa(1); got != 1 { fmt.Printf("add_int16 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_int16_ssa(32766); got != 32766 { fmt.Printf("add_int16 0%s32766 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_int16_0_ssa(32766); got != 32766 { fmt.Printf("add_int16 32766%s0 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_0_int16_ssa(32767); got != 32767 { fmt.Printf("add_int16 0%s32767 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_int16_0_ssa(32767); got != 32767 { fmt.Printf("add_int16 32767%s0 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_1_int16_ssa(-32768); got != -32767 { fmt.Printf("add_int16 1%s-32768 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_int16_1_ssa(-32768); got != -32767 { fmt.Printf("add_int16 -32768%s1 = %d, wanted -32767\n", `+`, got) failed = true } if got := add_1_int16_ssa(-32767); got != -32766 { fmt.Printf("add_int16 1%s-32767 = %d, wanted -32766\n", `+`, got) failed = true } if got := add_int16_1_ssa(-32767); got != -32766 { fmt.Printf("add_int16 -32767%s1 = %d, wanted -32766\n", `+`, got) failed = true } if got := add_1_int16_ssa(-1); got != 0 { fmt.Printf("add_int16 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int16_1_ssa(-1); got != 0 { fmt.Printf("add_int16 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_1_int16_ssa(0); got != 1 { fmt.Printf("add_int16 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int16_1_ssa(0); got != 1 { fmt.Printf("add_int16 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_int16_ssa(1); got != 2 { fmt.Printf("add_int16 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int16_1_ssa(1); got != 2 { fmt.Printf("add_int16 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_int16_ssa(32766); got != 32767 { fmt.Printf("add_int16 1%s32766 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_int16_1_ssa(32766); got != 32767 { fmt.Printf("add_int16 32766%s1 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_1_int16_ssa(32767); got != -32768 { fmt.Printf("add_int16 1%s32767 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_int16_1_ssa(32767); got != -32768 { fmt.Printf("add_int16 32767%s1 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_32766_int16_ssa(-32768); got != -2 { fmt.Printf("add_int16 32766%s-32768 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int16_32766_ssa(-32768); got != -2 { fmt.Printf("add_int16 -32768%s32766 = %d, wanted -2\n", `+`, got) failed = true } if got := add_32766_int16_ssa(-32767); got != -1 { fmt.Printf("add_int16 32766%s-32767 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int16_32766_ssa(-32767); got != -1 { fmt.Printf("add_int16 -32767%s32766 = %d, wanted -1\n", `+`, got) failed = true } if got := add_32766_int16_ssa(-1); got != 32765 { fmt.Printf("add_int16 32766%s-1 = %d, wanted 32765\n", `+`, got) failed = true } if got := add_int16_32766_ssa(-1); got != 32765 { fmt.Printf("add_int16 -1%s32766 = %d, wanted 32765\n", `+`, got) failed = true } if got := add_32766_int16_ssa(0); got != 32766 { fmt.Printf("add_int16 32766%s0 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_int16_32766_ssa(0); got != 32766 { fmt.Printf("add_int16 0%s32766 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_32766_int16_ssa(1); got != 32767 { fmt.Printf("add_int16 32766%s1 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_int16_32766_ssa(1); got != 32767 { fmt.Printf("add_int16 1%s32766 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_32766_int16_ssa(32766); got != -4 { fmt.Printf("add_int16 32766%s32766 = %d, wanted -4\n", `+`, got) failed = true } if got := add_int16_32766_ssa(32766); got != -4 { fmt.Printf("add_int16 32766%s32766 = %d, wanted -4\n", `+`, got) failed = true } if got := add_32766_int16_ssa(32767); got != -3 { fmt.Printf("add_int16 32766%s32767 = %d, wanted -3\n", `+`, got) failed = true } if got := add_int16_32766_ssa(32767); got != -3 { fmt.Printf("add_int16 32767%s32766 = %d, wanted -3\n", `+`, got) failed = true } if got := add_32767_int16_ssa(-32768); got != -1 { fmt.Printf("add_int16 32767%s-32768 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int16_32767_ssa(-32768); got != -1 { fmt.Printf("add_int16 -32768%s32767 = %d, wanted -1\n", `+`, got) failed = true } if got := add_32767_int16_ssa(-32767); got != 0 { fmt.Printf("add_int16 32767%s-32767 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int16_32767_ssa(-32767); got != 0 { fmt.Printf("add_int16 -32767%s32767 = %d, wanted 0\n", `+`, got) failed = true } if got := add_32767_int16_ssa(-1); got != 32766 { fmt.Printf("add_int16 32767%s-1 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_int16_32767_ssa(-1); got != 32766 { fmt.Printf("add_int16 -1%s32767 = %d, wanted 32766\n", `+`, got) failed = true } if got := add_32767_int16_ssa(0); got != 32767 { fmt.Printf("add_int16 32767%s0 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_int16_32767_ssa(0); got != 32767 { fmt.Printf("add_int16 0%s32767 = %d, wanted 32767\n", `+`, got) failed = true } if got := add_32767_int16_ssa(1); got != -32768 { fmt.Printf("add_int16 32767%s1 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_int16_32767_ssa(1); got != -32768 { fmt.Printf("add_int16 1%s32767 = %d, wanted -32768\n", `+`, got) failed = true } if got := add_32767_int16_ssa(32766); got != -3 { fmt.Printf("add_int16 32767%s32766 = %d, wanted -3\n", `+`, got) failed = true } if got := add_int16_32767_ssa(32766); got != -3 { fmt.Printf("add_int16 32766%s32767 = %d, wanted -3\n", `+`, got) failed = true } if got := add_32767_int16_ssa(32767); got != -2 { fmt.Printf("add_int16 32767%s32767 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int16_32767_ssa(32767); got != -2 { fmt.Printf("add_int16 32767%s32767 = %d, wanted -2\n", `+`, got) failed = true } if got := sub_Neg32768_int16_ssa(-32768); got != 0 { fmt.Printf("sub_int16 -32768%s-32768 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int16_Neg32768_ssa(-32768); got != 0 { fmt.Printf("sub_int16 -32768%s-32768 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg32768_int16_ssa(-32767); got != -1 { fmt.Printf("sub_int16 -32768%s-32767 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int16_Neg32768_ssa(-32767); got != 1 { fmt.Printf("sub_int16 -32767%s-32768 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg32768_int16_ssa(-1); got != -32767 { fmt.Printf("sub_int16 -32768%s-1 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_int16_Neg32768_ssa(-1); got != 32767 { fmt.Printf("sub_int16 -1%s-32768 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_Neg32768_int16_ssa(0); got != -32768 { fmt.Printf("sub_int16 -32768%s0 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_int16_Neg32768_ssa(0); got != -32768 { fmt.Printf("sub_int16 0%s-32768 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_Neg32768_int16_ssa(1); got != 32767 { fmt.Printf("sub_int16 -32768%s1 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_int16_Neg32768_ssa(1); got != -32767 { fmt.Printf("sub_int16 1%s-32768 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_Neg32768_int16_ssa(32766); got != 2 { fmt.Printf("sub_int16 -32768%s32766 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int16_Neg32768_ssa(32766); got != -2 { fmt.Printf("sub_int16 32766%s-32768 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_Neg32768_int16_ssa(32767); got != 1 { fmt.Printf("sub_int16 -32768%s32767 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int16_Neg32768_ssa(32767); got != -1 { fmt.Printf("sub_int16 32767%s-32768 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg32767_int16_ssa(-32768); got != 1 { fmt.Printf("sub_int16 -32767%s-32768 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int16_Neg32767_ssa(-32768); got != -1 { fmt.Printf("sub_int16 -32768%s-32767 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg32767_int16_ssa(-32767); got != 0 { fmt.Printf("sub_int16 -32767%s-32767 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int16_Neg32767_ssa(-32767); got != 0 { fmt.Printf("sub_int16 -32767%s-32767 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg32767_int16_ssa(-1); got != -32766 { fmt.Printf("sub_int16 -32767%s-1 = %d, wanted -32766\n", `-`, got) failed = true } if got := sub_int16_Neg32767_ssa(-1); got != 32766 { fmt.Printf("sub_int16 -1%s-32767 = %d, wanted 32766\n", `-`, got) failed = true } if got := sub_Neg32767_int16_ssa(0); got != -32767 { fmt.Printf("sub_int16 -32767%s0 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_int16_Neg32767_ssa(0); got != 32767 { fmt.Printf("sub_int16 0%s-32767 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_Neg32767_int16_ssa(1); got != -32768 { fmt.Printf("sub_int16 -32767%s1 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_int16_Neg32767_ssa(1); got != -32768 { fmt.Printf("sub_int16 1%s-32767 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_Neg32767_int16_ssa(32766); got != 3 { fmt.Printf("sub_int16 -32767%s32766 = %d, wanted 3\n", `-`, got) failed = true } if got := sub_int16_Neg32767_ssa(32766); got != -3 { fmt.Printf("sub_int16 32766%s-32767 = %d, wanted -3\n", `-`, got) failed = true } if got := sub_Neg32767_int16_ssa(32767); got != 2 { fmt.Printf("sub_int16 -32767%s32767 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int16_Neg32767_ssa(32767); got != -2 { fmt.Printf("sub_int16 32767%s-32767 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_Neg1_int16_ssa(-32768); got != 32767 { fmt.Printf("sub_int16 -1%s-32768 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_int16_Neg1_ssa(-32768); got != -32767 { fmt.Printf("sub_int16 -32768%s-1 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_Neg1_int16_ssa(-32767); got != 32766 { fmt.Printf("sub_int16 -1%s-32767 = %d, wanted 32766\n", `-`, got) failed = true } if got := sub_int16_Neg1_ssa(-32767); got != -32766 { fmt.Printf("sub_int16 -32767%s-1 = %d, wanted -32766\n", `-`, got) failed = true } if got := sub_Neg1_int16_ssa(-1); got != 0 { fmt.Printf("sub_int16 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int16_Neg1_ssa(-1); got != 0 { fmt.Printf("sub_int16 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg1_int16_ssa(0); got != -1 { fmt.Printf("sub_int16 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int16_Neg1_ssa(0); got != 1 { fmt.Printf("sub_int16 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg1_int16_ssa(1); got != -2 { fmt.Printf("sub_int16 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int16_Neg1_ssa(1); got != 2 { fmt.Printf("sub_int16 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_Neg1_int16_ssa(32766); got != -32767 { fmt.Printf("sub_int16 -1%s32766 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_int16_Neg1_ssa(32766); got != 32767 { fmt.Printf("sub_int16 32766%s-1 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_Neg1_int16_ssa(32767); got != -32768 { fmt.Printf("sub_int16 -1%s32767 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_int16_Neg1_ssa(32767); got != -32768 { fmt.Printf("sub_int16 32767%s-1 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_0_int16_ssa(-32768); got != -32768 { fmt.Printf("sub_int16 0%s-32768 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_int16_0_ssa(-32768); got != -32768 { fmt.Printf("sub_int16 -32768%s0 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_0_int16_ssa(-32767); got != 32767 { fmt.Printf("sub_int16 0%s-32767 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_int16_0_ssa(-32767); got != -32767 { fmt.Printf("sub_int16 -32767%s0 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_0_int16_ssa(-1); got != 1 { fmt.Printf("sub_int16 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int16_0_ssa(-1); got != -1 { fmt.Printf("sub_int16 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_0_int16_ssa(0); got != 0 { fmt.Printf("sub_int16 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int16_0_ssa(0); got != 0 { fmt.Printf("sub_int16 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_int16_ssa(1); got != -1 { fmt.Printf("sub_int16 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int16_0_ssa(1); got != 1 { fmt.Printf("sub_int16 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_int16_ssa(32766); got != -32766 { fmt.Printf("sub_int16 0%s32766 = %d, wanted -32766\n", `-`, got) failed = true } if got := sub_int16_0_ssa(32766); got != 32766 { fmt.Printf("sub_int16 32766%s0 = %d, wanted 32766\n", `-`, got) failed = true } if got := sub_0_int16_ssa(32767); got != -32767 { fmt.Printf("sub_int16 0%s32767 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_int16_0_ssa(32767); got != 32767 { fmt.Printf("sub_int16 32767%s0 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_1_int16_ssa(-32768); got != -32767 { fmt.Printf("sub_int16 1%s-32768 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_int16_1_ssa(-32768); got != 32767 { fmt.Printf("sub_int16 -32768%s1 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_1_int16_ssa(-32767); got != -32768 { fmt.Printf("sub_int16 1%s-32767 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_int16_1_ssa(-32767); got != -32768 { fmt.Printf("sub_int16 -32767%s1 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_1_int16_ssa(-1); got != 2 { fmt.Printf("sub_int16 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int16_1_ssa(-1); got != -2 { fmt.Printf("sub_int16 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_1_int16_ssa(0); got != 1 { fmt.Printf("sub_int16 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int16_1_ssa(0); got != -1 { fmt.Printf("sub_int16 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_1_int16_ssa(1); got != 0 { fmt.Printf("sub_int16 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int16_1_ssa(1); got != 0 { fmt.Printf("sub_int16 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_int16_ssa(32766); got != -32765 { fmt.Printf("sub_int16 1%s32766 = %d, wanted -32765\n", `-`, got) failed = true } if got := sub_int16_1_ssa(32766); got != 32765 { fmt.Printf("sub_int16 32766%s1 = %d, wanted 32765\n", `-`, got) failed = true } if got := sub_1_int16_ssa(32767); got != -32766 { fmt.Printf("sub_int16 1%s32767 = %d, wanted -32766\n", `-`, got) failed = true } if got := sub_int16_1_ssa(32767); got != 32766 { fmt.Printf("sub_int16 32767%s1 = %d, wanted 32766\n", `-`, got) failed = true } if got := sub_32766_int16_ssa(-32768); got != -2 { fmt.Printf("sub_int16 32766%s-32768 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int16_32766_ssa(-32768); got != 2 { fmt.Printf("sub_int16 -32768%s32766 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_32766_int16_ssa(-32767); got != -3 { fmt.Printf("sub_int16 32766%s-32767 = %d, wanted -3\n", `-`, got) failed = true } if got := sub_int16_32766_ssa(-32767); got != 3 { fmt.Printf("sub_int16 -32767%s32766 = %d, wanted 3\n", `-`, got) failed = true } if got := sub_32766_int16_ssa(-1); got != 32767 { fmt.Printf("sub_int16 32766%s-1 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_int16_32766_ssa(-1); got != -32767 { fmt.Printf("sub_int16 -1%s32766 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_32766_int16_ssa(0); got != 32766 { fmt.Printf("sub_int16 32766%s0 = %d, wanted 32766\n", `-`, got) failed = true } if got := sub_int16_32766_ssa(0); got != -32766 { fmt.Printf("sub_int16 0%s32766 = %d, wanted -32766\n", `-`, got) failed = true } if got := sub_32766_int16_ssa(1); got != 32765 { fmt.Printf("sub_int16 32766%s1 = %d, wanted 32765\n", `-`, got) failed = true } if got := sub_int16_32766_ssa(1); got != -32765 { fmt.Printf("sub_int16 1%s32766 = %d, wanted -32765\n", `-`, got) failed = true } if got := sub_32766_int16_ssa(32766); got != 0 { fmt.Printf("sub_int16 32766%s32766 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int16_32766_ssa(32766); got != 0 { fmt.Printf("sub_int16 32766%s32766 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_32766_int16_ssa(32767); got != -1 { fmt.Printf("sub_int16 32766%s32767 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int16_32766_ssa(32767); got != 1 { fmt.Printf("sub_int16 32767%s32766 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_32767_int16_ssa(-32768); got != -1 { fmt.Printf("sub_int16 32767%s-32768 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int16_32767_ssa(-32768); got != 1 { fmt.Printf("sub_int16 -32768%s32767 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_32767_int16_ssa(-32767); got != -2 { fmt.Printf("sub_int16 32767%s-32767 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int16_32767_ssa(-32767); got != 2 { fmt.Printf("sub_int16 -32767%s32767 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_32767_int16_ssa(-1); got != -32768 { fmt.Printf("sub_int16 32767%s-1 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_int16_32767_ssa(-1); got != -32768 { fmt.Printf("sub_int16 -1%s32767 = %d, wanted -32768\n", `-`, got) failed = true } if got := sub_32767_int16_ssa(0); got != 32767 { fmt.Printf("sub_int16 32767%s0 = %d, wanted 32767\n", `-`, got) failed = true } if got := sub_int16_32767_ssa(0); got != -32767 { fmt.Printf("sub_int16 0%s32767 = %d, wanted -32767\n", `-`, got) failed = true } if got := sub_32767_int16_ssa(1); got != 32766 { fmt.Printf("sub_int16 32767%s1 = %d, wanted 32766\n", `-`, got) failed = true } if got := sub_int16_32767_ssa(1); got != -32766 { fmt.Printf("sub_int16 1%s32767 = %d, wanted -32766\n", `-`, got) failed = true } if got := sub_32767_int16_ssa(32766); got != 1 { fmt.Printf("sub_int16 32767%s32766 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int16_32767_ssa(32766); got != -1 { fmt.Printf("sub_int16 32766%s32767 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_32767_int16_ssa(32767); got != 0 { fmt.Printf("sub_int16 32767%s32767 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int16_32767_ssa(32767); got != 0 { fmt.Printf("sub_int16 32767%s32767 = %d, wanted 0\n", `-`, got) failed = true } if got := div_Neg32768_int16_ssa(-32768); got != 1 { fmt.Printf("div_int16 -32768%s-32768 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_Neg32768_ssa(-32768); got != 1 { fmt.Printf("div_int16 -32768%s-32768 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg32768_int16_ssa(-32767); got != 1 { fmt.Printf("div_int16 -32768%s-32767 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_Neg32768_ssa(-32767); got != 0 { fmt.Printf("div_int16 -32767%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32768_int16_ssa(-1); got != -32768 { fmt.Printf("div_int16 -32768%s-1 = %d, wanted -32768\n", `/`, got) failed = true } if got := div_int16_Neg32768_ssa(-1); got != 0 { fmt.Printf("div_int16 -1%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_Neg32768_ssa(0); got != 0 { fmt.Printf("div_int16 0%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32768_int16_ssa(1); got != -32768 { fmt.Printf("div_int16 -32768%s1 = %d, wanted -32768\n", `/`, got) failed = true } if got := div_int16_Neg32768_ssa(1); got != 0 { fmt.Printf("div_int16 1%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32768_int16_ssa(32766); got != -1 { fmt.Printf("div_int16 -32768%s32766 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_Neg32768_ssa(32766); got != 0 { fmt.Printf("div_int16 32766%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32768_int16_ssa(32767); got != -1 { fmt.Printf("div_int16 -32768%s32767 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_Neg32768_ssa(32767); got != 0 { fmt.Printf("div_int16 32767%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32767_int16_ssa(-32768); got != 0 { fmt.Printf("div_int16 -32767%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_Neg32767_ssa(-32768); got != 1 { fmt.Printf("div_int16 -32768%s-32767 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg32767_int16_ssa(-32767); got != 1 { fmt.Printf("div_int16 -32767%s-32767 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_Neg32767_ssa(-32767); got != 1 { fmt.Printf("div_int16 -32767%s-32767 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg32767_int16_ssa(-1); got != 32767 { fmt.Printf("div_int16 -32767%s-1 = %d, wanted 32767\n", `/`, got) failed = true } if got := div_int16_Neg32767_ssa(-1); got != 0 { fmt.Printf("div_int16 -1%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_Neg32767_ssa(0); got != 0 { fmt.Printf("div_int16 0%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32767_int16_ssa(1); got != -32767 { fmt.Printf("div_int16 -32767%s1 = %d, wanted -32767\n", `/`, got) failed = true } if got := div_int16_Neg32767_ssa(1); got != 0 { fmt.Printf("div_int16 1%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32767_int16_ssa(32766); got != -1 { fmt.Printf("div_int16 -32767%s32766 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_Neg32767_ssa(32766); got != 0 { fmt.Printf("div_int16 32766%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg32767_int16_ssa(32767); got != -1 { fmt.Printf("div_int16 -32767%s32767 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_Neg32767_ssa(32767); got != -1 { fmt.Printf("div_int16 32767%s-32767 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg1_int16_ssa(-32768); got != 0 { fmt.Printf("div_int16 -1%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_Neg1_ssa(-32768); got != -32768 { fmt.Printf("div_int16 -32768%s-1 = %d, wanted -32768\n", `/`, got) failed = true } if got := div_Neg1_int16_ssa(-32767); got != 0 { fmt.Printf("div_int16 -1%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_Neg1_ssa(-32767); got != 32767 { fmt.Printf("div_int16 -32767%s-1 = %d, wanted 32767\n", `/`, got) failed = true } if got := div_Neg1_int16_ssa(-1); got != 1 { fmt.Printf("div_int16 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_Neg1_ssa(-1); got != 1 { fmt.Printf("div_int16 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_Neg1_ssa(0); got != 0 { fmt.Printf("div_int16 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg1_int16_ssa(1); got != -1 { fmt.Printf("div_int16 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_Neg1_ssa(1); got != -1 { fmt.Printf("div_int16 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg1_int16_ssa(32766); got != 0 { fmt.Printf("div_int16 -1%s32766 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_Neg1_ssa(32766); got != -32766 { fmt.Printf("div_int16 32766%s-1 = %d, wanted -32766\n", `/`, got) failed = true } if got := div_Neg1_int16_ssa(32767); got != 0 { fmt.Printf("div_int16 -1%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_Neg1_ssa(32767); got != -32767 { fmt.Printf("div_int16 32767%s-1 = %d, wanted -32767\n", `/`, got) failed = true } if got := div_0_int16_ssa(-32768); got != 0 { fmt.Printf("div_int16 0%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int16_ssa(-32767); got != 0 { fmt.Printf("div_int16 0%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int16_ssa(-1); got != 0 { fmt.Printf("div_int16 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int16_ssa(1); got != 0 { fmt.Printf("div_int16 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int16_ssa(32766); got != 0 { fmt.Printf("div_int16 0%s32766 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int16_ssa(32767); got != 0 { fmt.Printf("div_int16 0%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int16_ssa(-32768); got != 0 { fmt.Printf("div_int16 1%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_1_ssa(-32768); got != -32768 { fmt.Printf("div_int16 -32768%s1 = %d, wanted -32768\n", `/`, got) failed = true } if got := div_1_int16_ssa(-32767); got != 0 { fmt.Printf("div_int16 1%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_1_ssa(-32767); got != -32767 { fmt.Printf("div_int16 -32767%s1 = %d, wanted -32767\n", `/`, got) failed = true } if got := div_1_int16_ssa(-1); got != -1 { fmt.Printf("div_int16 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_1_ssa(-1); got != -1 { fmt.Printf("div_int16 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_1_ssa(0); got != 0 { fmt.Printf("div_int16 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int16_ssa(1); got != 1 { fmt.Printf("div_int16 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_1_ssa(1); got != 1 { fmt.Printf("div_int16 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_int16_ssa(32766); got != 0 { fmt.Printf("div_int16 1%s32766 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_1_ssa(32766); got != 32766 { fmt.Printf("div_int16 32766%s1 = %d, wanted 32766\n", `/`, got) failed = true } if got := div_1_int16_ssa(32767); got != 0 { fmt.Printf("div_int16 1%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_1_ssa(32767); got != 32767 { fmt.Printf("div_int16 32767%s1 = %d, wanted 32767\n", `/`, got) failed = true } if got := div_32766_int16_ssa(-32768); got != 0 { fmt.Printf("div_int16 32766%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_32766_ssa(-32768); got != -1 { fmt.Printf("div_int16 -32768%s32766 = %d, wanted -1\n", `/`, got) failed = true } if got := div_32766_int16_ssa(-32767); got != 0 { fmt.Printf("div_int16 32766%s-32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_32766_ssa(-32767); got != -1 { fmt.Printf("div_int16 -32767%s32766 = %d, wanted -1\n", `/`, got) failed = true } if got := div_32766_int16_ssa(-1); got != -32766 { fmt.Printf("div_int16 32766%s-1 = %d, wanted -32766\n", `/`, got) failed = true } if got := div_int16_32766_ssa(-1); got != 0 { fmt.Printf("div_int16 -1%s32766 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_32766_ssa(0); got != 0 { fmt.Printf("div_int16 0%s32766 = %d, wanted 0\n", `/`, got) failed = true } if got := div_32766_int16_ssa(1); got != 32766 { fmt.Printf("div_int16 32766%s1 = %d, wanted 32766\n", `/`, got) failed = true } if got := div_int16_32766_ssa(1); got != 0 { fmt.Printf("div_int16 1%s32766 = %d, wanted 0\n", `/`, got) failed = true } if got := div_32766_int16_ssa(32766); got != 1 { fmt.Printf("div_int16 32766%s32766 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_32766_ssa(32766); got != 1 { fmt.Printf("div_int16 32766%s32766 = %d, wanted 1\n", `/`, got) failed = true } if got := div_32766_int16_ssa(32767); got != 0 { fmt.Printf("div_int16 32766%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_32766_ssa(32767); got != 1 { fmt.Printf("div_int16 32767%s32766 = %d, wanted 1\n", `/`, got) failed = true } if got := div_32767_int16_ssa(-32768); got != 0 { fmt.Printf("div_int16 32767%s-32768 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_32767_ssa(-32768); got != -1 { fmt.Printf("div_int16 -32768%s32767 = %d, wanted -1\n", `/`, got) failed = true } if got := div_32767_int16_ssa(-32767); got != -1 { fmt.Printf("div_int16 32767%s-32767 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int16_32767_ssa(-32767); got != -1 { fmt.Printf("div_int16 -32767%s32767 = %d, wanted -1\n", `/`, got) failed = true } if got := div_32767_int16_ssa(-1); got != -32767 { fmt.Printf("div_int16 32767%s-1 = %d, wanted -32767\n", `/`, got) failed = true } if got := div_int16_32767_ssa(-1); got != 0 { fmt.Printf("div_int16 -1%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int16_32767_ssa(0); got != 0 { fmt.Printf("div_int16 0%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_32767_int16_ssa(1); got != 32767 { fmt.Printf("div_int16 32767%s1 = %d, wanted 32767\n", `/`, got) failed = true } if got := div_int16_32767_ssa(1); got != 0 { fmt.Printf("div_int16 1%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_32767_int16_ssa(32766); got != 1 { fmt.Printf("div_int16 32767%s32766 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_32767_ssa(32766); got != 0 { fmt.Printf("div_int16 32766%s32767 = %d, wanted 0\n", `/`, got) failed = true } if got := div_32767_int16_ssa(32767); got != 1 { fmt.Printf("div_int16 32767%s32767 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int16_32767_ssa(32767); got != 1 { fmt.Printf("div_int16 32767%s32767 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_Neg32768_int16_ssa(-32768); got != 0 { fmt.Printf("mul_int16 -32768%s-32768 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_Neg32768_ssa(-32768); got != 0 { fmt.Printf("mul_int16 -32768%s-32768 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg32768_int16_ssa(-32767); got != -32768 { fmt.Printf("mul_int16 -32768%s-32767 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_Neg32768_ssa(-32767); got != -32768 { fmt.Printf("mul_int16 -32767%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_Neg32768_int16_ssa(-1); got != -32768 { fmt.Printf("mul_int16 -32768%s-1 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_Neg32768_ssa(-1); got != -32768 { fmt.Printf("mul_int16 -1%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_Neg32768_int16_ssa(0); got != 0 { fmt.Printf("mul_int16 -32768%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_Neg32768_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s-32768 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg32768_int16_ssa(1); got != -32768 { fmt.Printf("mul_int16 -32768%s1 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_Neg32768_ssa(1); got != -32768 { fmt.Printf("mul_int16 1%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_Neg32768_int16_ssa(32766); got != 0 { fmt.Printf("mul_int16 -32768%s32766 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_Neg32768_ssa(32766); got != 0 { fmt.Printf("mul_int16 32766%s-32768 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg32768_int16_ssa(32767); got != -32768 { fmt.Printf("mul_int16 -32768%s32767 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_Neg32768_ssa(32767); got != -32768 { fmt.Printf("mul_int16 32767%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_Neg32767_int16_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 -32767%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_Neg32767_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 -32768%s-32767 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_Neg32767_int16_ssa(-32767); got != 1 { fmt.Printf("mul_int16 -32767%s-32767 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int16_Neg32767_ssa(-32767); got != 1 { fmt.Printf("mul_int16 -32767%s-32767 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg32767_int16_ssa(-1); got != 32767 { fmt.Printf("mul_int16 -32767%s-1 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_int16_Neg32767_ssa(-1); got != 32767 { fmt.Printf("mul_int16 -1%s-32767 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_Neg32767_int16_ssa(0); got != 0 { fmt.Printf("mul_int16 -32767%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_Neg32767_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s-32767 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg32767_int16_ssa(1); got != -32767 { fmt.Printf("mul_int16 -32767%s1 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_int16_Neg32767_ssa(1); got != -32767 { fmt.Printf("mul_int16 1%s-32767 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_Neg32767_int16_ssa(32766); got != 32766 { fmt.Printf("mul_int16 -32767%s32766 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_int16_Neg32767_ssa(32766); got != 32766 { fmt.Printf("mul_int16 32766%s-32767 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_Neg32767_int16_ssa(32767); got != -1 { fmt.Printf("mul_int16 -32767%s32767 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int16_Neg32767_ssa(32767); got != -1 { fmt.Printf("mul_int16 32767%s-32767 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg1_int16_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 -1%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_Neg1_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 -32768%s-1 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_Neg1_int16_ssa(-32767); got != 32767 { fmt.Printf("mul_int16 -1%s-32767 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_int16_Neg1_ssa(-32767); got != 32767 { fmt.Printf("mul_int16 -32767%s-1 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_Neg1_int16_ssa(-1); got != 1 { fmt.Printf("mul_int16 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int16_Neg1_ssa(-1); got != 1 { fmt.Printf("mul_int16 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg1_int16_ssa(0); got != 0 { fmt.Printf("mul_int16 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_Neg1_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg1_int16_ssa(1); got != -1 { fmt.Printf("mul_int16 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int16_Neg1_ssa(1); got != -1 { fmt.Printf("mul_int16 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg1_int16_ssa(32766); got != -32766 { fmt.Printf("mul_int16 -1%s32766 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_int16_Neg1_ssa(32766); got != -32766 { fmt.Printf("mul_int16 32766%s-1 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_Neg1_int16_ssa(32767); got != -32767 { fmt.Printf("mul_int16 -1%s32767 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_int16_Neg1_ssa(32767); got != -32767 { fmt.Printf("mul_int16 32767%s-1 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_0_int16_ssa(-32768); got != 0 { fmt.Printf("mul_int16 0%s-32768 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_0_ssa(-32768); got != 0 { fmt.Printf("mul_int16 -32768%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int16_ssa(-32767); got != 0 { fmt.Printf("mul_int16 0%s-32767 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_0_ssa(-32767); got != 0 { fmt.Printf("mul_int16 -32767%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int16_ssa(-1); got != 0 { fmt.Printf("mul_int16 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_0_ssa(-1); got != 0 { fmt.Printf("mul_int16 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int16_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_0_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int16_ssa(1); got != 0 { fmt.Printf("mul_int16 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_0_ssa(1); got != 0 { fmt.Printf("mul_int16 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int16_ssa(32766); got != 0 { fmt.Printf("mul_int16 0%s32766 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_0_ssa(32766); got != 0 { fmt.Printf("mul_int16 32766%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int16_ssa(32767); got != 0 { fmt.Printf("mul_int16 0%s32767 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_0_ssa(32767); got != 0 { fmt.Printf("mul_int16 32767%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int16_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 1%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_1_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 -32768%s1 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_1_int16_ssa(-32767); got != -32767 { fmt.Printf("mul_int16 1%s-32767 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_int16_1_ssa(-32767); got != -32767 { fmt.Printf("mul_int16 -32767%s1 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_1_int16_ssa(-1); got != -1 { fmt.Printf("mul_int16 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int16_1_ssa(-1); got != -1 { fmt.Printf("mul_int16 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_1_int16_ssa(0); got != 0 { fmt.Printf("mul_int16 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_1_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int16_ssa(1); got != 1 { fmt.Printf("mul_int16 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int16_1_ssa(1); got != 1 { fmt.Printf("mul_int16 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_int16_ssa(32766); got != 32766 { fmt.Printf("mul_int16 1%s32766 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_int16_1_ssa(32766); got != 32766 { fmt.Printf("mul_int16 32766%s1 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_1_int16_ssa(32767); got != 32767 { fmt.Printf("mul_int16 1%s32767 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_int16_1_ssa(32767); got != 32767 { fmt.Printf("mul_int16 32767%s1 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_32766_int16_ssa(-32768); got != 0 { fmt.Printf("mul_int16 32766%s-32768 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_32766_ssa(-32768); got != 0 { fmt.Printf("mul_int16 -32768%s32766 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_32766_int16_ssa(-32767); got != 32766 { fmt.Printf("mul_int16 32766%s-32767 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_int16_32766_ssa(-32767); got != 32766 { fmt.Printf("mul_int16 -32767%s32766 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_32766_int16_ssa(-1); got != -32766 { fmt.Printf("mul_int16 32766%s-1 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_int16_32766_ssa(-1); got != -32766 { fmt.Printf("mul_int16 -1%s32766 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_32766_int16_ssa(0); got != 0 { fmt.Printf("mul_int16 32766%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_32766_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s32766 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_32766_int16_ssa(1); got != 32766 { fmt.Printf("mul_int16 32766%s1 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_int16_32766_ssa(1); got != 32766 { fmt.Printf("mul_int16 1%s32766 = %d, wanted 32766\n", `*`, got) failed = true } if got := mul_32766_int16_ssa(32766); got != 4 { fmt.Printf("mul_int16 32766%s32766 = %d, wanted 4\n", `*`, got) failed = true } if got := mul_int16_32766_ssa(32766); got != 4 { fmt.Printf("mul_int16 32766%s32766 = %d, wanted 4\n", `*`, got) failed = true } if got := mul_32766_int16_ssa(32767); got != -32766 { fmt.Printf("mul_int16 32766%s32767 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_int16_32766_ssa(32767); got != -32766 { fmt.Printf("mul_int16 32767%s32766 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_32767_int16_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 32767%s-32768 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_int16_32767_ssa(-32768); got != -32768 { fmt.Printf("mul_int16 -32768%s32767 = %d, wanted -32768\n", `*`, got) failed = true } if got := mul_32767_int16_ssa(-32767); got != -1 { fmt.Printf("mul_int16 32767%s-32767 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int16_32767_ssa(-32767); got != -1 { fmt.Printf("mul_int16 -32767%s32767 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_32767_int16_ssa(-1); got != -32767 { fmt.Printf("mul_int16 32767%s-1 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_int16_32767_ssa(-1); got != -32767 { fmt.Printf("mul_int16 -1%s32767 = %d, wanted -32767\n", `*`, got) failed = true } if got := mul_32767_int16_ssa(0); got != 0 { fmt.Printf("mul_int16 32767%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int16_32767_ssa(0); got != 0 { fmt.Printf("mul_int16 0%s32767 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_32767_int16_ssa(1); got != 32767 { fmt.Printf("mul_int16 32767%s1 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_int16_32767_ssa(1); got != 32767 { fmt.Printf("mul_int16 1%s32767 = %d, wanted 32767\n", `*`, got) failed = true } if got := mul_32767_int16_ssa(32766); got != -32766 { fmt.Printf("mul_int16 32767%s32766 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_int16_32767_ssa(32766); got != -32766 { fmt.Printf("mul_int16 32766%s32767 = %d, wanted -32766\n", `*`, got) failed = true } if got := mul_32767_int16_ssa(32767); got != 1 { fmt.Printf("mul_int16 32767%s32767 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int16_32767_ssa(32767); got != 1 { fmt.Printf("mul_int16 32767%s32767 = %d, wanted 1\n", `*`, got) failed = true } if got := mod_Neg32768_int16_ssa(-32768); got != 0 { fmt.Printf("mod_int16 -32768%s-32768 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg32768_ssa(-32768); got != 0 { fmt.Printf("mod_int16 -32768%s-32768 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg32768_int16_ssa(-32767); got != -1 { fmt.Printf("mod_int16 -32768%s-32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg32768_ssa(-32767); got != -32767 { fmt.Printf("mod_int16 -32767%s-32768 = %d, wanted -32767\n", `%`, got) failed = true } if got := mod_Neg32768_int16_ssa(-1); got != 0 { fmt.Printf("mod_int16 -32768%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg32768_ssa(-1); got != -1 { fmt.Printf("mod_int16 -1%s-32768 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg32768_ssa(0); got != 0 { fmt.Printf("mod_int16 0%s-32768 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg32768_int16_ssa(1); got != 0 { fmt.Printf("mod_int16 -32768%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg32768_ssa(1); got != 1 { fmt.Printf("mod_int16 1%s-32768 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg32768_int16_ssa(32766); got != -2 { fmt.Printf("mod_int16 -32768%s32766 = %d, wanted -2\n", `%`, got) failed = true } if got := mod_int16_Neg32768_ssa(32766); got != 32766 { fmt.Printf("mod_int16 32766%s-32768 = %d, wanted 32766\n", `%`, got) failed = true } if got := mod_Neg32768_int16_ssa(32767); got != -1 { fmt.Printf("mod_int16 -32768%s32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg32768_ssa(32767); got != 32767 { fmt.Printf("mod_int16 32767%s-32768 = %d, wanted 32767\n", `%`, got) failed = true } if got := mod_Neg32767_int16_ssa(-32768); got != -32767 { fmt.Printf("mod_int16 -32767%s-32768 = %d, wanted -32767\n", `%`, got) failed = true } if got := mod_int16_Neg32767_ssa(-32768); got != -1 { fmt.Printf("mod_int16 -32768%s-32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_Neg32767_int16_ssa(-32767); got != 0 { fmt.Printf("mod_int16 -32767%s-32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg32767_ssa(-32767); got != 0 { fmt.Printf("mod_int16 -32767%s-32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg32767_int16_ssa(-1); got != 0 { fmt.Printf("mod_int16 -32767%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg32767_ssa(-1); got != -1 { fmt.Printf("mod_int16 -1%s-32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg32767_ssa(0); got != 0 { fmt.Printf("mod_int16 0%s-32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg32767_int16_ssa(1); got != 0 { fmt.Printf("mod_int16 -32767%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg32767_ssa(1); got != 1 { fmt.Printf("mod_int16 1%s-32767 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg32767_int16_ssa(32766); got != -1 { fmt.Printf("mod_int16 -32767%s32766 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg32767_ssa(32766); got != 32766 { fmt.Printf("mod_int16 32766%s-32767 = %d, wanted 32766\n", `%`, got) failed = true } if got := mod_Neg32767_int16_ssa(32767); got != 0 { fmt.Printf("mod_int16 -32767%s32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg32767_ssa(32767); got != 0 { fmt.Printf("mod_int16 32767%s-32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int16_ssa(-32768); got != -1 { fmt.Printf("mod_int16 -1%s-32768 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg1_ssa(-32768); got != 0 { fmt.Printf("mod_int16 -32768%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int16_ssa(-32767); got != -1 { fmt.Printf("mod_int16 -1%s-32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg1_ssa(-32767); got != 0 { fmt.Printf("mod_int16 -32767%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int16_ssa(-1); got != 0 { fmt.Printf("mod_int16 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg1_ssa(-1); got != 0 { fmt.Printf("mod_int16 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg1_ssa(0); got != 0 { fmt.Printf("mod_int16 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int16_ssa(1); got != 0 { fmt.Printf("mod_int16 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_Neg1_ssa(1); got != 0 { fmt.Printf("mod_int16 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int16_ssa(32766); got != -1 { fmt.Printf("mod_int16 -1%s32766 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg1_ssa(32766); got != 0 { fmt.Printf("mod_int16 32766%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int16_ssa(32767); got != -1 { fmt.Printf("mod_int16 -1%s32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_Neg1_ssa(32767); got != 0 { fmt.Printf("mod_int16 32767%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int16_ssa(-32768); got != 0 { fmt.Printf("mod_int16 0%s-32768 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int16_ssa(-32767); got != 0 { fmt.Printf("mod_int16 0%s-32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int16_ssa(-1); got != 0 { fmt.Printf("mod_int16 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int16_ssa(1); got != 0 { fmt.Printf("mod_int16 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int16_ssa(32766); got != 0 { fmt.Printf("mod_int16 0%s32766 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int16_ssa(32767); got != 0 { fmt.Printf("mod_int16 0%s32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int16_ssa(-32768); got != 1 { fmt.Printf("mod_int16 1%s-32768 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int16_1_ssa(-32768); got != 0 { fmt.Printf("mod_int16 -32768%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int16_ssa(-32767); got != 1 { fmt.Printf("mod_int16 1%s-32767 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int16_1_ssa(-32767); got != 0 { fmt.Printf("mod_int16 -32767%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int16_ssa(-1); got != 0 { fmt.Printf("mod_int16 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_1_ssa(-1); got != 0 { fmt.Printf("mod_int16 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_1_ssa(0); got != 0 { fmt.Printf("mod_int16 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int16_ssa(1); got != 0 { fmt.Printf("mod_int16 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_1_ssa(1); got != 0 { fmt.Printf("mod_int16 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int16_ssa(32766); got != 1 { fmt.Printf("mod_int16 1%s32766 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int16_1_ssa(32766); got != 0 { fmt.Printf("mod_int16 32766%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int16_ssa(32767); got != 1 { fmt.Printf("mod_int16 1%s32767 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int16_1_ssa(32767); got != 0 { fmt.Printf("mod_int16 32767%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_32766_int16_ssa(-32768); got != 32766 { fmt.Printf("mod_int16 32766%s-32768 = %d, wanted 32766\n", `%`, got) failed = true } if got := mod_int16_32766_ssa(-32768); got != -2 { fmt.Printf("mod_int16 -32768%s32766 = %d, wanted -2\n", `%`, got) failed = true } if got := mod_32766_int16_ssa(-32767); got != 32766 { fmt.Printf("mod_int16 32766%s-32767 = %d, wanted 32766\n", `%`, got) failed = true } if got := mod_int16_32766_ssa(-32767); got != -1 { fmt.Printf("mod_int16 -32767%s32766 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_32766_int16_ssa(-1); got != 0 { fmt.Printf("mod_int16 32766%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_32766_ssa(-1); got != -1 { fmt.Printf("mod_int16 -1%s32766 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_32766_ssa(0); got != 0 { fmt.Printf("mod_int16 0%s32766 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_32766_int16_ssa(1); got != 0 { fmt.Printf("mod_int16 32766%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_32766_ssa(1); got != 1 { fmt.Printf("mod_int16 1%s32766 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_32766_int16_ssa(32766); got != 0 { fmt.Printf("mod_int16 32766%s32766 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_32766_ssa(32766); got != 0 { fmt.Printf("mod_int16 32766%s32766 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_32766_int16_ssa(32767); got != 32766 { fmt.Printf("mod_int16 32766%s32767 = %d, wanted 32766\n", `%`, got) failed = true } if got := mod_int16_32766_ssa(32767); got != 1 { fmt.Printf("mod_int16 32767%s32766 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_32767_int16_ssa(-32768); got != 32767 { fmt.Printf("mod_int16 32767%s-32768 = %d, wanted 32767\n", `%`, got) failed = true } if got := mod_int16_32767_ssa(-32768); got != -1 { fmt.Printf("mod_int16 -32768%s32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_32767_int16_ssa(-32767); got != 0 { fmt.Printf("mod_int16 32767%s-32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_32767_ssa(-32767); got != 0 { fmt.Printf("mod_int16 -32767%s32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_32767_int16_ssa(-1); got != 0 { fmt.Printf("mod_int16 32767%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_32767_ssa(-1); got != -1 { fmt.Printf("mod_int16 -1%s32767 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int16_32767_ssa(0); got != 0 { fmt.Printf("mod_int16 0%s32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_32767_int16_ssa(1); got != 0 { fmt.Printf("mod_int16 32767%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_32767_ssa(1); got != 1 { fmt.Printf("mod_int16 1%s32767 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_32767_int16_ssa(32766); got != 1 { fmt.Printf("mod_int16 32767%s32766 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int16_32767_ssa(32766); got != 32766 { fmt.Printf("mod_int16 32766%s32767 = %d, wanted 32766\n", `%`, got) failed = true } if got := mod_32767_int16_ssa(32767); got != 0 { fmt.Printf("mod_int16 32767%s32767 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int16_32767_ssa(32767); got != 0 { fmt.Printf("mod_int16 32767%s32767 = %d, wanted 0\n", `%`, got) failed = true } if got := add_0_uint8_ssa(0); got != 0 { fmt.Printf("add_uint8 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint8_0_ssa(0); got != 0 { fmt.Printf("add_uint8 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_uint8_ssa(1); got != 1 { fmt.Printf("add_uint8 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint8_0_ssa(1); got != 1 { fmt.Printf("add_uint8 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_uint8_ssa(255); got != 255 { fmt.Printf("add_uint8 0%s255 = %d, wanted 255\n", `+`, got) failed = true } if got := add_uint8_0_ssa(255); got != 255 { fmt.Printf("add_uint8 255%s0 = %d, wanted 255\n", `+`, got) failed = true } if got := add_1_uint8_ssa(0); got != 1 { fmt.Printf("add_uint8 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_uint8_1_ssa(0); got != 1 { fmt.Printf("add_uint8 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_uint8_ssa(1); got != 2 { fmt.Printf("add_uint8 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_uint8_1_ssa(1); got != 2 { fmt.Printf("add_uint8 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_uint8_ssa(255); got != 0 { fmt.Printf("add_uint8 1%s255 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint8_1_ssa(255); got != 0 { fmt.Printf("add_uint8 255%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_255_uint8_ssa(0); got != 255 { fmt.Printf("add_uint8 255%s0 = %d, wanted 255\n", `+`, got) failed = true } if got := add_uint8_255_ssa(0); got != 255 { fmt.Printf("add_uint8 0%s255 = %d, wanted 255\n", `+`, got) failed = true } if got := add_255_uint8_ssa(1); got != 0 { fmt.Printf("add_uint8 255%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_uint8_255_ssa(1); got != 0 { fmt.Printf("add_uint8 1%s255 = %d, wanted 0\n", `+`, got) failed = true } if got := add_255_uint8_ssa(255); got != 254 { fmt.Printf("add_uint8 255%s255 = %d, wanted 254\n", `+`, got) failed = true } if got := add_uint8_255_ssa(255); got != 254 { fmt.Printf("add_uint8 255%s255 = %d, wanted 254\n", `+`, got) failed = true } if got := sub_0_uint8_ssa(0); got != 0 { fmt.Printf("sub_uint8 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint8_0_ssa(0); got != 0 { fmt.Printf("sub_uint8 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_uint8_ssa(1); got != 255 { fmt.Printf("sub_uint8 0%s1 = %d, wanted 255\n", `-`, got) failed = true } if got := sub_uint8_0_ssa(1); got != 1 { fmt.Printf("sub_uint8 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_uint8_ssa(255); got != 1 { fmt.Printf("sub_uint8 0%s255 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint8_0_ssa(255); got != 255 { fmt.Printf("sub_uint8 255%s0 = %d, wanted 255\n", `-`, got) failed = true } if got := sub_1_uint8_ssa(0); got != 1 { fmt.Printf("sub_uint8 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_uint8_1_ssa(0); got != 255 { fmt.Printf("sub_uint8 0%s1 = %d, wanted 255\n", `-`, got) failed = true } if got := sub_1_uint8_ssa(1); got != 0 { fmt.Printf("sub_uint8 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint8_1_ssa(1); got != 0 { fmt.Printf("sub_uint8 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_uint8_ssa(255); got != 2 { fmt.Printf("sub_uint8 1%s255 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_uint8_1_ssa(255); got != 254 { fmt.Printf("sub_uint8 255%s1 = %d, wanted 254\n", `-`, got) failed = true } if got := sub_255_uint8_ssa(0); got != 255 { fmt.Printf("sub_uint8 255%s0 = %d, wanted 255\n", `-`, got) failed = true } if got := sub_uint8_255_ssa(0); got != 1 { fmt.Printf("sub_uint8 0%s255 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_255_uint8_ssa(1); got != 254 { fmt.Printf("sub_uint8 255%s1 = %d, wanted 254\n", `-`, got) failed = true } if got := sub_uint8_255_ssa(1); got != 2 { fmt.Printf("sub_uint8 1%s255 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_255_uint8_ssa(255); got != 0 { fmt.Printf("sub_uint8 255%s255 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_uint8_255_ssa(255); got != 0 { fmt.Printf("sub_uint8 255%s255 = %d, wanted 0\n", `-`, got) failed = true } if got := div_0_uint8_ssa(1); got != 0 { fmt.Printf("div_uint8 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_uint8_ssa(255); got != 0 { fmt.Printf("div_uint8 0%s255 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint8_1_ssa(0); got != 0 { fmt.Printf("div_uint8 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_uint8_ssa(1); got != 1 { fmt.Printf("div_uint8 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint8_1_ssa(1); got != 1 { fmt.Printf("div_uint8 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_uint8_ssa(255); got != 0 { fmt.Printf("div_uint8 1%s255 = %d, wanted 0\n", `/`, got) failed = true } if got := div_uint8_1_ssa(255); got != 255 { fmt.Printf("div_uint8 255%s1 = %d, wanted 255\n", `/`, got) failed = true } if got := div_uint8_255_ssa(0); got != 0 { fmt.Printf("div_uint8 0%s255 = %d, wanted 0\n", `/`, got) failed = true } if got := div_255_uint8_ssa(1); got != 255 { fmt.Printf("div_uint8 255%s1 = %d, wanted 255\n", `/`, got) failed = true } if got := div_uint8_255_ssa(1); got != 0 { fmt.Printf("div_uint8 1%s255 = %d, wanted 0\n", `/`, got) failed = true } if got := div_255_uint8_ssa(255); got != 1 { fmt.Printf("div_uint8 255%s255 = %d, wanted 1\n", `/`, got) failed = true } if got := div_uint8_255_ssa(255); got != 1 { fmt.Printf("div_uint8 255%s255 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_0_uint8_ssa(0); got != 0 { fmt.Printf("mul_uint8 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint8_0_ssa(0); got != 0 { fmt.Printf("mul_uint8 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint8_ssa(1); got != 0 { fmt.Printf("mul_uint8 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint8_0_ssa(1); got != 0 { fmt.Printf("mul_uint8 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_uint8_ssa(255); got != 0 { fmt.Printf("mul_uint8 0%s255 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint8_0_ssa(255); got != 0 { fmt.Printf("mul_uint8 255%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint8_ssa(0); got != 0 { fmt.Printf("mul_uint8 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint8_1_ssa(0); got != 0 { fmt.Printf("mul_uint8 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_uint8_ssa(1); got != 1 { fmt.Printf("mul_uint8 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint8_1_ssa(1); got != 1 { fmt.Printf("mul_uint8 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_uint8_ssa(255); got != 255 { fmt.Printf("mul_uint8 1%s255 = %d, wanted 255\n", `*`, got) failed = true } if got := mul_uint8_1_ssa(255); got != 255 { fmt.Printf("mul_uint8 255%s1 = %d, wanted 255\n", `*`, got) failed = true } if got := mul_255_uint8_ssa(0); got != 0 { fmt.Printf("mul_uint8 255%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_uint8_255_ssa(0); got != 0 { fmt.Printf("mul_uint8 0%s255 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_255_uint8_ssa(1); got != 255 { fmt.Printf("mul_uint8 255%s1 = %d, wanted 255\n", `*`, got) failed = true } if got := mul_uint8_255_ssa(1); got != 255 { fmt.Printf("mul_uint8 1%s255 = %d, wanted 255\n", `*`, got) failed = true } if got := mul_255_uint8_ssa(255); got != 1 { fmt.Printf("mul_uint8 255%s255 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_uint8_255_ssa(255); got != 1 { fmt.Printf("mul_uint8 255%s255 = %d, wanted 1\n", `*`, got) failed = true } if got := lsh_0_uint8_ssa(0); got != 0 { fmt.Printf("lsh_uint8 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint8_0_ssa(0); got != 0 { fmt.Printf("lsh_uint8 0%s0 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_0_uint8_ssa(1); got != 0 { fmt.Printf("lsh_uint8 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint8_0_ssa(1); got != 1 { fmt.Printf("lsh_uint8 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_0_uint8_ssa(255); got != 0 { fmt.Printf("lsh_uint8 0%s255 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint8_0_ssa(255); got != 255 { fmt.Printf("lsh_uint8 255%s0 = %d, wanted 255\n", `<<`, got) failed = true } if got := lsh_1_uint8_ssa(0); got != 1 { fmt.Printf("lsh_uint8 1%s0 = %d, wanted 1\n", `<<`, got) failed = true } if got := lsh_uint8_1_ssa(0); got != 0 { fmt.Printf("lsh_uint8 0%s1 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_1_uint8_ssa(1); got != 2 { fmt.Printf("lsh_uint8 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_uint8_1_ssa(1); got != 2 { fmt.Printf("lsh_uint8 1%s1 = %d, wanted 2\n", `<<`, got) failed = true } if got := lsh_1_uint8_ssa(255); got != 0 { fmt.Printf("lsh_uint8 1%s255 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint8_1_ssa(255); got != 254 { fmt.Printf("lsh_uint8 255%s1 = %d, wanted 254\n", `<<`, got) failed = true } if got := lsh_255_uint8_ssa(0); got != 255 { fmt.Printf("lsh_uint8 255%s0 = %d, wanted 255\n", `<<`, got) failed = true } if got := lsh_uint8_255_ssa(0); got != 0 { fmt.Printf("lsh_uint8 0%s255 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_255_uint8_ssa(1); got != 254 { fmt.Printf("lsh_uint8 255%s1 = %d, wanted 254\n", `<<`, got) failed = true } if got := lsh_uint8_255_ssa(1); got != 0 { fmt.Printf("lsh_uint8 1%s255 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_255_uint8_ssa(255); got != 0 { fmt.Printf("lsh_uint8 255%s255 = %d, wanted 0\n", `<<`, got) failed = true } if got := lsh_uint8_255_ssa(255); got != 0 { fmt.Printf("lsh_uint8 255%s255 = %d, wanted 0\n", `<<`, got) failed = true } if got := rsh_0_uint8_ssa(0); got != 0 { fmt.Printf("rsh_uint8 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint8_0_ssa(0); got != 0 { fmt.Printf("rsh_uint8 0%s0 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_0_uint8_ssa(1); got != 0 { fmt.Printf("rsh_uint8 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint8_0_ssa(1); got != 1 { fmt.Printf("rsh_uint8 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_0_uint8_ssa(255); got != 0 { fmt.Printf("rsh_uint8 0%s255 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint8_0_ssa(255); got != 255 { fmt.Printf("rsh_uint8 255%s0 = %d, wanted 255\n", `>>`, got) failed = true } if got := rsh_1_uint8_ssa(0); got != 1 { fmt.Printf("rsh_uint8 1%s0 = %d, wanted 1\n", `>>`, got) failed = true } if got := rsh_uint8_1_ssa(0); got != 0 { fmt.Printf("rsh_uint8 0%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint8_ssa(1); got != 0 { fmt.Printf("rsh_uint8 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint8_1_ssa(1); got != 0 { fmt.Printf("rsh_uint8 1%s1 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_1_uint8_ssa(255); got != 0 { fmt.Printf("rsh_uint8 1%s255 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint8_1_ssa(255); got != 127 { fmt.Printf("rsh_uint8 255%s1 = %d, wanted 127\n", `>>`, got) failed = true } if got := rsh_255_uint8_ssa(0); got != 255 { fmt.Printf("rsh_uint8 255%s0 = %d, wanted 255\n", `>>`, got) failed = true } if got := rsh_uint8_255_ssa(0); got != 0 { fmt.Printf("rsh_uint8 0%s255 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_255_uint8_ssa(1); got != 127 { fmt.Printf("rsh_uint8 255%s1 = %d, wanted 127\n", `>>`, got) failed = true } if got := rsh_uint8_255_ssa(1); got != 0 { fmt.Printf("rsh_uint8 1%s255 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_255_uint8_ssa(255); got != 0 { fmt.Printf("rsh_uint8 255%s255 = %d, wanted 0\n", `>>`, got) failed = true } if got := rsh_uint8_255_ssa(255); got != 0 { fmt.Printf("rsh_uint8 255%s255 = %d, wanted 0\n", `>>`, got) failed = true } if got := mod_0_uint8_ssa(1); got != 0 { fmt.Printf("mod_uint8 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_uint8_ssa(255); got != 0 { fmt.Printf("mod_uint8 0%s255 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint8_1_ssa(0); got != 0 { fmt.Printf("mod_uint8 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint8_ssa(1); got != 0 { fmt.Printf("mod_uint8 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint8_1_ssa(1); got != 0 { fmt.Printf("mod_uint8 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_uint8_ssa(255); got != 1 { fmt.Printf("mod_uint8 1%s255 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_uint8_1_ssa(255); got != 0 { fmt.Printf("mod_uint8 255%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint8_255_ssa(0); got != 0 { fmt.Printf("mod_uint8 0%s255 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_255_uint8_ssa(1); got != 0 { fmt.Printf("mod_uint8 255%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint8_255_ssa(1); got != 1 { fmt.Printf("mod_uint8 1%s255 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_255_uint8_ssa(255); got != 0 { fmt.Printf("mod_uint8 255%s255 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_uint8_255_ssa(255); got != 0 { fmt.Printf("mod_uint8 255%s255 = %d, wanted 0\n", `%`, got) failed = true } if got := add_Neg128_int8_ssa(-128); got != 0 { fmt.Printf("add_int8 -128%s-128 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int8_Neg128_ssa(-128); got != 0 { fmt.Printf("add_int8 -128%s-128 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg128_int8_ssa(-127); got != 1 { fmt.Printf("add_int8 -128%s-127 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int8_Neg128_ssa(-127); got != 1 { fmt.Printf("add_int8 -127%s-128 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg128_int8_ssa(-1); got != 127 { fmt.Printf("add_int8 -128%s-1 = %d, wanted 127\n", `+`, got) failed = true } if got := add_int8_Neg128_ssa(-1); got != 127 { fmt.Printf("add_int8 -1%s-128 = %d, wanted 127\n", `+`, got) failed = true } if got := add_Neg128_int8_ssa(0); got != -128 { fmt.Printf("add_int8 -128%s0 = %d, wanted -128\n", `+`, got) failed = true } if got := add_int8_Neg128_ssa(0); got != -128 { fmt.Printf("add_int8 0%s-128 = %d, wanted -128\n", `+`, got) failed = true } if got := add_Neg128_int8_ssa(1); got != -127 { fmt.Printf("add_int8 -128%s1 = %d, wanted -127\n", `+`, got) failed = true } if got := add_int8_Neg128_ssa(1); got != -127 { fmt.Printf("add_int8 1%s-128 = %d, wanted -127\n", `+`, got) failed = true } if got := add_Neg128_int8_ssa(126); got != -2 { fmt.Printf("add_int8 -128%s126 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int8_Neg128_ssa(126); got != -2 { fmt.Printf("add_int8 126%s-128 = %d, wanted -2\n", `+`, got) failed = true } if got := add_Neg128_int8_ssa(127); got != -1 { fmt.Printf("add_int8 -128%s127 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int8_Neg128_ssa(127); got != -1 { fmt.Printf("add_int8 127%s-128 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg127_int8_ssa(-128); got != 1 { fmt.Printf("add_int8 -127%s-128 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int8_Neg127_ssa(-128); got != 1 { fmt.Printf("add_int8 -128%s-127 = %d, wanted 1\n", `+`, got) failed = true } if got := add_Neg127_int8_ssa(-127); got != 2 { fmt.Printf("add_int8 -127%s-127 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int8_Neg127_ssa(-127); got != 2 { fmt.Printf("add_int8 -127%s-127 = %d, wanted 2\n", `+`, got) failed = true } if got := add_Neg127_int8_ssa(-1); got != -128 { fmt.Printf("add_int8 -127%s-1 = %d, wanted -128\n", `+`, got) failed = true } if got := add_int8_Neg127_ssa(-1); got != -128 { fmt.Printf("add_int8 -1%s-127 = %d, wanted -128\n", `+`, got) failed = true } if got := add_Neg127_int8_ssa(0); got != -127 { fmt.Printf("add_int8 -127%s0 = %d, wanted -127\n", `+`, got) failed = true } if got := add_int8_Neg127_ssa(0); got != -127 { fmt.Printf("add_int8 0%s-127 = %d, wanted -127\n", `+`, got) failed = true } if got := add_Neg127_int8_ssa(1); got != -126 { fmt.Printf("add_int8 -127%s1 = %d, wanted -126\n", `+`, got) failed = true } if got := add_int8_Neg127_ssa(1); got != -126 { fmt.Printf("add_int8 1%s-127 = %d, wanted -126\n", `+`, got) failed = true } if got := add_Neg127_int8_ssa(126); got != -1 { fmt.Printf("add_int8 -127%s126 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int8_Neg127_ssa(126); got != -1 { fmt.Printf("add_int8 126%s-127 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg127_int8_ssa(127); got != 0 { fmt.Printf("add_int8 -127%s127 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int8_Neg127_ssa(127); got != 0 { fmt.Printf("add_int8 127%s-127 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg1_int8_ssa(-128); got != 127 { fmt.Printf("add_int8 -1%s-128 = %d, wanted 127\n", `+`, got) failed = true } if got := add_int8_Neg1_ssa(-128); got != 127 { fmt.Printf("add_int8 -128%s-1 = %d, wanted 127\n", `+`, got) failed = true } if got := add_Neg1_int8_ssa(-127); got != -128 { fmt.Printf("add_int8 -1%s-127 = %d, wanted -128\n", `+`, got) failed = true } if got := add_int8_Neg1_ssa(-127); got != -128 { fmt.Printf("add_int8 -127%s-1 = %d, wanted -128\n", `+`, got) failed = true } if got := add_Neg1_int8_ssa(-1); got != -2 { fmt.Printf("add_int8 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int8_Neg1_ssa(-1); got != -2 { fmt.Printf("add_int8 -1%s-1 = %d, wanted -2\n", `+`, got) failed = true } if got := add_Neg1_int8_ssa(0); got != -1 { fmt.Printf("add_int8 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int8_Neg1_ssa(0); got != -1 { fmt.Printf("add_int8 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_Neg1_int8_ssa(1); got != 0 { fmt.Printf("add_int8 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int8_Neg1_ssa(1); got != 0 { fmt.Printf("add_int8 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_Neg1_int8_ssa(126); got != 125 { fmt.Printf("add_int8 -1%s126 = %d, wanted 125\n", `+`, got) failed = true } if got := add_int8_Neg1_ssa(126); got != 125 { fmt.Printf("add_int8 126%s-1 = %d, wanted 125\n", `+`, got) failed = true } if got := add_Neg1_int8_ssa(127); got != 126 { fmt.Printf("add_int8 -1%s127 = %d, wanted 126\n", `+`, got) failed = true } if got := add_int8_Neg1_ssa(127); got != 126 { fmt.Printf("add_int8 127%s-1 = %d, wanted 126\n", `+`, got) failed = true } if got := add_0_int8_ssa(-128); got != -128 { fmt.Printf("add_int8 0%s-128 = %d, wanted -128\n", `+`, got) failed = true } if got := add_int8_0_ssa(-128); got != -128 { fmt.Printf("add_int8 -128%s0 = %d, wanted -128\n", `+`, got) failed = true } if got := add_0_int8_ssa(-127); got != -127 { fmt.Printf("add_int8 0%s-127 = %d, wanted -127\n", `+`, got) failed = true } if got := add_int8_0_ssa(-127); got != -127 { fmt.Printf("add_int8 -127%s0 = %d, wanted -127\n", `+`, got) failed = true } if got := add_0_int8_ssa(-1); got != -1 { fmt.Printf("add_int8 0%s-1 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int8_0_ssa(-1); got != -1 { fmt.Printf("add_int8 -1%s0 = %d, wanted -1\n", `+`, got) failed = true } if got := add_0_int8_ssa(0); got != 0 { fmt.Printf("add_int8 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int8_0_ssa(0); got != 0 { fmt.Printf("add_int8 0%s0 = %d, wanted 0\n", `+`, got) failed = true } if got := add_0_int8_ssa(1); got != 1 { fmt.Printf("add_int8 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int8_0_ssa(1); got != 1 { fmt.Printf("add_int8 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_0_int8_ssa(126); got != 126 { fmt.Printf("add_int8 0%s126 = %d, wanted 126\n", `+`, got) failed = true } if got := add_int8_0_ssa(126); got != 126 { fmt.Printf("add_int8 126%s0 = %d, wanted 126\n", `+`, got) failed = true } if got := add_0_int8_ssa(127); got != 127 { fmt.Printf("add_int8 0%s127 = %d, wanted 127\n", `+`, got) failed = true } if got := add_int8_0_ssa(127); got != 127 { fmt.Printf("add_int8 127%s0 = %d, wanted 127\n", `+`, got) failed = true } if got := add_1_int8_ssa(-128); got != -127 { fmt.Printf("add_int8 1%s-128 = %d, wanted -127\n", `+`, got) failed = true } if got := add_int8_1_ssa(-128); got != -127 { fmt.Printf("add_int8 -128%s1 = %d, wanted -127\n", `+`, got) failed = true } if got := add_1_int8_ssa(-127); got != -126 { fmt.Printf("add_int8 1%s-127 = %d, wanted -126\n", `+`, got) failed = true } if got := add_int8_1_ssa(-127); got != -126 { fmt.Printf("add_int8 -127%s1 = %d, wanted -126\n", `+`, got) failed = true } if got := add_1_int8_ssa(-1); got != 0 { fmt.Printf("add_int8 1%s-1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int8_1_ssa(-1); got != 0 { fmt.Printf("add_int8 -1%s1 = %d, wanted 0\n", `+`, got) failed = true } if got := add_1_int8_ssa(0); got != 1 { fmt.Printf("add_int8 1%s0 = %d, wanted 1\n", `+`, got) failed = true } if got := add_int8_1_ssa(0); got != 1 { fmt.Printf("add_int8 0%s1 = %d, wanted 1\n", `+`, got) failed = true } if got := add_1_int8_ssa(1); got != 2 { fmt.Printf("add_int8 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_int8_1_ssa(1); got != 2 { fmt.Printf("add_int8 1%s1 = %d, wanted 2\n", `+`, got) failed = true } if got := add_1_int8_ssa(126); got != 127 { fmt.Printf("add_int8 1%s126 = %d, wanted 127\n", `+`, got) failed = true } if got := add_int8_1_ssa(126); got != 127 { fmt.Printf("add_int8 126%s1 = %d, wanted 127\n", `+`, got) failed = true } if got := add_1_int8_ssa(127); got != -128 { fmt.Printf("add_int8 1%s127 = %d, wanted -128\n", `+`, got) failed = true } if got := add_int8_1_ssa(127); got != -128 { fmt.Printf("add_int8 127%s1 = %d, wanted -128\n", `+`, got) failed = true } if got := add_126_int8_ssa(-128); got != -2 { fmt.Printf("add_int8 126%s-128 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int8_126_ssa(-128); got != -2 { fmt.Printf("add_int8 -128%s126 = %d, wanted -2\n", `+`, got) failed = true } if got := add_126_int8_ssa(-127); got != -1 { fmt.Printf("add_int8 126%s-127 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int8_126_ssa(-127); got != -1 { fmt.Printf("add_int8 -127%s126 = %d, wanted -1\n", `+`, got) failed = true } if got := add_126_int8_ssa(-1); got != 125 { fmt.Printf("add_int8 126%s-1 = %d, wanted 125\n", `+`, got) failed = true } if got := add_int8_126_ssa(-1); got != 125 { fmt.Printf("add_int8 -1%s126 = %d, wanted 125\n", `+`, got) failed = true } if got := add_126_int8_ssa(0); got != 126 { fmt.Printf("add_int8 126%s0 = %d, wanted 126\n", `+`, got) failed = true } if got := add_int8_126_ssa(0); got != 126 { fmt.Printf("add_int8 0%s126 = %d, wanted 126\n", `+`, got) failed = true } if got := add_126_int8_ssa(1); got != 127 { fmt.Printf("add_int8 126%s1 = %d, wanted 127\n", `+`, got) failed = true } if got := add_int8_126_ssa(1); got != 127 { fmt.Printf("add_int8 1%s126 = %d, wanted 127\n", `+`, got) failed = true } if got := add_126_int8_ssa(126); got != -4 { fmt.Printf("add_int8 126%s126 = %d, wanted -4\n", `+`, got) failed = true } if got := add_int8_126_ssa(126); got != -4 { fmt.Printf("add_int8 126%s126 = %d, wanted -4\n", `+`, got) failed = true } if got := add_126_int8_ssa(127); got != -3 { fmt.Printf("add_int8 126%s127 = %d, wanted -3\n", `+`, got) failed = true } if got := add_int8_126_ssa(127); got != -3 { fmt.Printf("add_int8 127%s126 = %d, wanted -3\n", `+`, got) failed = true } if got := add_127_int8_ssa(-128); got != -1 { fmt.Printf("add_int8 127%s-128 = %d, wanted -1\n", `+`, got) failed = true } if got := add_int8_127_ssa(-128); got != -1 { fmt.Printf("add_int8 -128%s127 = %d, wanted -1\n", `+`, got) failed = true } if got := add_127_int8_ssa(-127); got != 0 { fmt.Printf("add_int8 127%s-127 = %d, wanted 0\n", `+`, got) failed = true } if got := add_int8_127_ssa(-127); got != 0 { fmt.Printf("add_int8 -127%s127 = %d, wanted 0\n", `+`, got) failed = true } if got := add_127_int8_ssa(-1); got != 126 { fmt.Printf("add_int8 127%s-1 = %d, wanted 126\n", `+`, got) failed = true } if got := add_int8_127_ssa(-1); got != 126 { fmt.Printf("add_int8 -1%s127 = %d, wanted 126\n", `+`, got) failed = true } if got := add_127_int8_ssa(0); got != 127 { fmt.Printf("add_int8 127%s0 = %d, wanted 127\n", `+`, got) failed = true } if got := add_int8_127_ssa(0); got != 127 { fmt.Printf("add_int8 0%s127 = %d, wanted 127\n", `+`, got) failed = true } if got := add_127_int8_ssa(1); got != -128 { fmt.Printf("add_int8 127%s1 = %d, wanted -128\n", `+`, got) failed = true } if got := add_int8_127_ssa(1); got != -128 { fmt.Printf("add_int8 1%s127 = %d, wanted -128\n", `+`, got) failed = true } if got := add_127_int8_ssa(126); got != -3 { fmt.Printf("add_int8 127%s126 = %d, wanted -3\n", `+`, got) failed = true } if got := add_int8_127_ssa(126); got != -3 { fmt.Printf("add_int8 126%s127 = %d, wanted -3\n", `+`, got) failed = true } if got := add_127_int8_ssa(127); got != -2 { fmt.Printf("add_int8 127%s127 = %d, wanted -2\n", `+`, got) failed = true } if got := add_int8_127_ssa(127); got != -2 { fmt.Printf("add_int8 127%s127 = %d, wanted -2\n", `+`, got) failed = true } if got := sub_Neg128_int8_ssa(-128); got != 0 { fmt.Printf("sub_int8 -128%s-128 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int8_Neg128_ssa(-128); got != 0 { fmt.Printf("sub_int8 -128%s-128 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg128_int8_ssa(-127); got != -1 { fmt.Printf("sub_int8 -128%s-127 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int8_Neg128_ssa(-127); got != 1 { fmt.Printf("sub_int8 -127%s-128 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg128_int8_ssa(-1); got != -127 { fmt.Printf("sub_int8 -128%s-1 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_int8_Neg128_ssa(-1); got != 127 { fmt.Printf("sub_int8 -1%s-128 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_Neg128_int8_ssa(0); got != -128 { fmt.Printf("sub_int8 -128%s0 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_int8_Neg128_ssa(0); got != -128 { fmt.Printf("sub_int8 0%s-128 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_Neg128_int8_ssa(1); got != 127 { fmt.Printf("sub_int8 -128%s1 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_int8_Neg128_ssa(1); got != -127 { fmt.Printf("sub_int8 1%s-128 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_Neg128_int8_ssa(126); got != 2 { fmt.Printf("sub_int8 -128%s126 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int8_Neg128_ssa(126); got != -2 { fmt.Printf("sub_int8 126%s-128 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_Neg128_int8_ssa(127); got != 1 { fmt.Printf("sub_int8 -128%s127 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int8_Neg128_ssa(127); got != -1 { fmt.Printf("sub_int8 127%s-128 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg127_int8_ssa(-128); got != 1 { fmt.Printf("sub_int8 -127%s-128 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int8_Neg127_ssa(-128); got != -1 { fmt.Printf("sub_int8 -128%s-127 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_Neg127_int8_ssa(-127); got != 0 { fmt.Printf("sub_int8 -127%s-127 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int8_Neg127_ssa(-127); got != 0 { fmt.Printf("sub_int8 -127%s-127 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg127_int8_ssa(-1); got != -126 { fmt.Printf("sub_int8 -127%s-1 = %d, wanted -126\n", `-`, got) failed = true } if got := sub_int8_Neg127_ssa(-1); got != 126 { fmt.Printf("sub_int8 -1%s-127 = %d, wanted 126\n", `-`, got) failed = true } if got := sub_Neg127_int8_ssa(0); got != -127 { fmt.Printf("sub_int8 -127%s0 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_int8_Neg127_ssa(0); got != 127 { fmt.Printf("sub_int8 0%s-127 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_Neg127_int8_ssa(1); got != -128 { fmt.Printf("sub_int8 -127%s1 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_int8_Neg127_ssa(1); got != -128 { fmt.Printf("sub_int8 1%s-127 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_Neg127_int8_ssa(126); got != 3 { fmt.Printf("sub_int8 -127%s126 = %d, wanted 3\n", `-`, got) failed = true } if got := sub_int8_Neg127_ssa(126); got != -3 { fmt.Printf("sub_int8 126%s-127 = %d, wanted -3\n", `-`, got) failed = true } if got := sub_Neg127_int8_ssa(127); got != 2 { fmt.Printf("sub_int8 -127%s127 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int8_Neg127_ssa(127); got != -2 { fmt.Printf("sub_int8 127%s-127 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_Neg1_int8_ssa(-128); got != 127 { fmt.Printf("sub_int8 -1%s-128 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_int8_Neg1_ssa(-128); got != -127 { fmt.Printf("sub_int8 -128%s-1 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_Neg1_int8_ssa(-127); got != 126 { fmt.Printf("sub_int8 -1%s-127 = %d, wanted 126\n", `-`, got) failed = true } if got := sub_int8_Neg1_ssa(-127); got != -126 { fmt.Printf("sub_int8 -127%s-1 = %d, wanted -126\n", `-`, got) failed = true } if got := sub_Neg1_int8_ssa(-1); got != 0 { fmt.Printf("sub_int8 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int8_Neg1_ssa(-1); got != 0 { fmt.Printf("sub_int8 -1%s-1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_Neg1_int8_ssa(0); got != -1 { fmt.Printf("sub_int8 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int8_Neg1_ssa(0); got != 1 { fmt.Printf("sub_int8 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_Neg1_int8_ssa(1); got != -2 { fmt.Printf("sub_int8 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int8_Neg1_ssa(1); got != 2 { fmt.Printf("sub_int8 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_Neg1_int8_ssa(126); got != -127 { fmt.Printf("sub_int8 -1%s126 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_int8_Neg1_ssa(126); got != 127 { fmt.Printf("sub_int8 126%s-1 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_Neg1_int8_ssa(127); got != -128 { fmt.Printf("sub_int8 -1%s127 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_int8_Neg1_ssa(127); got != -128 { fmt.Printf("sub_int8 127%s-1 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_0_int8_ssa(-128); got != -128 { fmt.Printf("sub_int8 0%s-128 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_int8_0_ssa(-128); got != -128 { fmt.Printf("sub_int8 -128%s0 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_0_int8_ssa(-127); got != 127 { fmt.Printf("sub_int8 0%s-127 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_int8_0_ssa(-127); got != -127 { fmt.Printf("sub_int8 -127%s0 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_0_int8_ssa(-1); got != 1 { fmt.Printf("sub_int8 0%s-1 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int8_0_ssa(-1); got != -1 { fmt.Printf("sub_int8 -1%s0 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_0_int8_ssa(0); got != 0 { fmt.Printf("sub_int8 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int8_0_ssa(0); got != 0 { fmt.Printf("sub_int8 0%s0 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_0_int8_ssa(1); got != -1 { fmt.Printf("sub_int8 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int8_0_ssa(1); got != 1 { fmt.Printf("sub_int8 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_0_int8_ssa(126); got != -126 { fmt.Printf("sub_int8 0%s126 = %d, wanted -126\n", `-`, got) failed = true } if got := sub_int8_0_ssa(126); got != 126 { fmt.Printf("sub_int8 126%s0 = %d, wanted 126\n", `-`, got) failed = true } if got := sub_0_int8_ssa(127); got != -127 { fmt.Printf("sub_int8 0%s127 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_int8_0_ssa(127); got != 127 { fmt.Printf("sub_int8 127%s0 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_1_int8_ssa(-128); got != -127 { fmt.Printf("sub_int8 1%s-128 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_int8_1_ssa(-128); got != 127 { fmt.Printf("sub_int8 -128%s1 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_1_int8_ssa(-127); got != -128 { fmt.Printf("sub_int8 1%s-127 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_int8_1_ssa(-127); got != -128 { fmt.Printf("sub_int8 -127%s1 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_1_int8_ssa(-1); got != 2 { fmt.Printf("sub_int8 1%s-1 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_int8_1_ssa(-1); got != -2 { fmt.Printf("sub_int8 -1%s1 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_1_int8_ssa(0); got != 1 { fmt.Printf("sub_int8 1%s0 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int8_1_ssa(0); got != -1 { fmt.Printf("sub_int8 0%s1 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_1_int8_ssa(1); got != 0 { fmt.Printf("sub_int8 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int8_1_ssa(1); got != 0 { fmt.Printf("sub_int8 1%s1 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_1_int8_ssa(126); got != -125 { fmt.Printf("sub_int8 1%s126 = %d, wanted -125\n", `-`, got) failed = true } if got := sub_int8_1_ssa(126); got != 125 { fmt.Printf("sub_int8 126%s1 = %d, wanted 125\n", `-`, got) failed = true } if got := sub_1_int8_ssa(127); got != -126 { fmt.Printf("sub_int8 1%s127 = %d, wanted -126\n", `-`, got) failed = true } if got := sub_int8_1_ssa(127); got != 126 { fmt.Printf("sub_int8 127%s1 = %d, wanted 126\n", `-`, got) failed = true } if got := sub_126_int8_ssa(-128); got != -2 { fmt.Printf("sub_int8 126%s-128 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int8_126_ssa(-128); got != 2 { fmt.Printf("sub_int8 -128%s126 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_126_int8_ssa(-127); got != -3 { fmt.Printf("sub_int8 126%s-127 = %d, wanted -3\n", `-`, got) failed = true } if got := sub_int8_126_ssa(-127); got != 3 { fmt.Printf("sub_int8 -127%s126 = %d, wanted 3\n", `-`, got) failed = true } if got := sub_126_int8_ssa(-1); got != 127 { fmt.Printf("sub_int8 126%s-1 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_int8_126_ssa(-1); got != -127 { fmt.Printf("sub_int8 -1%s126 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_126_int8_ssa(0); got != 126 { fmt.Printf("sub_int8 126%s0 = %d, wanted 126\n", `-`, got) failed = true } if got := sub_int8_126_ssa(0); got != -126 { fmt.Printf("sub_int8 0%s126 = %d, wanted -126\n", `-`, got) failed = true } if got := sub_126_int8_ssa(1); got != 125 { fmt.Printf("sub_int8 126%s1 = %d, wanted 125\n", `-`, got) failed = true } if got := sub_int8_126_ssa(1); got != -125 { fmt.Printf("sub_int8 1%s126 = %d, wanted -125\n", `-`, got) failed = true } if got := sub_126_int8_ssa(126); got != 0 { fmt.Printf("sub_int8 126%s126 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int8_126_ssa(126); got != 0 { fmt.Printf("sub_int8 126%s126 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_126_int8_ssa(127); got != -1 { fmt.Printf("sub_int8 126%s127 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int8_126_ssa(127); got != 1 { fmt.Printf("sub_int8 127%s126 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_127_int8_ssa(-128); got != -1 { fmt.Printf("sub_int8 127%s-128 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_int8_127_ssa(-128); got != 1 { fmt.Printf("sub_int8 -128%s127 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_127_int8_ssa(-127); got != -2 { fmt.Printf("sub_int8 127%s-127 = %d, wanted -2\n", `-`, got) failed = true } if got := sub_int8_127_ssa(-127); got != 2 { fmt.Printf("sub_int8 -127%s127 = %d, wanted 2\n", `-`, got) failed = true } if got := sub_127_int8_ssa(-1); got != -128 { fmt.Printf("sub_int8 127%s-1 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_int8_127_ssa(-1); got != -128 { fmt.Printf("sub_int8 -1%s127 = %d, wanted -128\n", `-`, got) failed = true } if got := sub_127_int8_ssa(0); got != 127 { fmt.Printf("sub_int8 127%s0 = %d, wanted 127\n", `-`, got) failed = true } if got := sub_int8_127_ssa(0); got != -127 { fmt.Printf("sub_int8 0%s127 = %d, wanted -127\n", `-`, got) failed = true } if got := sub_127_int8_ssa(1); got != 126 { fmt.Printf("sub_int8 127%s1 = %d, wanted 126\n", `-`, got) failed = true } if got := sub_int8_127_ssa(1); got != -126 { fmt.Printf("sub_int8 1%s127 = %d, wanted -126\n", `-`, got) failed = true } if got := sub_127_int8_ssa(126); got != 1 { fmt.Printf("sub_int8 127%s126 = %d, wanted 1\n", `-`, got) failed = true } if got := sub_int8_127_ssa(126); got != -1 { fmt.Printf("sub_int8 126%s127 = %d, wanted -1\n", `-`, got) failed = true } if got := sub_127_int8_ssa(127); got != 0 { fmt.Printf("sub_int8 127%s127 = %d, wanted 0\n", `-`, got) failed = true } if got := sub_int8_127_ssa(127); got != 0 { fmt.Printf("sub_int8 127%s127 = %d, wanted 0\n", `-`, got) failed = true } if got := div_Neg128_int8_ssa(-128); got != 1 { fmt.Printf("div_int8 -128%s-128 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_Neg128_ssa(-128); got != 1 { fmt.Printf("div_int8 -128%s-128 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg128_int8_ssa(-127); got != 1 { fmt.Printf("div_int8 -128%s-127 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_Neg128_ssa(-127); got != 0 { fmt.Printf("div_int8 -127%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg128_int8_ssa(-1); got != -128 { fmt.Printf("div_int8 -128%s-1 = %d, wanted -128\n", `/`, got) failed = true } if got := div_int8_Neg128_ssa(-1); got != 0 { fmt.Printf("div_int8 -1%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_Neg128_ssa(0); got != 0 { fmt.Printf("div_int8 0%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg128_int8_ssa(1); got != -128 { fmt.Printf("div_int8 -128%s1 = %d, wanted -128\n", `/`, got) failed = true } if got := div_int8_Neg128_ssa(1); got != 0 { fmt.Printf("div_int8 1%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg128_int8_ssa(126); got != -1 { fmt.Printf("div_int8 -128%s126 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_Neg128_ssa(126); got != 0 { fmt.Printf("div_int8 126%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg128_int8_ssa(127); got != -1 { fmt.Printf("div_int8 -128%s127 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_Neg128_ssa(127); got != 0 { fmt.Printf("div_int8 127%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg127_int8_ssa(-128); got != 0 { fmt.Printf("div_int8 -127%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_Neg127_ssa(-128); got != 1 { fmt.Printf("div_int8 -128%s-127 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg127_int8_ssa(-127); got != 1 { fmt.Printf("div_int8 -127%s-127 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_Neg127_ssa(-127); got != 1 { fmt.Printf("div_int8 -127%s-127 = %d, wanted 1\n", `/`, got) failed = true } if got := div_Neg127_int8_ssa(-1); got != 127 { fmt.Printf("div_int8 -127%s-1 = %d, wanted 127\n", `/`, got) failed = true } if got := div_int8_Neg127_ssa(-1); got != 0 { fmt.Printf("div_int8 -1%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_Neg127_ssa(0); got != 0 { fmt.Printf("div_int8 0%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg127_int8_ssa(1); got != -127 { fmt.Printf("div_int8 -127%s1 = %d, wanted -127\n", `/`, got) failed = true } if got := div_int8_Neg127_ssa(1); got != 0 { fmt.Printf("div_int8 1%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg127_int8_ssa(126); got != -1 { fmt.Printf("div_int8 -127%s126 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_Neg127_ssa(126); got != 0 { fmt.Printf("div_int8 126%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg127_int8_ssa(127); got != -1 { fmt.Printf("div_int8 -127%s127 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_Neg127_ssa(127); got != -1 { fmt.Printf("div_int8 127%s-127 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg1_int8_ssa(-128); got != 0 { fmt.Printf("div_int8 -1%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_Neg1_ssa(-128); got != -128 { fmt.Printf("div_int8 -128%s-1 = %d, wanted -128\n", `/`, got) failed = true } if got := div_Neg1_int8_ssa(-127); got != 0 { fmt.Printf("div_int8 -1%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_Neg1_ssa(-127); got != 127 { fmt.Printf("div_int8 -127%s-1 = %d, wanted 127\n", `/`, got) failed = true } if got := div_Neg1_int8_ssa(-1); got != 1 { fmt.Printf("div_int8 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_Neg1_ssa(-1); got != 1 { fmt.Printf("div_int8 -1%s-1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_Neg1_ssa(0); got != 0 { fmt.Printf("div_int8 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_Neg1_int8_ssa(1); got != -1 { fmt.Printf("div_int8 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_Neg1_ssa(1); got != -1 { fmt.Printf("div_int8 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_Neg1_int8_ssa(126); got != 0 { fmt.Printf("div_int8 -1%s126 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_Neg1_ssa(126); got != -126 { fmt.Printf("div_int8 126%s-1 = %d, wanted -126\n", `/`, got) failed = true } if got := div_Neg1_int8_ssa(127); got != 0 { fmt.Printf("div_int8 -1%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_Neg1_ssa(127); got != -127 { fmt.Printf("div_int8 127%s-1 = %d, wanted -127\n", `/`, got) failed = true } if got := div_0_int8_ssa(-128); got != 0 { fmt.Printf("div_int8 0%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int8_ssa(-127); got != 0 { fmt.Printf("div_int8 0%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int8_ssa(-1); got != 0 { fmt.Printf("div_int8 0%s-1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int8_ssa(1); got != 0 { fmt.Printf("div_int8 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int8_ssa(126); got != 0 { fmt.Printf("div_int8 0%s126 = %d, wanted 0\n", `/`, got) failed = true } if got := div_0_int8_ssa(127); got != 0 { fmt.Printf("div_int8 0%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int8_ssa(-128); got != 0 { fmt.Printf("div_int8 1%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_1_ssa(-128); got != -128 { fmt.Printf("div_int8 -128%s1 = %d, wanted -128\n", `/`, got) failed = true } if got := div_1_int8_ssa(-127); got != 0 { fmt.Printf("div_int8 1%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_1_ssa(-127); got != -127 { fmt.Printf("div_int8 -127%s1 = %d, wanted -127\n", `/`, got) failed = true } if got := div_1_int8_ssa(-1); got != -1 { fmt.Printf("div_int8 1%s-1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_1_ssa(-1); got != -1 { fmt.Printf("div_int8 -1%s1 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_1_ssa(0); got != 0 { fmt.Printf("div_int8 0%s1 = %d, wanted 0\n", `/`, got) failed = true } if got := div_1_int8_ssa(1); got != 1 { fmt.Printf("div_int8 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_1_ssa(1); got != 1 { fmt.Printf("div_int8 1%s1 = %d, wanted 1\n", `/`, got) failed = true } if got := div_1_int8_ssa(126); got != 0 { fmt.Printf("div_int8 1%s126 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_1_ssa(126); got != 126 { fmt.Printf("div_int8 126%s1 = %d, wanted 126\n", `/`, got) failed = true } if got := div_1_int8_ssa(127); got != 0 { fmt.Printf("div_int8 1%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_1_ssa(127); got != 127 { fmt.Printf("div_int8 127%s1 = %d, wanted 127\n", `/`, got) failed = true } if got := div_126_int8_ssa(-128); got != 0 { fmt.Printf("div_int8 126%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_126_ssa(-128); got != -1 { fmt.Printf("div_int8 -128%s126 = %d, wanted -1\n", `/`, got) failed = true } if got := div_126_int8_ssa(-127); got != 0 { fmt.Printf("div_int8 126%s-127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_126_ssa(-127); got != -1 { fmt.Printf("div_int8 -127%s126 = %d, wanted -1\n", `/`, got) failed = true } if got := div_126_int8_ssa(-1); got != -126 { fmt.Printf("div_int8 126%s-1 = %d, wanted -126\n", `/`, got) failed = true } if got := div_int8_126_ssa(-1); got != 0 { fmt.Printf("div_int8 -1%s126 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_126_ssa(0); got != 0 { fmt.Printf("div_int8 0%s126 = %d, wanted 0\n", `/`, got) failed = true } if got := div_126_int8_ssa(1); got != 126 { fmt.Printf("div_int8 126%s1 = %d, wanted 126\n", `/`, got) failed = true } if got := div_int8_126_ssa(1); got != 0 { fmt.Printf("div_int8 1%s126 = %d, wanted 0\n", `/`, got) failed = true } if got := div_126_int8_ssa(126); got != 1 { fmt.Printf("div_int8 126%s126 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_126_ssa(126); got != 1 { fmt.Printf("div_int8 126%s126 = %d, wanted 1\n", `/`, got) failed = true } if got := div_126_int8_ssa(127); got != 0 { fmt.Printf("div_int8 126%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_126_ssa(127); got != 1 { fmt.Printf("div_int8 127%s126 = %d, wanted 1\n", `/`, got) failed = true } if got := div_127_int8_ssa(-128); got != 0 { fmt.Printf("div_int8 127%s-128 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_127_ssa(-128); got != -1 { fmt.Printf("div_int8 -128%s127 = %d, wanted -1\n", `/`, got) failed = true } if got := div_127_int8_ssa(-127); got != -1 { fmt.Printf("div_int8 127%s-127 = %d, wanted -1\n", `/`, got) failed = true } if got := div_int8_127_ssa(-127); got != -1 { fmt.Printf("div_int8 -127%s127 = %d, wanted -1\n", `/`, got) failed = true } if got := div_127_int8_ssa(-1); got != -127 { fmt.Printf("div_int8 127%s-1 = %d, wanted -127\n", `/`, got) failed = true } if got := div_int8_127_ssa(-1); got != 0 { fmt.Printf("div_int8 -1%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_int8_127_ssa(0); got != 0 { fmt.Printf("div_int8 0%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_127_int8_ssa(1); got != 127 { fmt.Printf("div_int8 127%s1 = %d, wanted 127\n", `/`, got) failed = true } if got := div_int8_127_ssa(1); got != 0 { fmt.Printf("div_int8 1%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_127_int8_ssa(126); got != 1 { fmt.Printf("div_int8 127%s126 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_127_ssa(126); got != 0 { fmt.Printf("div_int8 126%s127 = %d, wanted 0\n", `/`, got) failed = true } if got := div_127_int8_ssa(127); got != 1 { fmt.Printf("div_int8 127%s127 = %d, wanted 1\n", `/`, got) failed = true } if got := div_int8_127_ssa(127); got != 1 { fmt.Printf("div_int8 127%s127 = %d, wanted 1\n", `/`, got) failed = true } if got := mul_Neg128_int8_ssa(-128); got != 0 { fmt.Printf("mul_int8 -128%s-128 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_Neg128_ssa(-128); got != 0 { fmt.Printf("mul_int8 -128%s-128 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg128_int8_ssa(-127); got != -128 { fmt.Printf("mul_int8 -128%s-127 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_Neg128_ssa(-127); got != -128 { fmt.Printf("mul_int8 -127%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_Neg128_int8_ssa(-1); got != -128 { fmt.Printf("mul_int8 -128%s-1 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_Neg128_ssa(-1); got != -128 { fmt.Printf("mul_int8 -1%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_Neg128_int8_ssa(0); got != 0 { fmt.Printf("mul_int8 -128%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_Neg128_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s-128 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg128_int8_ssa(1); got != -128 { fmt.Printf("mul_int8 -128%s1 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_Neg128_ssa(1); got != -128 { fmt.Printf("mul_int8 1%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_Neg128_int8_ssa(126); got != 0 { fmt.Printf("mul_int8 -128%s126 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_Neg128_ssa(126); got != 0 { fmt.Printf("mul_int8 126%s-128 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg128_int8_ssa(127); got != -128 { fmt.Printf("mul_int8 -128%s127 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_Neg128_ssa(127); got != -128 { fmt.Printf("mul_int8 127%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_Neg127_int8_ssa(-128); got != -128 { fmt.Printf("mul_int8 -127%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_Neg127_ssa(-128); got != -128 { fmt.Printf("mul_int8 -128%s-127 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_Neg127_int8_ssa(-127); got != 1 { fmt.Printf("mul_int8 -127%s-127 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int8_Neg127_ssa(-127); got != 1 { fmt.Printf("mul_int8 -127%s-127 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg127_int8_ssa(-1); got != 127 { fmt.Printf("mul_int8 -127%s-1 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_int8_Neg127_ssa(-1); got != 127 { fmt.Printf("mul_int8 -1%s-127 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_Neg127_int8_ssa(0); got != 0 { fmt.Printf("mul_int8 -127%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_Neg127_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s-127 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg127_int8_ssa(1); got != -127 { fmt.Printf("mul_int8 -127%s1 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_int8_Neg127_ssa(1); got != -127 { fmt.Printf("mul_int8 1%s-127 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_Neg127_int8_ssa(126); got != 126 { fmt.Printf("mul_int8 -127%s126 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_int8_Neg127_ssa(126); got != 126 { fmt.Printf("mul_int8 126%s-127 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_Neg127_int8_ssa(127); got != -1 { fmt.Printf("mul_int8 -127%s127 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int8_Neg127_ssa(127); got != -1 { fmt.Printf("mul_int8 127%s-127 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg1_int8_ssa(-128); got != -128 { fmt.Printf("mul_int8 -1%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_Neg1_ssa(-128); got != -128 { fmt.Printf("mul_int8 -128%s-1 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_Neg1_int8_ssa(-127); got != 127 { fmt.Printf("mul_int8 -1%s-127 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_int8_Neg1_ssa(-127); got != 127 { fmt.Printf("mul_int8 -127%s-1 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_Neg1_int8_ssa(-1); got != 1 { fmt.Printf("mul_int8 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int8_Neg1_ssa(-1); got != 1 { fmt.Printf("mul_int8 -1%s-1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_Neg1_int8_ssa(0); got != 0 { fmt.Printf("mul_int8 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_Neg1_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_Neg1_int8_ssa(1); got != -1 { fmt.Printf("mul_int8 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int8_Neg1_ssa(1); got != -1 { fmt.Printf("mul_int8 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_Neg1_int8_ssa(126); got != -126 { fmt.Printf("mul_int8 -1%s126 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_int8_Neg1_ssa(126); got != -126 { fmt.Printf("mul_int8 126%s-1 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_Neg1_int8_ssa(127); got != -127 { fmt.Printf("mul_int8 -1%s127 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_int8_Neg1_ssa(127); got != -127 { fmt.Printf("mul_int8 127%s-1 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_0_int8_ssa(-128); got != 0 { fmt.Printf("mul_int8 0%s-128 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_0_ssa(-128); got != 0 { fmt.Printf("mul_int8 -128%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int8_ssa(-127); got != 0 { fmt.Printf("mul_int8 0%s-127 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_0_ssa(-127); got != 0 { fmt.Printf("mul_int8 -127%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int8_ssa(-1); got != 0 { fmt.Printf("mul_int8 0%s-1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_0_ssa(-1); got != 0 { fmt.Printf("mul_int8 -1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int8_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_0_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int8_ssa(1); got != 0 { fmt.Printf("mul_int8 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_0_ssa(1); got != 0 { fmt.Printf("mul_int8 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int8_ssa(126); got != 0 { fmt.Printf("mul_int8 0%s126 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_0_ssa(126); got != 0 { fmt.Printf("mul_int8 126%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_0_int8_ssa(127); got != 0 { fmt.Printf("mul_int8 0%s127 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_0_ssa(127); got != 0 { fmt.Printf("mul_int8 127%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int8_ssa(-128); got != -128 { fmt.Printf("mul_int8 1%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_1_ssa(-128); got != -128 { fmt.Printf("mul_int8 -128%s1 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_1_int8_ssa(-127); got != -127 { fmt.Printf("mul_int8 1%s-127 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_int8_1_ssa(-127); got != -127 { fmt.Printf("mul_int8 -127%s1 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_1_int8_ssa(-1); got != -1 { fmt.Printf("mul_int8 1%s-1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int8_1_ssa(-1); got != -1 { fmt.Printf("mul_int8 -1%s1 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_1_int8_ssa(0); got != 0 { fmt.Printf("mul_int8 1%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_1_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s1 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_1_int8_ssa(1); got != 1 { fmt.Printf("mul_int8 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int8_1_ssa(1); got != 1 { fmt.Printf("mul_int8 1%s1 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_1_int8_ssa(126); got != 126 { fmt.Printf("mul_int8 1%s126 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_int8_1_ssa(126); got != 126 { fmt.Printf("mul_int8 126%s1 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_1_int8_ssa(127); got != 127 { fmt.Printf("mul_int8 1%s127 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_int8_1_ssa(127); got != 127 { fmt.Printf("mul_int8 127%s1 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_126_int8_ssa(-128); got != 0 { fmt.Printf("mul_int8 126%s-128 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_126_ssa(-128); got != 0 { fmt.Printf("mul_int8 -128%s126 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_126_int8_ssa(-127); got != 126 { fmt.Printf("mul_int8 126%s-127 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_int8_126_ssa(-127); got != 126 { fmt.Printf("mul_int8 -127%s126 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_126_int8_ssa(-1); got != -126 { fmt.Printf("mul_int8 126%s-1 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_int8_126_ssa(-1); got != -126 { fmt.Printf("mul_int8 -1%s126 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_126_int8_ssa(0); got != 0 { fmt.Printf("mul_int8 126%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_126_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s126 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_126_int8_ssa(1); got != 126 { fmt.Printf("mul_int8 126%s1 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_int8_126_ssa(1); got != 126 { fmt.Printf("mul_int8 1%s126 = %d, wanted 126\n", `*`, got) failed = true } if got := mul_126_int8_ssa(126); got != 4 { fmt.Printf("mul_int8 126%s126 = %d, wanted 4\n", `*`, got) failed = true } if got := mul_int8_126_ssa(126); got != 4 { fmt.Printf("mul_int8 126%s126 = %d, wanted 4\n", `*`, got) failed = true } if got := mul_126_int8_ssa(127); got != -126 { fmt.Printf("mul_int8 126%s127 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_int8_126_ssa(127); got != -126 { fmt.Printf("mul_int8 127%s126 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_127_int8_ssa(-128); got != -128 { fmt.Printf("mul_int8 127%s-128 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_int8_127_ssa(-128); got != -128 { fmt.Printf("mul_int8 -128%s127 = %d, wanted -128\n", `*`, got) failed = true } if got := mul_127_int8_ssa(-127); got != -1 { fmt.Printf("mul_int8 127%s-127 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_int8_127_ssa(-127); got != -1 { fmt.Printf("mul_int8 -127%s127 = %d, wanted -1\n", `*`, got) failed = true } if got := mul_127_int8_ssa(-1); got != -127 { fmt.Printf("mul_int8 127%s-1 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_int8_127_ssa(-1); got != -127 { fmt.Printf("mul_int8 -1%s127 = %d, wanted -127\n", `*`, got) failed = true } if got := mul_127_int8_ssa(0); got != 0 { fmt.Printf("mul_int8 127%s0 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_int8_127_ssa(0); got != 0 { fmt.Printf("mul_int8 0%s127 = %d, wanted 0\n", `*`, got) failed = true } if got := mul_127_int8_ssa(1); got != 127 { fmt.Printf("mul_int8 127%s1 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_int8_127_ssa(1); got != 127 { fmt.Printf("mul_int8 1%s127 = %d, wanted 127\n", `*`, got) failed = true } if got := mul_127_int8_ssa(126); got != -126 { fmt.Printf("mul_int8 127%s126 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_int8_127_ssa(126); got != -126 { fmt.Printf("mul_int8 126%s127 = %d, wanted -126\n", `*`, got) failed = true } if got := mul_127_int8_ssa(127); got != 1 { fmt.Printf("mul_int8 127%s127 = %d, wanted 1\n", `*`, got) failed = true } if got := mul_int8_127_ssa(127); got != 1 { fmt.Printf("mul_int8 127%s127 = %d, wanted 1\n", `*`, got) failed = true } if got := mod_Neg128_int8_ssa(-128); got != 0 { fmt.Printf("mod_int8 -128%s-128 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg128_ssa(-128); got != 0 { fmt.Printf("mod_int8 -128%s-128 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg128_int8_ssa(-127); got != -1 { fmt.Printf("mod_int8 -128%s-127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg128_ssa(-127); got != -127 { fmt.Printf("mod_int8 -127%s-128 = %d, wanted -127\n", `%`, got) failed = true } if got := mod_Neg128_int8_ssa(-1); got != 0 { fmt.Printf("mod_int8 -128%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg128_ssa(-1); got != -1 { fmt.Printf("mod_int8 -1%s-128 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg128_ssa(0); got != 0 { fmt.Printf("mod_int8 0%s-128 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg128_int8_ssa(1); got != 0 { fmt.Printf("mod_int8 -128%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg128_ssa(1); got != 1 { fmt.Printf("mod_int8 1%s-128 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg128_int8_ssa(126); got != -2 { fmt.Printf("mod_int8 -128%s126 = %d, wanted -2\n", `%`, got) failed = true } if got := mod_int8_Neg128_ssa(126); got != 126 { fmt.Printf("mod_int8 126%s-128 = %d, wanted 126\n", `%`, got) failed = true } if got := mod_Neg128_int8_ssa(127); got != -1 { fmt.Printf("mod_int8 -128%s127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg128_ssa(127); got != 127 { fmt.Printf("mod_int8 127%s-128 = %d, wanted 127\n", `%`, got) failed = true } if got := mod_Neg127_int8_ssa(-128); got != -127 { fmt.Printf("mod_int8 -127%s-128 = %d, wanted -127\n", `%`, got) failed = true } if got := mod_int8_Neg127_ssa(-128); got != -1 { fmt.Printf("mod_int8 -128%s-127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_Neg127_int8_ssa(-127); got != 0 { fmt.Printf("mod_int8 -127%s-127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg127_ssa(-127); got != 0 { fmt.Printf("mod_int8 -127%s-127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg127_int8_ssa(-1); got != 0 { fmt.Printf("mod_int8 -127%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg127_ssa(-1); got != -1 { fmt.Printf("mod_int8 -1%s-127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg127_ssa(0); got != 0 { fmt.Printf("mod_int8 0%s-127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg127_int8_ssa(1); got != 0 { fmt.Printf("mod_int8 -127%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg127_ssa(1); got != 1 { fmt.Printf("mod_int8 1%s-127 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_Neg127_int8_ssa(126); got != -1 { fmt.Printf("mod_int8 -127%s126 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg127_ssa(126); got != 126 { fmt.Printf("mod_int8 126%s-127 = %d, wanted 126\n", `%`, got) failed = true } if got := mod_Neg127_int8_ssa(127); got != 0 { fmt.Printf("mod_int8 -127%s127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg127_ssa(127); got != 0 { fmt.Printf("mod_int8 127%s-127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int8_ssa(-128); got != -1 { fmt.Printf("mod_int8 -1%s-128 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg1_ssa(-128); got != 0 { fmt.Printf("mod_int8 -128%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int8_ssa(-127); got != -1 { fmt.Printf("mod_int8 -1%s-127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg1_ssa(-127); got != 0 { fmt.Printf("mod_int8 -127%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int8_ssa(-1); got != 0 { fmt.Printf("mod_int8 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg1_ssa(-1); got != 0 { fmt.Printf("mod_int8 -1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg1_ssa(0); got != 0 { fmt.Printf("mod_int8 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int8_ssa(1); got != 0 { fmt.Printf("mod_int8 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_Neg1_ssa(1); got != 0 { fmt.Printf("mod_int8 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int8_ssa(126); got != -1 { fmt.Printf("mod_int8 -1%s126 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg1_ssa(126); got != 0 { fmt.Printf("mod_int8 126%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_Neg1_int8_ssa(127); got != -1 { fmt.Printf("mod_int8 -1%s127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_Neg1_ssa(127); got != 0 { fmt.Printf("mod_int8 127%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int8_ssa(-128); got != 0 { fmt.Printf("mod_int8 0%s-128 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int8_ssa(-127); got != 0 { fmt.Printf("mod_int8 0%s-127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int8_ssa(-1); got != 0 { fmt.Printf("mod_int8 0%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int8_ssa(1); got != 0 { fmt.Printf("mod_int8 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int8_ssa(126); got != 0 { fmt.Printf("mod_int8 0%s126 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_0_int8_ssa(127); got != 0 { fmt.Printf("mod_int8 0%s127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int8_ssa(-128); got != 1 { fmt.Printf("mod_int8 1%s-128 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int8_1_ssa(-128); got != 0 { fmt.Printf("mod_int8 -128%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int8_ssa(-127); got != 1 { fmt.Printf("mod_int8 1%s-127 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int8_1_ssa(-127); got != 0 { fmt.Printf("mod_int8 -127%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int8_ssa(-1); got != 0 { fmt.Printf("mod_int8 1%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_1_ssa(-1); got != 0 { fmt.Printf("mod_int8 -1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_1_ssa(0); got != 0 { fmt.Printf("mod_int8 0%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int8_ssa(1); got != 0 { fmt.Printf("mod_int8 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_1_ssa(1); got != 0 { fmt.Printf("mod_int8 1%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int8_ssa(126); got != 1 { fmt.Printf("mod_int8 1%s126 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int8_1_ssa(126); got != 0 { fmt.Printf("mod_int8 126%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_1_int8_ssa(127); got != 1 { fmt.Printf("mod_int8 1%s127 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int8_1_ssa(127); got != 0 { fmt.Printf("mod_int8 127%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_126_int8_ssa(-128); got != 126 { fmt.Printf("mod_int8 126%s-128 = %d, wanted 126\n", `%`, got) failed = true } if got := mod_int8_126_ssa(-128); got != -2 { fmt.Printf("mod_int8 -128%s126 = %d, wanted -2\n", `%`, got) failed = true } if got := mod_126_int8_ssa(-127); got != 126 { fmt.Printf("mod_int8 126%s-127 = %d, wanted 126\n", `%`, got) failed = true } if got := mod_int8_126_ssa(-127); got != -1 { fmt.Printf("mod_int8 -127%s126 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_126_int8_ssa(-1); got != 0 { fmt.Printf("mod_int8 126%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_126_ssa(-1); got != -1 { fmt.Printf("mod_int8 -1%s126 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_126_ssa(0); got != 0 { fmt.Printf("mod_int8 0%s126 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_126_int8_ssa(1); got != 0 { fmt.Printf("mod_int8 126%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_126_ssa(1); got != 1 { fmt.Printf("mod_int8 1%s126 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_126_int8_ssa(126); got != 0 { fmt.Printf("mod_int8 126%s126 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_126_ssa(126); got != 0 { fmt.Printf("mod_int8 126%s126 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_126_int8_ssa(127); got != 126 { fmt.Printf("mod_int8 126%s127 = %d, wanted 126\n", `%`, got) failed = true } if got := mod_int8_126_ssa(127); got != 1 { fmt.Printf("mod_int8 127%s126 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_127_int8_ssa(-128); got != 127 { fmt.Printf("mod_int8 127%s-128 = %d, wanted 127\n", `%`, got) failed = true } if got := mod_int8_127_ssa(-128); got != -1 { fmt.Printf("mod_int8 -128%s127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_127_int8_ssa(-127); got != 0 { fmt.Printf("mod_int8 127%s-127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_127_ssa(-127); got != 0 { fmt.Printf("mod_int8 -127%s127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_127_int8_ssa(-1); got != 0 { fmt.Printf("mod_int8 127%s-1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_127_ssa(-1); got != -1 { fmt.Printf("mod_int8 -1%s127 = %d, wanted -1\n", `%`, got) failed = true } if got := mod_int8_127_ssa(0); got != 0 { fmt.Printf("mod_int8 0%s127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_127_int8_ssa(1); got != 0 { fmt.Printf("mod_int8 127%s1 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_127_ssa(1); got != 1 { fmt.Printf("mod_int8 1%s127 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_127_int8_ssa(126); got != 1 { fmt.Printf("mod_int8 127%s126 = %d, wanted 1\n", `%`, got) failed = true } if got := mod_int8_127_ssa(126); got != 126 { fmt.Printf("mod_int8 126%s127 = %d, wanted 126\n", `%`, got) failed = true } if got := mod_127_int8_ssa(127); got != 0 { fmt.Printf("mod_int8 127%s127 = %d, wanted 0\n", `%`, got) failed = true } if got := mod_int8_127_ssa(127); got != 0 { fmt.Printf("mod_int8 127%s127 = %d, wanted 0\n", `%`, got) failed = true } if failed { panic("tests failed") } } ================================================ FILE: tests/data/pass/hello.go ================================================ // GOAL: parse, compile, run, assert output == "Hello, rgo". package main import "fmt" func main() { fmt.Println("Hello, rgo") } ================================================ FILE: tests/data/pass/precedence.go ================================================ package main func main() { // Equals 97. a := 45 + 52 // Next line equivalent to: (23%45) + (21/45) + 5 - ((2<<3)*6)&5 // Equals 28. b := 23%45 + 21/45 + 5 - 2<<3*6&5 } ================================================ FILE: tests/data/pass/rewriteAMD64.go ================================================ // autogenerated from gen/AMD64.rules: do not edit! // generated with: cd gen; go run *.go package ssa import "math" var _ = math.MinInt8 // in case not otherwise used func rewriteValueAMD64(v *Value, config *Config) bool { switch v.Op { case OpAMD64ADDB: return rewriteValueAMD64_OpAMD64ADDB(v, config) case OpAMD64ADDBconst: return rewriteValueAMD64_OpAMD64ADDBconst(v, config) case OpAMD64ADDL: return rewriteValueAMD64_OpAMD64ADDL(v, config) case OpAMD64ADDLconst: return rewriteValueAMD64_OpAMD64ADDLconst(v, config) case OpAMD64ADDQ: return rewriteValueAMD64_OpAMD64ADDQ(v, config) case OpAMD64ADDQconst: return rewriteValueAMD64_OpAMD64ADDQconst(v, config) case OpAMD64ADDW: return rewriteValueAMD64_OpAMD64ADDW(v, config) case OpAMD64ADDWconst: return rewriteValueAMD64_OpAMD64ADDWconst(v, config) case OpAMD64ANDB: return rewriteValueAMD64_OpAMD64ANDB(v, config) case OpAMD64ANDBconst: return rewriteValueAMD64_OpAMD64ANDBconst(v, config) case OpAMD64ANDL: return rewriteValueAMD64_OpAMD64ANDL(v, config) case OpAMD64ANDLconst: return rewriteValueAMD64_OpAMD64ANDLconst(v, config) case OpAMD64ANDQ: return rewriteValueAMD64_OpAMD64ANDQ(v, config) case OpAMD64ANDQconst: return rewriteValueAMD64_OpAMD64ANDQconst(v, config) case OpAMD64ANDW: return rewriteValueAMD64_OpAMD64ANDW(v, config) case OpAMD64ANDWconst: return rewriteValueAMD64_OpAMD64ANDWconst(v, config) case OpAdd16: return rewriteValueAMD64_OpAdd16(v, config) case OpAdd32: return rewriteValueAMD64_OpAdd32(v, config) case OpAdd32F: return rewriteValueAMD64_OpAdd32F(v, config) case OpAdd64: return rewriteValueAMD64_OpAdd64(v, config) case OpAdd64F: return rewriteValueAMD64_OpAdd64F(v, config) case OpAdd8: return rewriteValueAMD64_OpAdd8(v, config) case OpAddPtr: return rewriteValueAMD64_OpAddPtr(v, config) case OpAddr: return rewriteValueAMD64_OpAddr(v, config) case OpAnd16: return rewriteValueAMD64_OpAnd16(v, config) case OpAnd32: return rewriteValueAMD64_OpAnd32(v, config) case OpAnd64: return rewriteValueAMD64_OpAnd64(v, config) case OpAnd8: return rewriteValueAMD64_OpAnd8(v, config) case OpAvg64u: return rewriteValueAMD64_OpAvg64u(v, config) case OpBswap32: return rewriteValueAMD64_OpBswap32(v, config) case OpBswap64: return rewriteValueAMD64_OpBswap64(v, config) case OpAMD64CMOVLEQconst: return rewriteValueAMD64_OpAMD64CMOVLEQconst(v, config) case OpAMD64CMOVQEQconst: return rewriteValueAMD64_OpAMD64CMOVQEQconst(v, config) case OpAMD64CMOVWEQconst: return rewriteValueAMD64_OpAMD64CMOVWEQconst(v, config) case OpAMD64CMPB: return rewriteValueAMD64_OpAMD64CMPB(v, config) case OpAMD64CMPBconst: return rewriteValueAMD64_OpAMD64CMPBconst(v, config) case OpAMD64CMPL: return rewriteValueAMD64_OpAMD64CMPL(v, config) case OpAMD64CMPLconst: return rewriteValueAMD64_OpAMD64CMPLconst(v, config) case OpAMD64CMPQ: return rewriteValueAMD64_OpAMD64CMPQ(v, config) case OpAMD64CMPQconst: return rewriteValueAMD64_OpAMD64CMPQconst(v, config) case OpAMD64CMPW: return rewriteValueAMD64_OpAMD64CMPW(v, config) case OpAMD64CMPWconst: return rewriteValueAMD64_OpAMD64CMPWconst(v, config) case OpClosureCall: return rewriteValueAMD64_OpClosureCall(v, config) case OpCom16: return rewriteValueAMD64_OpCom16(v, config) case OpCom32: return rewriteValueAMD64_OpCom32(v, config) case OpCom64: return rewriteValueAMD64_OpCom64(v, config) case OpCom8: return rewriteValueAMD64_OpCom8(v, config) case OpConst16: return rewriteValueAMD64_OpConst16(v, config) case OpConst32: return rewriteValueAMD64_OpConst32(v, config) case OpConst32F: return rewriteValueAMD64_OpConst32F(v, config) case OpConst64: return rewriteValueAMD64_OpConst64(v, config) case OpConst64F: return rewriteValueAMD64_OpConst64F(v, config) case OpConst8: return rewriteValueAMD64_OpConst8(v, config) case OpConstBool: return rewriteValueAMD64_OpConstBool(v, config) case OpConstNil: return rewriteValueAMD64_OpConstNil(v, config) case OpConvert: return rewriteValueAMD64_OpConvert(v, config) case OpCtz16: return rewriteValueAMD64_OpCtz16(v, config) case OpCtz32: return rewriteValueAMD64_OpCtz32(v, config) case OpCtz64: return rewriteValueAMD64_OpCtz64(v, config) case OpCvt32Fto32: return rewriteValueAMD64_OpCvt32Fto32(v, config) case OpCvt32Fto64: return rewriteValueAMD64_OpCvt32Fto64(v, config) case OpCvt32Fto64F: return rewriteValueAMD64_OpCvt32Fto64F(v, config) case OpCvt32to32F: return rewriteValueAMD64_OpCvt32to32F(v, config) case OpCvt32to64F: return rewriteValueAMD64_OpCvt32to64F(v, config) case OpCvt64Fto32: return rewriteValueAMD64_OpCvt64Fto32(v, config) case OpCvt64Fto32F: return rewriteValueAMD64_OpCvt64Fto32F(v, config) case OpCvt64Fto64: return rewriteValueAMD64_OpCvt64Fto64(v, config) case OpCvt64to32F: return rewriteValueAMD64_OpCvt64to32F(v, config) case OpCvt64to64F: return rewriteValueAMD64_OpCvt64to64F(v, config) case OpDeferCall: return rewriteValueAMD64_OpDeferCall(v, config) case OpDiv16: return rewriteValueAMD64_OpDiv16(v, config) case OpDiv16u: return rewriteValueAMD64_OpDiv16u(v, config) case OpDiv32: return rewriteValueAMD64_OpDiv32(v, config) case OpDiv32F: return rewriteValueAMD64_OpDiv32F(v, config) case OpDiv32u: return rewriteValueAMD64_OpDiv32u(v, config) case OpDiv64: return rewriteValueAMD64_OpDiv64(v, config) case OpDiv64F: return rewriteValueAMD64_OpDiv64F(v, config) case OpDiv64u: return rewriteValueAMD64_OpDiv64u(v, config) case OpDiv8: return rewriteValueAMD64_OpDiv8(v, config) case OpDiv8u: return rewriteValueAMD64_OpDiv8u(v, config) case OpEq16: return rewriteValueAMD64_OpEq16(v, config) case OpEq32: return rewriteValueAMD64_OpEq32(v, config) case OpEq32F: return rewriteValueAMD64_OpEq32F(v, config) case OpEq64: return rewriteValueAMD64_OpEq64(v, config) case OpEq64F: return rewriteValueAMD64_OpEq64F(v, config) case OpEq8: return rewriteValueAMD64_OpEq8(v, config) case OpEqPtr: return rewriteValueAMD64_OpEqPtr(v, config) case OpGeq16: return rewriteValueAMD64_OpGeq16(v, config) case OpGeq16U: return rewriteValueAMD64_OpGeq16U(v, config) case OpGeq32: return rewriteValueAMD64_OpGeq32(v, config) case OpGeq32F: return rewriteValueAMD64_OpGeq32F(v, config) case OpGeq32U: return rewriteValueAMD64_OpGeq32U(v, config) case OpGeq64: return rewriteValueAMD64_OpGeq64(v, config) case OpGeq64F: return rewriteValueAMD64_OpGeq64F(v, config) case OpGeq64U: return rewriteValueAMD64_OpGeq64U(v, config) case OpGeq8: return rewriteValueAMD64_OpGeq8(v, config) case OpGeq8U: return rewriteValueAMD64_OpGeq8U(v, config) case OpGetClosurePtr: return rewriteValueAMD64_OpGetClosurePtr(v, config) case OpGetG: return rewriteValueAMD64_OpGetG(v, config) case OpGoCall: return rewriteValueAMD64_OpGoCall(v, config) case OpGreater16: return rewriteValueAMD64_OpGreater16(v, config) case OpGreater16U: return rewriteValueAMD64_OpGreater16U(v, config) case OpGreater32: return rewriteValueAMD64_OpGreater32(v, config) case OpGreater32F: return rewriteValueAMD64_OpGreater32F(v, config) case OpGreater32U: return rewriteValueAMD64_OpGreater32U(v, config) case OpGreater64: return rewriteValueAMD64_OpGreater64(v, config) case OpGreater64F: return rewriteValueAMD64_OpGreater64F(v, config) case OpGreater64U: return rewriteValueAMD64_OpGreater64U(v, config) case OpGreater8: return rewriteValueAMD64_OpGreater8(v, config) case OpGreater8U: return rewriteValueAMD64_OpGreater8U(v, config) case OpHmul16: return rewriteValueAMD64_OpHmul16(v, config) case OpHmul16u: return rewriteValueAMD64_OpHmul16u(v, config) case OpHmul32: return rewriteValueAMD64_OpHmul32(v, config) case OpHmul32u: return rewriteValueAMD64_OpHmul32u(v, config) case OpHmul64: return rewriteValueAMD64_OpHmul64(v, config) case OpHmul64u: return rewriteValueAMD64_OpHmul64u(v, config) case OpHmul8: return rewriteValueAMD64_OpHmul8(v, config) case OpHmul8u: return rewriteValueAMD64_OpHmul8u(v, config) case OpITab: return rewriteValueAMD64_OpITab(v, config) case OpInterCall: return rewriteValueAMD64_OpInterCall(v, config) case OpIsInBounds: return rewriteValueAMD64_OpIsInBounds(v, config) case OpIsNonNil: return rewriteValueAMD64_OpIsNonNil(v, config) case OpIsSliceInBounds: return rewriteValueAMD64_OpIsSliceInBounds(v, config) case OpAMD64LEAQ: return rewriteValueAMD64_OpAMD64LEAQ(v, config) case OpAMD64LEAQ1: return rewriteValueAMD64_OpAMD64LEAQ1(v, config) case OpAMD64LEAQ2: return rewriteValueAMD64_OpAMD64LEAQ2(v, config) case OpAMD64LEAQ4: return rewriteValueAMD64_OpAMD64LEAQ4(v, config) case OpAMD64LEAQ8: return rewriteValueAMD64_OpAMD64LEAQ8(v, config) case OpLeq16: return rewriteValueAMD64_OpLeq16(v, config) case OpLeq16U: return rewriteValueAMD64_OpLeq16U(v, config) case OpLeq32: return rewriteValueAMD64_OpLeq32(v, config) case OpLeq32F: return rewriteValueAMD64_OpLeq32F(v, config) case OpLeq32U: return rewriteValueAMD64_OpLeq32U(v, config) case OpLeq64: return rewriteValueAMD64_OpLeq64(v, config) case OpLeq64F: return rewriteValueAMD64_OpLeq64F(v, config) case OpLeq64U: return rewriteValueAMD64_OpLeq64U(v, config) case OpLeq8: return rewriteValueAMD64_OpLeq8(v, config) case OpLeq8U: return rewriteValueAMD64_OpLeq8U(v, config) case OpLess16: return rewriteValueAMD64_OpLess16(v, config) case OpLess16U: return rewriteValueAMD64_OpLess16U(v, config) case OpLess32: return rewriteValueAMD64_OpLess32(v, config) case OpLess32F: return rewriteValueAMD64_OpLess32F(v, config) case OpLess32U: return rewriteValueAMD64_OpLess32U(v, config) case OpLess64: return rewriteValueAMD64_OpLess64(v, config) case OpLess64F: return rewriteValueAMD64_OpLess64F(v, config) case OpLess64U: return rewriteValueAMD64_OpLess64U(v, config) case OpLess8: return rewriteValueAMD64_OpLess8(v, config) case OpLess8U: return rewriteValueAMD64_OpLess8U(v, config) case OpLoad: return rewriteValueAMD64_OpLoad(v, config) case OpLrot16: return rewriteValueAMD64_OpLrot16(v, config) case OpLrot32: return rewriteValueAMD64_OpLrot32(v, config) case OpLrot64: return rewriteValueAMD64_OpLrot64(v, config) case OpLrot8: return rewriteValueAMD64_OpLrot8(v, config) case OpLsh16x16: return rewriteValueAMD64_OpLsh16x16(v, config) case OpLsh16x32: return rewriteValueAMD64_OpLsh16x32(v, config) case OpLsh16x64: return rewriteValueAMD64_OpLsh16x64(v, config) case OpLsh16x8: return rewriteValueAMD64_OpLsh16x8(v, config) case OpLsh32x16: return rewriteValueAMD64_OpLsh32x16(v, config) case OpLsh32x32: return rewriteValueAMD64_OpLsh32x32(v, config) case OpLsh32x64: return rewriteValueAMD64_OpLsh32x64(v, config) case OpLsh32x8: return rewriteValueAMD64_OpLsh32x8(v, config) case OpLsh64x16: return rewriteValueAMD64_OpLsh64x16(v, config) case OpLsh64x32: return rewriteValueAMD64_OpLsh64x32(v, config) case OpLsh64x64: return rewriteValueAMD64_OpLsh64x64(v, config) case OpLsh64x8: return rewriteValueAMD64_OpLsh64x8(v, config) case OpLsh8x16: return rewriteValueAMD64_OpLsh8x16(v, config) case OpLsh8x32: return rewriteValueAMD64_OpLsh8x32(v, config) case OpLsh8x64: return rewriteValueAMD64_OpLsh8x64(v, config) case OpLsh8x8: return rewriteValueAMD64_OpLsh8x8(v, config) case OpAMD64MOVBQSX: return rewriteValueAMD64_OpAMD64MOVBQSX(v, config) case OpAMD64MOVBQSXload: return rewriteValueAMD64_OpAMD64MOVBQSXload(v, config) case OpAMD64MOVBQZX: return rewriteValueAMD64_OpAMD64MOVBQZX(v, config) case OpAMD64MOVBload: return rewriteValueAMD64_OpAMD64MOVBload(v, config) case OpAMD64MOVBloadidx1: return rewriteValueAMD64_OpAMD64MOVBloadidx1(v, config) case OpAMD64MOVBstore: return rewriteValueAMD64_OpAMD64MOVBstore(v, config) case OpAMD64MOVBstoreconst: return rewriteValueAMD64_OpAMD64MOVBstoreconst(v, config) case OpAMD64MOVBstoreconstidx1: return rewriteValueAMD64_OpAMD64MOVBstoreconstidx1(v, config) case OpAMD64MOVBstoreidx1: return rewriteValueAMD64_OpAMD64MOVBstoreidx1(v, config) case OpAMD64MOVLQSX: return rewriteValueAMD64_OpAMD64MOVLQSX(v, config) case OpAMD64MOVLQSXload: return rewriteValueAMD64_OpAMD64MOVLQSXload(v, config) case OpAMD64MOVLQZX: return rewriteValueAMD64_OpAMD64MOVLQZX(v, config) case OpAMD64MOVLload: return rewriteValueAMD64_OpAMD64MOVLload(v, config) case OpAMD64MOVLloadidx1: return rewriteValueAMD64_OpAMD64MOVLloadidx1(v, config) case OpAMD64MOVLloadidx4: return rewriteValueAMD64_OpAMD64MOVLloadidx4(v, config) case OpAMD64MOVLstore: return rewriteValueAMD64_OpAMD64MOVLstore(v, config) case OpAMD64MOVLstoreconst: return rewriteValueAMD64_OpAMD64MOVLstoreconst(v, config) case OpAMD64MOVLstoreconstidx1: return rewriteValueAMD64_OpAMD64MOVLstoreconstidx1(v, config) case OpAMD64MOVLstoreconstidx4: return rewriteValueAMD64_OpAMD64MOVLstoreconstidx4(v, config) case OpAMD64MOVLstoreidx1: return rewriteValueAMD64_OpAMD64MOVLstoreidx1(v, config) case OpAMD64MOVLstoreidx4: return rewriteValueAMD64_OpAMD64MOVLstoreidx4(v, config) case OpAMD64MOVOload: return rewriteValueAMD64_OpAMD64MOVOload(v, config) case OpAMD64MOVOstore: return rewriteValueAMD64_OpAMD64MOVOstore(v, config) case OpAMD64MOVQload: return rewriteValueAMD64_OpAMD64MOVQload(v, config) case OpAMD64MOVQloadidx1: return rewriteValueAMD64_OpAMD64MOVQloadidx1(v, config) case OpAMD64MOVQloadidx8: return rewriteValueAMD64_OpAMD64MOVQloadidx8(v, config) case OpAMD64MOVQstore: return rewriteValueAMD64_OpAMD64MOVQstore(v, config) case OpAMD64MOVQstoreconst: return rewriteValueAMD64_OpAMD64MOVQstoreconst(v, config) case OpAMD64MOVQstoreconstidx1: return rewriteValueAMD64_OpAMD64MOVQstoreconstidx1(v, config) case OpAMD64MOVQstoreconstidx8: return rewriteValueAMD64_OpAMD64MOVQstoreconstidx8(v, config) case OpAMD64MOVQstoreidx1: return rewriteValueAMD64_OpAMD64MOVQstoreidx1(v, config) case OpAMD64MOVQstoreidx8: return rewriteValueAMD64_OpAMD64MOVQstoreidx8(v, config) case OpAMD64MOVSDload: return rewriteValueAMD64_OpAMD64MOVSDload(v, config) case OpAMD64MOVSDloadidx1: return rewriteValueAMD64_OpAMD64MOVSDloadidx1(v, config) case OpAMD64MOVSDloadidx8: return rewriteValueAMD64_OpAMD64MOVSDloadidx8(v, config) case OpAMD64MOVSDstore: return rewriteValueAMD64_OpAMD64MOVSDstore(v, config) case OpAMD64MOVSDstoreidx1: return rewriteValueAMD64_OpAMD64MOVSDstoreidx1(v, config) case OpAMD64MOVSDstoreidx8: return rewriteValueAMD64_OpAMD64MOVSDstoreidx8(v, config) case OpAMD64MOVSSload: return rewriteValueAMD64_OpAMD64MOVSSload(v, config) case OpAMD64MOVSSloadidx1: return rewriteValueAMD64_OpAMD64MOVSSloadidx1(v, config) case OpAMD64MOVSSloadidx4: return rewriteValueAMD64_OpAMD64MOVSSloadidx4(v, config) case OpAMD64MOVSSstore: return rewriteValueAMD64_OpAMD64MOVSSstore(v, config) case OpAMD64MOVSSstoreidx1: return rewriteValueAMD64_OpAMD64MOVSSstoreidx1(v, config) case OpAMD64MOVSSstoreidx4: return rewriteValueAMD64_OpAMD64MOVSSstoreidx4(v, config) case OpAMD64MOVWQSX: return rewriteValueAMD64_OpAMD64MOVWQSX(v, config) case OpAMD64MOVWQSXload: return rewriteValueAMD64_OpAMD64MOVWQSXload(v, config) case OpAMD64MOVWQZX: return rewriteValueAMD64_OpAMD64MOVWQZX(v, config) case OpAMD64MOVWload: return rewriteValueAMD64_OpAMD64MOVWload(v, config) case OpAMD64MOVWloadidx1: return rewriteValueAMD64_OpAMD64MOVWloadidx1(v, config) case OpAMD64MOVWloadidx2: return rewriteValueAMD64_OpAMD64MOVWloadidx2(v, config) case OpAMD64MOVWstore: return rewriteValueAMD64_OpAMD64MOVWstore(v, config) case OpAMD64MOVWstoreconst: return rewriteValueAMD64_OpAMD64MOVWstoreconst(v, config) case OpAMD64MOVWstoreconstidx1: return rewriteValueAMD64_OpAMD64MOVWstoreconstidx1(v, config) case OpAMD64MOVWstoreconstidx2: return rewriteValueAMD64_OpAMD64MOVWstoreconstidx2(v, config) case OpAMD64MOVWstoreidx1: return rewriteValueAMD64_OpAMD64MOVWstoreidx1(v, config) case OpAMD64MOVWstoreidx2: return rewriteValueAMD64_OpAMD64MOVWstoreidx2(v, config) case OpAMD64MULB: return rewriteValueAMD64_OpAMD64MULB(v, config) case OpAMD64MULBconst: return rewriteValueAMD64_OpAMD64MULBconst(v, config) case OpAMD64MULL: return rewriteValueAMD64_OpAMD64MULL(v, config) case OpAMD64MULLconst: return rewriteValueAMD64_OpAMD64MULLconst(v, config) case OpAMD64MULQ: return rewriteValueAMD64_OpAMD64MULQ(v, config) case OpAMD64MULQconst: return rewriteValueAMD64_OpAMD64MULQconst(v, config) case OpAMD64MULW: return rewriteValueAMD64_OpAMD64MULW(v, config) case OpAMD64MULWconst: return rewriteValueAMD64_OpAMD64MULWconst(v, config) case OpMod16: return rewriteValueAMD64_OpMod16(v, config) case OpMod16u: return rewriteValueAMD64_OpMod16u(v, config) case OpMod32: return rewriteValueAMD64_OpMod32(v, config) case OpMod32u: return rewriteValueAMD64_OpMod32u(v, config) case OpMod64: return rewriteValueAMD64_OpMod64(v, config) case OpMod64u: return rewriteValueAMD64_OpMod64u(v, config) case OpMod8: return rewriteValueAMD64_OpMod8(v, config) case OpMod8u: return rewriteValueAMD64_OpMod8u(v, config) case OpMove: return rewriteValueAMD64_OpMove(v, config) case OpMul16: return rewriteValueAMD64_OpMul16(v, config) case OpMul32: return rewriteValueAMD64_OpMul32(v, config) case OpMul32F: return rewriteValueAMD64_OpMul32F(v, config) case OpMul64: return rewriteValueAMD64_OpMul64(v, config) case OpMul64F: return rewriteValueAMD64_OpMul64F(v, config) case OpMul8: return rewriteValueAMD64_OpMul8(v, config) case OpAMD64NEGB: return rewriteValueAMD64_OpAMD64NEGB(v, config) case OpAMD64NEGL: return rewriteValueAMD64_OpAMD64NEGL(v, config) case OpAMD64NEGQ: return rewriteValueAMD64_OpAMD64NEGQ(v, config) case OpAMD64NEGW: return rewriteValueAMD64_OpAMD64NEGW(v, config) case OpAMD64NOTB: return rewriteValueAMD64_OpAMD64NOTB(v, config) case OpAMD64NOTL: return rewriteValueAMD64_OpAMD64NOTL(v, config) case OpAMD64NOTQ: return rewriteValueAMD64_OpAMD64NOTQ(v, config) case OpAMD64NOTW: return rewriteValueAMD64_OpAMD64NOTW(v, config) case OpNeg16: return rewriteValueAMD64_OpNeg16(v, config) case OpNeg32: return rewriteValueAMD64_OpNeg32(v, config) case OpNeg32F: return rewriteValueAMD64_OpNeg32F(v, config) case OpNeg64: return rewriteValueAMD64_OpNeg64(v, config) case OpNeg64F: return rewriteValueAMD64_OpNeg64F(v, config) case OpNeg8: return rewriteValueAMD64_OpNeg8(v, config) case OpNeq16: return rewriteValueAMD64_OpNeq16(v, config) case OpNeq32: return rewriteValueAMD64_OpNeq32(v, config) case OpNeq32F: return rewriteValueAMD64_OpNeq32F(v, config) case OpNeq64: return rewriteValueAMD64_OpNeq64(v, config) case OpNeq64F: return rewriteValueAMD64_OpNeq64F(v, config) case OpNeq8: return rewriteValueAMD64_OpNeq8(v, config) case OpNeqPtr: return rewriteValueAMD64_OpNeqPtr(v, config) case OpNilCheck: return rewriteValueAMD64_OpNilCheck(v, config) case OpNot: return rewriteValueAMD64_OpNot(v, config) case OpAMD64ORB: return rewriteValueAMD64_OpAMD64ORB(v, config) case OpAMD64ORBconst: return rewriteValueAMD64_OpAMD64ORBconst(v, config) case OpAMD64ORL: return rewriteValueAMD64_OpAMD64ORL(v, config) case OpAMD64ORLconst: return rewriteValueAMD64_OpAMD64ORLconst(v, config) case OpAMD64ORQ: return rewriteValueAMD64_OpAMD64ORQ(v, config) case OpAMD64ORQconst: return rewriteValueAMD64_OpAMD64ORQconst(v, config) case OpAMD64ORW: return rewriteValueAMD64_OpAMD64ORW(v, config) case OpAMD64ORWconst: return rewriteValueAMD64_OpAMD64ORWconst(v, config) case OpOffPtr: return rewriteValueAMD64_OpOffPtr(v, config) case OpOr16: return rewriteValueAMD64_OpOr16(v, config) case OpOr32: return rewriteValueAMD64_OpOr32(v, config) case OpOr64: return rewriteValueAMD64_OpOr64(v, config) case OpOr8: return rewriteValueAMD64_OpOr8(v, config) case OpRsh16Ux16: return rewriteValueAMD64_OpRsh16Ux16(v, config) case OpRsh16Ux32: return rewriteValueAMD64_OpRsh16Ux32(v, config) case OpRsh16Ux64: return rewriteValueAMD64_OpRsh16Ux64(v, config) case OpRsh16Ux8: return rewriteValueAMD64_OpRsh16Ux8(v, config) case OpRsh16x16: return rewriteValueAMD64_OpRsh16x16(v, config) case OpRsh16x32: return rewriteValueAMD64_OpRsh16x32(v, config) case OpRsh16x64: return rewriteValueAMD64_OpRsh16x64(v, config) case OpRsh16x8: return rewriteValueAMD64_OpRsh16x8(v, config) case OpRsh32Ux16: return rewriteValueAMD64_OpRsh32Ux16(v, config) case OpRsh32Ux32: return rewriteValueAMD64_OpRsh32Ux32(v, config) case OpRsh32Ux64: return rewriteValueAMD64_OpRsh32Ux64(v, config) case OpRsh32Ux8: return rewriteValueAMD64_OpRsh32Ux8(v, config) case OpRsh32x16: return rewriteValueAMD64_OpRsh32x16(v, config) case OpRsh32x32: return rewriteValueAMD64_OpRsh32x32(v, config) case OpRsh32x64: return rewriteValueAMD64_OpRsh32x64(v, config) case OpRsh32x8: return rewriteValueAMD64_OpRsh32x8(v, config) case OpRsh64Ux16: return rewriteValueAMD64_OpRsh64Ux16(v, config) case OpRsh64Ux32: return rewriteValueAMD64_OpRsh64Ux32(v, config) case OpRsh64Ux64: return rewriteValueAMD64_OpRsh64Ux64(v, config) case OpRsh64Ux8: return rewriteValueAMD64_OpRsh64Ux8(v, config) case OpRsh64x16: return rewriteValueAMD64_OpRsh64x16(v, config) case OpRsh64x32: return rewriteValueAMD64_OpRsh64x32(v, config) case OpRsh64x64: return rewriteValueAMD64_OpRsh64x64(v, config) case OpRsh64x8: return rewriteValueAMD64_OpRsh64x8(v, config) case OpRsh8Ux16: return rewriteValueAMD64_OpRsh8Ux16(v, config) case OpRsh8Ux32: return rewriteValueAMD64_OpRsh8Ux32(v, config) case OpRsh8Ux64: return rewriteValueAMD64_OpRsh8Ux64(v, config) case OpRsh8Ux8: return rewriteValueAMD64_OpRsh8Ux8(v, config) case OpRsh8x16: return rewriteValueAMD64_OpRsh8x16(v, config) case OpRsh8x32: return rewriteValueAMD64_OpRsh8x32(v, config) case OpRsh8x64: return rewriteValueAMD64_OpRsh8x64(v, config) case OpRsh8x8: return rewriteValueAMD64_OpRsh8x8(v, config) case OpAMD64SARB: return rewriteValueAMD64_OpAMD64SARB(v, config) case OpAMD64SARBconst: return rewriteValueAMD64_OpAMD64SARBconst(v, config) case OpAMD64SARL: return rewriteValueAMD64_OpAMD64SARL(v, config) case OpAMD64SARLconst: return rewriteValueAMD64_OpAMD64SARLconst(v, config) case OpAMD64SARQ: return rewriteValueAMD64_OpAMD64SARQ(v, config) case OpAMD64SARQconst: return rewriteValueAMD64_OpAMD64SARQconst(v, config) case OpAMD64SARW: return rewriteValueAMD64_OpAMD64SARW(v, config) case OpAMD64SARWconst: return rewriteValueAMD64_OpAMD64SARWconst(v, config) case OpAMD64SBBLcarrymask: return rewriteValueAMD64_OpAMD64SBBLcarrymask(v, config) case OpAMD64SBBQcarrymask: return rewriteValueAMD64_OpAMD64SBBQcarrymask(v, config) case OpAMD64SETA: return rewriteValueAMD64_OpAMD64SETA(v, config) case OpAMD64SETAE: return rewriteValueAMD64_OpAMD64SETAE(v, config) case OpAMD64SETB: return rewriteValueAMD64_OpAMD64SETB(v, config) case OpAMD64SETBE: return rewriteValueAMD64_OpAMD64SETBE(v, config) case OpAMD64SETEQ: return rewriteValueAMD64_OpAMD64SETEQ(v, config) case OpAMD64SETG: return rewriteValueAMD64_OpAMD64SETG(v, config) case OpAMD64SETGE: return rewriteValueAMD64_OpAMD64SETGE(v, config) case OpAMD64SETL: return rewriteValueAMD64_OpAMD64SETL(v, config) case OpAMD64SETLE: return rewriteValueAMD64_OpAMD64SETLE(v, config) case OpAMD64SETNE: return rewriteValueAMD64_OpAMD64SETNE(v, config) case OpAMD64SHLB: return rewriteValueAMD64_OpAMD64SHLB(v, config) case OpAMD64SHLL: return rewriteValueAMD64_OpAMD64SHLL(v, config) case OpAMD64SHLQ: return rewriteValueAMD64_OpAMD64SHLQ(v, config) case OpAMD64SHLW: return rewriteValueAMD64_OpAMD64SHLW(v, config) case OpAMD64SHRB: return rewriteValueAMD64_OpAMD64SHRB(v, config) case OpAMD64SHRL: return rewriteValueAMD64_OpAMD64SHRL(v, config) case OpAMD64SHRQ: return rewriteValueAMD64_OpAMD64SHRQ(v, config) case OpAMD64SHRW: return rewriteValueAMD64_OpAMD64SHRW(v, config) case OpAMD64SUBB: return rewriteValueAMD64_OpAMD64SUBB(v, config) case OpAMD64SUBBconst: return rewriteValueAMD64_OpAMD64SUBBconst(v, config) case OpAMD64SUBL: return rewriteValueAMD64_OpAMD64SUBL(v, config) case OpAMD64SUBLconst: return rewriteValueAMD64_OpAMD64SUBLconst(v, config) case OpAMD64SUBQ: return rewriteValueAMD64_OpAMD64SUBQ(v, config) case OpAMD64SUBQconst: return rewriteValueAMD64_OpAMD64SUBQconst(v, config) case OpAMD64SUBW: return rewriteValueAMD64_OpAMD64SUBW(v, config) case OpAMD64SUBWconst: return rewriteValueAMD64_OpAMD64SUBWconst(v, config) case OpSignExt16to32: return rewriteValueAMD64_OpSignExt16to32(v, config) case OpSignExt16to64: return rewriteValueAMD64_OpSignExt16to64(v, config) case OpSignExt32to64: return rewriteValueAMD64_OpSignExt32to64(v, config) case OpSignExt8to16: return rewriteValueAMD64_OpSignExt8to16(v, config) case OpSignExt8to32: return rewriteValueAMD64_OpSignExt8to32(v, config) case OpSignExt8to64: return rewriteValueAMD64_OpSignExt8to64(v, config) case OpSqrt: return rewriteValueAMD64_OpSqrt(v, config) case OpStaticCall: return rewriteValueAMD64_OpStaticCall(v, config) case OpStore: return rewriteValueAMD64_OpStore(v, config) case OpSub16: return rewriteValueAMD64_OpSub16(v, config) case OpSub32: return rewriteValueAMD64_OpSub32(v, config) case OpSub32F: return rewriteValueAMD64_OpSub32F(v, config) case OpSub64: return rewriteValueAMD64_OpSub64(v, config) case OpSub64F: return rewriteValueAMD64_OpSub64F(v, config) case OpSub8: return rewriteValueAMD64_OpSub8(v, config) case OpSubPtr: return rewriteValueAMD64_OpSubPtr(v, config) case OpTrunc16to8: return rewriteValueAMD64_OpTrunc16to8(v, config) case OpTrunc32to16: return rewriteValueAMD64_OpTrunc32to16(v, config) case OpTrunc32to8: return rewriteValueAMD64_OpTrunc32to8(v, config) case OpTrunc64to16: return rewriteValueAMD64_OpTrunc64to16(v, config) case OpTrunc64to32: return rewriteValueAMD64_OpTrunc64to32(v, config) case OpTrunc64to8: return rewriteValueAMD64_OpTrunc64to8(v, config) case OpAMD64XORB: return rewriteValueAMD64_OpAMD64XORB(v, config) case OpAMD64XORBconst: return rewriteValueAMD64_OpAMD64XORBconst(v, config) case OpAMD64XORL: return rewriteValueAMD64_OpAMD64XORL(v, config) case OpAMD64XORLconst: return rewriteValueAMD64_OpAMD64XORLconst(v, config) case OpAMD64XORQ: return rewriteValueAMD64_OpAMD64XORQ(v, config) case OpAMD64XORQconst: return rewriteValueAMD64_OpAMD64XORQconst(v, config) case OpAMD64XORW: return rewriteValueAMD64_OpAMD64XORW(v, config) case OpAMD64XORWconst: return rewriteValueAMD64_OpAMD64XORWconst(v, config) case OpXor16: return rewriteValueAMD64_OpXor16(v, config) case OpXor32: return rewriteValueAMD64_OpXor32(v, config) case OpXor64: return rewriteValueAMD64_OpXor64(v, config) case OpXor8: return rewriteValueAMD64_OpXor8(v, config) case OpZero: return rewriteValueAMD64_OpZero(v, config) case OpZeroExt16to32: return rewriteValueAMD64_OpZeroExt16to32(v, config) case OpZeroExt16to64: return rewriteValueAMD64_OpZeroExt16to64(v, config) case OpZeroExt32to64: return rewriteValueAMD64_OpZeroExt32to64(v, config) case OpZeroExt8to16: return rewriteValueAMD64_OpZeroExt8to16(v, config) case OpZeroExt8to32: return rewriteValueAMD64_OpZeroExt8to32(v, config) case OpZeroExt8to64: return rewriteValueAMD64_OpZeroExt8to64(v, config) } return false } func rewriteValueAMD64_OpAMD64ADDB(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDB x (MOVBconst [c])) // cond: // result: (ADDBconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64ADDBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDB (MOVBconst [c]) x) // cond: // result: (ADDBconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ADDBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDB x (NEGB y)) // cond: // result: (SUBB x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64NEGB { break } y := v_1.Args[0] v.reset(OpAMD64SUBB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64ADDBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDBconst [c] x) // cond: int8(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int8(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ADDBconst [c] (MOVBconst [d])) // cond: // result: (MOVBconst [int64(int8(c+d))]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = int64(int8(c + d)) return true } // match: (ADDBconst [c] (ADDBconst [d] x)) // cond: // result: (ADDBconst [int64(int8(c+d))] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ADDBconst { break } d := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ADDBconst) v.AuxInt = int64(int8(c + d)) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ADDL(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDL x (MOVLconst [c])) // cond: // result: (ADDLconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64ADDLconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDL (MOVLconst [c]) x) // cond: // result: (ADDLconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ADDLconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDL x (NEGL y)) // cond: // result: (SUBL x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64NEGL { break } y := v_1.Args[0] v.reset(OpAMD64SUBL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64ADDLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDLconst [c] x) // cond: int32(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int32(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ADDLconst [c] (MOVLconst [d])) // cond: // result: (MOVLconst [int64(int32(c+d))]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = int64(int32(c + d)) return true } // match: (ADDLconst [c] (ADDLconst [d] x)) // cond: // result: (ADDLconst [int64(int32(c+d))] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ADDLconst { break } d := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ADDLconst) v.AuxInt = int64(int32(c + d)) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ADDQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDQ x (MOVQconst [c])) // cond: is32Bit(c) // result: (ADDQconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt if !(is32Bit(c)) { break } v.reset(OpAMD64ADDQconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDQ (MOVQconst [c]) x) // cond: is32Bit(c) // result: (ADDQconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt x := v.Args[1] if !(is32Bit(c)) { break } v.reset(OpAMD64ADDQconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDQ x (SHLQconst [3] y)) // cond: // result: (LEAQ8 x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 3 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ8) v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ x (SHLQconst [2] y)) // cond: // result: (LEAQ4 x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 2 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ4) v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ x (SHLQconst [1] y)) // cond: // result: (LEAQ2 x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 1 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ2) v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ x (ADDQ y y)) // cond: // result: (LEAQ2 x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQ { break } y := v_1.Args[0] if y != v_1.Args[1] { break } v.reset(OpAMD64LEAQ2) v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ x (ADDQ x y)) // cond: // result: (LEAQ2 y x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQ { break } if x != v_1.Args[0] { break } y := v_1.Args[1] v.reset(OpAMD64LEAQ2) v.AddArg(y) v.AddArg(x) return true } // match: (ADDQ x (ADDQ y x)) // cond: // result: (LEAQ2 y x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQ { break } y := v_1.Args[0] if x != v_1.Args[1] { break } v.reset(OpAMD64LEAQ2) v.AddArg(y) v.AddArg(x) return true } // match: (ADDQ (ADDQconst [c] x) y) // cond: // result: (LEAQ1 [c] x y) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt x := v_0.Args[0] y := v.Args[1] v.reset(OpAMD64LEAQ1) v.AuxInt = c v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ x (ADDQconst [c] y)) // cond: // result: (LEAQ1 [c] x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt y := v_1.Args[0] v.reset(OpAMD64LEAQ1) v.AuxInt = c v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ x (LEAQ [c] {s} y)) // cond: x.Op != OpSB && y.Op != OpSB // result: (LEAQ1 [c] {s} x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64LEAQ { break } c := v_1.AuxInt s := v_1.Aux y := v_1.Args[0] if !(x.Op != OpSB && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ (LEAQ [c] {s} x) y) // cond: x.Op != OpSB && y.Op != OpSB // result: (LEAQ1 [c] {s} x y) for { v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } c := v_0.AuxInt s := v_0.Aux x := v_0.Args[0] y := v.Args[1] if !(x.Op != OpSB && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (ADDQ x (NEGQ y)) // cond: // result: (SUBQ x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64NEGQ { break } y := v_1.Args[0] v.reset(OpAMD64SUBQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64ADDQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDQconst [c] (ADDQ x y)) // cond: // result: (LEAQ1 [c] x y) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } x := v_0.Args[0] y := v_0.Args[1] v.reset(OpAMD64LEAQ1) v.AuxInt = c v.AddArg(x) v.AddArg(y) return true } // match: (ADDQconst [c] (LEAQ [d] {s} x)) // cond: is32Bit(c+d) // result: (LEAQ [c+d] {s} x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } d := v_0.AuxInt s := v_0.Aux x := v_0.Args[0] if !(is32Bit(c + d)) { break } v.reset(OpAMD64LEAQ) v.AuxInt = c + d v.Aux = s v.AddArg(x) return true } // match: (ADDQconst [c] (LEAQ1 [d] {s} x y)) // cond: is32Bit(c+d) // result: (LEAQ1 [c+d] {s} x y) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } d := v_0.AuxInt s := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(c + d)) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (ADDQconst [c] (LEAQ2 [d] {s} x y)) // cond: is32Bit(c+d) // result: (LEAQ2 [c+d] {s} x y) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ2 { break } d := v_0.AuxInt s := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(c + d)) { break } v.reset(OpAMD64LEAQ2) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (ADDQconst [c] (LEAQ4 [d] {s} x y)) // cond: is32Bit(c+d) // result: (LEAQ4 [c+d] {s} x y) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ4 { break } d := v_0.AuxInt s := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(c + d)) { break } v.reset(OpAMD64LEAQ4) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (ADDQconst [c] (LEAQ8 [d] {s} x y)) // cond: is32Bit(c+d) // result: (LEAQ8 [c+d] {s} x y) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ8 { break } d := v_0.AuxInt s := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(c + d)) { break } v.reset(OpAMD64LEAQ8) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (ADDQconst [0] x) // cond: // result: x for { if v.AuxInt != 0 { break } x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ADDQconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [c+d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = c + d return true } // match: (ADDQconst [c] (ADDQconst [d] x)) // cond: is32Bit(c+d) // result: (ADDQconst [c+d] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt x := v_0.Args[0] if !(is32Bit(c + d)) { break } v.reset(OpAMD64ADDQconst) v.AuxInt = c + d v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ADDW(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDW x (MOVWconst [c])) // cond: // result: (ADDWconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64ADDWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDW (MOVWconst [c]) x) // cond: // result: (ADDWconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ADDWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ADDW x (NEGW y)) // cond: // result: (SUBW x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64NEGW { break } y := v_1.Args[0] v.reset(OpAMD64SUBW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64ADDWconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ADDWconst [c] x) // cond: int16(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int16(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ADDWconst [c] (MOVWconst [d])) // cond: // result: (MOVWconst [int64(int16(c+d))]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = int64(int16(c + d)) return true } // match: (ADDWconst [c] (ADDWconst [d] x)) // cond: // result: (ADDWconst [int64(int16(c+d))] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ADDWconst { break } d := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ADDWconst) v.AuxInt = int64(int16(c + d)) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ANDB(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDB x (MOVLconst [c])) // cond: // result: (ANDBconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64ANDBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDB (MOVLconst [c]) x) // cond: // result: (ANDBconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ANDBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDB x (MOVBconst [c])) // cond: // result: (ANDBconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64ANDBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDB (MOVBconst [c]) x) // cond: // result: (ANDBconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ANDBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDB x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ANDBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDBconst [c] (ANDBconst [d] x)) // cond: // result: (ANDBconst [c & d] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ANDBconst { break } d := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ANDBconst) v.AuxInt = c & d v.AddArg(x) return true } // match: (ANDBconst [c] _) // cond: int8(c)==0 // result: (MOVBconst [0]) for { c := v.AuxInt if !(int8(c) == 0) { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (ANDBconst [c] x) // cond: int8(c)==-1 // result: x for { c := v.AuxInt x := v.Args[0] if !(int8(c) == -1) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ANDBconst [c] (MOVBconst [d])) // cond: // result: (MOVBconst [c&d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = c & d return true } return false } func rewriteValueAMD64_OpAMD64ANDL(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDL x (MOVLconst [c])) // cond: // result: (ANDLconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64ANDLconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDL (MOVLconst [c]) x) // cond: // result: (ANDLconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ANDLconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDL x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ANDLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDLconst [c] (ANDLconst [d] x)) // cond: // result: (ANDLconst [c & d] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ANDLconst { break } d := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ANDLconst) v.AuxInt = c & d v.AddArg(x) return true } // match: (ANDLconst [c] _) // cond: int32(c)==0 // result: (MOVLconst [0]) for { c := v.AuxInt if !(int32(c) == 0) { break } v.reset(OpAMD64MOVLconst) v.AuxInt = 0 return true } // match: (ANDLconst [c] x) // cond: int32(c)==-1 // result: x for { c := v.AuxInt x := v.Args[0] if !(int32(c) == -1) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ANDLconst [c] (MOVLconst [d])) // cond: // result: (MOVLconst [c&d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = c & d return true } return false } func rewriteValueAMD64_OpAMD64ANDQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDQ x (MOVQconst [c])) // cond: is32Bit(c) // result: (ANDQconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt if !(is32Bit(c)) { break } v.reset(OpAMD64ANDQconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDQ (MOVQconst [c]) x) // cond: is32Bit(c) // result: (ANDQconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt x := v.Args[1] if !(is32Bit(c)) { break } v.reset(OpAMD64ANDQconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDQ x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ANDQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDQconst [c] (ANDQconst [d] x)) // cond: // result: (ANDQconst [c & d] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ANDQconst { break } d := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ANDQconst) v.AuxInt = c & d v.AddArg(x) return true } // match: (ANDQconst [0xFF] x) // cond: // result: (MOVBQZX x) for { if v.AuxInt != 0xFF { break } x := v.Args[0] v.reset(OpAMD64MOVBQZX) v.AddArg(x) return true } // match: (ANDQconst [0xFFFF] x) // cond: // result: (MOVWQZX x) for { if v.AuxInt != 0xFFFF { break } x := v.Args[0] v.reset(OpAMD64MOVWQZX) v.AddArg(x) return true } // match: (ANDQconst [0xFFFFFFFF] x) // cond: // result: (MOVLQZX x) for { if v.AuxInt != 0xFFFFFFFF { break } x := v.Args[0] v.reset(OpAMD64MOVLQZX) v.AddArg(x) return true } // match: (ANDQconst [0] _) // cond: // result: (MOVQconst [0]) for { if v.AuxInt != 0 { break } v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } // match: (ANDQconst [-1] x) // cond: // result: x for { if v.AuxInt != -1 { break } x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ANDQconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [c&d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = c & d return true } return false } func rewriteValueAMD64_OpAMD64ANDW(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDW x (MOVLconst [c])) // cond: // result: (ANDWconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64ANDWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDW (MOVLconst [c]) x) // cond: // result: (ANDWconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ANDWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDW x (MOVWconst [c])) // cond: // result: (ANDWconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64ANDWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDW (MOVWconst [c]) x) // cond: // result: (ANDWconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ANDWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ANDW x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ANDWconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ANDWconst [c] (ANDWconst [d] x)) // cond: // result: (ANDWconst [c & d] x) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64ANDWconst { break } d := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ANDWconst) v.AuxInt = c & d v.AddArg(x) return true } // match: (ANDWconst [c] _) // cond: int16(c)==0 // result: (MOVWconst [0]) for { c := v.AuxInt if !(int16(c) == 0) { break } v.reset(OpAMD64MOVWconst) v.AuxInt = 0 return true } // match: (ANDWconst [c] x) // cond: int16(c)==-1 // result: x for { c := v.AuxInt x := v.Args[0] if !(int16(c) == -1) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ANDWconst [c] (MOVWconst [d])) // cond: // result: (MOVWconst [c&d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = c & d return true } return false } func rewriteValueAMD64_OpAdd16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Add16 x y) // cond: // result: (ADDW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ADDW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAdd32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Add32 x y) // cond: // result: (ADDL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ADDL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAdd32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Add32F x y) // cond: // result: (ADDSS x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ADDSS) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAdd64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Add64 x y) // cond: // result: (ADDQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ADDQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAdd64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Add64F x y) // cond: // result: (ADDSD x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ADDSD) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAdd8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Add8 x y) // cond: // result: (ADDB x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ADDB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAddPtr(v *Value, config *Config) bool { b := v.Block _ = b // match: (AddPtr x y) // cond: // result: (ADDQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ADDQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAddr(v *Value, config *Config) bool { b := v.Block _ = b // match: (Addr {sym} base) // cond: // result: (LEAQ {sym} base) for { sym := v.Aux base := v.Args[0] v.reset(OpAMD64LEAQ) v.Aux = sym v.AddArg(base) return true } return false } func rewriteValueAMD64_OpAnd16(v *Value, config *Config) bool { b := v.Block _ = b // match: (And16 x y) // cond: // result: (ANDW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAnd32(v *Value, config *Config) bool { b := v.Block _ = b // match: (And32 x y) // cond: // result: (ANDL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAnd64(v *Value, config *Config) bool { b := v.Block _ = b // match: (And64 x y) // cond: // result: (ANDQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAnd8(v *Value, config *Config) bool { b := v.Block _ = b // match: (And8 x y) // cond: // result: (ANDB x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAvg64u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Avg64u x y) // cond: // result: (AVGQU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64AVGQU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpBswap32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Bswap32 x) // cond: // result: (BSWAPL x) for { x := v.Args[0] v.reset(OpAMD64BSWAPL) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpBswap64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Bswap64 x) // cond: // result: (BSWAPQ x) for { x := v.Args[0] v.reset(OpAMD64BSWAPQ) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64CMOVLEQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMOVLEQconst x (InvertFlags y) [c]) // cond: // result: (CMOVLNEconst x y [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64InvertFlags { break } y := v_1.Args[0] c := v.AuxInt v.reset(OpAMD64CMOVLNEconst) v.AddArg(x) v.AddArg(y) v.AuxInt = c return true } // match: (CMOVLEQconst _ (FlagEQ) [c]) // cond: // result: (Const32 [c]) for { v_1 := v.Args[1] if v_1.Op != OpAMD64FlagEQ { break } c := v.AuxInt v.reset(OpConst32) v.AuxInt = c return true } // match: (CMOVLEQconst x (FlagLT_ULT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagLT_ULT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVLEQconst x (FlagLT_UGT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagLT_UGT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVLEQconst x (FlagGT_ULT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagGT_ULT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVLEQconst x (FlagGT_UGT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagGT_UGT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64CMOVQEQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMOVQEQconst x (InvertFlags y) [c]) // cond: // result: (CMOVQNEconst x y [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64InvertFlags { break } y := v_1.Args[0] c := v.AuxInt v.reset(OpAMD64CMOVQNEconst) v.AddArg(x) v.AddArg(y) v.AuxInt = c return true } // match: (CMOVQEQconst _ (FlagEQ) [c]) // cond: // result: (Const64 [c]) for { v_1 := v.Args[1] if v_1.Op != OpAMD64FlagEQ { break } c := v.AuxInt v.reset(OpConst64) v.AuxInt = c return true } // match: (CMOVQEQconst x (FlagLT_ULT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagLT_ULT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVQEQconst x (FlagLT_UGT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagLT_UGT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVQEQconst x (FlagGT_ULT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagGT_ULT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVQEQconst x (FlagGT_UGT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagGT_UGT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64CMOVWEQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMOVWEQconst x (InvertFlags y) [c]) // cond: // result: (CMOVWNEconst x y [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64InvertFlags { break } y := v_1.Args[0] c := v.AuxInt v.reset(OpAMD64CMOVWNEconst) v.AddArg(x) v.AddArg(y) v.AuxInt = c return true } // match: (CMOVWEQconst _ (FlagEQ) [c]) // cond: // result: (Const16 [c]) for { v_1 := v.Args[1] if v_1.Op != OpAMD64FlagEQ { break } c := v.AuxInt v.reset(OpConst16) v.AuxInt = c return true } // match: (CMOVWEQconst x (FlagLT_ULT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagLT_ULT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVWEQconst x (FlagLT_UGT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagLT_UGT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVWEQconst x (FlagGT_ULT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagGT_ULT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (CMOVWEQconst x (FlagGT_UGT)) // cond: // result: x for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64FlagGT_UGT { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64CMPB(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMPB x (MOVBconst [c])) // cond: // result: (CMPBconst x [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64CMPBconst) v.AddArg(x) v.AuxInt = c return true } // match: (CMPB (MOVBconst [c]) x) // cond: // result: (InvertFlags (CMPBconst x [c])) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64InvertFlags) v0 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v0.AddArg(x) v0.AuxInt = c v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpAMD64CMPBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMPBconst (MOVBconst [x]) [y]) // cond: int8(x)==int8(y) // result: (FlagEQ) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } x := v_0.AuxInt y := v.AuxInt if !(int8(x) == int8(y)) { break } v.reset(OpAMD64FlagEQ) return true } // match: (CMPBconst (MOVBconst [x]) [y]) // cond: int8(x)uint8(y) // result: (FlagLT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } x := v_0.AuxInt y := v.AuxInt if !(int8(x) < int8(y) && uint8(x) > uint8(y)) { break } v.reset(OpAMD64FlagLT_UGT) return true } // match: (CMPBconst (MOVBconst [x]) [y]) // cond: int8(x)>int8(y) && uint8(x) int8(y) && uint8(x) < uint8(y)) { break } v.reset(OpAMD64FlagGT_ULT) return true } // match: (CMPBconst (MOVBconst [x]) [y]) // cond: int8(x)>int8(y) && uint8(x)>uint8(y) // result: (FlagGT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } x := v_0.AuxInt y := v.AuxInt if !(int8(x) > int8(y) && uint8(x) > uint8(y)) { break } v.reset(OpAMD64FlagGT_UGT) return true } // match: (CMPBconst (ANDBconst _ [m]) [n]) // cond: 0 <= int8(m) && int8(m) < int8(n) // result: (FlagLT_ULT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDBconst { break } m := v_0.AuxInt n := v.AuxInt if !(0 <= int8(m) && int8(m) < int8(n)) { break } v.reset(OpAMD64FlagLT_ULT) return true } // match: (CMPBconst (ANDB x y) [0]) // cond: // result: (TESTB x y) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDB { break } x := v_0.Args[0] y := v_0.Args[1] if v.AuxInt != 0 { break } v.reset(OpAMD64TESTB) v.AddArg(x) v.AddArg(y) return true } // match: (CMPBconst (ANDBconst [c] x) [0]) // cond: // result: (TESTBconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDBconst { break } c := v_0.AuxInt x := v_0.Args[0] if v.AuxInt != 0 { break } v.reset(OpAMD64TESTBconst) v.AuxInt = c v.AddArg(x) return true } // match: (CMPBconst x [0]) // cond: // result: (TESTB x x) for { x := v.Args[0] if v.AuxInt != 0 { break } v.reset(OpAMD64TESTB) v.AddArg(x) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64CMPL(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMPL x (MOVLconst [c])) // cond: // result: (CMPLconst x [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64CMPLconst) v.AddArg(x) v.AuxInt = c return true } // match: (CMPL (MOVLconst [c]) x) // cond: // result: (InvertFlags (CMPLconst x [c])) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64InvertFlags) v0 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v0.AddArg(x) v0.AuxInt = c v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpAMD64CMPLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (CMPLconst (MOVLconst [x]) [y]) // cond: int32(x)==int32(y) // result: (FlagEQ) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } x := v_0.AuxInt y := v.AuxInt if !(int32(x) == int32(y)) { break } v.reset(OpAMD64FlagEQ) return true } // match: (CMPLconst (MOVLconst [x]) [y]) // cond: int32(x)uint32(y) // result: (FlagLT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } x := v_0.AuxInt y := v.AuxInt if !(int32(x) < int32(y) && uint32(x) > uint32(y)) { break } v.reset(OpAMD64FlagLT_UGT) return true } // match: (CMPLconst (MOVLconst [x]) [y]) // cond: int32(x)>int32(y) && uint32(x) int32(y) && uint32(x) < uint32(y)) { break } v.reset(OpAMD64FlagGT_ULT) return true } // match: (CMPLconst (MOVLconst [x]) [y]) // cond: int32(x)>int32(y) && uint32(x)>uint32(y) // result: (FlagGT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } x := v_0.AuxInt y := v.AuxInt if !(int32(x) > int32(y) && uint32(x) > uint32(y)) { break } v.reset(OpAMD64FlagGT_UGT) return true } // match: (CMPLconst (SHRLconst _ [c]) [n]) // cond: 0 <= n && 0 < c && c <= 32 && (1<uint64(y) // result: (FlagLT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } x := v_0.AuxInt y := v.AuxInt if !(x < y && uint64(x) > uint64(y)) { break } v.reset(OpAMD64FlagLT_UGT) return true } // match: (CMPQconst (MOVQconst [x]) [y]) // cond: x>y && uint64(x) y && uint64(x) < uint64(y)) { break } v.reset(OpAMD64FlagGT_ULT) return true } // match: (CMPQconst (MOVQconst [x]) [y]) // cond: x>y && uint64(x)>uint64(y) // result: (FlagGT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } x := v_0.AuxInt y := v.AuxInt if !(x > y && uint64(x) > uint64(y)) { break } v.reset(OpAMD64FlagGT_UGT) return true } // match: (CMPQconst (MOVBQZX _) [c]) // cond: 0xFF < c // result: (FlagLT_ULT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBQZX { break } c := v.AuxInt if !(0xFF < c) { break } v.reset(OpAMD64FlagLT_ULT) return true } // match: (CMPQconst (MOVWQZX _) [c]) // cond: 0xFFFF < c // result: (FlagLT_ULT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWQZX { break } c := v.AuxInt if !(0xFFFF < c) { break } v.reset(OpAMD64FlagLT_ULT) return true } // match: (CMPQconst (MOVLQZX _) [c]) // cond: 0xFFFFFFFF < c // result: (FlagLT_ULT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLQZX { break } c := v.AuxInt if !(0xFFFFFFFF < c) { break } v.reset(OpAMD64FlagLT_ULT) return true } // match: (CMPQconst (SHRQconst _ [c]) [n]) // cond: 0 <= n && 0 < c && c <= 64 && (1<uint16(y) // result: (FlagLT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } x := v_0.AuxInt y := v.AuxInt if !(int16(x) < int16(y) && uint16(x) > uint16(y)) { break } v.reset(OpAMD64FlagLT_UGT) return true } // match: (CMPWconst (MOVWconst [x]) [y]) // cond: int16(x)>int16(y) && uint16(x) int16(y) && uint16(x) < uint16(y)) { break } v.reset(OpAMD64FlagGT_ULT) return true } // match: (CMPWconst (MOVWconst [x]) [y]) // cond: int16(x)>int16(y) && uint16(x)>uint16(y) // result: (FlagGT_UGT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } x := v_0.AuxInt y := v.AuxInt if !(int16(x) > int16(y) && uint16(x) > uint16(y)) { break } v.reset(OpAMD64FlagGT_UGT) return true } // match: (CMPWconst (ANDWconst _ [m]) [n]) // cond: 0 <= int16(m) && int16(m) < int16(n) // result: (FlagLT_ULT) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDWconst { break } m := v_0.AuxInt n := v.AuxInt if !(0 <= int16(m) && int16(m) < int16(n)) { break } v.reset(OpAMD64FlagLT_ULT) return true } // match: (CMPWconst (ANDW x y) [0]) // cond: // result: (TESTW x y) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDW { break } x := v_0.Args[0] y := v_0.Args[1] if v.AuxInt != 0 { break } v.reset(OpAMD64TESTW) v.AddArg(x) v.AddArg(y) return true } // match: (CMPWconst (ANDWconst [c] x) [0]) // cond: // result: (TESTWconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDWconst { break } c := v_0.AuxInt x := v_0.Args[0] if v.AuxInt != 0 { break } v.reset(OpAMD64TESTWconst) v.AuxInt = c v.AddArg(x) return true } // match: (CMPWconst x [0]) // cond: // result: (TESTW x x) for { x := v.Args[0] if v.AuxInt != 0 { break } v.reset(OpAMD64TESTW) v.AddArg(x) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpClosureCall(v *Value, config *Config) bool { b := v.Block _ = b // match: (ClosureCall [argwid] entry closure mem) // cond: // result: (CALLclosure [argwid] entry closure mem) for { argwid := v.AuxInt entry := v.Args[0] closure := v.Args[1] mem := v.Args[2] v.reset(OpAMD64CALLclosure) v.AuxInt = argwid v.AddArg(entry) v.AddArg(closure) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpCom16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Com16 x) // cond: // result: (NOTW x) for { x := v.Args[0] v.reset(OpAMD64NOTW) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCom32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Com32 x) // cond: // result: (NOTL x) for { x := v.Args[0] v.reset(OpAMD64NOTL) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCom64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Com64 x) // cond: // result: (NOTQ x) for { x := v.Args[0] v.reset(OpAMD64NOTQ) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCom8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Com8 x) // cond: // result: (NOTB x) for { x := v.Args[0] v.reset(OpAMD64NOTB) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpConst16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Const16 [val]) // cond: // result: (MOVWconst [val]) for { val := v.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = val return true } return false } func rewriteValueAMD64_OpConst32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Const32 [val]) // cond: // result: (MOVLconst [val]) for { val := v.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = val return true } return false } func rewriteValueAMD64_OpConst32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Const32F [val]) // cond: // result: (MOVSSconst [val]) for { val := v.AuxInt v.reset(OpAMD64MOVSSconst) v.AuxInt = val return true } return false } func rewriteValueAMD64_OpConst64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Const64 [val]) // cond: // result: (MOVQconst [val]) for { val := v.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = val return true } return false } func rewriteValueAMD64_OpConst64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Const64F [val]) // cond: // result: (MOVSDconst [val]) for { val := v.AuxInt v.reset(OpAMD64MOVSDconst) v.AuxInt = val return true } return false } func rewriteValueAMD64_OpConst8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Const8 [val]) // cond: // result: (MOVBconst [val]) for { val := v.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = val return true } return false } func rewriteValueAMD64_OpConstBool(v *Value, config *Config) bool { b := v.Block _ = b // match: (ConstBool [b]) // cond: // result: (MOVBconst [b]) for { b := v.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = b return true } return false } func rewriteValueAMD64_OpConstNil(v *Value, config *Config) bool { b := v.Block _ = b // match: (ConstNil) // cond: // result: (MOVQconst [0]) for { v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpConvert(v *Value, config *Config) bool { b := v.Block _ = b // match: (Convert x mem) // cond: // result: (MOVQconvert x mem) for { t := v.Type x := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVQconvert) v.Type = t v.AddArg(x) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpCtz16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Ctz16 x) // cond: // result: (CMOVWEQconst (BSFW x) (CMPWconst x [0]) [16]) for { t := v.Type x := v.Args[0] v.reset(OpAMD64CMOVWEQconst) v0 := b.NewValue0(v.Line, OpAMD64BSFW, t) v0.AddArg(x) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v1.AddArg(x) v1.AuxInt = 0 v.AddArg(v1) v.AuxInt = 16 return true } return false } func rewriteValueAMD64_OpCtz32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Ctz32 x) // cond: // result: (CMOVLEQconst (BSFL x) (CMPLconst x [0]) [32]) for { t := v.Type x := v.Args[0] v.reset(OpAMD64CMOVLEQconst) v0 := b.NewValue0(v.Line, OpAMD64BSFL, t) v0.AddArg(x) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v1.AddArg(x) v1.AuxInt = 0 v.AddArg(v1) v.AuxInt = 32 return true } return false } func rewriteValueAMD64_OpCtz64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Ctz64 x) // cond: // result: (CMOVQEQconst (BSFQ x) (CMPQconst x [0]) [64]) for { t := v.Type x := v.Args[0] v.reset(OpAMD64CMOVQEQconst) v0 := b.NewValue0(v.Line, OpAMD64BSFQ, t) v0.AddArg(x) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v1.AddArg(x) v1.AuxInt = 0 v.AddArg(v1) v.AuxInt = 64 return true } return false } func rewriteValueAMD64_OpCvt32Fto32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt32Fto32 x) // cond: // result: (CVTTSS2SL x) for { x := v.Args[0] v.reset(OpAMD64CVTTSS2SL) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt32Fto64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt32Fto64 x) // cond: // result: (CVTTSS2SQ x) for { x := v.Args[0] v.reset(OpAMD64CVTTSS2SQ) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt32Fto64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt32Fto64F x) // cond: // result: (CVTSS2SD x) for { x := v.Args[0] v.reset(OpAMD64CVTSS2SD) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt32to32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt32to32F x) // cond: // result: (CVTSL2SS x) for { x := v.Args[0] v.reset(OpAMD64CVTSL2SS) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt32to64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt32to64F x) // cond: // result: (CVTSL2SD x) for { x := v.Args[0] v.reset(OpAMD64CVTSL2SD) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt64Fto32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt64Fto32 x) // cond: // result: (CVTTSD2SL x) for { x := v.Args[0] v.reset(OpAMD64CVTTSD2SL) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt64Fto32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt64Fto32F x) // cond: // result: (CVTSD2SS x) for { x := v.Args[0] v.reset(OpAMD64CVTSD2SS) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt64Fto64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt64Fto64 x) // cond: // result: (CVTTSD2SQ x) for { x := v.Args[0] v.reset(OpAMD64CVTTSD2SQ) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt64to32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt64to32F x) // cond: // result: (CVTSQ2SS x) for { x := v.Args[0] v.reset(OpAMD64CVTSQ2SS) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpCvt64to64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Cvt64to64F x) // cond: // result: (CVTSQ2SD x) for { x := v.Args[0] v.reset(OpAMD64CVTSQ2SD) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpDeferCall(v *Value, config *Config) bool { b := v.Block _ = b // match: (DeferCall [argwid] mem) // cond: // result: (CALLdefer [argwid] mem) for { argwid := v.AuxInt mem := v.Args[0] v.reset(OpAMD64CALLdefer) v.AuxInt = argwid v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpDiv16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div16 x y) // cond: // result: (DIVW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv16u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div16u x y) // cond: // result: (DIVWU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVWU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div32 x y) // cond: // result: (DIVL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div32F x y) // cond: // result: (DIVSS x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVSS) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv32u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div32u x y) // cond: // result: (DIVLU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVLU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div64 x y) // cond: // result: (DIVQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div64F x y) // cond: // result: (DIVSD x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVSD) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv64u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div64u x y) // cond: // result: (DIVQU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVQU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpDiv8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div8 x y) // cond: // result: (DIVW (SignExt8to16 x) (SignExt8to16 y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVW) v0 := b.NewValue0(v.Line, OpSignExt8to16, config.fe.TypeInt16()) v0.AddArg(x) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpSignExt8to16, config.fe.TypeInt16()) v1.AddArg(y) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpDiv8u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Div8u x y) // cond: // result: (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64DIVWU) v0 := b.NewValue0(v.Line, OpZeroExt8to16, config.fe.TypeUInt16()) v0.AddArg(x) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpZeroExt8to16, config.fe.TypeUInt16()) v1.AddArg(y) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpEq16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Eq16 x y) // cond: // result: (SETEQ (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETEQ) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpEq32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Eq32 x y) // cond: // result: (SETEQ (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETEQ) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpEq32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Eq32F x y) // cond: // result: (SETEQF (UCOMISS x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETEQF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISS, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpEq64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Eq64 x y) // cond: // result: (SETEQ (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETEQ) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpEq64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Eq64F x y) // cond: // result: (SETEQF (UCOMISD x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETEQF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISD, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpEq8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Eq8 x y) // cond: // result: (SETEQ (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETEQ) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpEqPtr(v *Value, config *Config) bool { b := v.Block _ = b // match: (EqPtr x y) // cond: // result: (SETEQ (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETEQ) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq16 x y) // cond: // result: (SETGE (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGE) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq16U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq16U x y) // cond: // result: (SETAE (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETAE) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq32 x y) // cond: // result: (SETGE (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGE) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq32F x y) // cond: // result: (SETGEF (UCOMISS x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGEF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISS, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq32U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq32U x y) // cond: // result: (SETAE (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETAE) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq64 x y) // cond: // result: (SETGE (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGE) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq64F x y) // cond: // result: (SETGEF (UCOMISD x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGEF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISD, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq64U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq64U x y) // cond: // result: (SETAE (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETAE) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq8 x y) // cond: // result: (SETGE (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGE) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGeq8U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Geq8U x y) // cond: // result: (SETAE (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETAE) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGetClosurePtr(v *Value, config *Config) bool { b := v.Block _ = b // match: (GetClosurePtr) // cond: // result: (LoweredGetClosurePtr) for { v.reset(OpAMD64LoweredGetClosurePtr) return true } return false } func rewriteValueAMD64_OpGetG(v *Value, config *Config) bool { b := v.Block _ = b // match: (GetG mem) // cond: // result: (LoweredGetG mem) for { mem := v.Args[0] v.reset(OpAMD64LoweredGetG) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpGoCall(v *Value, config *Config) bool { b := v.Block _ = b // match: (GoCall [argwid] mem) // cond: // result: (CALLgo [argwid] mem) for { argwid := v.AuxInt mem := v.Args[0] v.reset(OpAMD64CALLgo) v.AuxInt = argwid v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpGreater16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater16 x y) // cond: // result: (SETG (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETG) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater16U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater16U x y) // cond: // result: (SETA (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETA) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater32 x y) // cond: // result: (SETG (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETG) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater32F x y) // cond: // result: (SETGF (UCOMISS x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISS, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater32U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater32U x y) // cond: // result: (SETA (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETA) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater64 x y) // cond: // result: (SETG (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETG) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater64F x y) // cond: // result: (SETGF (UCOMISD x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISD, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater64U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater64U x y) // cond: // result: (SETA (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETA) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater8 x y) // cond: // result: (SETG (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETG) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpGreater8U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Greater8U x y) // cond: // result: (SETA (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETA) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpHmul16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul16 x y) // cond: // result: (HMULW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpHmul16u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul16u x y) // cond: // result: (HMULWU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULWU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpHmul32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul32 x y) // cond: // result: (HMULL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpHmul32u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul32u x y) // cond: // result: (HMULLU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULLU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpHmul64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul64 x y) // cond: // result: (HMULQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpHmul64u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul64u x y) // cond: // result: (HMULQU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULQU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpHmul8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul8 x y) // cond: // result: (HMULB x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpHmul8u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Hmul8u x y) // cond: // result: (HMULBU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64HMULBU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpITab(v *Value, config *Config) bool { b := v.Block _ = b // match: (ITab (Load ptr mem)) // cond: // result: (MOVQload ptr mem) for { v_0 := v.Args[0] if v_0.Op != OpLoad { break } ptr := v_0.Args[0] mem := v_0.Args[1] v.reset(OpAMD64MOVQload) v.AddArg(ptr) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpInterCall(v *Value, config *Config) bool { b := v.Block _ = b // match: (InterCall [argwid] entry mem) // cond: // result: (CALLinter [argwid] entry mem) for { argwid := v.AuxInt entry := v.Args[0] mem := v.Args[1] v.reset(OpAMD64CALLinter) v.AuxInt = argwid v.AddArg(entry) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpIsInBounds(v *Value, config *Config) bool { b := v.Block _ = b // match: (IsInBounds idx len) // cond: // result: (SETB (CMPQ idx len)) for { idx := v.Args[0] len := v.Args[1] v.reset(OpAMD64SETB) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(idx) v0.AddArg(len) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpIsNonNil(v *Value, config *Config) bool { b := v.Block _ = b // match: (IsNonNil p) // cond: // result: (SETNE (TESTQ p p)) for { p := v.Args[0] v.reset(OpAMD64SETNE) v0 := b.NewValue0(v.Line, OpAMD64TESTQ, TypeFlags) v0.AddArg(p) v0.AddArg(p) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpIsSliceInBounds(v *Value, config *Config) bool { b := v.Block _ = b // match: (IsSliceInBounds idx len) // cond: // result: (SETBE (CMPQ idx len)) for { idx := v.Args[0] len := v.Args[1] v.reset(OpAMD64SETBE) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(idx) v0.AddArg(len) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpAMD64LEAQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (LEAQ [c] {s} (ADDQconst [d] x)) // cond: is32Bit(c+d) // result: (LEAQ [c+d] {s} x) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt x := v_0.Args[0] if !(is32Bit(c + d)) { break } v.reset(OpAMD64LEAQ) v.AuxInt = c + d v.Aux = s v.AddArg(x) return true } // match: (LEAQ [c] {s} (ADDQ x y)) // cond: x.Op != OpSB && y.Op != OpSB // result: (LEAQ1 [c] {s} x y) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } x := v_0.Args[0] y := v_0.Args[1] if !(x.Op != OpSB && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ [off1] {sym1} (LEAQ [off2] {sym2} x)) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (LEAQ [off1+off2] {mergeSym(sym1,sym2)} x) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64LEAQ) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) return true } // match: (LEAQ [off1] {sym1} (LEAQ1 [off2] {sym2} x y)) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (LEAQ1 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ [off1] {sym1} (LEAQ2 [off2] {sym2} x y)) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (LEAQ2 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ2 { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64LEAQ2) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ [off1] {sym1} (LEAQ4 [off2] {sym2} x y)) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (LEAQ4 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ4 { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64LEAQ4) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ [off1] {sym1} (LEAQ8 [off2] {sym2} x y)) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (LEAQ8 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ8 { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v_0.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64LEAQ8) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64LEAQ1(v *Value, config *Config) bool { b := v.Block _ = b // match: (LEAQ1 [c] {s} (ADDQconst [d] x) y) // cond: is32Bit(c+d) && x.Op != OpSB // result: (LEAQ1 [c+d] {s} x y) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt x := v_0.Args[0] y := v.Args[1] if !(is32Bit(c+d) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ1 [c] {s} x (ADDQconst [d] y)) // cond: is32Bit(c+d) && y.Op != OpSB // result: (LEAQ1 [c+d] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt y := v_1.Args[0] if !(is32Bit(c+d) && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ1 [c] {s} x (SHLQconst [1] y)) // cond: // result: (LEAQ2 [c] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 1 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ2) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ1 [c] {s} (SHLQconst [1] x) y) // cond: // result: (LEAQ2 [c] {s} y x) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64SHLQconst { break } if v_0.AuxInt != 1 { break } x := v_0.Args[0] y := v.Args[1] v.reset(OpAMD64LEAQ2) v.AuxInt = c v.Aux = s v.AddArg(y) v.AddArg(x) return true } // match: (LEAQ1 [c] {s} x (SHLQconst [2] y)) // cond: // result: (LEAQ4 [c] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 2 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ4) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ1 [c] {s} (SHLQconst [2] x) y) // cond: // result: (LEAQ4 [c] {s} y x) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64SHLQconst { break } if v_0.AuxInt != 2 { break } x := v_0.Args[0] y := v.Args[1] v.reset(OpAMD64LEAQ4) v.AuxInt = c v.Aux = s v.AddArg(y) v.AddArg(x) return true } // match: (LEAQ1 [c] {s} x (SHLQconst [3] y)) // cond: // result: (LEAQ8 [c] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 3 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ8) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ1 [c] {s} (SHLQconst [3] x) y) // cond: // result: (LEAQ8 [c] {s} y x) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64SHLQconst { break } if v_0.AuxInt != 3 { break } x := v_0.Args[0] y := v.Args[1] v.reset(OpAMD64LEAQ8) v.AuxInt = c v.Aux = s v.AddArg(y) v.AddArg(x) return true } // match: (LEAQ1 [off1] {sym1} (LEAQ [off2] {sym2} x) y) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB // result: (LEAQ1 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ1 [off1] {sym1} x (LEAQ [off2] {sym2} y)) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && y.Op != OpSB // result: (LEAQ1 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64LEAQ { break } off2 := v_1.AuxInt sym2 := v_1.Aux y := v_1.Args[0] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64LEAQ2(v *Value, config *Config) bool { b := v.Block _ = b // match: (LEAQ2 [c] {s} (ADDQconst [d] x) y) // cond: is32Bit(c+d) && x.Op != OpSB // result: (LEAQ2 [c+d] {s} x y) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt x := v_0.Args[0] y := v.Args[1] if !(is32Bit(c+d) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ2) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ2 [c] {s} x (ADDQconst [d] y)) // cond: is32Bit(c+2*d) && y.Op != OpSB // result: (LEAQ2 [c+2*d] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt y := v_1.Args[0] if !(is32Bit(c+2*d) && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ2) v.AuxInt = c + 2*d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ2 [c] {s} x (SHLQconst [1] y)) // cond: // result: (LEAQ4 [c] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 1 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ4) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ2 [c] {s} x (SHLQconst [2] y)) // cond: // result: (LEAQ8 [c] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 2 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ8) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ2 [off1] {sym1} (LEAQ [off2] {sym2} x) y) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB // result: (LEAQ2 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ2) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64LEAQ4(v *Value, config *Config) bool { b := v.Block _ = b // match: (LEAQ4 [c] {s} (ADDQconst [d] x) y) // cond: is32Bit(c+d) && x.Op != OpSB // result: (LEAQ4 [c+d] {s} x y) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt x := v_0.Args[0] y := v.Args[1] if !(is32Bit(c+d) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ4) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ4 [c] {s} x (ADDQconst [d] y)) // cond: is32Bit(c+4*d) && y.Op != OpSB // result: (LEAQ4 [c+4*d] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt y := v_1.Args[0] if !(is32Bit(c+4*d) && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ4) v.AuxInt = c + 4*d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ4 [c] {s} x (SHLQconst [1] y)) // cond: // result: (LEAQ8 [c] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 1 { break } y := v_1.Args[0] v.reset(OpAMD64LEAQ8) v.AuxInt = c v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ4 [off1] {sym1} (LEAQ [off2] {sym2} x) y) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB // result: (LEAQ4 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ4) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64LEAQ8(v *Value, config *Config) bool { b := v.Block _ = b // match: (LEAQ8 [c] {s} (ADDQconst [d] x) y) // cond: is32Bit(c+d) && x.Op != OpSB // result: (LEAQ8 [c+d] {s} x y) for { c := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt x := v_0.Args[0] y := v.Args[1] if !(is32Bit(c+d) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ8) v.AuxInt = c + d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ8 [c] {s} x (ADDQconst [d] y)) // cond: is32Bit(c+8*d) && y.Op != OpSB // result: (LEAQ8 [c+8*d] {s} x y) for { c := v.AuxInt s := v.Aux x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt y := v_1.Args[0] if !(is32Bit(c+8*d) && y.Op != OpSB) { break } v.reset(OpAMD64LEAQ8) v.AuxInt = c + 8*d v.Aux = s v.AddArg(x) v.AddArg(y) return true } // match: (LEAQ8 [off1] {sym1} (LEAQ [off2] {sym2} x) y) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB // result: (LEAQ8 [off1+off2] {mergeSym(sym1,sym2)} x y) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux x := v_0.Args[0] y := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) { break } v.reset(OpAMD64LEAQ8) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpLeq16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq16 x y) // cond: // result: (SETLE (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETLE) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq16U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq16U x y) // cond: // result: (SETBE (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETBE) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq32 x y) // cond: // result: (SETLE (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETLE) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq32F x y) // cond: // result: (SETGEF (UCOMISS y x)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGEF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISS, TypeFlags) v0.AddArg(y) v0.AddArg(x) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq32U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq32U x y) // cond: // result: (SETBE (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETBE) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq64 x y) // cond: // result: (SETLE (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETLE) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq64F x y) // cond: // result: (SETGEF (UCOMISD y x)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGEF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISD, TypeFlags) v0.AddArg(y) v0.AddArg(x) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq64U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq64U x y) // cond: // result: (SETBE (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETBE) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq8 x y) // cond: // result: (SETLE (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETLE) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLeq8U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Leq8U x y) // cond: // result: (SETBE (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETBE) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less16 x y) // cond: // result: (SETL (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETL) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess16U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less16U x y) // cond: // result: (SETB (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETB) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less32 x y) // cond: // result: (SETL (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETL) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less32F x y) // cond: // result: (SETGF (UCOMISS y x)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISS, TypeFlags) v0.AddArg(y) v0.AddArg(x) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess32U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less32U x y) // cond: // result: (SETB (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETB) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less64 x y) // cond: // result: (SETL (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETL) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less64F x y) // cond: // result: (SETGF (UCOMISD y x)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETGF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISD, TypeFlags) v0.AddArg(y) v0.AddArg(x) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess64U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less64U x y) // cond: // result: (SETB (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETB) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less8 x y) // cond: // result: (SETL (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETL) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLess8U(v *Value, config *Config) bool { b := v.Block _ = b // match: (Less8U x y) // cond: // result: (SETB (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETB) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpLoad(v *Value, config *Config) bool { b := v.Block _ = b // match: (Load ptr mem) // cond: (is64BitInt(t) || isPtr(t)) // result: (MOVQload ptr mem) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] if !(is64BitInt(t) || isPtr(t)) { break } v.reset(OpAMD64MOVQload) v.AddArg(ptr) v.AddArg(mem) return true } // match: (Load ptr mem) // cond: is32BitInt(t) // result: (MOVLload ptr mem) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] if !(is32BitInt(t)) { break } v.reset(OpAMD64MOVLload) v.AddArg(ptr) v.AddArg(mem) return true } // match: (Load ptr mem) // cond: is16BitInt(t) // result: (MOVWload ptr mem) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] if !(is16BitInt(t)) { break } v.reset(OpAMD64MOVWload) v.AddArg(ptr) v.AddArg(mem) return true } // match: (Load ptr mem) // cond: (t.IsBoolean() || is8BitInt(t)) // result: (MOVBload ptr mem) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] if !(t.IsBoolean() || is8BitInt(t)) { break } v.reset(OpAMD64MOVBload) v.AddArg(ptr) v.AddArg(mem) return true } // match: (Load ptr mem) // cond: is32BitFloat(t) // result: (MOVSSload ptr mem) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] if !(is32BitFloat(t)) { break } v.reset(OpAMD64MOVSSload) v.AddArg(ptr) v.AddArg(mem) return true } // match: (Load ptr mem) // cond: is64BitFloat(t) // result: (MOVSDload ptr mem) for { t := v.Type ptr := v.Args[0] mem := v.Args[1] if !(is64BitFloat(t)) { break } v.reset(OpAMD64MOVSDload) v.AddArg(ptr) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpLrot16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lrot16 x [c]) // cond: // result: (ROLWconst [c&15] x) for { t := v.Type x := v.Args[0] c := v.AuxInt v.reset(OpAMD64ROLWconst) v.Type = t v.AuxInt = c & 15 v.AddArg(x) return true } return false } func rewriteValueAMD64_OpLrot32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lrot32 x [c]) // cond: // result: (ROLLconst [c&31] x) for { t := v.Type x := v.Args[0] c := v.AuxInt v.reset(OpAMD64ROLLconst) v.Type = t v.AuxInt = c & 31 v.AddArg(x) return true } return false } func rewriteValueAMD64_OpLrot64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lrot64 x [c]) // cond: // result: (ROLQconst [c&63] x) for { t := v.Type x := v.Args[0] c := v.AuxInt v.reset(OpAMD64ROLQconst) v.Type = t v.AuxInt = c & 63 v.AddArg(x) return true } return false } func rewriteValueAMD64_OpLrot8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lrot8 x [c]) // cond: // result: (ROLBconst [c&7] x) for { t := v.Type x := v.Args[0] c := v.AuxInt v.reset(OpAMD64ROLBconst) v.Type = t v.AuxInt = c & 7 v.AddArg(x) return true } return false } func rewriteValueAMD64_OpLsh16x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh16x16 x y) // cond: // result: (ANDW (SHLW x y) (SBBLcarrymask (CMPWconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHLW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh16x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh16x32 x y) // cond: // result: (ANDW (SHLW x y) (SBBLcarrymask (CMPLconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHLW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh16x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh16x64 x y) // cond: // result: (ANDW (SHLW x y) (SBBLcarrymask (CMPQconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHLW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh16x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh16x8 x y) // cond: // result: (ANDW (SHLW x y) (SBBLcarrymask (CMPBconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHLW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh32x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh32x16 x y) // cond: // result: (ANDL (SHLL x y) (SBBLcarrymask (CMPWconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHLL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh32x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh32x32 x y) // cond: // result: (ANDL (SHLL x y) (SBBLcarrymask (CMPLconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHLL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh32x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh32x64 x y) // cond: // result: (ANDL (SHLL x y) (SBBLcarrymask (CMPQconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHLL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh32x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh32x8 x y) // cond: // result: (ANDL (SHLL x y) (SBBLcarrymask (CMPBconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHLL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh64x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh64x16 x y) // cond: // result: (ANDQ (SHLQ x y) (SBBQcarrymask (CMPWconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHLQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh64x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh64x32 x y) // cond: // result: (ANDQ (SHLQ x y) (SBBQcarrymask (CMPLconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHLQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh64x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh64x64 x y) // cond: // result: (ANDQ (SHLQ x y) (SBBQcarrymask (CMPQconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHLQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh64x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh64x8 x y) // cond: // result: (ANDQ (SHLQ x y) (SBBQcarrymask (CMPBconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHLQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh8x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh8x16 x y) // cond: // result: (ANDB (SHLB x y) (SBBLcarrymask (CMPWconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHLB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh8x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh8x32 x y) // cond: // result: (ANDB (SHLB x y) (SBBLcarrymask (CMPLconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHLB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh8x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh8x64 x y) // cond: // result: (ANDB (SHLB x y) (SBBLcarrymask (CMPQconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHLB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpLsh8x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Lsh8x8 x y) // cond: // result: (ANDB (SHLB x y) (SBBLcarrymask (CMPBconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHLB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpAMD64MOVBQSX(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBQSX x:(MOVBload [off] {sym} ptr mem)) // cond: x.Uses == 1 // result: @x.Block (MOVBQSXload [off] {sym} ptr mem) for { x := v.Args[0] if x.Op != OpAMD64MOVBload { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] mem := x.Args[1] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVBQSXload, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(mem) return true } // match: (MOVBQSX (ANDBconst [c] x)) // cond: c & 0x80 == 0 // result: (ANDQconst [c & 0x7f] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDBconst { break } c := v_0.AuxInt x := v_0.Args[0] if !(c&0x80 == 0) { break } v.reset(OpAMD64ANDQconst) v.AuxInt = c & 0x7f v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MOVBQSXload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBQSXload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVBQSXload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVBQSXload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVBQZX(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBQZX x:(MOVBload [off] {sym} ptr mem)) // cond: x.Uses == 1 // result: @x.Block (MOVBload [off] {sym} ptr mem) for { x := v.Args[0] if x.Op != OpAMD64MOVBload { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] mem := x.Args[1] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVBload, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(mem) return true } // match: (MOVBQZX x:(MOVBloadidx1 [off] {sym} ptr idx mem)) // cond: x.Uses == 1 // result: @x.Block (MOVBloadidx1 [off] {sym} ptr idx mem) for { x := v.Args[0] if x.Op != OpAMD64MOVBloadidx1 { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] idx := x.Args[1] mem := x.Args[2] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVBloadidx1, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(idx) v0.AddArg(mem) return true } // match: (MOVBQZX (ANDBconst [c] x)) // cond: // result: (ANDQconst [c & 0xff] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDBconst { break } c := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ANDQconst) v.AuxInt = c & 0xff v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MOVBload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _)) // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) // result: x for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBstore { break } off2 := v_1.AuxInt sym2 := v_1.Aux ptr2 := v_1.Args[0] x := v_1.Args[1] if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (MOVBload [off1] {sym} (ADDQconst [off2] ptr) mem) // cond: is32Bit(off1+off2) // result: (MOVBload [off1+off2] {sym} ptr mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVBload) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVBload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVBload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } // match: (MOVBload [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVBloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVBloadidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVBload [off] {sym} (ADDQ ptr idx) mem) // cond: ptr.Op != OpSB // result: (MOVBloadidx1 [off] {sym} ptr idx mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVBloadidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVBloadidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBloadidx1 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVBloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVBloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVBloadidx1 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVBloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVBloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVBstore(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBstore [off] {sym} ptr (MOVBQSX x) mem) // cond: // result: (MOVBstore [off] {sym} ptr x mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBQSX { break } x := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVBstore) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(x) v.AddArg(mem) return true } // match: (MOVBstore [off] {sym} ptr (MOVBQZX x) mem) // cond: // result: (MOVBstore [off] {sym} ptr x mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBQZX { break } x := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVBstore) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(x) v.AddArg(mem) return true } // match: (MOVBstore [off1] {sym} (ADDQconst [off2] ptr) val mem) // cond: is32Bit(off1+off2) // result: (MOVBstore [off1+off2] {sym} ptr val mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVBstore) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVBstore [off] {sym} ptr (MOVBconst [c]) mem) // cond: validOff(off) // result: (MOVBstoreconst [makeValAndOff(int64(int8(c)),off)] {sym} ptr mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt mem := v.Args[2] if !(validOff(off)) { break } v.reset(OpAMD64MOVBstoreconst) v.AuxInt = makeValAndOff(int64(int8(c)), off) v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVBstore [off1] {sym1} (LEAQ [off2] {sym2} base) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVBstore) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVBstore [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVBstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVBstoreidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVBstore [off] {sym} (ADDQ ptr idx) val mem) // cond: ptr.Op != OpSB // result: (MOVBstoreidx1 [off] {sym} ptr idx val mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVBstoreidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVBstoreconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBstoreconst [sc] {s} (ADDQconst [off] ptr) mem) // cond: ValAndOff(sc).canAdd(off) // result: (MOVBstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) for { sc := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVBstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = s v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVBstoreconst [sc] {sym1} (LEAQ [off] {sym2} ptr) mem) // cond: canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) // result: (MOVBstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) for { sc := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] mem := v.Args[1] if !(canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVBstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVBstoreconst [x] {sym1} (LEAQ1 [off] {sym2} ptr idx) mem) // cond: canMergeSym(sym1, sym2) // result: (MOVBstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) for { x := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVBstoreconstidx1) v.AuxInt = ValAndOff(x).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVBstoreconst [x] {sym} (ADDQ ptr idx) mem) // cond: // result: (MOVBstoreconstidx1 [x] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] v.reset(OpAMD64MOVBstoreconstidx1) v.AuxInt = x v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVBstoreconstidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBstoreconstidx1 [x] {sym} (ADDQconst [c] ptr) idx mem) // cond: // result: (MOVBstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVBstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVBstoreconstidx1 [x] {sym} ptr (ADDQconst [c] idx) mem) // cond: // result: (MOVBstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVBstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVBstoreidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVBstoreidx1 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVBstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVBstoreidx1 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVBstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLQSX(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLQSX x:(MOVLload [off] {sym} ptr mem)) // cond: x.Uses == 1 // result: @x.Block (MOVLQSXload [off] {sym} ptr mem) for { x := v.Args[0] if x.Op != OpAMD64MOVLload { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] mem := x.Args[1] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVLQSXload, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(mem) return true } // match: (MOVLQSX (ANDLconst [c] x)) // cond: c & 0x80000000 == 0 // result: (ANDQconst [c & 0x7fffffff] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDLconst { break } c := v_0.AuxInt x := v_0.Args[0] if !(c&0x80000000 == 0) { break } v.reset(OpAMD64ANDQconst) v.AuxInt = c & 0x7fffffff v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MOVLQSXload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLQSXload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVLQSXload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLQSXload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLQZX(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLQZX x:(MOVLload [off] {sym} ptr mem)) // cond: x.Uses == 1 // result: @x.Block (MOVLload [off] {sym} ptr mem) for { x := v.Args[0] if x.Op != OpAMD64MOVLload { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] mem := x.Args[1] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVLload, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(mem) return true } // match: (MOVLQZX x:(MOVLloadidx1 [off] {sym} ptr idx mem)) // cond: x.Uses == 1 // result: @x.Block (MOVLloadidx1 [off] {sym} ptr idx mem) for { x := v.Args[0] if x.Op != OpAMD64MOVLloadidx1 { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] idx := x.Args[1] mem := x.Args[2] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVLloadidx1, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(idx) v0.AddArg(mem) return true } // match: (MOVLQZX x:(MOVLloadidx4 [off] {sym} ptr idx mem)) // cond: x.Uses == 1 // result: @x.Block (MOVLloadidx4 [off] {sym} ptr idx mem) for { x := v.Args[0] if x.Op != OpAMD64MOVLloadidx4 { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] idx := x.Args[1] mem := x.Args[2] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVLloadidx4, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(idx) v0.AddArg(mem) return true } // match: (MOVLQZX (ANDLconst [c] x)) // cond: c & 0x80000000 == 0 // result: (ANDQconst [c & 0x7fffffff] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDLconst { break } c := v_0.AuxInt x := v_0.Args[0] if !(c&0x80000000 == 0) { break } v.reset(OpAMD64ANDQconst) v.AuxInt = c & 0x7fffffff v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MOVLload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLload [off] {sym} ptr (MOVLstore [off2] {sym2} ptr2 x _)) // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) // result: x for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLstore { break } off2 := v_1.AuxInt sym2 := v_1.Aux ptr2 := v_1.Args[0] x := v_1.Args[1] if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (MOVLload [off1] {sym} (ADDQconst [off2] ptr) mem) // cond: is32Bit(off1+off2) // result: (MOVLload [off1+off2] {sym} ptr mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVLload) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVLload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVLload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } // match: (MOVLload [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVLloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLloadidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLload [off1] {sym1} (LEAQ4 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVLloadidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ4 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLloadidx4) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLload [off] {sym} (ADDQ ptr idx) mem) // cond: ptr.Op != OpSB // result: (MOVLloadidx1 [off] {sym} ptr idx mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVLloadidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLloadidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLloadidx1 [c] {sym} ptr (SHLQconst [2] idx) mem) // cond: // result: (MOVLloadidx4 [c] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 2 { break } idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLloadidx4) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLloadidx1 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVLloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVLloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLloadidx1 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVLloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLloadidx4(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLloadidx4 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVLloadidx4 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVLloadidx4) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLloadidx4 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVLloadidx4 [c+4*d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLloadidx4) v.AuxInt = c + 4*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLstore(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLstore [off] {sym} ptr (MOVLQSX x) mem) // cond: // result: (MOVLstore [off] {sym} ptr x mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLQSX { break } x := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLstore) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(x) v.AddArg(mem) return true } // match: (MOVLstore [off] {sym} ptr (MOVLQZX x) mem) // cond: // result: (MOVLstore [off] {sym} ptr x mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLQZX { break } x := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLstore) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(x) v.AddArg(mem) return true } // match: (MOVLstore [off1] {sym} (ADDQconst [off2] ptr) val mem) // cond: is32Bit(off1+off2) // result: (MOVLstore [off1+off2] {sym} ptr val mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVLstore) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVLstore [off] {sym} ptr (MOVLconst [c]) mem) // cond: validOff(off) // result: (MOVLstoreconst [makeValAndOff(int64(int32(c)),off)] {sym} ptr mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt mem := v.Args[2] if !(validOff(off)) { break } v.reset(OpAMD64MOVLstoreconst) v.AuxInt = makeValAndOff(int64(int32(c)), off) v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVLstore [off1] {sym1} (LEAQ [off2] {sym2} base) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVLstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLstore) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVLstore [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVLstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLstoreidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVLstore [off1] {sym1} (LEAQ4 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVLstoreidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ4 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLstoreidx4) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVLstore [off] {sym} (ADDQ ptr idx) val mem) // cond: ptr.Op != OpSB // result: (MOVLstoreidx1 [off] {sym} ptr idx val mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVLstoreidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLstoreconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLstoreconst [sc] {s} (ADDQconst [off] ptr) mem) // cond: ValAndOff(sc).canAdd(off) // result: (MOVLstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) for { sc := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVLstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = s v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVLstoreconst [sc] {sym1} (LEAQ [off] {sym2} ptr) mem) // cond: canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) // result: (MOVLstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) for { sc := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] mem := v.Args[1] if !(canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVLstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVLstoreconst [x] {sym1} (LEAQ1 [off] {sym2} ptr idx) mem) // cond: canMergeSym(sym1, sym2) // result: (MOVLstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) for { x := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLstoreconstidx1) v.AuxInt = ValAndOff(x).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLstoreconst [x] {sym1} (LEAQ4 [off] {sym2} ptr idx) mem) // cond: canMergeSym(sym1, sym2) // result: (MOVLstoreconstidx4 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) for { x := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ4 { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVLstoreconstidx4) v.AuxInt = ValAndOff(x).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLstoreconst [x] {sym} (ADDQ ptr idx) mem) // cond: // result: (MOVLstoreconstidx1 [x] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] v.reset(OpAMD64MOVLstoreconstidx1) v.AuxInt = x v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLstoreconstidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLstoreconstidx1 [c] {sym} ptr (SHLQconst [2] idx) mem) // cond: // result: (MOVLstoreconstidx4 [c] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 2 { break } idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLstoreconstidx4) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLstoreconstidx1 [x] {sym} (ADDQconst [c] ptr) idx mem) // cond: // result: (MOVLstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVLstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLstoreconstidx1 [x] {sym} ptr (ADDQconst [c] idx) mem) // cond: // result: (MOVLstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLstoreconstidx4(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLstoreconstidx4 [x] {sym} (ADDQconst [c] ptr) idx mem) // cond: // result: (MOVLstoreconstidx4 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVLstoreconstidx4) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVLstoreconstidx4 [x] {sym} ptr (ADDQconst [c] idx) mem) // cond: // result: (MOVLstoreconstidx4 [ValAndOff(x).add(4*c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVLstoreconstidx4) v.AuxInt = ValAndOff(x).add(4 * c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLstoreidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLstoreidx1 [c] {sym} ptr (SHLQconst [2] idx) val mem) // cond: // result: (MOVLstoreidx4 [c] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 2 { break } idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVLstoreidx4) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVLstoreidx1 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVLstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVLstoreidx1 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVLstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVLstoreidx4(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVLstoreidx4 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVLstoreidx4 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVLstoreidx4) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVLstoreidx4 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVLstoreidx4 [c+4*d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVLstoreidx4) v.AuxInt = c + 4*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVOload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVOload [off1] {sym} (ADDQconst [off2] ptr) mem) // cond: is32Bit(off1+off2) // result: (MOVOload [off1+off2] {sym} ptr mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVOload) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVOload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVOload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVOload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVOstore(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVOstore [off1] {sym} (ADDQconst [off2] ptr) val mem) // cond: is32Bit(off1+off2) // result: (MOVOstore [off1+off2] {sym} ptr val mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVOstore) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVOstore [off1] {sym1} (LEAQ [off2] {sym2} base) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVOstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVOstore) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQload [off] {sym} ptr (MOVQstore [off2] {sym2} ptr2 x _)) // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) // result: x for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQstore { break } off2 := v_1.AuxInt sym2 := v_1.Aux ptr2 := v_1.Args[0] x := v_1.Args[1] if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (MOVQload [off1] {sym} (ADDQconst [off2] ptr) mem) // cond: is32Bit(off1+off2) // result: (MOVQload [off1+off2] {sym} ptr mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVQload) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVQload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVQload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } // match: (MOVQload [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVQloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQloadidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQload [off1] {sym1} (LEAQ8 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVQloadidx8 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ8 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQloadidx8) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQload [off] {sym} (ADDQ ptr idx) mem) // cond: ptr.Op != OpSB // result: (MOVQloadidx1 [off] {sym} ptr idx mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVQloadidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQloadidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQloadidx1 [c] {sym} ptr (SHLQconst [3] idx) mem) // cond: // result: (MOVQloadidx8 [c] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 3 { break } idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVQloadidx8) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQloadidx1 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVQloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVQloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQloadidx1 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVQloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVQloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQloadidx8(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQloadidx8 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVQloadidx8 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVQloadidx8) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQloadidx8 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVQloadidx8 [c+8*d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVQloadidx8) v.AuxInt = c + 8*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQstore(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQstore [off1] {sym} (ADDQconst [off2] ptr) val mem) // cond: is32Bit(off1+off2) // result: (MOVQstore [off1+off2] {sym} ptr val mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVQstore) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVQstore [off] {sym} ptr (MOVQconst [c]) mem) // cond: validValAndOff(c,off) // result: (MOVQstoreconst [makeValAndOff(c,off)] {sym} ptr mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt mem := v.Args[2] if !(validValAndOff(c, off)) { break } v.reset(OpAMD64MOVQstoreconst) v.AuxInt = makeValAndOff(c, off) v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVQstore [off1] {sym1} (LEAQ [off2] {sym2} base) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVQstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQstore) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVQstore [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVQstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQstoreidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVQstore [off1] {sym1} (LEAQ8 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVQstoreidx8 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ8 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQstoreidx8) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVQstore [off] {sym} (ADDQ ptr idx) val mem) // cond: ptr.Op != OpSB // result: (MOVQstoreidx1 [off] {sym} ptr idx val mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVQstoreidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQstoreconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQstoreconst [sc] {s} (ADDQconst [off] ptr) mem) // cond: ValAndOff(sc).canAdd(off) // result: (MOVQstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) for { sc := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVQstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = s v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVQstoreconst [sc] {sym1} (LEAQ [off] {sym2} ptr) mem) // cond: canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) // result: (MOVQstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) for { sc := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] mem := v.Args[1] if !(canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVQstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVQstoreconst [x] {sym1} (LEAQ1 [off] {sym2} ptr idx) mem) // cond: canMergeSym(sym1, sym2) // result: (MOVQstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) for { x := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQstoreconstidx1) v.AuxInt = ValAndOff(x).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQstoreconst [x] {sym1} (LEAQ8 [off] {sym2} ptr idx) mem) // cond: canMergeSym(sym1, sym2) // result: (MOVQstoreconstidx8 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) for { x := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ8 { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVQstoreconstidx8) v.AuxInt = ValAndOff(x).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQstoreconst [x] {sym} (ADDQ ptr idx) mem) // cond: // result: (MOVQstoreconstidx1 [x] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] v.reset(OpAMD64MOVQstoreconstidx1) v.AuxInt = x v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQstoreconstidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQstoreconstidx1 [c] {sym} ptr (SHLQconst [3] idx) mem) // cond: // result: (MOVQstoreconstidx8 [c] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 3 { break } idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVQstoreconstidx8) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQstoreconstidx1 [x] {sym} (ADDQconst [c] ptr) idx mem) // cond: // result: (MOVQstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVQstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQstoreconstidx1 [x] {sym} ptr (ADDQconst [c] idx) mem) // cond: // result: (MOVQstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVQstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQstoreconstidx8(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQstoreconstidx8 [x] {sym} (ADDQconst [c] ptr) idx mem) // cond: // result: (MOVQstoreconstidx8 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVQstoreconstidx8) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVQstoreconstidx8 [x] {sym} ptr (ADDQconst [c] idx) mem) // cond: // result: (MOVQstoreconstidx8 [ValAndOff(x).add(8*c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVQstoreconstidx8) v.AuxInt = ValAndOff(x).add(8 * c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQstoreidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQstoreidx1 [c] {sym} ptr (SHLQconst [3] idx) val mem) // cond: // result: (MOVQstoreidx8 [c] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 3 { break } idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVQstoreidx8) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVQstoreidx1 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVQstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVQstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVQstoreidx1 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVQstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVQstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVQstoreidx8(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVQstoreidx8 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVQstoreidx8 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVQstoreidx8) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVQstoreidx8 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVQstoreidx8 [c+8*d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVQstoreidx8) v.AuxInt = c + 8*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSDload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSDload [off1] {sym} (ADDQconst [off2] ptr) mem) // cond: is32Bit(off1+off2) // result: (MOVSDload [off1+off2] {sym} ptr mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVSDload) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVSDload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSDload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSDload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } // match: (MOVSDload [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSDloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSDloadidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSDload [off1] {sym1} (LEAQ8 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSDloadidx8 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ8 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSDloadidx8) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSDload [off] {sym} (ADDQ ptr idx) mem) // cond: ptr.Op != OpSB // result: (MOVSDloadidx1 [off] {sym} ptr idx mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVSDloadidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSDloadidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSDloadidx1 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVSDloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVSDloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSDloadidx1 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVSDloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVSDloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSDloadidx8(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSDloadidx8 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVSDloadidx8 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVSDloadidx8) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSDloadidx8 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVSDloadidx8 [c+8*d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVSDloadidx8) v.AuxInt = c + 8*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSDstore(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSDstore [off1] {sym} (ADDQconst [off2] ptr) val mem) // cond: is32Bit(off1+off2) // result: (MOVSDstore [off1+off2] {sym} ptr val mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVSDstore) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSDstore [off1] {sym1} (LEAQ [off2] {sym2} base) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSDstore) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSDstore [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSDstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSDstoreidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSDstore [off1] {sym1} (LEAQ8 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSDstoreidx8 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ8 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSDstoreidx8) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSDstore [off] {sym} (ADDQ ptr idx) val mem) // cond: ptr.Op != OpSB // result: (MOVSDstoreidx1 [off] {sym} ptr idx val mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVSDstoreidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSDstoreidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSDstoreidx1 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSDstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSDstoreidx1 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSDstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSDstoreidx8(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSDstoreidx8 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVSDstoreidx8 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSDstoreidx8) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSDstoreidx8 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVSDstoreidx8 [c+8*d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSDstoreidx8) v.AuxInt = c + 8*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSSload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSSload [off1] {sym} (ADDQconst [off2] ptr) mem) // cond: is32Bit(off1+off2) // result: (MOVSSload [off1+off2] {sym} ptr mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVSSload) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVSSload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSSload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSSload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } // match: (MOVSSload [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSSloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSSloadidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSSload [off1] {sym1} (LEAQ4 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSSloadidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ4 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSSloadidx4) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSSload [off] {sym} (ADDQ ptr idx) mem) // cond: ptr.Op != OpSB // result: (MOVSSloadidx1 [off] {sym} ptr idx mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVSSloadidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSSloadidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSSloadidx1 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVSSloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVSSloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSSloadidx1 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVSSloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVSSloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSSloadidx4(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSSloadidx4 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVSSloadidx4 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVSSloadidx4) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVSSloadidx4 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVSSloadidx4 [c+4*d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVSSloadidx4) v.AuxInt = c + 4*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSSstore(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSSstore [off1] {sym} (ADDQconst [off2] ptr) val mem) // cond: is32Bit(off1+off2) // result: (MOVSSstore [off1+off2] {sym} ptr val mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVSSstore) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSSstore [off1] {sym1} (LEAQ [off2] {sym2} base) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSSstore) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSSstore [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSSstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSSstoreidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSSstore [off1] {sym1} (LEAQ4 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVSSstoreidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ4 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVSSstoreidx4) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSSstore [off] {sym} (ADDQ ptr idx) val mem) // cond: ptr.Op != OpSB // result: (MOVSSstoreidx1 [off] {sym} ptr idx val mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVSSstoreidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSSstoreidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSSstoreidx1 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSSstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSSstoreidx1 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSSstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVSSstoreidx4(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVSSstoreidx4 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVSSstoreidx4 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSSstoreidx4) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVSSstoreidx4 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVSSstoreidx4 [c+4*d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVSSstoreidx4) v.AuxInt = c + 4*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWQSX(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWQSX x:(MOVWload [off] {sym} ptr mem)) // cond: x.Uses == 1 // result: @x.Block (MOVWQSXload [off] {sym} ptr mem) for { x := v.Args[0] if x.Op != OpAMD64MOVWload { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] mem := x.Args[1] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVWQSXload, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(mem) return true } // match: (MOVWQSX (ANDWconst [c] x)) // cond: c & 0x8000 == 0 // result: (ANDQconst [c & 0x7fff] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDWconst { break } c := v_0.AuxInt x := v_0.Args[0] if !(c&0x8000 == 0) { break } v.reset(OpAMD64ANDQconst) v.AuxInt = c & 0x7fff v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MOVWQSXload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWQSXload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVWQSXload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWQSXload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWQZX(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWQZX x:(MOVWload [off] {sym} ptr mem)) // cond: x.Uses == 1 // result: @x.Block (MOVWload [off] {sym} ptr mem) for { x := v.Args[0] if x.Op != OpAMD64MOVWload { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] mem := x.Args[1] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVWload, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(mem) return true } // match: (MOVWQZX x:(MOVWloadidx1 [off] {sym} ptr idx mem)) // cond: x.Uses == 1 // result: @x.Block (MOVWloadidx1 [off] {sym} ptr idx mem) for { x := v.Args[0] if x.Op != OpAMD64MOVWloadidx1 { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] idx := x.Args[1] mem := x.Args[2] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVWloadidx1, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(idx) v0.AddArg(mem) return true } // match: (MOVWQZX x:(MOVWloadidx2 [off] {sym} ptr idx mem)) // cond: x.Uses == 1 // result: @x.Block (MOVWloadidx2 [off] {sym} ptr idx mem) for { x := v.Args[0] if x.Op != OpAMD64MOVWloadidx2 { break } off := x.AuxInt sym := x.Aux ptr := x.Args[0] idx := x.Args[1] mem := x.Args[2] if !(x.Uses == 1) { break } b = x.Block v0 := b.NewValue0(v.Line, OpAMD64MOVWloadidx2, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = off v0.Aux = sym v0.AddArg(ptr) v0.AddArg(idx) v0.AddArg(mem) return true } // match: (MOVWQZX (ANDWconst [c] x)) // cond: // result: (ANDQconst [c & 0xffff] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ANDWconst { break } c := v_0.AuxInt x := v_0.Args[0] v.reset(OpAMD64ANDQconst) v.AuxInt = c & 0xffff v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MOVWload(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _)) // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) // result: x for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWstore { break } off2 := v_1.AuxInt sym2 := v_1.Aux ptr2 := v_1.Args[0] x := v_1.Args[1] if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (MOVWload [off1] {sym} (ADDQconst [off2] ptr) mem) // cond: is32Bit(off1+off2) // result: (MOVWload [off1+off2] {sym} ptr mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVWload) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVWload [off1] {sym1} (LEAQ [off2] {sym2} base) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWload) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(mem) return true } // match: (MOVWload [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVWloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWloadidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWload [off1] {sym1} (LEAQ2 [off2] {sym2} ptr idx) mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVWloadidx2 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ2 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWloadidx2) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWload [off] {sym} (ADDQ ptr idx) mem) // cond: ptr.Op != OpSB // result: (MOVWloadidx1 [off] {sym} ptr idx mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVWloadidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWloadidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWloadidx1 [c] {sym} ptr (SHLQconst [1] idx) mem) // cond: // result: (MOVWloadidx2 [c] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 1 { break } idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWloadidx2) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWloadidx1 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVWloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVWloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWloadidx1 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVWloadidx1 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWloadidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWloadidx2(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWloadidx2 [c] {sym} (ADDQconst [d] ptr) idx mem) // cond: // result: (MOVWloadidx2 [c+d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVWloadidx2) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWloadidx2 [c] {sym} ptr (ADDQconst [d] idx) mem) // cond: // result: (MOVWloadidx2 [c+2*d] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWloadidx2) v.AuxInt = c + 2*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWstore(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWstore [off] {sym} ptr (MOVWQSX x) mem) // cond: // result: (MOVWstore [off] {sym} ptr x mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWQSX { break } x := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWstore) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(x) v.AddArg(mem) return true } // match: (MOVWstore [off] {sym} ptr (MOVWQZX x) mem) // cond: // result: (MOVWstore [off] {sym} ptr x mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWQZX { break } x := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWstore) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(x) v.AddArg(mem) return true } // match: (MOVWstore [off1] {sym} (ADDQconst [off2] ptr) val mem) // cond: is32Bit(off1+off2) // result: (MOVWstore [off1+off2] {sym} ptr val mem) for { off1 := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off2 := v_0.AuxInt ptr := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1 + off2)) { break } v.reset(OpAMD64MOVWstore) v.AuxInt = off1 + off2 v.Aux = sym v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVWstore [off] {sym} ptr (MOVWconst [c]) mem) // cond: validOff(off) // result: (MOVWstoreconst [makeValAndOff(int64(int16(c)),off)] {sym} ptr mem) for { off := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt mem := v.Args[2] if !(validOff(off)) { break } v.reset(OpAMD64MOVWstoreconst) v.AuxInt = makeValAndOff(int64(int16(c)), off) v.Aux = sym v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVWstore [off1] {sym1} (LEAQ [off2] {sym2} base) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off2 := v_0.AuxInt sym2 := v_0.Aux base := v_0.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWstore) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(base) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVWstore [off1] {sym1} (LEAQ1 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVWstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWstoreidx1) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVWstore [off1] {sym1} (LEAQ2 [off2] {sym2} ptr idx) val mem) // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) // result: (MOVWstoreidx2 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) for { off1 := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ2 { break } off2 := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWstoreidx2) v.AuxInt = off1 + off2 v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVWstore [off] {sym} (ADDQ ptr idx) val mem) // cond: ptr.Op != OpSB // result: (MOVWstoreidx1 [off] {sym} ptr idx val mem) for { off := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] val := v.Args[1] mem := v.Args[2] if !(ptr.Op != OpSB) { break } v.reset(OpAMD64MOVWstoreidx1) v.AuxInt = off v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWstoreconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWstoreconst [sc] {s} (ADDQconst [off] ptr) mem) // cond: ValAndOff(sc).canAdd(off) // result: (MOVWstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) for { sc := v.AuxInt s := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } off := v_0.AuxInt ptr := v_0.Args[0] mem := v.Args[1] if !(ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVWstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = s v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVWstoreconst [sc] {sym1} (LEAQ [off] {sym2} ptr) mem) // cond: canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) // result: (MOVWstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) for { sc := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] mem := v.Args[1] if !(canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { break } v.reset(OpAMD64MOVWstoreconst) v.AuxInt = ValAndOff(sc).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(mem) return true } // match: (MOVWstoreconst [x] {sym1} (LEAQ1 [off] {sym2} ptr idx) mem) // cond: canMergeSym(sym1, sym2) // result: (MOVWstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) for { x := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ1 { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWstoreconstidx1) v.AuxInt = ValAndOff(x).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWstoreconst [x] {sym1} (LEAQ2 [off] {sym2} ptr idx) mem) // cond: canMergeSym(sym1, sym2) // result: (MOVWstoreconstidx2 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) for { x := v.AuxInt sym1 := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64LEAQ2 { break } off := v_0.AuxInt sym2 := v_0.Aux ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] if !(canMergeSym(sym1, sym2)) { break } v.reset(OpAMD64MOVWstoreconstidx2) v.AuxInt = ValAndOff(x).add(off) v.Aux = mergeSym(sym1, sym2) v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWstoreconst [x] {sym} (ADDQ ptr idx) mem) // cond: // result: (MOVWstoreconstidx1 [x] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQ { break } ptr := v_0.Args[0] idx := v_0.Args[1] mem := v.Args[1] v.reset(OpAMD64MOVWstoreconstidx1) v.AuxInt = x v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWstoreconstidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWstoreconstidx1 [c] {sym} ptr (SHLQconst [1] idx) mem) // cond: // result: (MOVWstoreconstidx2 [c] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 1 { break } idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWstoreconstidx2) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWstoreconstidx1 [x] {sym} (ADDQconst [c] ptr) idx mem) // cond: // result: (MOVWstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVWstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWstoreconstidx1 [x] {sym} ptr (ADDQconst [c] idx) mem) // cond: // result: (MOVWstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWstoreconstidx1) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWstoreconstidx2(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWstoreconstidx2 [x] {sym} (ADDQconst [c] ptr) idx mem) // cond: // result: (MOVWstoreconstidx2 [ValAndOff(x).add(c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } c := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVWstoreconstidx2) v.AuxInt = ValAndOff(x).add(c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } // match: (MOVWstoreconstidx2 [x] {sym} ptr (ADDQconst [c] idx) mem) // cond: // result: (MOVWstoreconstidx2 [ValAndOff(x).add(2*c)] {sym} ptr idx mem) for { x := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } c := v_1.AuxInt idx := v_1.Args[0] mem := v.Args[2] v.reset(OpAMD64MOVWstoreconstidx2) v.AuxInt = ValAndOff(x).add(2 * c) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWstoreidx1(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWstoreidx1 [c] {sym} ptr (SHLQconst [1] idx) val mem) // cond: // result: (MOVWstoreidx2 [c] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 1 { break } idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVWstoreidx2) v.AuxInt = c v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVWstoreidx1 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVWstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVWstoreidx1 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVWstoreidx1) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MOVWstoreidx2(v *Value, config *Config) bool { b := v.Block _ = b // match: (MOVWstoreidx2 [c] {sym} (ADDQconst [d] ptr) idx val mem) // cond: // result: (MOVWstoreidx2 [c+d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux v_0 := v.Args[0] if v_0.Op != OpAMD64ADDQconst { break } d := v_0.AuxInt ptr := v_0.Args[0] idx := v.Args[1] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVWstoreidx2) v.AuxInt = c + d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } // match: (MOVWstoreidx2 [c] {sym} ptr (ADDQconst [d] idx) val mem) // cond: // result: (MOVWstoreidx2 [c+2*d] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux ptr := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ADDQconst { break } d := v_1.AuxInt idx := v_1.Args[0] val := v.Args[2] mem := v.Args[3] v.reset(OpAMD64MOVWstoreidx2) v.AuxInt = c + 2*d v.Aux = sym v.AddArg(ptr) v.AddArg(idx) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64MULB(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULB x (MOVBconst [c])) // cond: // result: (MULBconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64MULBconst) v.AuxInt = c v.AddArg(x) return true } // match: (MULB (MOVBconst [c]) x) // cond: // result: (MULBconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64MULBconst) v.AuxInt = c v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MULBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULBconst [c] (MOVBconst [d])) // cond: // result: (MOVBconst [int64(int8(c*d))]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = int64(int8(c * d)) return true } return false } func rewriteValueAMD64_OpAMD64MULL(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULL x (MOVLconst [c])) // cond: // result: (MULLconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64MULLconst) v.AuxInt = c v.AddArg(x) return true } // match: (MULL (MOVLconst [c]) x) // cond: // result: (MULLconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64MULLconst) v.AuxInt = c v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MULLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULLconst [c] (MOVLconst [d])) // cond: // result: (MOVLconst [int64(int32(c*d))]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = int64(int32(c * d)) return true } return false } func rewriteValueAMD64_OpAMD64MULQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULQ x (MOVQconst [c])) // cond: is32Bit(c) // result: (MULQconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt if !(is32Bit(c)) { break } v.reset(OpAMD64MULQconst) v.AuxInt = c v.AddArg(x) return true } // match: (MULQ (MOVQconst [c]) x) // cond: is32Bit(c) // result: (MULQconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt x := v.Args[1] if !(is32Bit(c)) { break } v.reset(OpAMD64MULQconst) v.AuxInt = c v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MULQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULQconst [-1] x) // cond: // result: (NEGQ x) for { if v.AuxInt != -1 { break } x := v.Args[0] v.reset(OpAMD64NEGQ) v.AddArg(x) return true } // match: (MULQconst [0] _) // cond: // result: (MOVQconst [0]) for { if v.AuxInt != 0 { break } v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } // match: (MULQconst [1] x) // cond: // result: x for { if v.AuxInt != 1 { break } x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (MULQconst [3] x) // cond: // result: (LEAQ2 x x) for { if v.AuxInt != 3 { break } x := v.Args[0] v.reset(OpAMD64LEAQ2) v.AddArg(x) v.AddArg(x) return true } // match: (MULQconst [5] x) // cond: // result: (LEAQ4 x x) for { if v.AuxInt != 5 { break } x := v.Args[0] v.reset(OpAMD64LEAQ4) v.AddArg(x) v.AddArg(x) return true } // match: (MULQconst [7] x) // cond: // result: (LEAQ8 (NEGQ x) x) for { if v.AuxInt != 7 { break } x := v.Args[0] v.reset(OpAMD64LEAQ8) v0 := b.NewValue0(v.Line, OpAMD64NEGQ, v.Type) v0.AddArg(x) v.AddArg(v0) v.AddArg(x) return true } // match: (MULQconst [9] x) // cond: // result: (LEAQ8 x x) for { if v.AuxInt != 9 { break } x := v.Args[0] v.reset(OpAMD64LEAQ8) v.AddArg(x) v.AddArg(x) return true } // match: (MULQconst [11] x) // cond: // result: (LEAQ2 x (LEAQ4 x x)) for { if v.AuxInt != 11 { break } x := v.Args[0] v.reset(OpAMD64LEAQ2) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64LEAQ4, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [13] x) // cond: // result: (LEAQ4 x (LEAQ2 x x)) for { if v.AuxInt != 13 { break } x := v.Args[0] v.reset(OpAMD64LEAQ4) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64LEAQ2, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [21] x) // cond: // result: (LEAQ4 x (LEAQ4 x x)) for { if v.AuxInt != 21 { break } x := v.Args[0] v.reset(OpAMD64LEAQ4) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64LEAQ4, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [25] x) // cond: // result: (LEAQ8 x (LEAQ2 x x)) for { if v.AuxInt != 25 { break } x := v.Args[0] v.reset(OpAMD64LEAQ8) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64LEAQ2, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [37] x) // cond: // result: (LEAQ4 x (LEAQ8 x x)) for { if v.AuxInt != 37 { break } x := v.Args[0] v.reset(OpAMD64LEAQ4) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64LEAQ8, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [41] x) // cond: // result: (LEAQ8 x (LEAQ4 x x)) for { if v.AuxInt != 41 { break } x := v.Args[0] v.reset(OpAMD64LEAQ8) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64LEAQ4, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [73] x) // cond: // result: (LEAQ8 x (LEAQ8 x x)) for { if v.AuxInt != 73 { break } x := v.Args[0] v.reset(OpAMD64LEAQ8) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64LEAQ8, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [c] x) // cond: isPowerOfTwo(c) // result: (SHLQconst [log2(c)] x) for { c := v.AuxInt x := v.Args[0] if !(isPowerOfTwo(c)) { break } v.reset(OpAMD64SHLQconst) v.AuxInt = log2(c) v.AddArg(x) return true } // match: (MULQconst [c] x) // cond: isPowerOfTwo(c+1) && c >= 15 // result: (SUBQ (SHLQconst [log2(c+1)] x) x) for { c := v.AuxInt x := v.Args[0] if !(isPowerOfTwo(c+1) && c >= 15) { break } v.reset(OpAMD64SUBQ) v0 := b.NewValue0(v.Line, OpAMD64SHLQconst, v.Type) v0.AuxInt = log2(c + 1) v0.AddArg(x) v.AddArg(v0) v.AddArg(x) return true } // match: (MULQconst [c] x) // cond: isPowerOfTwo(c-1) && c >= 17 // result: (LEAQ1 (SHLQconst [log2(c-1)] x) x) for { c := v.AuxInt x := v.Args[0] if !(isPowerOfTwo(c-1) && c >= 17) { break } v.reset(OpAMD64LEAQ1) v0 := b.NewValue0(v.Line, OpAMD64SHLQconst, v.Type) v0.AuxInt = log2(c - 1) v0.AddArg(x) v.AddArg(v0) v.AddArg(x) return true } // match: (MULQconst [c] x) // cond: isPowerOfTwo(c-2) && c >= 34 // result: (LEAQ2 (SHLQconst [log2(c-2)] x) x) for { c := v.AuxInt x := v.Args[0] if !(isPowerOfTwo(c-2) && c >= 34) { break } v.reset(OpAMD64LEAQ2) v0 := b.NewValue0(v.Line, OpAMD64SHLQconst, v.Type) v0.AuxInt = log2(c - 2) v0.AddArg(x) v.AddArg(v0) v.AddArg(x) return true } // match: (MULQconst [c] x) // cond: isPowerOfTwo(c-4) && c >= 68 // result: (LEAQ4 (SHLQconst [log2(c-4)] x) x) for { c := v.AuxInt x := v.Args[0] if !(isPowerOfTwo(c-4) && c >= 68) { break } v.reset(OpAMD64LEAQ4) v0 := b.NewValue0(v.Line, OpAMD64SHLQconst, v.Type) v0.AuxInt = log2(c - 4) v0.AddArg(x) v.AddArg(v0) v.AddArg(x) return true } // match: (MULQconst [c] x) // cond: isPowerOfTwo(c-8) && c >= 136 // result: (LEAQ8 (SHLQconst [log2(c-8)] x) x) for { c := v.AuxInt x := v.Args[0] if !(isPowerOfTwo(c-8) && c >= 136) { break } v.reset(OpAMD64LEAQ8) v0 := b.NewValue0(v.Line, OpAMD64SHLQconst, v.Type) v0.AuxInt = log2(c - 8) v0.AddArg(x) v.AddArg(v0) v.AddArg(x) return true } // match: (MULQconst [c] x) // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SHLQconst [log2(c/3)] (LEAQ2 x x)) for { c := v.AuxInt x := v.Args[0] if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpAMD64SHLQconst) v.AuxInt = log2(c / 3) v0 := b.NewValue0(v.Line, OpAMD64LEAQ2, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [c] x) // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SHLQconst [log2(c/5)] (LEAQ4 x x)) for { c := v.AuxInt x := v.Args[0] if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpAMD64SHLQconst) v.AuxInt = log2(c / 5) v0 := b.NewValue0(v.Line, OpAMD64LEAQ4, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [c] x) // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SHLQconst [log2(c/9)] (LEAQ8 x x)) for { c := v.AuxInt x := v.Args[0] if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpAMD64SHLQconst) v.AuxInt = log2(c / 9) v0 := b.NewValue0(v.Line, OpAMD64LEAQ8, v.Type) v0.AddArg(x) v0.AddArg(x) v.AddArg(v0) return true } // match: (MULQconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [c*d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = c * d return true } return false } func rewriteValueAMD64_OpAMD64MULW(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULW x (MOVWconst [c])) // cond: // result: (MULWconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64MULWconst) v.AuxInt = c v.AddArg(x) return true } // match: (MULW (MOVWconst [c]) x) // cond: // result: (MULWconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64MULWconst) v.AuxInt = c v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64MULWconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (MULWconst [c] (MOVWconst [d])) // cond: // result: (MOVWconst [int64(int16(c*d))]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = int64(int16(c * d)) return true } return false } func rewriteValueAMD64_OpMod16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod16 x y) // cond: // result: (MODW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMod16u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod16u x y) // cond: // result: (MODWU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODWU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMod32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod32 x y) // cond: // result: (MODL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMod32u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod32u x y) // cond: // result: (MODLU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODLU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMod64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod64 x y) // cond: // result: (MODQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMod64u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod64u x y) // cond: // result: (MODQU x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODQU) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMod8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod8 x y) // cond: // result: (MODW (SignExt8to16 x) (SignExt8to16 y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODW) v0 := b.NewValue0(v.Line, OpSignExt8to16, config.fe.TypeInt16()) v0.AddArg(x) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpSignExt8to16, config.fe.TypeInt16()) v1.AddArg(y) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpMod8u(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mod8u x y) // cond: // result: (MODWU (ZeroExt8to16 x) (ZeroExt8to16 y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MODWU) v0 := b.NewValue0(v.Line, OpZeroExt8to16, config.fe.TypeUInt16()) v0.AddArg(x) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpZeroExt8to16, config.fe.TypeUInt16()) v1.AddArg(y) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpMove(v *Value, config *Config) bool { b := v.Block _ = b // match: (Move [0] _ _ mem) // cond: // result: mem for { if v.AuxInt != 0 { break } mem := v.Args[2] v.reset(OpCopy) v.Type = mem.Type v.AddArg(mem) return true } // match: (Move [1] dst src mem) // cond: // result: (MOVBstore dst (MOVBload src mem) mem) for { if v.AuxInt != 1 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVBstore) v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVBload, config.fe.TypeUInt8()) v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v.AddArg(mem) return true } // match: (Move [2] dst src mem) // cond: // result: (MOVWstore dst (MOVWload src mem) mem) for { if v.AuxInt != 2 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVWstore) v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVWload, config.fe.TypeUInt16()) v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v.AddArg(mem) return true } // match: (Move [4] dst src mem) // cond: // result: (MOVLstore dst (MOVLload src mem) mem) for { if v.AuxInt != 4 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVLstore) v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVLload, config.fe.TypeUInt32()) v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v.AddArg(mem) return true } // match: (Move [8] dst src mem) // cond: // result: (MOVQstore dst (MOVQload src mem) mem) for { if v.AuxInt != 8 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVQstore) v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVQload, config.fe.TypeUInt64()) v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v.AddArg(mem) return true } // match: (Move [16] dst src mem) // cond: // result: (MOVOstore dst (MOVOload src mem) mem) for { if v.AuxInt != 16 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVOstore) v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVOload, TypeInt128) v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v.AddArg(mem) return true } // match: (Move [3] dst src mem) // cond: // result: (MOVBstore [2] dst (MOVBload [2] src mem) (MOVWstore dst (MOVWload src mem) mem)) for { if v.AuxInt != 3 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVBstore) v.AuxInt = 2 v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVBload, config.fe.TypeUInt8()) v0.AuxInt = 2 v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVWstore, TypeMem) v1.AddArg(dst) v2 := b.NewValue0(v.Line, OpAMD64MOVWload, config.fe.TypeUInt16()) v2.AddArg(src) v2.AddArg(mem) v1.AddArg(v2) v1.AddArg(mem) v.AddArg(v1) return true } // match: (Move [5] dst src mem) // cond: // result: (MOVBstore [4] dst (MOVBload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) for { if v.AuxInt != 5 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVBstore) v.AuxInt = 4 v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVBload, config.fe.TypeUInt8()) v0.AuxInt = 4 v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVLstore, TypeMem) v1.AddArg(dst) v2 := b.NewValue0(v.Line, OpAMD64MOVLload, config.fe.TypeUInt32()) v2.AddArg(src) v2.AddArg(mem) v1.AddArg(v2) v1.AddArg(mem) v.AddArg(v1) return true } // match: (Move [6] dst src mem) // cond: // result: (MOVWstore [4] dst (MOVWload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) for { if v.AuxInt != 6 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVWstore) v.AuxInt = 4 v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVWload, config.fe.TypeUInt16()) v0.AuxInt = 4 v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVLstore, TypeMem) v1.AddArg(dst) v2 := b.NewValue0(v.Line, OpAMD64MOVLload, config.fe.TypeUInt32()) v2.AddArg(src) v2.AddArg(mem) v1.AddArg(v2) v1.AddArg(mem) v.AddArg(v1) return true } // match: (Move [7] dst src mem) // cond: // result: (MOVLstore [3] dst (MOVLload [3] src mem) (MOVLstore dst (MOVLload src mem) mem)) for { if v.AuxInt != 7 { break } dst := v.Args[0] src := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVLstore) v.AuxInt = 3 v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVLload, config.fe.TypeUInt32()) v0.AuxInt = 3 v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVLstore, TypeMem) v1.AddArg(dst) v2 := b.NewValue0(v.Line, OpAMD64MOVLload, config.fe.TypeUInt32()) v2.AddArg(src) v2.AddArg(mem) v1.AddArg(v2) v1.AddArg(mem) v.AddArg(v1) return true } // match: (Move [size] dst src mem) // cond: size > 8 && size < 16 // result: (MOVQstore [size-8] dst (MOVQload [size-8] src mem) (MOVQstore dst (MOVQload src mem) mem)) for { size := v.AuxInt dst := v.Args[0] src := v.Args[1] mem := v.Args[2] if !(size > 8 && size < 16) { break } v.reset(OpAMD64MOVQstore) v.AuxInt = size - 8 v.AddArg(dst) v0 := b.NewValue0(v.Line, OpAMD64MOVQload, config.fe.TypeUInt64()) v0.AuxInt = size - 8 v0.AddArg(src) v0.AddArg(mem) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVQstore, TypeMem) v1.AddArg(dst) v2 := b.NewValue0(v.Line, OpAMD64MOVQload, config.fe.TypeUInt64()) v2.AddArg(src) v2.AddArg(mem) v1.AddArg(v2) v1.AddArg(mem) v.AddArg(v1) return true } // match: (Move [size] dst src mem) // cond: size > 16 && size%16 != 0 && size%16 <= 8 // result: (Move [size-size%16] (ADDQconst dst [size%16]) (ADDQconst src [size%16]) (MOVQstore dst (MOVQload src mem) mem)) for { size := v.AuxInt dst := v.Args[0] src := v.Args[1] mem := v.Args[2] if !(size > 16 && size%16 != 0 && size%16 <= 8) { break } v.reset(OpMove) v.AuxInt = size - size%16 v0 := b.NewValue0(v.Line, OpAMD64ADDQconst, dst.Type) v0.AddArg(dst) v0.AuxInt = size % 16 v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64ADDQconst, src.Type) v1.AddArg(src) v1.AuxInt = size % 16 v.AddArg(v1) v2 := b.NewValue0(v.Line, OpAMD64MOVQstore, TypeMem) v2.AddArg(dst) v3 := b.NewValue0(v.Line, OpAMD64MOVQload, config.fe.TypeUInt64()) v3.AddArg(src) v3.AddArg(mem) v2.AddArg(v3) v2.AddArg(mem) v.AddArg(v2) return true } // match: (Move [size] dst src mem) // cond: size > 16 && size%16 != 0 && size%16 > 8 // result: (Move [size-size%16] (ADDQconst dst [size%16]) (ADDQconst src [size%16]) (MOVOstore dst (MOVOload src mem) mem)) for { size := v.AuxInt dst := v.Args[0] src := v.Args[1] mem := v.Args[2] if !(size > 16 && size%16 != 0 && size%16 > 8) { break } v.reset(OpMove) v.AuxInt = size - size%16 v0 := b.NewValue0(v.Line, OpAMD64ADDQconst, dst.Type) v0.AddArg(dst) v0.AuxInt = size % 16 v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64ADDQconst, src.Type) v1.AddArg(src) v1.AuxInt = size % 16 v.AddArg(v1) v2 := b.NewValue0(v.Line, OpAMD64MOVOstore, TypeMem) v2.AddArg(dst) v3 := b.NewValue0(v.Line, OpAMD64MOVOload, TypeInt128) v3.AddArg(src) v3.AddArg(mem) v2.AddArg(v3) v2.AddArg(mem) v.AddArg(v2) return true } // match: (Move [size] dst src mem) // cond: size >= 32 && size <= 16*64 && size%16 == 0 && !config.noDuffDevice // result: (DUFFCOPY [14*(64-size/16)] dst src mem) for { size := v.AuxInt dst := v.Args[0] src := v.Args[1] mem := v.Args[2] if !(size >= 32 && size <= 16*64 && size%16 == 0 && !config.noDuffDevice) { break } v.reset(OpAMD64DUFFCOPY) v.AuxInt = 14 * (64 - size/16) v.AddArg(dst) v.AddArg(src) v.AddArg(mem) return true } // match: (Move [size] dst src mem) // cond: (size > 16*64 || config.noDuffDevice) && size%8 == 0 // result: (REPMOVSQ dst src (MOVQconst [size/8]) mem) for { size := v.AuxInt dst := v.Args[0] src := v.Args[1] mem := v.Args[2] if !((size > 16*64 || config.noDuffDevice) && size%8 == 0) { break } v.reset(OpAMD64REPMOVSQ) v.AddArg(dst) v.AddArg(src) v0 := b.NewValue0(v.Line, OpAMD64MOVQconst, config.fe.TypeUInt64()) v0.AuxInt = size / 8 v.AddArg(v0) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpMul16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mul16 x y) // cond: // result: (MULW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MULW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMul32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mul32 x y) // cond: // result: (MULL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MULL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMul32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mul32F x y) // cond: // result: (MULSS x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MULSS) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMul64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mul64 x y) // cond: // result: (MULQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MULQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMul64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mul64F x y) // cond: // result: (MULSD x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MULSD) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpMul8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Mul8 x y) // cond: // result: (MULB x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64MULB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64NEGB(v *Value, config *Config) bool { b := v.Block _ = b // match: (NEGB (MOVBconst [c])) // cond: // result: (MOVBconst [int64(int8(-c))]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = int64(int8(-c)) return true } return false } func rewriteValueAMD64_OpAMD64NEGL(v *Value, config *Config) bool { b := v.Block _ = b // match: (NEGL (MOVLconst [c])) // cond: // result: (MOVLconst [int64(int32(-c))]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = int64(int32(-c)) return true } return false } func rewriteValueAMD64_OpAMD64NEGQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (NEGQ (MOVQconst [c])) // cond: // result: (MOVQconst [-c]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = -c return true } return false } func rewriteValueAMD64_OpAMD64NEGW(v *Value, config *Config) bool { b := v.Block _ = b // match: (NEGW (MOVWconst [c])) // cond: // result: (MOVWconst [int64(int16(-c))]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = int64(int16(-c)) return true } return false } func rewriteValueAMD64_OpAMD64NOTB(v *Value, config *Config) bool { b := v.Block _ = b // match: (NOTB (MOVBconst [c])) // cond: // result: (MOVBconst [^c]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = ^c return true } return false } func rewriteValueAMD64_OpAMD64NOTL(v *Value, config *Config) bool { b := v.Block _ = b // match: (NOTL (MOVLconst [c])) // cond: // result: (MOVLconst [^c]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = ^c return true } return false } func rewriteValueAMD64_OpAMD64NOTQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (NOTQ (MOVQconst [c])) // cond: // result: (MOVQconst [^c]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = ^c return true } return false } func rewriteValueAMD64_OpAMD64NOTW(v *Value, config *Config) bool { b := v.Block _ = b // match: (NOTW (MOVWconst [c])) // cond: // result: (MOVWconst [^c]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = ^c return true } return false } func rewriteValueAMD64_OpNeg16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neg16 x) // cond: // result: (NEGW x) for { x := v.Args[0] v.reset(OpAMD64NEGW) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpNeg32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neg32 x) // cond: // result: (NEGL x) for { x := v.Args[0] v.reset(OpAMD64NEGL) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpNeg32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neg32F x) // cond: // result: (PXOR x (MOVSSconst [f2i(math.Copysign(0, -1))])) for { x := v.Args[0] v.reset(OpAMD64PXOR) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64MOVSSconst, config.Frontend().TypeFloat32()) v0.AuxInt = f2i(math.Copysign(0, -1)) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeg64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neg64 x) // cond: // result: (NEGQ x) for { x := v.Args[0] v.reset(OpAMD64NEGQ) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpNeg64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neg64F x) // cond: // result: (PXOR x (MOVSDconst [f2i(math.Copysign(0, -1))])) for { x := v.Args[0] v.reset(OpAMD64PXOR) v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64MOVSDconst, config.Frontend().TypeFloat64()) v0.AuxInt = f2i(math.Copysign(0, -1)) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeg8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neg8 x) // cond: // result: (NEGB x) for { x := v.Args[0] v.reset(OpAMD64NEGB) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpNeq16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neq16 x y) // cond: // result: (SETNE (CMPW x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETNE) v0 := b.NewValue0(v.Line, OpAMD64CMPW, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeq32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neq32 x y) // cond: // result: (SETNE (CMPL x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETNE) v0 := b.NewValue0(v.Line, OpAMD64CMPL, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeq32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neq32F x y) // cond: // result: (SETNEF (UCOMISS x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETNEF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISS, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeq64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neq64 x y) // cond: // result: (SETNE (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETNE) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeq64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neq64F x y) // cond: // result: (SETNEF (UCOMISD x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETNEF) v0 := b.NewValue0(v.Line, OpAMD64UCOMISD, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeq8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Neq8 x y) // cond: // result: (SETNE (CMPB x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETNE) v0 := b.NewValue0(v.Line, OpAMD64CMPB, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNeqPtr(v *Value, config *Config) bool { b := v.Block _ = b // match: (NeqPtr x y) // cond: // result: (SETNE (CMPQ x y)) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SETNE) v0 := b.NewValue0(v.Line, OpAMD64CMPQ, TypeFlags) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpNilCheck(v *Value, config *Config) bool { b := v.Block _ = b // match: (NilCheck ptr mem) // cond: // result: (LoweredNilCheck ptr mem) for { ptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64LoweredNilCheck) v.AddArg(ptr) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpNot(v *Value, config *Config) bool { b := v.Block _ = b // match: (Not x) // cond: // result: (XORBconst [1] x) for { x := v.Args[0] v.reset(OpAMD64XORBconst) v.AuxInt = 1 v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ORB(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORB x (MOVBconst [c])) // cond: // result: (ORBconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64ORBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORB (MOVBconst [c]) x) // cond: // result: (ORBconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ORBconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORB x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64ORBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORBconst [c] x) // cond: int8(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int8(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ORBconst [c] _) // cond: int8(c)==-1 // result: (MOVBconst [-1]) for { c := v.AuxInt if !(int8(c) == -1) { break } v.reset(OpAMD64MOVBconst) v.AuxInt = -1 return true } // match: (ORBconst [c] (MOVBconst [d])) // cond: // result: (MOVBconst [c|d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = c | d return true } return false } func rewriteValueAMD64_OpAMD64ORL(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORL x (MOVLconst [c])) // cond: // result: (ORLconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64ORLconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORL (MOVLconst [c]) x) // cond: // result: (ORLconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ORLconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORL x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ORL (ORL (ORL x0:(MOVBload [i] {s} p mem) (SHLLconst [8] x1:(MOVBload [i+1] {s} p mem))) (SHLLconst [16] x2:(MOVBload [i+2] {s} p mem))) (SHLLconst [24] x3:(MOVBload [i+3] {s} p mem))) // cond: x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && mergePoint(b,x0,x1,x2,x3) != nil // result: @mergePoint(b,x0,x1,x2,x3) (MOVLload [i] {s} p mem) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ORL { break } v_0_0 := v_0.Args[0] if v_0_0.Op != OpAMD64ORL { break } x0 := v_0_0.Args[0] if x0.Op != OpAMD64MOVBload { break } i := x0.AuxInt s := x0.Aux p := x0.Args[0] mem := x0.Args[1] v_0_0_1 := v_0_0.Args[1] if v_0_0_1.Op != OpAMD64SHLLconst { break } if v_0_0_1.AuxInt != 8 { break } x1 := v_0_0_1.Args[0] if x1.Op != OpAMD64MOVBload { break } if x1.AuxInt != i+1 { break } if x1.Aux != s { break } if p != x1.Args[0] { break } if mem != x1.Args[1] { break } v_0_1 := v_0.Args[1] if v_0_1.Op != OpAMD64SHLLconst { break } if v_0_1.AuxInt != 16 { break } x2 := v_0_1.Args[0] if x2.Op != OpAMD64MOVBload { break } if x2.AuxInt != i+2 { break } if x2.Aux != s { break } if p != x2.Args[0] { break } if mem != x2.Args[1] { break } v_1 := v.Args[1] if v_1.Op != OpAMD64SHLLconst { break } if v_1.AuxInt != 24 { break } x3 := v_1.Args[0] if x3.Op != OpAMD64MOVBload { break } if x3.AuxInt != i+3 { break } if x3.Aux != s { break } if p != x3.Args[0] { break } if mem != x3.Args[1] { break } if !(x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && mergePoint(b, x0, x1, x2, x3) != nil) { break } b = mergePoint(b, x0, x1, x2, x3) v0 := b.NewValue0(v.Line, OpAMD64MOVLload, config.fe.TypeUInt32()) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = i v0.Aux = s v0.AddArg(p) v0.AddArg(mem) return true } // match: (ORL (ORL (ORL x0:(MOVBloadidx1 [i] {s} p idx mem) (SHLLconst [8] x1:(MOVBloadidx1 [i+1] {s} p idx mem))) (SHLLconst [16] x2:(MOVBloadidx1 [i+2] {s} p idx mem))) (SHLLconst [24] x3:(MOVBloadidx1 [i+3] {s} p idx mem))) // cond: x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && mergePoint(b,x0,x1,x2,x3) != nil // result: @mergePoint(b,x0,x1,x2,x3) (MOVLloadidx1 [i] {s} p idx mem) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ORL { break } v_0_0 := v_0.Args[0] if v_0_0.Op != OpAMD64ORL { break } x0 := v_0_0.Args[0] if x0.Op != OpAMD64MOVBloadidx1 { break } i := x0.AuxInt s := x0.Aux p := x0.Args[0] idx := x0.Args[1] mem := x0.Args[2] v_0_0_1 := v_0_0.Args[1] if v_0_0_1.Op != OpAMD64SHLLconst { break } if v_0_0_1.AuxInt != 8 { break } x1 := v_0_0_1.Args[0] if x1.Op != OpAMD64MOVBloadidx1 { break } if x1.AuxInt != i+1 { break } if x1.Aux != s { break } if p != x1.Args[0] { break } if idx != x1.Args[1] { break } if mem != x1.Args[2] { break } v_0_1 := v_0.Args[1] if v_0_1.Op != OpAMD64SHLLconst { break } if v_0_1.AuxInt != 16 { break } x2 := v_0_1.Args[0] if x2.Op != OpAMD64MOVBloadidx1 { break } if x2.AuxInt != i+2 { break } if x2.Aux != s { break } if p != x2.Args[0] { break } if idx != x2.Args[1] { break } if mem != x2.Args[2] { break } v_1 := v.Args[1] if v_1.Op != OpAMD64SHLLconst { break } if v_1.AuxInt != 24 { break } x3 := v_1.Args[0] if x3.Op != OpAMD64MOVBloadidx1 { break } if x3.AuxInt != i+3 { break } if x3.Aux != s { break } if p != x3.Args[0] { break } if idx != x3.Args[1] { break } if mem != x3.Args[2] { break } if !(x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && mergePoint(b, x0, x1, x2, x3) != nil) { break } b = mergePoint(b, x0, x1, x2, x3) v0 := b.NewValue0(v.Line, OpAMD64MOVLloadidx1, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = i v0.Aux = s v0.AddArg(p) v0.AddArg(idx) v0.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64ORLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORLconst [c] x) // cond: int32(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int32(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ORLconst [c] _) // cond: int32(c)==-1 // result: (MOVLconst [-1]) for { c := v.AuxInt if !(int32(c) == -1) { break } v.reset(OpAMD64MOVLconst) v.AuxInt = -1 return true } // match: (ORLconst [c] (MOVLconst [d])) // cond: // result: (MOVLconst [c|d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = c | d return true } return false } func rewriteValueAMD64_OpAMD64ORQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORQ x (MOVQconst [c])) // cond: is32Bit(c) // result: (ORQconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt if !(is32Bit(c)) { break } v.reset(OpAMD64ORQconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORQ (MOVQconst [c]) x) // cond: is32Bit(c) // result: (ORQconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt x := v.Args[1] if !(is32Bit(c)) { break } v.reset(OpAMD64ORQconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORQ x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ORQ (ORQ (ORQ (ORQ (ORQ (ORQ (ORQ x0:(MOVBload [i] {s} p mem) (SHLQconst [8] x1:(MOVBload [i+1] {s} p mem))) (SHLQconst [16] x2:(MOVBload [i+2] {s} p mem))) (SHLQconst [24] x3:(MOVBload [i+3] {s} p mem))) (SHLQconst [32] x4:(MOVBload [i+4] {s} p mem))) (SHLQconst [40] x5:(MOVBload [i+5] {s} p mem))) (SHLQconst [48] x6:(MOVBload [i+6] {s} p mem))) (SHLQconst [56] x7:(MOVBload [i+7] {s} p mem))) // cond: x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && mergePoint(b,x0,x1,x2,x3,x4,x5,x6,x7) != nil // result: @mergePoint(b,x0,x1,x2,x3,x4,x5,x6,x7) (MOVQload [i] {s} p mem) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ORQ { break } v_0_0 := v_0.Args[0] if v_0_0.Op != OpAMD64ORQ { break } v_0_0_0 := v_0_0.Args[0] if v_0_0_0.Op != OpAMD64ORQ { break } v_0_0_0_0 := v_0_0_0.Args[0] if v_0_0_0_0.Op != OpAMD64ORQ { break } v_0_0_0_0_0 := v_0_0_0_0.Args[0] if v_0_0_0_0_0.Op != OpAMD64ORQ { break } v_0_0_0_0_0_0 := v_0_0_0_0_0.Args[0] if v_0_0_0_0_0_0.Op != OpAMD64ORQ { break } x0 := v_0_0_0_0_0_0.Args[0] if x0.Op != OpAMD64MOVBload { break } i := x0.AuxInt s := x0.Aux p := x0.Args[0] mem := x0.Args[1] v_0_0_0_0_0_0_1 := v_0_0_0_0_0_0.Args[1] if v_0_0_0_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_0_0_0_1.AuxInt != 8 { break } x1 := v_0_0_0_0_0_0_1.Args[0] if x1.Op != OpAMD64MOVBload { break } if x1.AuxInt != i+1 { break } if x1.Aux != s { break } if p != x1.Args[0] { break } if mem != x1.Args[1] { break } v_0_0_0_0_0_1 := v_0_0_0_0_0.Args[1] if v_0_0_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_0_0_1.AuxInt != 16 { break } x2 := v_0_0_0_0_0_1.Args[0] if x2.Op != OpAMD64MOVBload { break } if x2.AuxInt != i+2 { break } if x2.Aux != s { break } if p != x2.Args[0] { break } if mem != x2.Args[1] { break } v_0_0_0_0_1 := v_0_0_0_0.Args[1] if v_0_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_0_1.AuxInt != 24 { break } x3 := v_0_0_0_0_1.Args[0] if x3.Op != OpAMD64MOVBload { break } if x3.AuxInt != i+3 { break } if x3.Aux != s { break } if p != x3.Args[0] { break } if mem != x3.Args[1] { break } v_0_0_0_1 := v_0_0_0.Args[1] if v_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_1.AuxInt != 32 { break } x4 := v_0_0_0_1.Args[0] if x4.Op != OpAMD64MOVBload { break } if x4.AuxInt != i+4 { break } if x4.Aux != s { break } if p != x4.Args[0] { break } if mem != x4.Args[1] { break } v_0_0_1 := v_0_0.Args[1] if v_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_1.AuxInt != 40 { break } x5 := v_0_0_1.Args[0] if x5.Op != OpAMD64MOVBload { break } if x5.AuxInt != i+5 { break } if x5.Aux != s { break } if p != x5.Args[0] { break } if mem != x5.Args[1] { break } v_0_1 := v_0.Args[1] if v_0_1.Op != OpAMD64SHLQconst { break } if v_0_1.AuxInt != 48 { break } x6 := v_0_1.Args[0] if x6.Op != OpAMD64MOVBload { break } if x6.AuxInt != i+6 { break } if x6.Aux != s { break } if p != x6.Args[0] { break } if mem != x6.Args[1] { break } v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 56 { break } x7 := v_1.Args[0] if x7.Op != OpAMD64MOVBload { break } if x7.AuxInt != i+7 { break } if x7.Aux != s { break } if p != x7.Args[0] { break } if mem != x7.Args[1] { break } if !(x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7) != nil) { break } b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7) v0 := b.NewValue0(v.Line, OpAMD64MOVQload, config.fe.TypeUInt64()) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = i v0.Aux = s v0.AddArg(p) v0.AddArg(mem) return true } // match: (ORQ (ORQ (ORQ (ORQ (ORQ (ORQ (ORQ x0:(MOVBloadidx1 [i] {s} p idx mem) (SHLQconst [8] x1:(MOVBloadidx1 [i+1] {s} p idx mem))) (SHLQconst [16] x2:(MOVBloadidx1 [i+2] {s} p idx mem))) (SHLQconst [24] x3:(MOVBloadidx1 [i+3] {s} p idx mem))) (SHLQconst [32] x4:(MOVBloadidx1 [i+4] {s} p idx mem))) (SHLQconst [40] x5:(MOVBloadidx1 [i+5] {s} p idx mem))) (SHLQconst [48] x6:(MOVBloadidx1 [i+6] {s} p idx mem))) (SHLQconst [56] x7:(MOVBloadidx1 [i+7] {s} p idx mem))) // cond: x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && mergePoint(b,x0,x1,x2,x3,x4,x5,x6,x7) != nil // result: @mergePoint(b,x0,x1,x2,x3,x4,x5,x6,x7) (MOVQloadidx1 [i] {s} p idx mem) for { v_0 := v.Args[0] if v_0.Op != OpAMD64ORQ { break } v_0_0 := v_0.Args[0] if v_0_0.Op != OpAMD64ORQ { break } v_0_0_0 := v_0_0.Args[0] if v_0_0_0.Op != OpAMD64ORQ { break } v_0_0_0_0 := v_0_0_0.Args[0] if v_0_0_0_0.Op != OpAMD64ORQ { break } v_0_0_0_0_0 := v_0_0_0_0.Args[0] if v_0_0_0_0_0.Op != OpAMD64ORQ { break } v_0_0_0_0_0_0 := v_0_0_0_0_0.Args[0] if v_0_0_0_0_0_0.Op != OpAMD64ORQ { break } x0 := v_0_0_0_0_0_0.Args[0] if x0.Op != OpAMD64MOVBloadidx1 { break } i := x0.AuxInt s := x0.Aux p := x0.Args[0] idx := x0.Args[1] mem := x0.Args[2] v_0_0_0_0_0_0_1 := v_0_0_0_0_0_0.Args[1] if v_0_0_0_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_0_0_0_1.AuxInt != 8 { break } x1 := v_0_0_0_0_0_0_1.Args[0] if x1.Op != OpAMD64MOVBloadidx1 { break } if x1.AuxInt != i+1 { break } if x1.Aux != s { break } if p != x1.Args[0] { break } if idx != x1.Args[1] { break } if mem != x1.Args[2] { break } v_0_0_0_0_0_1 := v_0_0_0_0_0.Args[1] if v_0_0_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_0_0_1.AuxInt != 16 { break } x2 := v_0_0_0_0_0_1.Args[0] if x2.Op != OpAMD64MOVBloadidx1 { break } if x2.AuxInt != i+2 { break } if x2.Aux != s { break } if p != x2.Args[0] { break } if idx != x2.Args[1] { break } if mem != x2.Args[2] { break } v_0_0_0_0_1 := v_0_0_0_0.Args[1] if v_0_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_0_1.AuxInt != 24 { break } x3 := v_0_0_0_0_1.Args[0] if x3.Op != OpAMD64MOVBloadidx1 { break } if x3.AuxInt != i+3 { break } if x3.Aux != s { break } if p != x3.Args[0] { break } if idx != x3.Args[1] { break } if mem != x3.Args[2] { break } v_0_0_0_1 := v_0_0_0.Args[1] if v_0_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_0_1.AuxInt != 32 { break } x4 := v_0_0_0_1.Args[0] if x4.Op != OpAMD64MOVBloadidx1 { break } if x4.AuxInt != i+4 { break } if x4.Aux != s { break } if p != x4.Args[0] { break } if idx != x4.Args[1] { break } if mem != x4.Args[2] { break } v_0_0_1 := v_0_0.Args[1] if v_0_0_1.Op != OpAMD64SHLQconst { break } if v_0_0_1.AuxInt != 40 { break } x5 := v_0_0_1.Args[0] if x5.Op != OpAMD64MOVBloadidx1 { break } if x5.AuxInt != i+5 { break } if x5.Aux != s { break } if p != x5.Args[0] { break } if idx != x5.Args[1] { break } if mem != x5.Args[2] { break } v_0_1 := v_0.Args[1] if v_0_1.Op != OpAMD64SHLQconst { break } if v_0_1.AuxInt != 48 { break } x6 := v_0_1.Args[0] if x6.Op != OpAMD64MOVBloadidx1 { break } if x6.AuxInt != i+6 { break } if x6.Aux != s { break } if p != x6.Args[0] { break } if idx != x6.Args[1] { break } if mem != x6.Args[2] { break } v_1 := v.Args[1] if v_1.Op != OpAMD64SHLQconst { break } if v_1.AuxInt != 56 { break } x7 := v_1.Args[0] if x7.Op != OpAMD64MOVBloadidx1 { break } if x7.AuxInt != i+7 { break } if x7.Aux != s { break } if p != x7.Args[0] { break } if idx != x7.Args[1] { break } if mem != x7.Args[2] { break } if !(x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7) != nil) { break } b = mergePoint(b, x0, x1, x2, x3, x4, x5, x6, x7) v0 := b.NewValue0(v.Line, OpAMD64MOVQloadidx1, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = i v0.Aux = s v0.AddArg(p) v0.AddArg(idx) v0.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64ORQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORQconst [0] x) // cond: // result: x for { if v.AuxInt != 0 { break } x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ORQconst [-1] _) // cond: // result: (MOVQconst [-1]) for { if v.AuxInt != -1 { break } v.reset(OpAMD64MOVQconst) v.AuxInt = -1 return true } // match: (ORQconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [c|d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = c | d return true } return false } func rewriteValueAMD64_OpAMD64ORW(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORW x (MOVWconst [c])) // cond: // result: (ORWconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64ORWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORW (MOVWconst [c]) x) // cond: // result: (ORWconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64ORWconst) v.AuxInt = c v.AddArg(x) return true } // match: (ORW x x) // cond: // result: x for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ORW x0:(MOVBload [i] {s} p mem) (SHLWconst [8] x1:(MOVBload [i+1] {s} p mem))) // cond: x0.Uses == 1 && x1.Uses == 1 && mergePoint(b,x0,x1) != nil // result: @mergePoint(b,x0,x1) (MOVWload [i] {s} p mem) for { x0 := v.Args[0] if x0.Op != OpAMD64MOVBload { break } i := x0.AuxInt s := x0.Aux p := x0.Args[0] mem := x0.Args[1] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLWconst { break } if v_1.AuxInt != 8 { break } x1 := v_1.Args[0] if x1.Op != OpAMD64MOVBload { break } if x1.AuxInt != i+1 { break } if x1.Aux != s { break } if p != x1.Args[0] { break } if mem != x1.Args[1] { break } if !(x0.Uses == 1 && x1.Uses == 1 && mergePoint(b, x0, x1) != nil) { break } b = mergePoint(b, x0, x1) v0 := b.NewValue0(v.Line, OpAMD64MOVWload, config.fe.TypeUInt16()) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = i v0.Aux = s v0.AddArg(p) v0.AddArg(mem) return true } // match: (ORW x0:(MOVBloadidx1 [i] {s} p idx mem) (SHLWconst [8] x1:(MOVBloadidx1 [i+1] {s} p idx mem))) // cond: x0.Uses == 1 && x1.Uses == 1 && mergePoint(b,x0,x1) != nil // result: @mergePoint(b,x0,x1) (MOVWloadidx1 [i] {s} p idx mem) for { x0 := v.Args[0] if x0.Op != OpAMD64MOVBloadidx1 { break } i := x0.AuxInt s := x0.Aux p := x0.Args[0] idx := x0.Args[1] mem := x0.Args[2] v_1 := v.Args[1] if v_1.Op != OpAMD64SHLWconst { break } if v_1.AuxInt != 8 { break } x1 := v_1.Args[0] if x1.Op != OpAMD64MOVBloadidx1 { break } if x1.AuxInt != i+1 { break } if x1.Aux != s { break } if p != x1.Args[0] { break } if idx != x1.Args[1] { break } if mem != x1.Args[2] { break } if !(x0.Uses == 1 && x1.Uses == 1 && mergePoint(b, x0, x1) != nil) { break } b = mergePoint(b, x0, x1) v0 := b.NewValue0(v.Line, OpAMD64MOVWloadidx1, v.Type) v.reset(OpCopy) v.AddArg(v0) v0.AuxInt = i v0.Aux = s v0.AddArg(p) v0.AddArg(idx) v0.AddArg(mem) return true } return false } func rewriteValueAMD64_OpAMD64ORWconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (ORWconst [c] x) // cond: int16(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int16(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (ORWconst [c] _) // cond: int16(c)==-1 // result: (MOVWconst [-1]) for { c := v.AuxInt if !(int16(c) == -1) { break } v.reset(OpAMD64MOVWconst) v.AuxInt = -1 return true } // match: (ORWconst [c] (MOVWconst [d])) // cond: // result: (MOVWconst [c|d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = c | d return true } return false } func rewriteValueAMD64_OpOffPtr(v *Value, config *Config) bool { b := v.Block _ = b // match: (OffPtr [off] ptr) // cond: is32Bit(off) // result: (ADDQconst [off] ptr) for { off := v.AuxInt ptr := v.Args[0] if !(is32Bit(off)) { break } v.reset(OpAMD64ADDQconst) v.AuxInt = off v.AddArg(ptr) return true } // match: (OffPtr [off] ptr) // cond: // result: (ADDQ (MOVQconst [off]) ptr) for { off := v.AuxInt ptr := v.Args[0] v.reset(OpAMD64ADDQ) v0 := b.NewValue0(v.Line, OpAMD64MOVQconst, config.fe.TypeUInt64()) v0.AuxInt = off v.AddArg(v0) v.AddArg(ptr) return true } return false } func rewriteValueAMD64_OpOr16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Or16 x y) // cond: // result: (ORW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ORW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpOr32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Or32 x y) // cond: // result: (ORL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ORL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpOr64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Or64 x y) // cond: // result: (ORQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ORQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpOr8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Or8 x y) // cond: // result: (ORB x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ORB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpRsh16Ux16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16Ux16 x y) // cond: // result: (ANDW (SHRW x y) (SBBLcarrymask (CMPWconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHRW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh16Ux32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16Ux32 x y) // cond: // result: (ANDW (SHRW x y) (SBBLcarrymask (CMPLconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHRW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh16Ux64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16Ux64 x y) // cond: // result: (ANDW (SHRW x y) (SBBLcarrymask (CMPQconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHRW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh16Ux8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16Ux8 x y) // cond: // result: (ANDW (SHRW x y) (SBBLcarrymask (CMPBconst y [16]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDW) v0 := b.NewValue0(v.Line, OpAMD64SHRW, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 16 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh16x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16x16 x y) // cond: // result: (SARW x (ORW y (NOTL (SBBLcarrymask (CMPWconst y [16]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARW) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORW, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 16 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh16x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16x32 x y) // cond: // result: (SARW x (ORL y (NOTL (SBBLcarrymask (CMPLconst y [16]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARW) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORL, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 16 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh16x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16x64 x y) // cond: // result: (SARW x (ORQ y (NOTQ (SBBQcarrymask (CMPQconst y [16]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARW) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORQ, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTQ, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 16 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh16x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh16x8 x y) // cond: // result: (SARW x (ORB y (NOTL (SBBLcarrymask (CMPBconst y [16]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARW) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORB, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 16 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh32Ux16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32Ux16 x y) // cond: // result: (ANDL (SHRL x y) (SBBLcarrymask (CMPWconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHRL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh32Ux32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32Ux32 x y) // cond: // result: (ANDL (SHRL x y) (SBBLcarrymask (CMPLconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHRL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh32Ux64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32Ux64 x y) // cond: // result: (ANDL (SHRL x y) (SBBLcarrymask (CMPQconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHRL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh32Ux8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32Ux8 x y) // cond: // result: (ANDL (SHRL x y) (SBBLcarrymask (CMPBconst y [32]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDL) v0 := b.NewValue0(v.Line, OpAMD64SHRL, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 32 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh32x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32x16 x y) // cond: // result: (SARL x (ORW y (NOTL (SBBLcarrymask (CMPWconst y [32]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARL) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORW, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 32 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh32x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32x32 x y) // cond: // result: (SARL x (ORL y (NOTL (SBBLcarrymask (CMPLconst y [32]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARL) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORL, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 32 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh32x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32x64 x y) // cond: // result: (SARL x (ORQ y (NOTQ (SBBQcarrymask (CMPQconst y [32]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARL) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORQ, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTQ, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 32 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh32x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh32x8 x y) // cond: // result: (SARL x (ORB y (NOTL (SBBLcarrymask (CMPBconst y [32]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARL) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORB, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 32 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh64Ux16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64Ux16 x y) // cond: // result: (ANDQ (SHRQ x y) (SBBQcarrymask (CMPWconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHRQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh64Ux32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64Ux32 x y) // cond: // result: (ANDQ (SHRQ x y) (SBBQcarrymask (CMPLconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHRQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh64Ux64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64Ux64 x y) // cond: // result: (ANDQ (SHRQ x y) (SBBQcarrymask (CMPQconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHRQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh64Ux8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64Ux8 x y) // cond: // result: (ANDQ (SHRQ x y) (SBBQcarrymask (CMPBconst y [64]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDQ) v0 := b.NewValue0(v.Line, OpAMD64SHRQ, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 64 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh64x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64x16 x y) // cond: // result: (SARQ x (ORW y (NOTL (SBBLcarrymask (CMPWconst y [64]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARQ) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORW, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 64 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh64x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64x32 x y) // cond: // result: (SARQ x (ORL y (NOTL (SBBLcarrymask (CMPLconst y [64]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARQ) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORL, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 64 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh64x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64x64 x y) // cond: // result: (SARQ x (ORQ y (NOTQ (SBBQcarrymask (CMPQconst y [64]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARQ) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORQ, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTQ, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 64 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh64x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh64x8 x y) // cond: // result: (SARQ x (ORB y (NOTL (SBBLcarrymask (CMPBconst y [64]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARQ) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORB, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 64 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh8Ux16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8Ux16 x y) // cond: // result: (ANDB (SHRB x y) (SBBLcarrymask (CMPWconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHRB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh8Ux32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8Ux32 x y) // cond: // result: (ANDB (SHRB x y) (SBBLcarrymask (CMPLconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHRB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh8Ux64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8Ux64 x y) // cond: // result: (ANDB (SHRB x y) (SBBLcarrymask (CMPQconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHRB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh8Ux8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8Ux8 x y) // cond: // result: (ANDB (SHRB x y) (SBBLcarrymask (CMPBconst y [8]))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64ANDB) v0 := b.NewValue0(v.Line, OpAMD64SHRB, t) v0.AddArg(x) v0.AddArg(y) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, t) v2 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v2.AddArg(y) v2.AuxInt = 8 v1.AddArg(v2) v.AddArg(v1) return true } return false } func rewriteValueAMD64_OpRsh8x16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8x16 x y) // cond: // result: (SARB x (ORW y (NOTL (SBBLcarrymask (CMPWconst y [8]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARB) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORW, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPWconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 8 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh8x32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8x32 x y) // cond: // result: (SARB x (ORL y (NOTL (SBBLcarrymask (CMPLconst y [8]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARB) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORL, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPLconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 8 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh8x64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8x64 x y) // cond: // result: (SARB x (ORQ y (NOTQ (SBBQcarrymask (CMPQconst y [8]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARB) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORQ, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTQ, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBQcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPQconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 8 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpRsh8x8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Rsh8x8 x y) // cond: // result: (SARB x (ORB y (NOTL (SBBLcarrymask (CMPBconst y [8]))))) for { t := v.Type x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SARB) v.Type = t v.AddArg(x) v0 := b.NewValue0(v.Line, OpAMD64ORB, y.Type) v0.AddArg(y) v1 := b.NewValue0(v.Line, OpAMD64NOTL, y.Type) v2 := b.NewValue0(v.Line, OpAMD64SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Line, OpAMD64CMPBconst, TypeFlags) v3.AddArg(y) v3.AuxInt = 8 v2.AddArg(v3) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } return false } func rewriteValueAMD64_OpAMD64SARB(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARB x (MOVQconst [c])) // cond: // result: (SARBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SARBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARB x (MOVLconst [c])) // cond: // result: (SARBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SARBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARB x (MOVWconst [c])) // cond: // result: (SARBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SARBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARB x (MOVBconst [c])) // cond: // result: (SARBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SARBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARB x (ANDBconst [31] y)) // cond: // result: (SARB x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDBconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SARB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SARBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARBconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [d>>uint64(c)]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = d >> uint64(c) return true } return false } func rewriteValueAMD64_OpAMD64SARL(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARL x (MOVQconst [c])) // cond: // result: (SARLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SARLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARL x (MOVLconst [c])) // cond: // result: (SARLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SARLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARL x (MOVWconst [c])) // cond: // result: (SARLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SARLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARL x (MOVBconst [c])) // cond: // result: (SARLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SARLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARL x (ANDLconst [31] y)) // cond: // result: (SARL x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDLconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SARL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SARLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARLconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [d>>uint64(c)]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = d >> uint64(c) return true } return false } func rewriteValueAMD64_OpAMD64SARQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARQ x (MOVQconst [c])) // cond: // result: (SARQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SARQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SARQ x (MOVLconst [c])) // cond: // result: (SARQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SARQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SARQ x (MOVWconst [c])) // cond: // result: (SARQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SARQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SARQ x (MOVBconst [c])) // cond: // result: (SARQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SARQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SARQ x (ANDQconst [63] y)) // cond: // result: (SARQ x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDQconst { break } if v_1.AuxInt != 63 { break } y := v_1.Args[0] v.reset(OpAMD64SARQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SARQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARQconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [d>>uint64(c)]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = d >> uint64(c) return true } return false } func rewriteValueAMD64_OpAMD64SARW(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARW x (MOVQconst [c])) // cond: // result: (SARWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SARWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARW x (MOVLconst [c])) // cond: // result: (SARWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SARWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARW x (MOVWconst [c])) // cond: // result: (SARWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SARWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARW x (MOVBconst [c])) // cond: // result: (SARWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SARWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SARW x (ANDWconst [31] y)) // cond: // result: (SARW x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDWconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SARW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SARWconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SARWconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [d>>uint64(c)]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = d >> uint64(c) return true } return false } func rewriteValueAMD64_OpAMD64SBBLcarrymask(v *Value, config *Config) bool { b := v.Block _ = b // match: (SBBLcarrymask (FlagEQ)) // cond: // result: (MOVLconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVLconst) v.AuxInt = 0 return true } // match: (SBBLcarrymask (FlagLT_ULT)) // cond: // result: (MOVLconst [-1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVLconst) v.AuxInt = -1 return true } // match: (SBBLcarrymask (FlagLT_UGT)) // cond: // result: (MOVLconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVLconst) v.AuxInt = 0 return true } // match: (SBBLcarrymask (FlagGT_ULT)) // cond: // result: (MOVLconst [-1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVLconst) v.AuxInt = -1 return true } // match: (SBBLcarrymask (FlagGT_UGT)) // cond: // result: (MOVLconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVLconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SBBQcarrymask(v *Value, config *Config) bool { b := v.Block _ = b // match: (SBBQcarrymask (FlagEQ)) // cond: // result: (MOVQconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } // match: (SBBQcarrymask (FlagLT_ULT)) // cond: // result: (MOVQconst [-1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVQconst) v.AuxInt = -1 return true } // match: (SBBQcarrymask (FlagLT_UGT)) // cond: // result: (MOVQconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } // match: (SBBQcarrymask (FlagGT_ULT)) // cond: // result: (MOVQconst [-1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVQconst) v.AuxInt = -1 return true } // match: (SBBQcarrymask (FlagGT_UGT)) // cond: // result: (MOVQconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SETA(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETA (InvertFlags x)) // cond: // result: (SETB x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETB) v.AddArg(x) return true } // match: (SETA (FlagEQ)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETA (FlagLT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETA (FlagLT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETA (FlagGT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETA (FlagGT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } return false } func rewriteValueAMD64_OpAMD64SETAE(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETAE (InvertFlags x)) // cond: // result: (SETBE x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETBE) v.AddArg(x) return true } // match: (SETAE (FlagEQ)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETAE (FlagLT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETAE (FlagLT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETAE (FlagGT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETAE (FlagGT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } return false } func rewriteValueAMD64_OpAMD64SETB(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETB (InvertFlags x)) // cond: // result: (SETA x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETA) v.AddArg(x) return true } // match: (SETB (FlagEQ)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETB (FlagLT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETB (FlagLT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETB (FlagGT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETB (FlagGT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SETBE(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETBE (InvertFlags x)) // cond: // result: (SETAE x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETAE) v.AddArg(x) return true } // match: (SETBE (FlagEQ)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETBE (FlagLT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETBE (FlagLT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETBE (FlagGT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETBE (FlagGT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SETEQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETEQ (InvertFlags x)) // cond: // result: (SETEQ x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETEQ) v.AddArg(x) return true } // match: (SETEQ (FlagEQ)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETEQ (FlagLT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETEQ (FlagLT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETEQ (FlagGT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETEQ (FlagGT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SETG(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETG (InvertFlags x)) // cond: // result: (SETL x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETL) v.AddArg(x) return true } // match: (SETG (FlagEQ)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETG (FlagLT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETG (FlagLT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETG (FlagGT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETG (FlagGT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } return false } func rewriteValueAMD64_OpAMD64SETGE(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETGE (InvertFlags x)) // cond: // result: (SETLE x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETLE) v.AddArg(x) return true } // match: (SETGE (FlagEQ)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETGE (FlagLT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETGE (FlagLT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETGE (FlagGT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETGE (FlagGT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } return false } func rewriteValueAMD64_OpAMD64SETL(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETL (InvertFlags x)) // cond: // result: (SETG x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETG) v.AddArg(x) return true } // match: (SETL (FlagEQ)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETL (FlagLT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETL (FlagLT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETL (FlagGT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETL (FlagGT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SETLE(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETLE (InvertFlags x)) // cond: // result: (SETGE x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETGE) v.AddArg(x) return true } // match: (SETLE (FlagEQ)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETLE (FlagLT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETLE (FlagLT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETLE (FlagGT_ULT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETLE (FlagGT_UGT)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SETNE(v *Value, config *Config) bool { b := v.Block _ = b // match: (SETNE (InvertFlags x)) // cond: // result: (SETNE x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64InvertFlags { break } x := v_0.Args[0] v.reset(OpAMD64SETNE) v.AddArg(x) return true } // match: (SETNE (FlagEQ)) // cond: // result: (MOVBconst [0]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagEQ { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } // match: (SETNE (FlagLT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETNE (FlagLT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagLT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETNE (FlagGT_ULT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_ULT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } // match: (SETNE (FlagGT_UGT)) // cond: // result: (MOVBconst [1]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64FlagGT_UGT { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 1 return true } return false } func rewriteValueAMD64_OpAMD64SHLB(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHLB x (MOVQconst [c])) // cond: // result: (SHLBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLB x (MOVLconst [c])) // cond: // result: (SHLBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLB x (MOVWconst [c])) // cond: // result: (SHLBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLB x (MOVBconst [c])) // cond: // result: (SHLBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLB x (ANDBconst [31] y)) // cond: // result: (SHLB x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDBconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SHLB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SHLL(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHLL x (MOVQconst [c])) // cond: // result: (SHLLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLL x (MOVLconst [c])) // cond: // result: (SHLLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLL x (MOVWconst [c])) // cond: // result: (SHLLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLL x (MOVBconst [c])) // cond: // result: (SHLLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLL x (ANDLconst [31] y)) // cond: // result: (SHLL x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDLconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SHLL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SHLQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHLQ x (MOVQconst [c])) // cond: // result: (SHLQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHLQ x (MOVLconst [c])) // cond: // result: (SHLQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHLQ x (MOVWconst [c])) // cond: // result: (SHLQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHLQ x (MOVBconst [c])) // cond: // result: (SHLQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHLQ x (ANDQconst [63] y)) // cond: // result: (SHLQ x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDQconst { break } if v_1.AuxInt != 63 { break } y := v_1.Args[0] v.reset(OpAMD64SHLQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SHLW(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHLW x (MOVQconst [c])) // cond: // result: (SHLWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLW x (MOVLconst [c])) // cond: // result: (SHLWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLW x (MOVWconst [c])) // cond: // result: (SHLWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLW x (MOVBconst [c])) // cond: // result: (SHLWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHLWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHLW x (ANDWconst [31] y)) // cond: // result: (SHLW x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDWconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SHLW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SHRB(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHRB x (MOVQconst [c])) // cond: // result: (SHRBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRB x (MOVLconst [c])) // cond: // result: (SHRBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRB x (MOVWconst [c])) // cond: // result: (SHRBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRB x (MOVBconst [c])) // cond: // result: (SHRBconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRBconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRB x (ANDBconst [31] y)) // cond: // result: (SHRB x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDBconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SHRB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SHRL(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHRL x (MOVQconst [c])) // cond: // result: (SHRLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRL x (MOVLconst [c])) // cond: // result: (SHRLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRL x (MOVWconst [c])) // cond: // result: (SHRLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRL x (MOVBconst [c])) // cond: // result: (SHRLconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRLconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRL x (ANDLconst [31] y)) // cond: // result: (SHRL x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDLconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SHRL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SHRQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHRQ x (MOVQconst [c])) // cond: // result: (SHRQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHRQ x (MOVLconst [c])) // cond: // result: (SHRQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHRQ x (MOVWconst [c])) // cond: // result: (SHRQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHRQ x (MOVBconst [c])) // cond: // result: (SHRQconst [c&63] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRQconst) v.AuxInt = c & 63 v.AddArg(x) return true } // match: (SHRQ x (ANDQconst [63] y)) // cond: // result: (SHRQ x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDQconst { break } if v_1.AuxInt != 63 { break } y := v_1.Args[0] v.reset(OpAMD64SHRQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SHRW(v *Value, config *Config) bool { b := v.Block _ = b // match: (SHRW x (MOVQconst [c])) // cond: // result: (SHRWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRW x (MOVLconst [c])) // cond: // result: (SHRWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRW x (MOVWconst [c])) // cond: // result: (SHRWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRW x (MOVBconst [c])) // cond: // result: (SHRWconst [c&31] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SHRWconst) v.AuxInt = c & 31 v.AddArg(x) return true } // match: (SHRW x (ANDWconst [31] y)) // cond: // result: (SHRW x y) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64ANDWconst { break } if v_1.AuxInt != 31 { break } y := v_1.Args[0] v.reset(OpAMD64SHRW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpAMD64SUBB(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBB x (MOVBconst [c])) // cond: // result: (SUBBconst x [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64SUBBconst) v.AddArg(x) v.AuxInt = c return true } // match: (SUBB (MOVBconst [c]) x) // cond: // result: (NEGB (SUBBconst x [c])) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64NEGB) v0 := b.NewValue0(v.Line, OpAMD64SUBBconst, v.Type) v0.AddArg(x) v0.AuxInt = c v.AddArg(v0) return true } // match: (SUBB x x) // cond: // result: (MOVBconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SUBBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBBconst [c] x) // cond: int8(c) == 0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int8(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (SUBBconst [c] x) // cond: // result: (ADDBconst [int64(int8(-c))] x) for { c := v.AuxInt x := v.Args[0] v.reset(OpAMD64ADDBconst) v.AuxInt = int64(int8(-c)) v.AddArg(x) return true } // match: (SUBBconst (MOVBconst [d]) [c]) // cond: // result: (MOVBconst [int64(int8(d-c))]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } d := v_0.AuxInt c := v.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = int64(int8(d - c)) return true } // match: (SUBBconst (SUBBconst x [d]) [c]) // cond: // result: (ADDBconst [int64(int8(-c-d))] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64SUBBconst { break } x := v_0.Args[0] d := v_0.AuxInt c := v.AuxInt v.reset(OpAMD64ADDBconst) v.AuxInt = int64(int8(-c - d)) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64SUBL(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBL x (MOVLconst [c])) // cond: // result: (SUBLconst x [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64SUBLconst) v.AddArg(x) v.AuxInt = c return true } // match: (SUBL (MOVLconst [c]) x) // cond: // result: (NEGL (SUBLconst x [c])) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64NEGL) v0 := b.NewValue0(v.Line, OpAMD64SUBLconst, v.Type) v0.AddArg(x) v0.AuxInt = c v.AddArg(v0) return true } // match: (SUBL x x) // cond: // result: (MOVLconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVLconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SUBLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBLconst [c] x) // cond: int32(c) == 0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int32(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (SUBLconst [c] x) // cond: // result: (ADDLconst [int64(int32(-c))] x) for { c := v.AuxInt x := v.Args[0] v.reset(OpAMD64ADDLconst) v.AuxInt = int64(int32(-c)) v.AddArg(x) return true } // match: (SUBLconst (MOVLconst [d]) [c]) // cond: // result: (MOVLconst [int64(int32(d-c))]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } d := v_0.AuxInt c := v.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = int64(int32(d - c)) return true } // match: (SUBLconst (SUBLconst x [d]) [c]) // cond: // result: (ADDLconst [int64(int32(-c-d))] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64SUBLconst { break } x := v_0.Args[0] d := v_0.AuxInt c := v.AuxInt v.reset(OpAMD64ADDLconst) v.AuxInt = int64(int32(-c - d)) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64SUBQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBQ x (MOVQconst [c])) // cond: is32Bit(c) // result: (SUBQconst x [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt if !(is32Bit(c)) { break } v.reset(OpAMD64SUBQconst) v.AddArg(x) v.AuxInt = c return true } // match: (SUBQ (MOVQconst [c]) x) // cond: is32Bit(c) // result: (NEGQ (SUBQconst x [c])) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt x := v.Args[1] if !(is32Bit(c)) { break } v.reset(OpAMD64NEGQ) v0 := b.NewValue0(v.Line, OpAMD64SUBQconst, v.Type) v0.AddArg(x) v0.AuxInt = c v.AddArg(v0) return true } // match: (SUBQ x x) // cond: // result: (MOVQconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SUBQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBQconst [0] x) // cond: // result: x for { if v.AuxInt != 0 { break } x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (SUBQconst [c] x) // cond: c != -(1<<31) // result: (ADDQconst [-c] x) for { c := v.AuxInt x := v.Args[0] if !(c != -(1 << 31)) { break } v.reset(OpAMD64ADDQconst) v.AuxInt = -c v.AddArg(x) return true } // match: (SUBQconst (MOVQconst [d]) [c]) // cond: // result: (MOVQconst [d-c]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt c := v.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = d - c return true } // match: (SUBQconst (SUBQconst x [d]) [c]) // cond: is32Bit(-c-d) // result: (ADDQconst [-c-d] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64SUBQconst { break } x := v_0.Args[0] d := v_0.AuxInt c := v.AuxInt if !(is32Bit(-c - d)) { break } v.reset(OpAMD64ADDQconst) v.AuxInt = -c - d v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64SUBW(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBW x (MOVWconst [c])) // cond: // result: (SUBWconst x [c]) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64SUBWconst) v.AddArg(x) v.AuxInt = c return true } // match: (SUBW (MOVWconst [c]) x) // cond: // result: (NEGW (SUBWconst x [c])) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64NEGW) v0 := b.NewValue0(v.Line, OpAMD64SUBWconst, v.Type) v0.AddArg(x) v0.AuxInt = c v.AddArg(v0) return true } // match: (SUBW x x) // cond: // result: (MOVWconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVWconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64SUBWconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (SUBWconst [c] x) // cond: int16(c) == 0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int16(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (SUBWconst [c] x) // cond: // result: (ADDWconst [int64(int16(-c))] x) for { c := v.AuxInt x := v.Args[0] v.reset(OpAMD64ADDWconst) v.AuxInt = int64(int16(-c)) v.AddArg(x) return true } // match: (SUBWconst (MOVWconst [d]) [c]) // cond: // result: (MOVWconst [int64(int16(d-c))]) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } d := v_0.AuxInt c := v.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = int64(int16(d - c)) return true } // match: (SUBWconst (SUBWconst x [d]) [c]) // cond: // result: (ADDWconst [int64(int16(-c-d))] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64SUBWconst { break } x := v_0.Args[0] d := v_0.AuxInt c := v.AuxInt v.reset(OpAMD64ADDWconst) v.AuxInt = int64(int16(-c - d)) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpSignExt16to32(v *Value, config *Config) bool { b := v.Block _ = b // match: (SignExt16to32 x) // cond: // result: (MOVWQSX x) for { x := v.Args[0] v.reset(OpAMD64MOVWQSX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpSignExt16to64(v *Value, config *Config) bool { b := v.Block _ = b // match: (SignExt16to64 x) // cond: // result: (MOVWQSX x) for { x := v.Args[0] v.reset(OpAMD64MOVWQSX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpSignExt32to64(v *Value, config *Config) bool { b := v.Block _ = b // match: (SignExt32to64 x) // cond: // result: (MOVLQSX x) for { x := v.Args[0] v.reset(OpAMD64MOVLQSX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpSignExt8to16(v *Value, config *Config) bool { b := v.Block _ = b // match: (SignExt8to16 x) // cond: // result: (MOVBQSX x) for { x := v.Args[0] v.reset(OpAMD64MOVBQSX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpSignExt8to32(v *Value, config *Config) bool { b := v.Block _ = b // match: (SignExt8to32 x) // cond: // result: (MOVBQSX x) for { x := v.Args[0] v.reset(OpAMD64MOVBQSX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpSignExt8to64(v *Value, config *Config) bool { b := v.Block _ = b // match: (SignExt8to64 x) // cond: // result: (MOVBQSX x) for { x := v.Args[0] v.reset(OpAMD64MOVBQSX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpSqrt(v *Value, config *Config) bool { b := v.Block _ = b // match: (Sqrt x) // cond: // result: (SQRTSD x) for { x := v.Args[0] v.reset(OpAMD64SQRTSD) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpStaticCall(v *Value, config *Config) bool { b := v.Block _ = b // match: (StaticCall [argwid] {target} mem) // cond: // result: (CALLstatic [argwid] {target} mem) for { argwid := v.AuxInt target := v.Aux mem := v.Args[0] v.reset(OpAMD64CALLstatic) v.AuxInt = argwid v.Aux = target v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpStore(v *Value, config *Config) bool { b := v.Block _ = b // match: (Store [8] ptr val mem) // cond: is64BitFloat(val.Type) // result: (MOVSDstore ptr val mem) for { if v.AuxInt != 8 { break } ptr := v.Args[0] val := v.Args[1] mem := v.Args[2] if !(is64BitFloat(val.Type)) { break } v.reset(OpAMD64MOVSDstore) v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (Store [4] ptr val mem) // cond: is32BitFloat(val.Type) // result: (MOVSSstore ptr val mem) for { if v.AuxInt != 4 { break } ptr := v.Args[0] val := v.Args[1] mem := v.Args[2] if !(is32BitFloat(val.Type)) { break } v.reset(OpAMD64MOVSSstore) v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (Store [8] ptr val mem) // cond: // result: (MOVQstore ptr val mem) for { if v.AuxInt != 8 { break } ptr := v.Args[0] val := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVQstore) v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (Store [4] ptr val mem) // cond: // result: (MOVLstore ptr val mem) for { if v.AuxInt != 4 { break } ptr := v.Args[0] val := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVLstore) v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (Store [2] ptr val mem) // cond: // result: (MOVWstore ptr val mem) for { if v.AuxInt != 2 { break } ptr := v.Args[0] val := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVWstore) v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } // match: (Store [1] ptr val mem) // cond: // result: (MOVBstore ptr val mem) for { if v.AuxInt != 1 { break } ptr := v.Args[0] val := v.Args[1] mem := v.Args[2] v.reset(OpAMD64MOVBstore) v.AddArg(ptr) v.AddArg(val) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpSub16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Sub16 x y) // cond: // result: (SUBW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SUBW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpSub32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Sub32 x y) // cond: // result: (SUBL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SUBL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpSub32F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Sub32F x y) // cond: // result: (SUBSS x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SUBSS) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpSub64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Sub64 x y) // cond: // result: (SUBQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SUBQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpSub64F(v *Value, config *Config) bool { b := v.Block _ = b // match: (Sub64F x y) // cond: // result: (SUBSD x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SUBSD) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpSub8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Sub8 x y) // cond: // result: (SUBB x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SUBB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpSubPtr(v *Value, config *Config) bool { b := v.Block _ = b // match: (SubPtr x y) // cond: // result: (SUBQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64SUBQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpTrunc16to8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Trunc16to8 x) // cond: // result: x for { x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpTrunc32to16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Trunc32to16 x) // cond: // result: x for { x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpTrunc32to8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Trunc32to8 x) // cond: // result: x for { x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpTrunc64to16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Trunc64to16 x) // cond: // result: x for { x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpTrunc64to32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Trunc64to32 x) // cond: // result: x for { x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpTrunc64to8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Trunc64to8 x) // cond: // result: x for { x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } return false } func rewriteValueAMD64_OpAMD64XORB(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORB x (MOVBconst [c])) // cond: // result: (XORBconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVBconst { break } c := v_1.AuxInt v.reset(OpAMD64XORBconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORB (MOVBconst [c]) x) // cond: // result: (XORBconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64XORBconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORB x x) // cond: // result: (MOVBconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVBconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64XORBconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORBconst [c] x) // cond: int8(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int8(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (XORBconst [c] (MOVBconst [d])) // cond: // result: (MOVBconst [c^d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVBconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVBconst) v.AuxInt = c ^ d return true } return false } func rewriteValueAMD64_OpAMD64XORL(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORL x (MOVLconst [c])) // cond: // result: (XORLconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVLconst { break } c := v_1.AuxInt v.reset(OpAMD64XORLconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORL (MOVLconst [c]) x) // cond: // result: (XORLconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64XORLconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORL x x) // cond: // result: (MOVLconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVLconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64XORLconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORLconst [c] x) // cond: int32(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int32(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (XORLconst [c] (MOVLconst [d])) // cond: // result: (MOVLconst [c^d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVLconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVLconst) v.AuxInt = c ^ d return true } return false } func rewriteValueAMD64_OpAMD64XORQ(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORQ x (MOVQconst [c])) // cond: is32Bit(c) // result: (XORQconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVQconst { break } c := v_1.AuxInt if !(is32Bit(c)) { break } v.reset(OpAMD64XORQconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORQ (MOVQconst [c]) x) // cond: is32Bit(c) // result: (XORQconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } c := v_0.AuxInt x := v.Args[1] if !(is32Bit(c)) { break } v.reset(OpAMD64XORQconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORQ x x) // cond: // result: (MOVQconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVQconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64XORQconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORQconst [0] x) // cond: // result: x for { if v.AuxInt != 0 { break } x := v.Args[0] v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (XORQconst [c] (MOVQconst [d])) // cond: // result: (MOVQconst [c^d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVQconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVQconst) v.AuxInt = c ^ d return true } return false } func rewriteValueAMD64_OpAMD64XORW(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORW x (MOVWconst [c])) // cond: // result: (XORWconst [c] x) for { x := v.Args[0] v_1 := v.Args[1] if v_1.Op != OpAMD64MOVWconst { break } c := v_1.AuxInt v.reset(OpAMD64XORWconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORW (MOVWconst [c]) x) // cond: // result: (XORWconst [c] x) for { v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } c := v_0.AuxInt x := v.Args[1] v.reset(OpAMD64XORWconst) v.AuxInt = c v.AddArg(x) return true } // match: (XORW x x) // cond: // result: (MOVWconst [0]) for { x := v.Args[0] if x != v.Args[1] { break } v.reset(OpAMD64MOVWconst) v.AuxInt = 0 return true } return false } func rewriteValueAMD64_OpAMD64XORWconst(v *Value, config *Config) bool { b := v.Block _ = b // match: (XORWconst [c] x) // cond: int16(c)==0 // result: x for { c := v.AuxInt x := v.Args[0] if !(int16(c) == 0) { break } v.reset(OpCopy) v.Type = x.Type v.AddArg(x) return true } // match: (XORWconst [c] (MOVWconst [d])) // cond: // result: (MOVWconst [c^d]) for { c := v.AuxInt v_0 := v.Args[0] if v_0.Op != OpAMD64MOVWconst { break } d := v_0.AuxInt v.reset(OpAMD64MOVWconst) v.AuxInt = c ^ d return true } return false } func rewriteValueAMD64_OpXor16(v *Value, config *Config) bool { b := v.Block _ = b // match: (Xor16 x y) // cond: // result: (XORW x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64XORW) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpXor32(v *Value, config *Config) bool { b := v.Block _ = b // match: (Xor32 x y) // cond: // result: (XORL x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64XORL) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpXor64(v *Value, config *Config) bool { b := v.Block _ = b // match: (Xor64 x y) // cond: // result: (XORQ x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64XORQ) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpXor8(v *Value, config *Config) bool { b := v.Block _ = b // match: (Xor8 x y) // cond: // result: (XORB x y) for { x := v.Args[0] y := v.Args[1] v.reset(OpAMD64XORB) v.AddArg(x) v.AddArg(y) return true } return false } func rewriteValueAMD64_OpZero(v *Value, config *Config) bool { b := v.Block _ = b // match: (Zero [0] _ mem) // cond: // result: mem for { if v.AuxInt != 0 { break } mem := v.Args[1] v.reset(OpCopy) v.Type = mem.Type v.AddArg(mem) return true } // match: (Zero [1] destptr mem) // cond: // result: (MOVBstoreconst [0] destptr mem) for { if v.AuxInt != 1 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVBstoreconst) v.AuxInt = 0 v.AddArg(destptr) v.AddArg(mem) return true } // match: (Zero [2] destptr mem) // cond: // result: (MOVWstoreconst [0] destptr mem) for { if v.AuxInt != 2 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVWstoreconst) v.AuxInt = 0 v.AddArg(destptr) v.AddArg(mem) return true } // match: (Zero [4] destptr mem) // cond: // result: (MOVLstoreconst [0] destptr mem) for { if v.AuxInt != 4 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVLstoreconst) v.AuxInt = 0 v.AddArg(destptr) v.AddArg(mem) return true } // match: (Zero [8] destptr mem) // cond: // result: (MOVQstoreconst [0] destptr mem) for { if v.AuxInt != 8 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVQstoreconst) v.AuxInt = 0 v.AddArg(destptr) v.AddArg(mem) return true } // match: (Zero [3] destptr mem) // cond: // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVWstoreconst [0] destptr mem)) for { if v.AuxInt != 3 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVBstoreconst) v.AuxInt = makeValAndOff(0, 2) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVWstoreconst, TypeMem) v0.AuxInt = 0 v0.AddArg(destptr) v0.AddArg(mem) v.AddArg(v0) return true } // match: (Zero [5] destptr mem) // cond: // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [0] destptr mem)) for { if v.AuxInt != 5 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVBstoreconst) v.AuxInt = makeValAndOff(0, 4) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVLstoreconst, TypeMem) v0.AuxInt = 0 v0.AddArg(destptr) v0.AddArg(mem) v.AddArg(v0) return true } // match: (Zero [6] destptr mem) // cond: // result: (MOVWstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [0] destptr mem)) for { if v.AuxInt != 6 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVWstoreconst) v.AuxInt = makeValAndOff(0, 4) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVLstoreconst, TypeMem) v0.AuxInt = 0 v0.AddArg(destptr) v0.AddArg(mem) v.AddArg(v0) return true } // match: (Zero [7] destptr mem) // cond: // result: (MOVLstoreconst [makeValAndOff(0,3)] destptr (MOVLstoreconst [0] destptr mem)) for { if v.AuxInt != 7 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVLstoreconst) v.AuxInt = makeValAndOff(0, 3) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVLstoreconst, TypeMem) v0.AuxInt = 0 v0.AddArg(destptr) v0.AddArg(mem) v.AddArg(v0) return true } // match: (Zero [size] destptr mem) // cond: size%8 != 0 && size > 8 // result: (Zero [size-size%8] (ADDQconst destptr [size%8]) (MOVQstoreconst [0] destptr mem)) for { size := v.AuxInt destptr := v.Args[0] mem := v.Args[1] if !(size%8 != 0 && size > 8) { break } v.reset(OpZero) v.AuxInt = size - size%8 v0 := b.NewValue0(v.Line, OpAMD64ADDQconst, config.fe.TypeUInt64()) v0.AddArg(destptr) v0.AuxInt = size % 8 v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVQstoreconst, TypeMem) v1.AuxInt = 0 v1.AddArg(destptr) v1.AddArg(mem) v.AddArg(v1) return true } // match: (Zero [16] destptr mem) // cond: // result: (MOVQstoreconst [makeValAndOff(0,8)] destptr (MOVQstoreconst [0] destptr mem)) for { if v.AuxInt != 16 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVQstoreconst) v.AuxInt = makeValAndOff(0, 8) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVQstoreconst, TypeMem) v0.AuxInt = 0 v0.AddArg(destptr) v0.AddArg(mem) v.AddArg(v0) return true } // match: (Zero [24] destptr mem) // cond: // result: (MOVQstoreconst [makeValAndOff(0,16)] destptr (MOVQstoreconst [makeValAndOff(0,8)] destptr (MOVQstoreconst [0] destptr mem))) for { if v.AuxInt != 24 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVQstoreconst) v.AuxInt = makeValAndOff(0, 16) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVQstoreconst, TypeMem) v0.AuxInt = makeValAndOff(0, 8) v0.AddArg(destptr) v1 := b.NewValue0(v.Line, OpAMD64MOVQstoreconst, TypeMem) v1.AuxInt = 0 v1.AddArg(destptr) v1.AddArg(mem) v0.AddArg(v1) v.AddArg(v0) return true } // match: (Zero [32] destptr mem) // cond: // result: (MOVQstoreconst [makeValAndOff(0,24)] destptr (MOVQstoreconst [makeValAndOff(0,16)] destptr (MOVQstoreconst [makeValAndOff(0,8)] destptr (MOVQstoreconst [0] destptr mem)))) for { if v.AuxInt != 32 { break } destptr := v.Args[0] mem := v.Args[1] v.reset(OpAMD64MOVQstoreconst) v.AuxInt = makeValAndOff(0, 24) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVQstoreconst, TypeMem) v0.AuxInt = makeValAndOff(0, 16) v0.AddArg(destptr) v1 := b.NewValue0(v.Line, OpAMD64MOVQstoreconst, TypeMem) v1.AuxInt = makeValAndOff(0, 8) v1.AddArg(destptr) v2 := b.NewValue0(v.Line, OpAMD64MOVQstoreconst, TypeMem) v2.AuxInt = 0 v2.AddArg(destptr) v2.AddArg(mem) v1.AddArg(v2) v0.AddArg(v1) v.AddArg(v0) return true } // match: (Zero [size] destptr mem) // cond: size <= 1024 && size%8 == 0 && size%16 != 0 && !config.noDuffDevice // result: (Zero [size-8] (ADDQconst [8] destptr) (MOVQstore destptr (MOVQconst [0]) mem)) for { size := v.AuxInt destptr := v.Args[0] mem := v.Args[1] if !(size <= 1024 && size%8 == 0 && size%16 != 0 && !config.noDuffDevice) { break } v.reset(OpZero) v.AuxInt = size - 8 v0 := b.NewValue0(v.Line, OpAMD64ADDQconst, config.fe.TypeUInt64()) v0.AuxInt = 8 v0.AddArg(destptr) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVQstore, TypeMem) v1.AddArg(destptr) v2 := b.NewValue0(v.Line, OpAMD64MOVQconst, config.fe.TypeUInt64()) v2.AuxInt = 0 v1.AddArg(v2) v1.AddArg(mem) v.AddArg(v1) return true } // match: (Zero [size] destptr mem) // cond: size <= 1024 && size%16 == 0 && !config.noDuffDevice // result: (DUFFZERO [duffStart(size)] (ADDQconst [duffAdj(size)] destptr) (MOVOconst [0]) mem) for { size := v.AuxInt destptr := v.Args[0] mem := v.Args[1] if !(size <= 1024 && size%16 == 0 && !config.noDuffDevice) { break } v.reset(OpAMD64DUFFZERO) v.AuxInt = duffStart(size) v0 := b.NewValue0(v.Line, OpAMD64ADDQconst, config.fe.TypeUInt64()) v0.AuxInt = duffAdj(size) v0.AddArg(destptr) v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVOconst, TypeInt128) v1.AuxInt = 0 v.AddArg(v1) v.AddArg(mem) return true } // match: (Zero [size] destptr mem) // cond: (size > 1024 || (config.noDuffDevice && size > 32)) && size%8 == 0 // result: (REPSTOSQ destptr (MOVQconst [size/8]) (MOVQconst [0]) mem) for { size := v.AuxInt destptr := v.Args[0] mem := v.Args[1] if !((size > 1024 || (config.noDuffDevice && size > 32)) && size%8 == 0) { break } v.reset(OpAMD64REPSTOSQ) v.AddArg(destptr) v0 := b.NewValue0(v.Line, OpAMD64MOVQconst, config.fe.TypeUInt64()) v0.AuxInt = size / 8 v.AddArg(v0) v1 := b.NewValue0(v.Line, OpAMD64MOVQconst, config.fe.TypeUInt64()) v1.AuxInt = 0 v.AddArg(v1) v.AddArg(mem) return true } return false } func rewriteValueAMD64_OpZeroExt16to32(v *Value, config *Config) bool { b := v.Block _ = b // match: (ZeroExt16to32 x) // cond: // result: (MOVWQZX x) for { x := v.Args[0] v.reset(OpAMD64MOVWQZX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpZeroExt16to64(v *Value, config *Config) bool { b := v.Block _ = b // match: (ZeroExt16to64 x) // cond: // result: (MOVWQZX x) for { x := v.Args[0] v.reset(OpAMD64MOVWQZX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpZeroExt32to64(v *Value, config *Config) bool { b := v.Block _ = b // match: (ZeroExt32to64 x) // cond: // result: (MOVLQZX x) for { x := v.Args[0] v.reset(OpAMD64MOVLQZX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpZeroExt8to16(v *Value, config *Config) bool { b := v.Block _ = b // match: (ZeroExt8to16 x) // cond: // result: (MOVBQZX x) for { x := v.Args[0] v.reset(OpAMD64MOVBQZX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpZeroExt8to32(v *Value, config *Config) bool { b := v.Block _ = b // match: (ZeroExt8to32 x) // cond: // result: (MOVBQZX x) for { x := v.Args[0] v.reset(OpAMD64MOVBQZX) v.AddArg(x) return true } return false } func rewriteValueAMD64_OpZeroExt8to64(v *Value, config *Config) bool { b := v.Block _ = b // match: (ZeroExt8to64 x) // cond: // result: (MOVBQZX x) for { x := v.Args[0] v.reset(OpAMD64MOVBQZX) v.AddArg(x) return true } return false } func rewriteBlockAMD64(b *Block) bool { switch b.Kind { case BlockAMD64EQ: // match: (EQ (InvertFlags cmp) yes no) // cond: // result: (EQ cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64EQ b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (EQ (FlagEQ) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (EQ (FlagLT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (EQ (FlagLT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (EQ (FlagGT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (EQ (FlagGT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } case BlockAMD64GE: // match: (GE (InvertFlags cmp) yes no) // cond: // result: (LE cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64LE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (GE (FlagEQ) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (GE (FlagLT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (GE (FlagLT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (GE (FlagGT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (GE (FlagGT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } case BlockAMD64GT: // match: (GT (InvertFlags cmp) yes no) // cond: // result: (LT cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64LT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (GT (FlagEQ) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (GT (FlagLT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (GT (FlagLT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (GT (FlagGT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (GT (FlagGT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } case BlockIf: // match: (If (SETL cmp) yes no) // cond: // result: (LT cmp yes no) for { v := b.Control if v.Op != OpAMD64SETL { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64LT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETLE cmp) yes no) // cond: // result: (LE cmp yes no) for { v := b.Control if v.Op != OpAMD64SETLE { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64LE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETG cmp) yes no) // cond: // result: (GT cmp yes no) for { v := b.Control if v.Op != OpAMD64SETG { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64GT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETGE cmp) yes no) // cond: // result: (GE cmp yes no) for { v := b.Control if v.Op != OpAMD64SETGE { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64GE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETEQ cmp) yes no) // cond: // result: (EQ cmp yes no) for { v := b.Control if v.Op != OpAMD64SETEQ { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64EQ b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETNE cmp) yes no) // cond: // result: (NE cmp yes no) for { v := b.Control if v.Op != OpAMD64SETNE { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64NE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETB cmp) yes no) // cond: // result: (ULT cmp yes no) for { v := b.Control if v.Op != OpAMD64SETB { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64ULT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETBE cmp) yes no) // cond: // result: (ULE cmp yes no) for { v := b.Control if v.Op != OpAMD64SETBE { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64ULE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETA cmp) yes no) // cond: // result: (UGT cmp yes no) for { v := b.Control if v.Op != OpAMD64SETA { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETAE cmp) yes no) // cond: // result: (UGE cmp yes no) for { v := b.Control if v.Op != OpAMD64SETAE { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETGF cmp) yes no) // cond: // result: (UGT cmp yes no) for { v := b.Control if v.Op != OpAMD64SETGF { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETGEF cmp) yes no) // cond: // result: (UGE cmp yes no) for { v := b.Control if v.Op != OpAMD64SETGEF { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETEQF cmp) yes no) // cond: // result: (EQF cmp yes no) for { v := b.Control if v.Op != OpAMD64SETEQF { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64EQF b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If (SETNEF cmp) yes no) // cond: // result: (NEF cmp yes no) for { v := b.Control if v.Op != OpAMD64SETNEF { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64NEF b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (If cond yes no) // cond: // result: (NE (TESTB cond cond) yes no) for { v := b.Control cond := b.Control yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64NE v0 := b.NewValue0(v.Line, OpAMD64TESTB, TypeFlags) v0.AddArg(cond) v0.AddArg(cond) b.SetControl(v0) b.Succs[0] = yes b.Succs[1] = no return true } case BlockAMD64LE: // match: (LE (InvertFlags cmp) yes no) // cond: // result: (GE cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64GE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (LE (FlagEQ) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (LE (FlagLT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (LE (FlagLT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (LE (FlagGT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (LE (FlagGT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } case BlockAMD64LT: // match: (LT (InvertFlags cmp) yes no) // cond: // result: (GT cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64GT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (LT (FlagEQ) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (LT (FlagLT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (LT (FlagLT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (LT (FlagGT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (LT (FlagGT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } case BlockAMD64NE: // match: (NE (TESTB (SETL cmp)) yes no) // cond: // result: (LT cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETL { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64LT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETLE cmp)) yes no) // cond: // result: (LE cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETLE { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64LE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETG cmp)) yes no) // cond: // result: (GT cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETG { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64GT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETGE cmp)) yes no) // cond: // result: (GE cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETGE { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64GE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETEQ cmp)) yes no) // cond: // result: (EQ cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETEQ { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64EQ b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETNE cmp)) yes no) // cond: // result: (NE cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETNE { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64NE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETB cmp)) yes no) // cond: // result: (ULT cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETB { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64ULT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETBE cmp)) yes no) // cond: // result: (ULE cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETBE { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64ULE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETA cmp)) yes no) // cond: // result: (UGT cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETA { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETAE cmp)) yes no) // cond: // result: (UGE cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETAE { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETGF cmp)) yes no) // cond: // result: (UGT cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETGF { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETGEF cmp)) yes no) // cond: // result: (UGE cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETGEF { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETEQF cmp)) yes no) // cond: // result: (EQF cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETEQF { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64EQF b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (TESTB (SETNEF cmp)) yes no) // cond: // result: (NEF cmp yes no) for { v := b.Control if v.Op != OpAMD64TESTB { break } v_0 := v.Args[0] if v_0.Op != OpAMD64SETNEF { break } cmp := v_0.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64NEF b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (InvertFlags cmp) yes no) // cond: // result: (NE cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64NE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (FlagEQ) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (NE (FlagLT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (FlagLT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (FlagGT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (NE (FlagGT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } case BlockAMD64UGE: // match: (UGE (InvertFlags cmp) yes no) // cond: // result: (ULE cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64ULE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (UGE (FlagEQ) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (UGE (FlagLT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (UGE (FlagLT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (UGE (FlagGT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (UGE (FlagGT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } case BlockAMD64UGT: // match: (UGT (InvertFlags cmp) yes no) // cond: // result: (ULT cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64ULT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (UGT (FlagEQ) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (UGT (FlagLT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (UGT (FlagLT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (UGT (FlagGT_ULT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (UGT (FlagGT_UGT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } case BlockAMD64ULE: // match: (ULE (InvertFlags cmp) yes no) // cond: // result: (UGE cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGE b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (ULE (FlagEQ) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (ULE (FlagLT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (ULE (FlagLT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (ULE (FlagGT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (ULE (FlagGT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } case BlockAMD64ULT: // match: (ULT (InvertFlags cmp) yes no) // cond: // result: (UGT cmp yes no) for { v := b.Control if v.Op != OpAMD64InvertFlags { break } cmp := v.Args[0] yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockAMD64UGT b.SetControl(cmp) b.Succs[0] = yes b.Succs[1] = no return true } // match: (ULT (FlagEQ) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagEQ { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (ULT (FlagLT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagLT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (ULT (FlagLT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagLT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } // match: (ULT (FlagGT_ULT) yes no) // cond: // result: (First nil yes no) for { v := b.Control if v.Op != OpAMD64FlagGT_ULT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = yes b.Succs[1] = no return true } // match: (ULT (FlagGT_UGT) yes no) // cond: // result: (First nil no yes) for { v := b.Control if v.Op != OpAMD64FlagGT_UGT { break } yes := b.Succs[0] no := b.Succs[1] b.Kind = BlockFirst b.SetControl(nil) b.Succs[0] = no b.Succs[1] = yes b.Likely *= -1 return true } } return false } ================================================ FILE: tests/data/pass/simplest.go ================================================ package main func main() {} ================================================ FILE: tests/data/pass/viper.go ================================================ // Copyright © 2014 Steve Francia . // // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file. // Viper is a application configuration system. // It believes that applications can be configured a variety of ways // via flags, ENVIRONMENT variables, configuration files retrieved // from the file system, or a remote key/value store. // Each item takes precedence over the item below it: // overrides // flag // env // config // key/value store // default package viper import ( "bytes" "fmt" "io" "io/ioutil" "log" "os" "path/filepath" "reflect" "strings" "time" "github.com/kr/pretty" "github.com/mitchellh/mapstructure" "github.com/spf13/cast" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/pflag" "gopkg.in/fsnotify.v1" ) var v *Viper func init() { v = New() } type remoteConfigFactory interface { Get(rp RemoteProvider) (io.Reader, error) Watch(rp RemoteProvider) (io.Reader, error) } // RemoteConfig is optional, see the remote package var RemoteConfig remoteConfigFactory // Denotes encountering an unsupported // configuration filetype. type UnsupportedConfigError string // Returns the formatted configuration error. func (str UnsupportedConfigError) Error() string { return fmt.Sprintf("Unsupported Config Type %q", string(str)) } // Denotes encountering an unsupported remote // provider. Currently only etcd and Consul are // supported. type UnsupportedRemoteProviderError string // Returns the formatted remote provider error. func (str UnsupportedRemoteProviderError) Error() string { return fmt.Sprintf("Unsupported Remote Provider Type %q", string(str)) } // Denotes encountering an error while trying to // pull the configuration from the remote provider. type RemoteConfigError string // Returns the formatted remote provider error func (rce RemoteConfigError) Error() string { return fmt.Sprintf("Remote Configurations Error: %s", string(rce)) } // Denotes failing to find configuration file. type ConfigFileNotFoundError struct { name, locations string } // Returns the formatted configuration error. func (fnfe ConfigFileNotFoundError) Error() string { return fmt.Sprintf("Config File %q Not Found in %q", fnfe.name, fnfe.locations) } // Viper is a prioritized configuration registry. It // maintains a set of configuration sources, fetches // values to populate those, and provides them according // to the source's priority. // The priority of the sources is the following: // 1. overrides // 2. flags // 3. env. variables // 4. config file // 5. key/value store // 6. defaults // // For example, if values from the following sources were loaded: // // Defaults : { // "secret": "", // "user": "default", // "endpoint": "https://localhost" // } // Config : { // "user": "root" // "secret": "defaultsecret" // } // Env : { // "secret": "somesecretkey" // } // // The resulting config will have the following values: // // { // "secret": "somesecretkey", // "user": "root", // "endpoint": "https://localhost" // } type Viper struct { // Delimiter that separates a list of keys // used to access a nested value in one go keyDelim string // A set of paths to look for the config file in configPaths []string // A set of remote providers to search for the configuration remoteProviders []*defaultRemoteProvider // Name of file to look for inside the path configName string configFile string configType string envPrefix string automaticEnvApplied bool envKeyReplacer *strings.Replacer config map[string]interface{} override map[string]interface{} defaults map[string]interface{} kvstore map[string]interface{} pflags map[string]FlagValue env map[string]string aliases map[string]string typeByDefValue bool onConfigChange func(fsnotify.Event) } // Returns an initialized Viper instance. func New() *Viper { v := new(Viper) v.keyDelim = "." v.configName = "config" v.config = make(map[string]interface{}) v.override = make(map[string]interface{}) v.defaults = make(map[string]interface{}) v.kvstore = make(map[string]interface{}) v.pflags = make(map[string]FlagValue) v.env = make(map[string]string) v.aliases = make(map[string]string) v.typeByDefValue = false return v } // Intended for testing, will reset all to default settings. // In the public interface for the viper package so applications // can use it in their testing as well. func Reset() { v = New() SupportedExts = []string{"json", "toml", "yaml", "yml", "hcl"} SupportedRemoteProviders = []string{"etcd", "consul"} } type defaultRemoteProvider struct { provider string endpoint string path string secretKeyring string } func (rp defaultRemoteProvider) Provider() string { return rp.provider } func (rp defaultRemoteProvider) Endpoint() string { return rp.endpoint } func (rp defaultRemoteProvider) Path() string { return rp.path } func (rp defaultRemoteProvider) SecretKeyring() string { return rp.secretKeyring } // RemoteProvider stores the configuration necessary // to connect to a remote key/value store. // Optional secretKeyring to unencrypt encrypted values // can be provided. type RemoteProvider interface { Provider() string Endpoint() string Path() string SecretKeyring() string } // Universally supported extensions. var SupportedExts []string = []string{"json", "toml", "yaml", "yml", "properties", "props", "prop", "hcl"} // Universally supported remote providers. var SupportedRemoteProviders []string = []string{"etcd", "consul"} func OnConfigChange(run func(in fsnotify.Event)) { v.OnConfigChange(run) } func (v *Viper) OnConfigChange(run func(in fsnotify.Event)) { v.onConfigChange = run } func WatchConfig() { v.WatchConfig() } func (v *Viper) WatchConfig() { go func() { watcher, err := fsnotify.NewWatcher() if err != nil { log.Fatal(err) } defer watcher.Close() // we have to watch the entire directory to pick up renames/atomic saves in a cross-platform way configFile := filepath.Clean(v.getConfigFile()) configDir, _ := filepath.Split(configFile) done := make(chan bool) go func() { for { select { case event := <-watcher.Events: // we only care about the config file if filepath.Clean(event.Name) == configFile { if event.Op&fsnotify.Write == fsnotify.Write || event.Op&fsnotify.Create == fsnotify.Create { err := v.ReadInConfig() if err != nil { log.Println("error:", err) } v.onConfigChange(event) } } case err := <-watcher.Errors: log.Println("error:", err) } } }() watcher.Add(configDir) <-done }() } // Explicitly define the path, name and extension of the config file // Viper will use this and not check any of the config paths func SetConfigFile(in string) { v.SetConfigFile(in) } func (v *Viper) SetConfigFile(in string) { if in != "" { v.configFile = in } } // Define a prefix that ENVIRONMENT variables will use. // E.g. if your prefix is "spf", the env registry // will look for env. variables that start with "SPF_" func SetEnvPrefix(in string) { v.SetEnvPrefix(in) } func (v *Viper) SetEnvPrefix(in string) { if in != "" { v.envPrefix = in } } func (v *Viper) mergeWithEnvPrefix(in string) string { if v.envPrefix != "" { return strings.ToUpper(v.envPrefix + "_" + in) } return strings.ToUpper(in) } // TODO: should getEnv logic be moved into find(). Can generalize the use of // rewriting keys many things, Ex: Get('someKey') -> some_key // (cammel case to snake case for JSON keys perhaps) // getEnv s a wrapper around os.Getenv which replaces characters in the original // key. This allows env vars which have different keys then the config object // keys func (v *Viper) getEnv(key string) string { if v.envKeyReplacer != nil { key = v.envKeyReplacer.Replace(key) } return os.Getenv(key) } // Return the file used to populate the config registry func ConfigFileUsed() string { return v.ConfigFileUsed() } func (v *Viper) ConfigFileUsed() string { return v.configFile } // Add a path for Viper to search for the config file in. // Can be called multiple times to define multiple search paths. func AddConfigPath(in string) { v.AddConfigPath(in) } func (v *Viper) AddConfigPath(in string) { if in != "" { absin := absPathify(in) jww.INFO.Println("adding", absin, "to paths to search") if !stringInSlice(absin, v.configPaths) { v.configPaths = append(v.configPaths, absin) } } } // AddRemoteProvider adds a remote configuration source. // Remote Providers are searched in the order they are added. // provider is a string value, "etcd" or "consul" are currently supported. // endpoint is the url. etcd requires http://ip:port consul requires ip:port // path is the path in the k/v store to retrieve configuration // To retrieve a config file called myapp.json from /configs/myapp.json // you should set path to /configs and set config name (SetConfigName()) to // "myapp" func AddRemoteProvider(provider, endpoint, path string) error { return v.AddRemoteProvider(provider, endpoint, path) } func (v *Viper) AddRemoteProvider(provider, endpoint, path string) error { if !stringInSlice(provider, SupportedRemoteProviders) { return UnsupportedRemoteProviderError(provider) } if provider != "" && endpoint != "" { jww.INFO.Printf("adding %s:%s to remote provider list", provider, endpoint) rp := &defaultRemoteProvider{ endpoint: endpoint, provider: provider, path: path, } if !v.providerPathExists(rp) { v.remoteProviders = append(v.remoteProviders, rp) } } return nil } // AddSecureRemoteProvider adds a remote configuration source. // Secure Remote Providers are searched in the order they are added. // provider is a string value, "etcd" or "consul" are currently supported. // endpoint is the url. etcd requires http://ip:port consul requires ip:port // secretkeyring is the filepath to your openpgp secret keyring. e.g. /etc/secrets/myring.gpg // path is the path in the k/v store to retrieve configuration // To retrieve a config file called myapp.json from /configs/myapp.json // you should set path to /configs and set config name (SetConfigName()) to // "myapp" // Secure Remote Providers are implemented with github.com/xordataexchange/crypt func AddSecureRemoteProvider(provider, endpoint, path, secretkeyring string) error { return v.AddSecureRemoteProvider(provider, endpoint, path, secretkeyring) } func (v *Viper) AddSecureRemoteProvider(provider, endpoint, path, secretkeyring string) error { if !stringInSlice(provider, SupportedRemoteProviders) { return UnsupportedRemoteProviderError(provider) } if provider != "" && endpoint != "" { jww.INFO.Printf("adding %s:%s to remote provider list", provider, endpoint) rp := &defaultRemoteProvider{ endpoint: endpoint, provider: provider, path: path, secretKeyring: secretkeyring, } if !v.providerPathExists(rp) { v.remoteProviders = append(v.remoteProviders, rp) } } return nil } func (v *Viper) providerPathExists(p *defaultRemoteProvider) bool { for _, y := range v.remoteProviders { if reflect.DeepEqual(y, p) { return true } } return false } func (v *Viper) searchMap(source map[string]interface{}, path []string) interface{} { if len(path) == 0 { return source } var ok bool var next interface{} for k, v := range source { if strings.ToLower(k) == strings.ToLower(path[0]) { ok = true next = v break } } if ok { switch next.(type) { case map[interface{}]interface{}: return v.searchMap(cast.ToStringMap(next), path[1:]) case map[string]interface{}: // Type assertion is safe here since it is only reached // if the type of `next` is the same as the type being asserted return v.searchMap(next.(map[string]interface{}), path[1:]) default: return next } } else { return nil } } // SetTypeByDefaultValue enables or disables the inference of a key value's // type when the Get function is used based upon a key's default value as // opposed to the value returned based on the normal fetch logic. // // For example, if a key has a default value of []string{} and the same key // is set via an environment variable to "a b c", a call to the Get function // would return a string slice for the key if the key's type is inferred by // the default value and the Get function would return: // // []string {"a", "b", "c"} // // Otherwise the Get function would return: // // "a b c" func SetTypeByDefaultValue(enable bool) { v.SetTypeByDefaultValue(enable) } func (v *Viper) SetTypeByDefaultValue(enable bool) { v.typeByDefValue = enable } // Viper is essentially repository for configurations // Get can retrieve any value given the key to use // Get has the behavior of returning the value associated with the first // place from where it is set. Viper will check in the following order: // override, flag, env, config file, key/value store, default // // Get returns an interface. For a specific value use one of the Get____ methods. func Get(key string) interface{} { return v.Get(key) } func (v *Viper) Get(key string) interface{} { path := strings.Split(key, v.keyDelim) lcaseKey := strings.ToLower(key) val := v.find(lcaseKey) if val == nil { source := v.find(strings.ToLower(path[0])) if source != nil { if reflect.TypeOf(source).Kind() == reflect.Map { val = v.searchMap(cast.ToStringMap(source), path[1:]) } } } // if no other value is returned and a flag does exist for the value, // get the flag's value even if the flag's value has not changed if val == nil { if flag, exists := v.pflags[lcaseKey]; exists { jww.TRACE.Println(key, "get pflag default", val) switch flag.ValueType() { case "int", "int8", "int16", "int32", "int64": val = cast.ToInt(flag.ValueString()) case "bool": val = cast.ToBool(flag.ValueString()) default: val = flag.ValueString() } } } if val == nil { return nil } var valType interface{} if !v.typeByDefValue { valType = val } else { defVal, defExists := v.defaults[lcaseKey] if defExists { valType = defVal } else { valType = val } } switch valType.(type) { case bool: return cast.ToBool(val) case string: return cast.ToString(val) case int64, int32, int16, int8, int: return cast.ToInt(val) case float64, float32: return cast.ToFloat64(val) case time.Time: return cast.ToTime(val) case time.Duration: return cast.ToDuration(val) case []string: return cast.ToStringSlice(val) } return val } // Returns new Viper instance representing a sub tree of this instance func Sub(key string) *Viper { return v.Sub(key) } func (v *Viper) Sub(key string) *Viper { subv := New() data := v.Get(key) if reflect.TypeOf(data).Kind() == reflect.Map { subv.config = cast.ToStringMap(data) return subv } else { return nil } } // Returns the value associated with the key as a string func GetString(key string) string { return v.GetString(key) } func (v *Viper) GetString(key string) string { return cast.ToString(v.Get(key)) } // Returns the value associated with the key asa boolean func GetBool(key string) bool { return v.GetBool(key) } func (v *Viper) GetBool(key string) bool { return cast.ToBool(v.Get(key)) } // Returns the value associated with the key as an integer func GetInt(key string) int { return v.GetInt(key) } func (v *Viper) GetInt(key string) int { return cast.ToInt(v.Get(key)) } // Returns the value associated with the key as a float64 func GetFloat64(key string) float64 { return v.GetFloat64(key) } func (v *Viper) GetFloat64(key string) float64 { return cast.ToFloat64(v.Get(key)) } // Returns the value associated with the key as time func GetTime(key string) time.Time { return v.GetTime(key) } func (v *Viper) GetTime(key string) time.Time { return cast.ToTime(v.Get(key)) } // Returns the value associated with the key as a duration func GetDuration(key string) time.Duration { return v.GetDuration(key) } func (v *Viper) GetDuration(key string) time.Duration { return cast.ToDuration(v.Get(key)) } // Returns the value associated with the key as a slice of strings func GetStringSlice(key string) []string { return v.GetStringSlice(key) } func (v *Viper) GetStringSlice(key string) []string { return cast.ToStringSlice(v.Get(key)) } // Returns the value associated with the key as a map of interfaces func GetStringMap(key string) map[string]interface{} { return v.GetStringMap(key) } func (v *Viper) GetStringMap(key string) map[string]interface{} { return cast.ToStringMap(v.Get(key)) } // Returns the value associated with the key as a map of strings func GetStringMapString(key string) map[string]string { return v.GetStringMapString(key) } func (v *Viper) GetStringMapString(key string) map[string]string { return cast.ToStringMapString(v.Get(key)) } // Returns the value associated with the key as a map to a slice of strings. func GetStringMapStringSlice(key string) map[string][]string { return v.GetStringMapStringSlice(key) } func (v *Viper) GetStringMapStringSlice(key string) map[string][]string { return cast.ToStringMapStringSlice(v.Get(key)) } // Returns the size of the value associated with the given key // in bytes. func GetSizeInBytes(key string) uint { return v.GetSizeInBytes(key) } func (v *Viper) GetSizeInBytes(key string) uint { sizeStr := cast.ToString(v.Get(key)) return parseSizeInBytes(sizeStr) } // Takes a single key and unmarshals it into a Struct func UnmarshalKey(key string, rawVal interface{}) error { return v.UnmarshalKey(key, rawVal) } func (v *Viper) UnmarshalKey(key string, rawVal interface{}) error { return mapstructure.Decode(v.Get(key), rawVal) } // Unmarshals the config into a Struct. Make sure that the tags // on the fields of the structure are properly set. func Unmarshal(rawVal interface{}) error { return v.Unmarshal(rawVal) } func (v *Viper) Unmarshal(rawVal interface{}) error { err := mapstructure.WeakDecode(v.AllSettings(), rawVal) if err != nil { return err } v.insensitiviseMaps() return nil } // A wrapper around mapstructure.Decode that mimics the WeakDecode functionality // while erroring on non existing vals in the destination struct func weakDecodeExact(input, output interface{}) error { config := &mapstructure.DecoderConfig{ ErrorUnused: true, Metadata: nil, Result: output, WeaklyTypedInput: true, } decoder, err := mapstructure.NewDecoder(config) if err != nil { return err } return decoder.Decode(input) } // Unmarshals the config into a Struct, erroring if a field is non-existant // in the destination struct func (v *Viper) UnmarshalExact(rawVal interface{}) error { err := weakDecodeExact(v.AllSettings(), rawVal) if err != nil { return err } v.insensitiviseMaps() return nil } // Bind a full flag set to the configuration, using each flag's long // name as the config key. func BindPFlags(flags *pflag.FlagSet) (err error) { return v.BindPFlags(flags) } func (v *Viper) BindPFlags(flags *pflag.FlagSet) (err error) { return v.BindFlagValues(pflagValueSet{flags}) } // Bind a specific key to a pflag (as used by cobra) // Example(where serverCmd is a Cobra instance): // // serverCmd.Flags().Int("port", 1138, "Port to run Application server on") // Viper.BindPFlag("port", serverCmd.Flags().Lookup("port")) // func BindPFlag(key string, flag *pflag.Flag) (err error) { return v.BindPFlag(key, flag) } func (v *Viper) BindPFlag(key string, flag *pflag.Flag) (err error) { return v.BindFlagValue(key, pflagValue{flag}) } // Bind a full FlagValue set to the configuration, using each flag's long // name as the config key. func BindFlagValues(flags FlagValueSet) (err error) { return v.BindFlagValues(flags) } func (v *Viper) BindFlagValues(flags FlagValueSet) (err error) { flags.VisitAll(func(flag FlagValue) { if err = v.BindFlagValue(flag.Name(), flag); err != nil { return } }) return nil } // Bind a specific key to a FlagValue. // Example(where serverCmd is a Cobra instance): // // serverCmd.Flags().Int("port", 1138, "Port to run Application server on") // Viper.BindFlagValue("port", serverCmd.Flags().Lookup("port")) // func BindFlagValue(key string, flag FlagValue) (err error) { return v.BindFlagValue(key, flag) } func (v *Viper) BindFlagValue(key string, flag FlagValue) (err error) { if flag == nil { return fmt.Errorf("flag for %q is nil", key) } v.pflags[strings.ToLower(key)] = flag return nil } // Binds a Viper key to a ENV variable // ENV variables are case sensitive // If only a key is provided, it will use the env key matching the key, uppercased. // EnvPrefix will be used when set when env name is not provided. func BindEnv(input ...string) (err error) { return v.BindEnv(input...) } func (v *Viper) BindEnv(input ...string) (err error) { var key, envkey string if len(input) == 0 { return fmt.Errorf("BindEnv missing key to bind to") } key = strings.ToLower(input[0]) if len(input) == 1 { envkey = v.mergeWithEnvPrefix(key) } else { envkey = input[1] } v.env[key] = envkey return nil } // Given a key, find the value // Viper will check in the following order: // flag, env, config file, key/value store, default // Viper will check to see if an alias exists first func (v *Viper) find(key string) interface{} { var val interface{} var exists bool // if the requested key is an alias, then return the proper key key = v.realKey(key) // PFlag Override first flag, exists := v.pflags[key] if exists && flag.HasChanged() { jww.TRACE.Println(key, "found in override (via pflag):", flag.ValueString()) switch flag.ValueType() { case "int", "int8", "int16", "int32", "int64": return cast.ToInt(flag.ValueString()) case "bool": return cast.ToBool(flag.ValueString()) default: return flag.ValueString() } } val, exists = v.override[key] if exists { jww.TRACE.Println(key, "found in override:", val) return val } if v.automaticEnvApplied { // even if it hasn't been registered, if automaticEnv is used, // check any Get request if val = v.getEnv(v.mergeWithEnvPrefix(key)); val != "" { jww.TRACE.Println(key, "found in environment with val:", val) return val } } envkey, exists := v.env[key] if exists { jww.TRACE.Println(key, "registered as env var", envkey) if val = v.getEnv(envkey); val != "" { jww.TRACE.Println(envkey, "found in environment with val:", val) return val } else { jww.TRACE.Println(envkey, "env value unset:") } } val, exists = v.config[key] if exists { jww.TRACE.Println(key, "found in config:", val) return val } // Test for nested config parameter if strings.Contains(key, v.keyDelim) { path := strings.Split(key, v.keyDelim) source := v.find(path[0]) if source != nil { if reflect.TypeOf(source).Kind() == reflect.Map { val := v.searchMap(cast.ToStringMap(source), path[1:]) jww.TRACE.Println(key, "found in nested config:", val) return val } } } val, exists = v.kvstore[key] if exists { jww.TRACE.Println(key, "found in key/value store:", val) return val } val, exists = v.defaults[key] if exists { jww.TRACE.Println(key, "found in defaults:", val) return val } return nil } // Check to see if the key has been set in any of the data locations func IsSet(key string) bool { return v.IsSet(key) } func (v *Viper) IsSet(key string) bool { path := strings.Split(key, v.keyDelim) lcaseKey := strings.ToLower(key) val := v.find(lcaseKey) if val == nil { source := v.find(strings.ToLower(path[0])) if source != nil { if reflect.TypeOf(source).Kind() == reflect.Map { val = v.searchMap(cast.ToStringMap(source), path[1:]) } } } return val != nil } // Have Viper check ENV variables for all // keys set in config, default & flags func AutomaticEnv() { v.AutomaticEnv() } func (v *Viper) AutomaticEnv() { v.automaticEnvApplied = true } // SetEnvKeyReplacer sets the strings.Replacer on the viper object // Useful for mapping an environmental variable to a key that does // not match it. func SetEnvKeyReplacer(r *strings.Replacer) { v.SetEnvKeyReplacer(r) } func (v *Viper) SetEnvKeyReplacer(r *strings.Replacer) { v.envKeyReplacer = r } // Aliases provide another accessor for the same key. // This enables one to change a name without breaking the application func RegisterAlias(alias string, key string) { v.RegisterAlias(alias, key) } func (v *Viper) RegisterAlias(alias string, key string) { v.registerAlias(alias, strings.ToLower(key)) } func (v *Viper) registerAlias(alias string, key string) { alias = strings.ToLower(alias) if alias != key && alias != v.realKey(key) { _, exists := v.aliases[alias] if !exists { // if we alias something that exists in one of the maps to another // name, we'll never be able to get that value using the original // name, so move the config value to the new realkey. if val, ok := v.config[alias]; ok { delete(v.config, alias) v.config[key] = val } if val, ok := v.kvstore[alias]; ok { delete(v.kvstore, alias) v.kvstore[key] = val } if val, ok := v.defaults[alias]; ok { delete(v.defaults, alias) v.defaults[key] = val } if val, ok := v.override[alias]; ok { delete(v.override, alias) v.override[key] = val } v.aliases[alias] = key } } else { jww.WARN.Println("Creating circular reference alias", alias, key, v.realKey(key)) } } func (v *Viper) realKey(key string) string { newkey, exists := v.aliases[key] if exists { jww.DEBUG.Println("Alias", key, "to", newkey) return v.realKey(newkey) } else { return key } } // Check to see if the given key (or an alias) is in the config file func InConfig(key string) bool { return v.InConfig(key) } func (v *Viper) InConfig(key string) bool { // if the requested key is an alias, then return the proper key key = v.realKey(key) _, exists := v.config[key] return exists } // Set the default value for this key. // Default only used when no value is provided by the user via flag, config or ENV. func SetDefault(key string, value interface{}) { v.SetDefault(key, value) } func (v *Viper) SetDefault(key string, value interface{}) { // If alias passed in, then set the proper default key = v.realKey(strings.ToLower(key)) v.defaults[key] = value } // Sets the value for the key in the override regiser. // Will be used instead of values obtained via // flags, config file, ENV, default, or key/value store func Set(key string, value interface{}) { v.Set(key, value) } func (v *Viper) Set(key string, value interface{}) { // If alias passed in, then set the proper override key = v.realKey(strings.ToLower(key)) v.override[key] = value } // Viper will discover and load the configuration file from disk // and key/value stores, searching in one of the defined paths. func ReadInConfig() error { return v.ReadInConfig() } func (v *Viper) ReadInConfig() error { jww.INFO.Println("Attempting to read in config file") if !stringInSlice(v.getConfigType(), SupportedExts) { return UnsupportedConfigError(v.getConfigType()) } file, err := ioutil.ReadFile(v.getConfigFile()) if err != nil { return err } v.config = make(map[string]interface{}) return v.unmarshalReader(bytes.NewReader(file), v.config) } // MergeInConfig merges a new configuration with an existing config. func MergeInConfig() error { return v.MergeInConfig() } func (v *Viper) MergeInConfig() error { jww.INFO.Println("Attempting to merge in config file") if !stringInSlice(v.getConfigType(), SupportedExts) { return UnsupportedConfigError(v.getConfigType()) } file, err := ioutil.ReadFile(v.getConfigFile()) if err != nil { return err } return v.MergeConfig(bytes.NewReader(file)) } // Viper will read a configuration file, setting existing keys to nil if the // key does not exist in the file. func ReadConfig(in io.Reader) error { return v.ReadConfig(in) } func (v *Viper) ReadConfig(in io.Reader) error { v.config = make(map[string]interface{}) return v.unmarshalReader(in, v.config) } // MergeConfig merges a new configuration with an existing config. func MergeConfig(in io.Reader) error { return v.MergeConfig(in) } func (v *Viper) MergeConfig(in io.Reader) error { if v.config == nil { v.config = make(map[string]interface{}) } cfg := make(map[string]interface{}) if err := v.unmarshalReader(in, cfg); err != nil { return err } mergeMaps(cfg, v.config, nil) return nil } func keyExists(k string, m map[string]interface{}) string { lk := strings.ToLower(k) for mk := range m { lmk := strings.ToLower(mk) if lmk == lk { return mk } } return "" } func castToMapStringInterface( src map[interface{}]interface{}) map[string]interface{} { tgt := map[string]interface{}{} for k, v := range src { tgt[fmt.Sprintf("%v", k)] = v } return tgt } // mergeMaps merges two maps. The `itgt` parameter is for handling go-yaml's // insistence on parsing nested structures as `map[interface{}]interface{}` // instead of using a `string` as the key for nest structures beyond one level // deep. Both map types are supported as there is a go-yaml fork that uses // `map[string]interface{}` instead. func mergeMaps( src, tgt map[string]interface{}, itgt map[interface{}]interface{}) { for sk, sv := range src { tk := keyExists(sk, tgt) if tk == "" { jww.TRACE.Printf("tk=\"\", tgt[%s]=%v", sk, sv) tgt[sk] = sv if itgt != nil { itgt[sk] = sv } continue } tv, ok := tgt[tk] if !ok { jww.TRACE.Printf("tgt[%s] != ok, tgt[%s]=%v", tk, sk, sv) tgt[sk] = sv if itgt != nil { itgt[sk] = sv } continue } svType := reflect.TypeOf(sv) tvType := reflect.TypeOf(tv) if svType != tvType { jww.ERROR.Printf( "svType != tvType; key=%s, st=%v, tt=%v, sv=%v, tv=%v", sk, svType, tvType, sv, tv) continue } jww.TRACE.Printf("processing key=%s, st=%v, tt=%v, sv=%v, tv=%v", sk, svType, tvType, sv, tv) switch ttv := tv.(type) { case map[interface{}]interface{}: jww.TRACE.Printf("merging maps (must convert)") tsv := sv.(map[interface{}]interface{}) ssv := castToMapStringInterface(tsv) stv := castToMapStringInterface(ttv) mergeMaps(ssv, stv, ttv) case map[string]interface{}: jww.TRACE.Printf("merging maps") mergeMaps(sv.(map[string]interface{}), ttv, nil) default: jww.TRACE.Printf("setting value") tgt[tk] = sv if itgt != nil { itgt[tk] = sv } } } } // func ReadBufConfig(buf *bytes.Buffer) error { return v.ReadBufConfig(buf) } // func (v *Viper) ReadBufConfig(buf *bytes.Buffer) error { // v.config = make(map[string]interface{}) // return v.unmarshalReader(buf, v.config) // } // Attempts to get configuration from a remote source // and read it in the remote configuration registry. func ReadRemoteConfig() error { return v.ReadRemoteConfig() } func (v *Viper) ReadRemoteConfig() error { err := v.getKeyValueConfig() if err != nil { return err } return nil } func WatchRemoteConfig() error { return v.WatchRemoteConfig() } func (v *Viper) WatchRemoteConfig() error { err := v.watchKeyValueConfig() if err != nil { return err } return nil } // Unmarshall a Reader into a map // Should probably be an unexported function func unmarshalReader(in io.Reader, c map[string]interface{}) error { return v.unmarshalReader(in, c) } func (v *Viper) unmarshalReader(in io.Reader, c map[string]interface{}) error { return unmarshallConfigReader(in, c, v.getConfigType()) } func (v *Viper) insensitiviseMaps() { insensitiviseMap(v.config) insensitiviseMap(v.defaults) insensitiviseMap(v.override) insensitiviseMap(v.kvstore) } // retrieve the first found remote configuration func (v *Viper) getKeyValueConfig() error { if RemoteConfig == nil { return RemoteConfigError("Enable the remote features by doing a blank import of the viper/remote package: '_ github.com/spf13/viper/remote'") } for _, rp := range v.remoteProviders { val, err := v.getRemoteConfig(rp) if err != nil { continue } v.kvstore = val return nil } return RemoteConfigError("No Files Found") } func (v *Viper) getRemoteConfig(provider *defaultRemoteProvider) (map[string]interface{}, error) { reader, err := RemoteConfig.Get(provider) if err != nil { return nil, err } err = v.unmarshalReader(reader, v.kvstore) return v.kvstore, err } // retrieve the first found remote configuration func (v *Viper) watchKeyValueConfig() error { for _, rp := range v.remoteProviders { val, err := v.watchRemoteConfig(rp) if err != nil { continue } v.kvstore = val return nil } return RemoteConfigError("No Files Found") } func (v *Viper) watchRemoteConfig(provider *defaultRemoteProvider) (map[string]interface{}, error) { reader, err := RemoteConfig.Watch(provider) if err != nil { return nil, err } err = v.unmarshalReader(reader, v.kvstore) return v.kvstore, err } // Return all keys regardless where they are set func AllKeys() []string { return v.AllKeys() } func (v *Viper) AllKeys() []string { m := map[string]struct{}{} for key, _ := range v.defaults { m[strings.ToLower(key)] = struct{}{} } for key, _ := range v.pflags { m[strings.ToLower(key)] = struct{}{} } for key, _ := range v.env { m[strings.ToLower(key)] = struct{}{} } for key, _ := range v.config { m[strings.ToLower(key)] = struct{}{} } for key, _ := range v.kvstore { m[strings.ToLower(key)] = struct{}{} } for key, _ := range v.override { m[strings.ToLower(key)] = struct{}{} } for key, _ := range v.aliases { m[strings.ToLower(key)] = struct{}{} } a := []string{} for x, _ := range m { a = append(a, x) } return a } // Return all settings as a map[string]interface{} func AllSettings() map[string]interface{} { return v.AllSettings() } func (v *Viper) AllSettings() map[string]interface{} { m := map[string]interface{}{} for _, x := range v.AllKeys() { m[x] = v.Get(x) } return m } // Name for the config file. // Does not include extension. func SetConfigName(in string) { v.SetConfigName(in) } func (v *Viper) SetConfigName(in string) { if in != "" { v.configName = in } } // Sets the type of the configuration returned by the // remote source, e.g. "json". func SetConfigType(in string) { v.SetConfigType(in) } func (v *Viper) SetConfigType(in string) { if in != "" { v.configType = in } } func (v *Viper) getConfigType() string { if v.configType != "" { return v.configType } cf := v.getConfigFile() ext := filepath.Ext(cf) if len(ext) > 1 { return ext[1:] } else { return "" } } func (v *Viper) getConfigFile() string { // if explicitly set, then use it if v.configFile != "" { return v.configFile } cf, err := v.findConfigFile() if err != nil { return "" } v.configFile = cf return v.getConfigFile() } func (v *Viper) searchInPath(in string) (filename string) { jww.DEBUG.Println("Searching for config in ", in) for _, ext := range SupportedExts { jww.DEBUG.Println("Checking for", filepath.Join(in, v.configName+"."+ext)) if b, _ := exists(filepath.Join(in, v.configName+"."+ext)); b { jww.DEBUG.Println("Found: ", filepath.Join(in, v.configName+"."+ext)) return filepath.Join(in, v.configName+"."+ext) } } return "" } // search all configPaths for any config file. // Returns the first path that exists (and is a config file) func (v *Viper) findConfigFile() (string, error) { jww.INFO.Println("Searching for config in ", v.configPaths) for _, cp := range v.configPaths { file := v.searchInPath(cp) if file != "" { return file, nil } } return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)} } // Prints all configuration registries for debugging // purposes. func Debug() { v.Debug() } func (v *Viper) Debug() { fmt.Println("Aliases:") pretty.Println(v.aliases) fmt.Println("Override:") pretty.Println(v.override) fmt.Println("PFlags") pretty.Println(v.pflags) fmt.Println("Env:") pretty.Println(v.env) fmt.Println("Key/Value Store:") pretty.Println(v.kvstore) fmt.Println("Config:") pretty.Println(v.config) fmt.Println("Defaults:") pretty.Println(v.defaults) } ================================================ FILE: tests/runner.rs ================================================ #[macro_use] extern crate log; extern crate rgo; extern crate convenience as cnv; extern crate env_logger; extern crate colored; use colored::*; use std::fs; use std::path::{Path, PathBuf}; use std::env; fn flush() { use std::io::Write; ::std::io::stdout().flush().unwrap(); } fn test_path>(path: P) -> PathBuf { let mut new = PathBuf::from(env!("CARGO_MANIFEST_DIR")); new.push("tests"); new.push("data"); new.push(path); new } fn for_all_in, F: Fn(String) -> U, U>(path: P, f: F) { let entries = fs::read_dir(test_path(path)).unwrap(); for entry in entries { let path = entry.unwrap().path(); let src = cnv::read_file(&path).unwrap(); debug!("processing {}", path.display()); f(src); } } fn main() { env::set_var("RUST_LOG", env::var("LOG").unwrap_or("info".into())); env::set_var("RUST_BACKTRACE", "1"); env_logger::init().unwrap(); lexing_does_not_panic(); parsing_does_not_panic(); } fn lexing_does_not_panic() { print!("making sure lexing doesn't panic... "); flush(); for_all_in("pass", |src| { rgo::lexer::tokenize(&src); }); println!("{}", "OK.".green()); } fn parsing_does_not_panic() { print!("making sure parsing doesn't panic... "); flush(); for_all_in("pass", |src| { let tokens: Vec<_> = rgo::lexer::Lexer::new(&src).collect(); match rgo::Parser::new(tokens.clone().into_iter()).parse() { Ok(_) => {} Err(e) => { // println!("Tokens:\n{:?}", tokens); panic!("{:?}", e); } } }); println!("{}", "OK.".green()); }