aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/arithmetic.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/codegen/arithmetic.go')
-rw-r--r--test/codegen/arithmetic.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go
index eb0f338036..eb95416b6a 100644
--- a/test/codegen/arithmetic.go
+++ b/test/codegen/arithmetic.go
@@ -84,6 +84,30 @@ func NegAddFromConstNeg(a int) int {
return c
}
+func SubSubNegSimplify(a, b int) int {
+ // amd64:"NEGQ"
+ r := (a - b) - a
+ return r
+}
+
+func SubAddSimplify(a, b int) int {
+ // amd64:-"SUBQ",-"ADDQ"
+ r := a + (b - a)
+ return r
+}
+
+func SubAddNegSimplify(a, b int) int {
+ // amd64:"NEGQ",-"ADDQ",-"SUBQ"
+ r := a - (b + a)
+ return r
+}
+
+func AddAddSubSimplify(a, b, c int) int {
+ // amd64:-"SUBQ"
+ r := a + (b + (c - a))
+ return r
+}
+
// -------------------- //
// Multiplication //
// -------------------- //