File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -2219,6 +2219,36 @@ def f(n):
22192219 self .assertNotIn ("_LOAD_ATTR_METHOD_NO_DICT" , uops )
22202220 self .assertNotIn ("_LOAD_ATTR_METHOD_LAZY_DICT" , uops )
22212221
2222+ def test_unary_invert_long_type (self ):
2223+ def testfunc (n ):
2224+ for _ in range (n ):
2225+ a = 9397
2226+ x = ~ a + ~ a
2227+
2228+ testfunc (TIER2_THRESHOLD )
2229+
2230+ ex = get_first_executor (testfunc )
2231+ self .assertIsNotNone (ex )
2232+ uops = get_opnames (ex )
2233+
2234+ self .assertNotIn ("_GUARD_TOS_INT" , uops )
2235+ self .assertNotIn ("_GUARD_NOS_INT" , uops )
2236+
2237+ def test_unary_invert_replace (self ):
2238+ def testfunc (n ):
2239+ for _ in range (n ):
2240+ a = - 1
2241+ a = ~ a
2242+
2243+ testfunc (TIER2_THRESHOLD )
2244+
2245+ ex = get_first_executor (testfunc )
2246+ self .assertIsNotNone (ex )
2247+ uops = get_opnames (ex )
2248+
2249+ self .assertNotIn ("_UNARY_INVERT" , uops )
2250+ self .assertIn ("_LOAD_CONST_INLINE_BORROW" , uops )
2251+
22222252
22232253def global_identity (x ):
22242254 return x
You can’t perform that action at this time.
0 commit comments