mirror of https://github.com/commaai/tinygrad.git
UOp vmin/vmax on ADD (#5689)
This commit is contained in:
parent
e2e70bd90b
commit
8648fb2636
|
@ -183,7 +183,6 @@ class TestSymbolic(unittest.TestCase):
|
|||
self.helper_test_variable(Variable("a", 0, 7) // -2, -4, 0, "((((a*-1)+8)//2)+-4)")
|
||||
self.helper_test_variable(Variable("a", 0, 6) // -2, -3, 0, "((((a*-1)+6)//2)+-3)")
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_sum_div_remove(self):
|
||||
self.helper_test_variable(Node.sum([Variable("a", 0, 7), Variable("b", 0, 3)]) // 20, 0, 0, "0")
|
||||
|
||||
|
|
|
@ -112,6 +112,8 @@ class UOp:
|
|||
if self.op is UOps.ALU:
|
||||
if self.arg is UnaryOps.NEG and self.dtype != dtypes.bool and not dtypes.is_unsigned(cast(DType, self.dtype)):
|
||||
return self.const(-self.src[0].vmax.arg), self.const(-self.src[0].vmin.arg)
|
||||
if self.arg is BinaryOps.ADD:
|
||||
return self.const(self.src[0].vmin.arg+self.src[1].vmin.arg), self.const(self.src[0].vmax.arg+self.src[1].vmax.arg)
|
||||
return None, None
|
||||
|
||||
class UPat:
|
||||
|
|
Loading…
Reference in New Issue