File tree 2 files changed +24
-0
lines changed
src/cmd/compile/internal/x86 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ func ssaGenValue387(s *gc.SSAGenState, v *ssa.Value) {
46
46
case ssa .Op386MOVSSloadidx1 , ssa .Op386MOVSDloadidx1 :
47
47
p .From .Scale = 1
48
48
p .From .Index = v .Args [1 ].Reg ()
49
+ if p .From .Index == x86 .REG_SP {
50
+ p .From .Reg , p .From .Index = p .From .Index , p .From .Reg
51
+ }
49
52
case ssa .Op386MOVSSloadidx4 :
50
53
p .From .Scale = 4
51
54
p .From .Index = v .Args [1 ].Reg ()
@@ -95,6 +98,9 @@ func ssaGenValue387(s *gc.SSAGenState, v *ssa.Value) {
95
98
case ssa .Op386MOVSSstoreidx1 , ssa .Op386MOVSDstoreidx1 :
96
99
p .To .Scale = 1
97
100
p .To .Index = v .Args [1 ].Reg ()
101
+ if p .To .Index == x86 .REG_SP {
102
+ p .To .Reg , p .To .Index = p .To .Index , p .To .Reg
103
+ }
98
104
case ssa .Op386MOVSSstoreidx4 :
99
105
p .To .Scale = 4
100
106
p .To .Index = v .Args [1 ].Reg ()
Original file line number Diff line number Diff line change
1
+ // compile
2
+
3
+ // Copyright 2017 The Go Authors. All rights reserved.
4
+ // Use of this source code is governed by a BSD-style
5
+ // license that can be found in the LICENSE file.
6
+
7
+ // Make sure SSA->assembly pass can handle SP as an index register.
8
+
9
+ package p
10
+
11
+ type T struct {
12
+ a ,b ,c ,d float32
13
+ }
14
+
15
+ func f (a * [8 ]T , i ,j ,k int ) float32 {
16
+ b := * a
17
+ return b [i ].a + b [j ].b + b [k ].c
18
+ }
You can’t perform that action at this time.
0 commit comments