// Boolean ops; 0=false, 1=true
(AndB ...) => (AND ...)
(OrB ...) => (OR ...)
-(EqB x y) => (XORI [1] (XOR <typ.Bool> x y))
+(EqB x y) => (SEQZ (XOR <typ.Bool> x y))
(NeqB ...) => (XOR ...)
-(Not x) => (XORI [1] x)
+(Not ...) => (SEQZ ...)
// Lowering pointer arithmetic
// TODO: Special handling for SP offsets, like ARM
v.Op = OpRISCV64LoweredNilCheck
return true
case OpNot:
- return rewriteValueRISCV64_OpNot(v)
+ v.Op = OpRISCV64SEQZ
+ return true
case OpOffPtr:
return rewriteValueRISCV64_OpOffPtr(v)
case OpOr16:
b := v.Block
typ := &b.Func.Config.Types
// match: (EqB x y)
- // result: (XORI [1] (XOR <typ.Bool> x y))
+ // result: (SEQZ (XOR <typ.Bool> x y))
for {
x := v_0
y := v_1
- v.reset(OpRISCV64XORI)
- v.AuxInt = int64ToAuxInt(1)
+ v.reset(OpRISCV64SEQZ)
v0 := b.NewValue0(v.Pos, OpRISCV64XOR, typ.Bool)
v0.AddArg2(x, y)
v.AddArg(v0)
return true
}
}
-func rewriteValueRISCV64_OpNot(v *Value) bool {
- v_0 := v.Args[0]
- // match: (Not x)
- // result: (XORI [1] x)
- for {
- x := v_0
- v.reset(OpRISCV64XORI)
- v.AuxInt = int64ToAuxInt(1)
- v.AddArg(x)
- return true
- }
-}
func rewriteValueRISCV64_OpOffPtr(v *Value) bool {
v_0 := v.Args[0]
b := v.Block