]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix merging of s390x conditional moves into branch conditions
authorMichael Munday <munday@ca.ibm.com>
Tue, 21 Feb 2017 20:20:38 +0000 (15:20 -0500)
committerMichael Munday <munday@ca.ibm.com>
Tue, 28 Feb 2017 02:57:23 +0000 (02:57 +0000)
commit4dbcb53d0b5842d4db5735f9a67935405aa84eab
tree912b15c5ef2bcc25cbe603376b6f4c2d8d329656
parent1b31c9ff679c98deccd06477ec48fc190bd5ca53
cmd/compile: fix merging of s390x conditional moves into branch conditions

A type conversion inserted between MOVD{LT,LE,GT,GE,EQ,NE} and CMPWconst
by CL 36256 broke the rewrite rule designed to merge the two.
This results in simple for loops (e.g. for i := 0; i < N; i++ {})
emitting two comparisons instead of one, plus a conditional move.

This CL explicitly types the input to CMPWconst so that the type conversion
can be omitted. It also adds a test to check that conditional moves aren't
emitted for loops with 'less than' conditions (i.e. i < N) on s390x.

Fixes #19227.

Change-Id: Ia39e806ed723791c3c755951aef23f957828ea3e
Reviewed-on: https://go-review.googlesource.com/37334
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/gen/S390X.rules
src/cmd/compile/internal/ssa/loop_test.go [new file with mode: 0644]
src/cmd/compile/internal/ssa/rewriteS390X.go