(CSNEG [cc] x y (InvertFlags cmp)) => (CSNEG [arm64Invert(cc)] x y cmp)
// absorb flag constants into boolean values
-(Equal (FlagConstant [fc])) => (MOVDconst [b2i(fc.eq())])
-(NotEqual (FlagConstant [fc])) => (MOVDconst [b2i(fc.ne())])
-(LessThan (FlagConstant [fc])) => (MOVDconst [b2i(fc.lt())])
-(LessThanU (FlagConstant [fc])) => (MOVDconst [b2i(fc.ult())])
-(LessEqual (FlagConstant [fc])) => (MOVDconst [b2i(fc.le())])
-(LessEqualU (FlagConstant [fc])) => (MOVDconst [b2i(fc.ule())])
-(GreaterThan (FlagConstant [fc])) => (MOVDconst [b2i(fc.gt())])
-(GreaterThanU (FlagConstant [fc])) => (MOVDconst [b2i(fc.ugt())])
-(GreaterEqual (FlagConstant [fc])) => (MOVDconst [b2i(fc.ge())])
-(GreaterEqualU (FlagConstant [fc])) => (MOVDconst [b2i(fc.uge())])
+(Equal (FlagConstant [fc])) => (MOVDconst [b2i(fc.eq())])
+(NotEqual (FlagConstant [fc])) => (MOVDconst [b2i(fc.ne())])
+(LessThan (FlagConstant [fc])) => (MOVDconst [b2i(fc.lt())])
+(LessThanU (FlagConstant [fc])) => (MOVDconst [b2i(fc.ult())])
+(LessEqual (FlagConstant [fc])) => (MOVDconst [b2i(fc.le())])
+(LessEqualU (FlagConstant [fc])) => (MOVDconst [b2i(fc.ule())])
+(GreaterThan (FlagConstant [fc])) => (MOVDconst [b2i(fc.gt())])
+(GreaterThanU (FlagConstant [fc])) => (MOVDconst [b2i(fc.ugt())])
+(GreaterEqual (FlagConstant [fc])) => (MOVDconst [b2i(fc.ge())])
+(GreaterEqualU (FlagConstant [fc])) => (MOVDconst [b2i(fc.uge())])
+(LessThanNoov (FlagConstant [fc])) => (MOVDconst [b2i(fc.ltNoov())])
+(GreaterEqualNoov (FlagConstant [fc])) => (MOVDconst [b2i(fc.geNoov())])
// absorb InvertFlags into boolean values
(Equal (InvertFlags x)) => (Equal x)
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
+ // match: (GreaterEqualNoov (FlagConstant [fc]))
+ // result: (MOVDconst [b2i(fc.geNoov())])
+ for {
+ if v_0.Op != OpARM64FlagConstant {
+ break
+ }
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ v.reset(OpARM64MOVDconst)
+ v.AuxInt = int64ToAuxInt(b2i(fc.geNoov()))
+ return true
+ }
// match: (GreaterEqualNoov (InvertFlags x))
// result: (CSINC [OpARM64NotEqual] (LessThanNoov <typ.Bool> x) (MOVDconst [0]) x)
for {
v_0 := v.Args[0]
b := v.Block
typ := &b.Func.Config.Types
+ // match: (LessThanNoov (FlagConstant [fc]))
+ // result: (MOVDconst [b2i(fc.ltNoov())])
+ for {
+ if v_0.Op != OpARM64FlagConstant {
+ break
+ }
+ fc := auxIntToFlagConstant(v_0.AuxInt)
+ v.reset(OpARM64MOVDconst)
+ v.AuxInt = int64ToAuxInt(b2i(fc.ltNoov()))
+ return true
+ }
// match: (LessThanNoov (InvertFlags x))
// result: (CSEL0 [OpARM64NotEqual] (GreaterEqualNoov <typ.Bool> x) x)
for {
--- /dev/null
+// build
+
+// Copyright 2025 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
+
+var g bool
+
+func main() {
+ l_4 := uint32(0x6E54EE87)
+ v4 := int8(-Int64FromInt64(1))
+ g = int32(v4) >= safe_mod_func_int32_t_s_s(BoolInt32(l_4 >= 1), 7)
+}
+
+func safe_mod_func_int32_t_s_s(si1 int32, si2 int32) (r int32) {
+ var v1 int32
+ if si2 == 0 {
+ v1 = si1
+ } else {
+ v1 = si1 % si2
+ }
+ return v1
+}
+
+func Int64FromInt64(n int64) int64 {
+ return n
+}
+
+func BoolInt32(b bool) int32 {
+ if b {
+ return 1
+ }
+ return 0
+}