(NOTQ (MOVQconst [c])) -> (MOVQconst [^c])
(NOTL (MOVLconst [c])) -> (MOVLconst [^c])
(BTSQconst [c] (MOVQconst [d])) -> (MOVQconst [d|(1<<uint32(c))])
-(BTSLconst [c] (MOVLconst [d])) -> (MOVLconst [d|(1<<uint32(c))])
+(BTSLconst [c] (MOVLconst [d])) -> (MOVLconst [int64(int32(d|(1<<uint32(c))))])
(BTRQconst [c] (MOVQconst [d])) -> (MOVQconst [d&^(1<<uint32(c))])
-(BTRLconst [c] (MOVLconst [d])) -> (MOVLconst [d&^(1<<uint32(c))])
+(BTRLconst [c] (MOVLconst [d])) -> (MOVLconst [int64(int32(d&^(1<<uint32(c))))])
(BTCQconst [c] (MOVQconst [d])) -> (MOVQconst [d^(1<<uint32(c))])
-(BTCLconst [c] (MOVLconst [d])) -> (MOVLconst [d^(1<<uint32(c))])
+(BTCLconst [c] (MOVLconst [d])) -> (MOVLconst [int64(int32(d^(1<<uint32(c))))])
// generic simplifications
// TODO: more of this
return true
}
// match: (BTCLconst [c] (MOVLconst [d]))
- // result: (MOVLconst [d^(1<<uint32(c))])
+ // result: (MOVLconst [int64(int32(d^(1<<uint32(c))))])
for {
c := v.AuxInt
v_0 := v.Args[0]
}
d := v_0.AuxInt
v.reset(OpAMD64MOVLconst)
- v.AuxInt = d ^ (1 << uint32(c))
+ v.AuxInt = int64(int32(d ^ (1 << uint32(c))))
return true
}
return false
return true
}
// match: (BTRLconst [c] (MOVLconst [d]))
- // result: (MOVLconst [d&^(1<<uint32(c))])
+ // result: (MOVLconst [int64(int32(d&^(1<<uint32(c))))])
for {
c := v.AuxInt
v_0 := v.Args[0]
}
d := v_0.AuxInt
v.reset(OpAMD64MOVLconst)
- v.AuxInt = d &^ (1 << uint32(c))
+ v.AuxInt = int64(int32(d &^ (1 << uint32(c))))
return true
}
return false
return true
}
// match: (BTSLconst [c] (MOVLconst [d]))
- // result: (MOVLconst [d|(1<<uint32(c))])
+ // result: (MOVLconst [int64(int32(d|(1<<uint32(c))))])
for {
c := v.AuxInt
v_0 := v.Args[0]
}
d := v_0.AuxInt
v.reset(OpAMD64MOVLconst)
- v.AuxInt = d | (1 << uint32(c))
+ v.AuxInt = int64(int32(d | (1 << uint32(c))))
return true
}
return false
--- /dev/null
+// compile -d=ssa/check/on
+
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+func f() uint32 {
+ s := "\x01"
+ x := -int32(s[0])
+ return uint32(x) & 0x7fffffff
+}