(RSBconst [c] (SUBconst [d] x)) -> (RSBconst [int64(int32(c+d))] x)
(RSCconst [c] (ADDconst [d] x) flags) -> (RSCconst [int64(int32(c-d))] x flags)
(RSCconst [c] (SUBconst [d] x) flags) -> (RSCconst [int64(int32(c+d))] x flags)
-(SLLconst [c] (MOVWconst [d])) -> (MOVWconst [int64(uint32(d)<<uint64(c))])
-(SRLconst [c] (MOVWconst [d])) -> (MOVWconst [int64(uint32(d)>>uint64(c))])
+(SLLconst [c] (MOVWconst [d])) -> (MOVWconst [int64(int32(uint32(d)<<uint64(c)))])
+(SRLconst [c] (MOVWconst [d])) -> (MOVWconst [int64(int32(uint32(d)>>uint64(c)))])
(SRAconst [c] (MOVWconst [d])) -> (MOVWconst [int64(int32(d)>>uint64(c))])
(MUL (MOVWconst [c]) (MOVWconst [d])) -> (MOVWconst [int64(int32(c*d))])
(MULA (MOVWconst [c]) (MOVWconst [d]) a) -> (ADDconst [int64(int32(c*d))] a)
(MULS (MOVWconst [c]) (MOVWconst [d]) a) -> (SUBconst [int64(int32(c*d))] a)
-(Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(uint32(c)/uint32(d))])
-(Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(uint32(c)%uint32(d))])
+(Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(int32(uint32(c)/uint32(d)))])
+(Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) -> (MOVWconst [int64(int32(uint32(c)%uint32(d)))])
(ANDconst [c] (MOVWconst [d])) -> (MOVWconst [c&d])
(ANDconst [c] (ANDconst [d] x)) -> (ANDconst [c&d] x)
(ORconst [c] (MOVWconst [d])) -> (MOVWconst [c|d])
(MOVWreg (MOVWconst [c])) -> (MOVWconst [c])
// BFX: Width = c >> 8, LSB = c & 0xff, result = d << (32 - Width - LSB) >> (32 - Width)
(BFX [c] (MOVWconst [d])) -> (MOVWconst [int64(int32(d)<<(32-uint32(c&0xff)-uint32(c>>8))>>(32-uint32(c>>8)))])
-(BFXU [c] (MOVWconst [d])) -> (MOVWconst [int64(uint32(d)<<(32-uint32(c&0xff)-uint32(c>>8))>>(32-uint32(c>>8)))])
+(BFXU [c] (MOVWconst [d])) -> (MOVWconst [int64(int32(uint32(d)<<(32-uint32(c&0xff)-uint32(c>>8))>>(32-uint32(c>>8))))])
// absorb shifts into ops
(ADD x (SLLconst [c] y)) -> (ADDshiftLL x y [c])
func rewriteValueARM_OpARMBFXU_0(v *Value) bool {
// match: (BFXU [c] (MOVWconst [d]))
// cond:
- // result: (MOVWconst [int64(uint32(d)<<(32-uint32(c&0xff)-uint32(c>>8))>>(32-uint32(c>>8)))])
+ // result: (MOVWconst [int64(int32(uint32(d)<<(32-uint32(c&0xff)-uint32(c>>8))>>(32-uint32(c>>8))))])
for {
c := v.AuxInt
v_0 := v.Args[0]
}
d := v_0.AuxInt
v.reset(OpARMMOVWconst)
- v.AuxInt = int64(uint32(d) << (32 - uint32(c&0xff) - uint32(c>>8)) >> (32 - uint32(c>>8)))
+ v.AuxInt = int64(int32(uint32(d) << (32 - uint32(c&0xff) - uint32(c>>8)) >> (32 - uint32(c>>8))))
return true
}
return false
func rewriteValueARM_OpARMSLLconst_0(v *Value) bool {
// match: (SLLconst [c] (MOVWconst [d]))
// cond:
- // result: (MOVWconst [int64(uint32(d)<<uint64(c))])
+ // result: (MOVWconst [int64(int32(uint32(d)<<uint64(c)))])
for {
c := v.AuxInt
v_0 := v.Args[0]
}
d := v_0.AuxInt
v.reset(OpARMMOVWconst)
- v.AuxInt = int64(uint32(d) << uint64(c))
+ v.AuxInt = int64(int32(uint32(d) << uint64(c)))
return true
}
return false
func rewriteValueARM_OpARMSRLconst_0(v *Value) bool {
// match: (SRLconst [c] (MOVWconst [d]))
// cond:
- // result: (MOVWconst [int64(uint32(d)>>uint64(c))])
+ // result: (MOVWconst [int64(int32(uint32(d)>>uint64(c)))])
for {
c := v.AuxInt
v_0 := v.Args[0]
}
d := v_0.AuxInt
v.reset(OpARMMOVWconst)
- v.AuxInt = int64(uint32(d) >> uint64(c))
+ v.AuxInt = int64(int32(uint32(d) >> uint64(c)))
return true
}
// match: (SRLconst (SLLconst x [c]) [d])
}
// match: (Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d])))
// cond:
- // result: (MOVWconst [int64(uint32(c)/uint32(d))])
+ // result: (MOVWconst [int64(int32(uint32(c)/uint32(d)))])
for {
v_0 := v.Args[0]
if v_0.Op != OpARMCALLudiv {
}
d := v_0_1.AuxInt
v.reset(OpARMMOVWconst)
- v.AuxInt = int64(uint32(c) / uint32(d))
+ v.AuxInt = int64(int32(uint32(c) / uint32(d)))
return true
}
return false
}
// match: (Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d])))
// cond:
- // result: (MOVWconst [int64(uint32(c)%uint32(d))])
+ // result: (MOVWconst [int64(int32(uint32(c)%uint32(d)))])
for {
v_0 := v.Args[0]
if v_0.Op != OpARMCALLudiv {
}
d := v_0_1.AuxInt
v.reset(OpARMMOVWconst)
- v.AuxInt = int64(uint32(c) % uint32(d))
+ v.AuxInt = int64(int32(uint32(c) % uint32(d)))
return true
}
return false
--- /dev/null
+// compile -d=ssa/check/on
+
+// Copyright 2018 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.
+
+// Issue 25993: SSA check fails on ARM.
+
+package p
+
+func f() {
+ var x int
+ var B0 bool
+ B0 = !B0 || B0
+ if B0 && B0 {
+ x = -1
+ }
+ var AI []int
+ var AB []bool
+ _ = AI[x] > 0 && AB[x]
+}