aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/rewriteAMD64.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2020-04-12 20:05:14 -0700
committerKeith Randall <khr@golang.org>2020-04-13 15:41:40 +0000
commit1e820a3432029355402aeeaf769b9a4e46eb46aa (patch)
tree1747a67dbb270f2cc2f5903e40c2eaf6c168346c /src/cmd/compile/internal/ssa/rewriteAMD64.go
parentdc9879e8fde3af804ac310ee54cf67efdae26aab (diff)
downloadgo-1e820a3432029355402aeeaf769b9a4e46eb46aa.tar.gz
go-1e820a3432029355402aeeaf769b9a4e46eb46aa.zip
cmd/compile: ensure ... rules have compatible aux and auxint types
Otherwise, just copying the aux and auxint fields doesn't make much sense. (Although there's no bug - it just means it isn't typechecked correctly.) Change-Id: I4e21ac67f0c7bfd04ed5af1713cd24bca08af092 Reviewed-on: https://go-review.googlesource.com/c/go/+/227962 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewriteAMD64.go')
-rw-r--r--src/cmd/compile/internal/ssa/rewriteAMD64.go51
1 files changed, 43 insertions, 8 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go
index f4f83597eb..df36e41d2d 100644
--- a/src/cmd/compile/internal/ssa/rewriteAMD64.go
+++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go
@@ -646,8 +646,7 @@ func rewriteValueAMD64(v *Value) bool {
case OpCondSelect:
return rewriteValueAMD64_OpCondSelect(v)
case OpConst16:
- v.Op = OpAMD64MOVLconst
- return true
+ return rewriteValueAMD64_OpConst16(v)
case OpConst32:
v.Op = OpAMD64MOVLconst
return true
@@ -661,14 +660,11 @@ func rewriteValueAMD64(v *Value) bool {
v.Op = OpAMD64MOVSDconst
return true
case OpConst8:
- v.Op = OpAMD64MOVLconst
- return true
+ return rewriteValueAMD64_OpConst8(v)
case OpConstBool:
- v.Op = OpAMD64MOVLconst
- return true
+ return rewriteValueAMD64_OpConstBool(v)
case OpConstNil:
- v.Op = OpAMD64MOVQconst
- return true
+ return rewriteValueAMD64_OpConstNil(v)
case OpCtz16:
return rewriteValueAMD64_OpCtz16(v)
case OpCtz16NonZero:
@@ -29457,6 +29453,45 @@ func rewriteValueAMD64_OpCondSelect(v *Value) bool {
}
return false
}
+func rewriteValueAMD64_OpConst16(v *Value) bool {
+ // match: (Const16 [c])
+ // result: (MOVLconst [int32(c)])
+ for {
+ c := auxIntToInt16(v.AuxInt)
+ v.reset(OpAMD64MOVLconst)
+ v.AuxInt = int32ToAuxInt(int32(c))
+ return true
+ }
+}
+func rewriteValueAMD64_OpConst8(v *Value) bool {
+ // match: (Const8 [c])
+ // result: (MOVLconst [int32(c)])
+ for {
+ c := auxIntToInt8(v.AuxInt)
+ v.reset(OpAMD64MOVLconst)
+ v.AuxInt = int32ToAuxInt(int32(c))
+ return true
+ }
+}
+func rewriteValueAMD64_OpConstBool(v *Value) bool {
+ // match: (ConstBool [c])
+ // result: (MOVLconst [int32(b2i(c))])
+ for {
+ c := auxIntToBool(v.AuxInt)
+ v.reset(OpAMD64MOVLconst)
+ v.AuxInt = int32ToAuxInt(int32(b2i(c)))
+ return true
+ }
+}
+func rewriteValueAMD64_OpConstNil(v *Value) bool {
+ // match: (ConstNil )
+ // result: (MOVQconst [0])
+ for {
+ v.reset(OpAMD64MOVQconst)
+ v.AuxInt = int64ToAuxInt(0)
+ return true
+ }
+}
func rewriteValueAMD64_OpCtz16(v *Value) bool {
v_0 := v.Args[0]
b := v.Block