From 3adbdb6d9931276894c5e2524f5ca8ca26bfeab5 Mon Sep 17 00:00:00 2001
From: Keith Randall <khr@golang.org>
Date: Sun, 22 Mar 2020 13:27:02 -0700
Subject: [PATCH] cmd/compile: disable mem+op operations on 386

Rolling back portions of CL 222782 to see if that helps
issue #37881 any.

Update #37881

Change-Id: I9cc3ff8c469fa5e4b22daec715d04148033f46f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/224837
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
---
 .../compile/internal/ssa/addressingmodes.go   | 37 +++++++++---------
 test/codegen/arithmetic.go                    |  4 --
 test/codegen/memops.go                        | 39 -------------------
 3 files changed, 19 insertions(+), 61 deletions(-)

diff --git a/src/cmd/compile/internal/ssa/addressingmodes.go b/src/cmd/compile/internal/ssa/addressingmodes.go
index 2af8a4d1fc1..77d14dcfb87 100644
--- a/src/cmd/compile/internal/ssa/addressingmodes.go
+++ b/src/cmd/compile/internal/ssa/addressingmodes.go
@@ -204,22 +204,23 @@ var combine = map[[2]Op]Op{
 	[2]Op{Op386MOVWstoreconst, Op386LEAL2}: Op386MOVWstoreconstidx2,
 	[2]Op{Op386MOVLstoreconst, Op386LEAL1}: Op386MOVLstoreconstidx1,
 	[2]Op{Op386MOVLstoreconst, Op386LEAL4}: Op386MOVLstoreconstidx4,
-
-	[2]Op{Op386ADDLload, Op386LEAL4}: Op386ADDLloadidx4,
-	[2]Op{Op386SUBLload, Op386LEAL4}: Op386SUBLloadidx4,
-	[2]Op{Op386MULLload, Op386LEAL4}: Op386MULLloadidx4,
-	[2]Op{Op386ANDLload, Op386LEAL4}: Op386ANDLloadidx4,
-	[2]Op{Op386ORLload, Op386LEAL4}:  Op386ORLloadidx4,
-	[2]Op{Op386XORLload, Op386LEAL4}: Op386XORLloadidx4,
-
-	[2]Op{Op386ADDLmodify, Op386LEAL4}: Op386ADDLmodifyidx4,
-	[2]Op{Op386SUBLmodify, Op386LEAL4}: Op386SUBLmodifyidx4,
-	[2]Op{Op386ANDLmodify, Op386LEAL4}: Op386ANDLmodifyidx4,
-	[2]Op{Op386ORLmodify, Op386LEAL4}:  Op386ORLmodifyidx4,
-	[2]Op{Op386XORLmodify, Op386LEAL4}: Op386XORLmodifyidx4,
-
-	[2]Op{Op386ADDLconstmodify, Op386LEAL4}: Op386ADDLconstmodifyidx4,
-	[2]Op{Op386ANDLconstmodify, Op386LEAL4}: Op386ANDLconstmodifyidx4,
-	[2]Op{Op386ORLconstmodify, Op386LEAL4}:  Op386ORLconstmodifyidx4,
-	[2]Op{Op386XORLconstmodify, Op386LEAL4}: Op386XORLconstmodifyidx4,
+	/*
+		[2]Op{Op386ADDLload, Op386LEAL4}: Op386ADDLloadidx4,
+		[2]Op{Op386SUBLload, Op386LEAL4}: Op386SUBLloadidx4,
+		[2]Op{Op386MULLload, Op386LEAL4}: Op386MULLloadidx4,
+		[2]Op{Op386ANDLload, Op386LEAL4}: Op386ANDLloadidx4,
+		[2]Op{Op386ORLload, Op386LEAL4}:  Op386ORLloadidx4,
+		[2]Op{Op386XORLload, Op386LEAL4}: Op386XORLloadidx4,
+
+		[2]Op{Op386ADDLmodify, Op386LEAL4}: Op386ADDLmodifyidx4,
+		[2]Op{Op386SUBLmodify, Op386LEAL4}: Op386SUBLmodifyidx4,
+		[2]Op{Op386ANDLmodify, Op386LEAL4}: Op386ANDLmodifyidx4,
+		[2]Op{Op386ORLmodify, Op386LEAL4}:  Op386ORLmodifyidx4,
+		[2]Op{Op386XORLmodify, Op386LEAL4}: Op386XORLmodifyidx4,
+
+		[2]Op{Op386ADDLconstmodify, Op386LEAL4}: Op386ADDLconstmodifyidx4,
+		[2]Op{Op386ANDLconstmodify, Op386LEAL4}: Op386ANDLconstmodifyidx4,
+		[2]Op{Op386ORLconstmodify, Op386LEAL4}:  Op386ORLconstmodifyidx4,
+		[2]Op{Op386XORLconstmodify, Op386LEAL4}: Op386XORLconstmodifyidx4,
+	*/
 }
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go
index a076664e8e3..85dec5e0fca 100644
--- a/test/codegen/arithmetic.go
+++ b/test/codegen/arithmetic.go
@@ -27,13 +27,9 @@ func SubMem(arr []int, b, c, d int) int {
 	arr[4]--
 	// 386:`ADDL\s[$]-20,\s20\([A-Z]+\)`
 	arr[5] -= 20
-	// 386:`SUBL\s\([A-Z]+\)\([A-Z]+\*4\),\s[A-Z]+`
 	ef -= arr[b]
-	// 386:`SUBL\s[A-Z]+,\s\([A-Z]+\)\([A-Z]+\*4\)`
 	arr[c] -= b
-	// 386:`ADDL\s[$]-15,\s\([A-Z]+\)\([A-Z]+\*4\)`
 	arr[d] -= 15
-	// 386:`DECL\s\([A-Z]+\)\([A-Z]+\*4\)`
 	arr[b]--
 	// amd64:`DECQ\s64\([A-Z]+\)`
 	arr[8]--
diff --git a/test/codegen/memops.go b/test/codegen/memops.go
index 0df191480d0..e393e5684fd 100644
--- a/test/codegen/memops.go
+++ b/test/codegen/memops.go
@@ -204,42 +204,3 @@ func idxFloat64(x, y []float64, i int) {
 	// 386/sse2: `MOVSD\tX[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\)`
 	y[16*i+1] = t
 }
-
-func idxLoadPlusOp(x []int32, i int) int32 {
-	s := x[0]
-	// 386: `ADDL\t4\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
-	s += x[i+1]
-	// 386: `SUBL\t8\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
-	s -= x[i+2]
-	// 386: `IMULL\t12\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
-	s *= x[i+3]
-	// 386: `ANDL\t16\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
-	s &= x[i+4]
-	// 386: `ORL\t20\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
-	s |= x[i+5]
-	// 386: `XORL\t24\([A-Z]+\)\([A-Z]+\*4\), [A-Z]+`
-	s ^= x[i+6]
-	return s
-}
-
-func idxStorePlusOp(x []int32, i int, v int32) {
-	// 386: `ADDL\t[A-Z]+, 4\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+1] += v
-	// 386: `SUBL\t[A-Z]+, 8\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+2] -= v
-	// 386: `ANDL\t[A-Z]+, 12\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+3] &= v
-	// 386: `ORL\t[A-Z]+, 16\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+4] |= v
-	// 386: `XORL\t[A-Z]+, 20\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+5] ^= v
-
-	// 386: `ADDL\t[$]77, 24\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+6] += 77
-	// 386: `ANDL\t[$]77, 28\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+7] &= 77
-	// 386: `ORL\t[$]77, 32\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+8] |= 77
-	// 386: `XORL\t[$]77, 36\([A-Z]+\)\([A-Z]+\*4\)`
-	x[i+9] ^= 77
-}
-- 
GitLab