mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Add more facts after "x = y.max(a: z)"
wuffs_png_decode_19k_8bpp/clang9 95.8MB/s ± 1% 95.7MB/s ± 1% ~ (p=0.310 n=5+5) wuffs_png_decode_40k_24bpp/clang9 112MB/s ± 0% 112MB/s ± 0% +0.16% (p=0.008 n=5+5) wuffs_png_decode_77k_8bpp/clang9 358MB/s ± 0% 357MB/s ± 0% ~ (p=0.905 n=4+5) wuffs_png_decode_552k_32bpp/clang9 143MB/s ± 0% 119MB/s ± 1% -17.27% (p=0.008 n=5+5) wuffs_png_decode_4002k_24bpp/clang9 114MB/s ± 0% 114MB/s ± 0% +0.42% (p=0.008 n=5+5) wuffs_png_decode_filter_1_sub/clang9 1.02GB/s ± 0% 0.92GB/s ± 1% -9.75% (p=0.008 n=5+5) wuffs_png_decode_filter_2_up/clang9 13.5GB/s ± 0% 13.3GB/s ± 1% -1.25% (p=0.008 n=5+5) wuffs_png_decode_filter_3_average/clang9 491MB/s ± 0% 554MB/s ± 0% +12.72% (p=0.008 n=5+5) wuffs_png_decode_filter_4_paeth/clang9 75.5MB/s ± 0% 61.9MB/s ± 1% -17.95% (p=0.008 n=5+5) wuffs_png_decode_19k_8bpp/gcc10 99.4MB/s ± 0% 99.9MB/s ± 1% +0.51% (p=0.032 n=5+5) wuffs_png_decode_40k_24bpp/gcc10 116MB/s ± 0% 114MB/s ± 0% -2.27% (p=0.008 n=5+5) wuffs_png_decode_77k_8bpp/gcc10 321MB/s ± 0% 325MB/s ± 0% +1.32% (p=0.016 n=5+4) wuffs_png_decode_552k_32bpp/gcc10 159MB/s ± 0% 160MB/s ± 0% ~ (p=0.190 n=5+4) wuffs_png_decode_4002k_24bpp/gcc10 117MB/s ± 0% 117MB/s ± 0% ~ (p=0.310 n=5+5) wuffs_png_decode_filter_1_sub/gcc10 1.12GB/s ± 0% 0.98GB/s ± 0% -12.54% (p=0.008 n=5+5) wuffs_png_decode_filter_2_up/gcc10 11.3GB/s ± 0% 11.5GB/s ± 1% +2.08% (p=0.016 n=4+5) wuffs_png_decode_filter_3_average/gcc10 644MB/s ± 0% 644MB/s ± 0% ~ (p=0.151 n=5+5) wuffs_png_decode_filter_4_paeth/gcc10 83.8MB/s ± 0% 84.3MB/s ± 1% ~ (p=0.095 n=5+5)
This commit is contained in:
1 parent
a98739bf90
commit
b7b39e34d8
4 files changed
+81
-9
No files matched your search
@@ -793,6 +793,10 @@ func (n *TypeExpr) IsArrayType() bool {
|
||||
return n.id0 == t.IDArray
|
||||
}
|
||||
|
||||
func (n *TypeExpr) IsFuncType() bool {
|
||||
return n.id0 == t.IDFunc
|
||||
}
|
||||
|
||||
func (n *TypeExpr) IsPointerType() bool {
|
||||
return n.id0 == t.IDNptr || n.id0 == t.IDPtr
|
||||
}
|
||||
|
||||
@@ -447,6 +447,17 @@ func (q *checker) bcheckAssignment(lhs *a.Expr, op t.ID, rhs *a.Expr) error {
|
||||
|
||||
if lhs.MType().IsNumType() && rhs.Effect().Pure() {
|
||||
q.facts.appendBinaryOpFact(t.IDXBinaryEqEq, lhs, rhs)
|
||||
|
||||
if rhs.Operator() == t.IDOpenParen {
|
||||
if lTyp := rhs.LHS().AsExpr().MType(); lTyp.IsFuncType() && lTyp.Receiver().IsNumType() {
|
||||
switch fn := lTyp.FuncName(); fn {
|
||||
case t.IDMax, t.IDMin:
|
||||
if err := q.bcheckAssignmentMaxMin(lhs, fn, rhs); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -541,6 +552,36 @@ func (q *checker) bcheckAssignment1(lhs *a.Expr, lTyp *a.TypeExpr, op t.ID, rhs
|
||||
return rb, nil
|
||||
}
|
||||
|
||||
func (q *checker) bcheckAssignmentMaxMin(lhs *a.Expr, funcName t.ID, rhs *a.Expr) error {
|
||||
if len(rhs.Args()) != 1 {
|
||||
return fmt.Errorf("check: internal error: max/min has unexpected arguments")
|
||||
}
|
||||
op := t.ID(0)
|
||||
switch funcName {
|
||||
case t.IDMax:
|
||||
op = t.IDXBinaryGreaterEq
|
||||
case t.IDMin:
|
||||
op = t.IDXBinaryLessEq
|
||||
default:
|
||||
return fmt.Errorf("check: internal error: max/min has unexpected function name")
|
||||
}
|
||||
|
||||
operands := [2]*a.Expr{
|
||||
rhs.LHS().AsExpr().LHS().AsExpr(),
|
||||
rhs.Args()[0].AsArg().Value(),
|
||||
}
|
||||
for _, operand := range operands {
|
||||
if operand.Mentions(lhs) {
|
||||
continue
|
||||
}
|
||||
o := a.NewExpr(0, op, 0, lhs.AsNode(), nil, operand.AsNode(), nil)
|
||||
o.SetMBounds(bounds{zero, one})
|
||||
o.SetMType(typeExprBool)
|
||||
q.facts.appendFact(o)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func snapshot(facts []*a.Expr) []*a.Expr {
|
||||
return append([]*a.Expr(nil), facts...)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user