MCPcopy Index your code
hub / github.com/python/mypy / test_branch_rare

Method test_branch_rare

mypyc/test/test_emitfunc.py:260–281  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

258 self.assert_emit(b, """if (cpy_r_b == 2) goto CPyL9;""", next_block=next_block)
259
260 def test_branch_rare(self) -> None:
261 self.assert_emit(
262 Branch(self.b, BasicBlock(8), BasicBlock(9), Branch.BOOL, rare=True),
263 """if (unlikely(cpy_r_b)) {
264 goto CPyL8;
265 } else
266 goto CPyL9;
267 """,
268 )
269 next_block = BasicBlock(9)
270 self.assert_emit(
271 Branch(self.b, BasicBlock(8), next_block, Branch.BOOL, rare=True),
272 """if (unlikely(cpy_r_b)) goto CPyL8;""",
273 next_block=next_block,
274 )
275 next_block = BasicBlock(8)
276 b = Branch(self.b, next_block, BasicBlock(9), Branch.BOOL, rare=True)
277 self.assert_emit(b, """if (likely(!cpy_r_b)) goto CPyL9;""", next_block=next_block)
278 next_block = BasicBlock(8)
279 b = Branch(self.b, next_block, BasicBlock(9), Branch.BOOL, rare=True)
280 b.negated = True
281 self.assert_emit(b, """if (likely(cpy_r_b)) goto CPyL9;""", next_block=next_block)
282
283 def test_call(self) -> None:
284 decl = FuncDecl(

Callers

nothing calls this directly

Calls 3

assert_emitMethod · 0.95
BranchClass · 0.90
BasicBlockClass · 0.90

Tested by

no test coverage detected