Lines Matching full:check
234 * Helper to check if a given instruction is a conditional branch
266 /* Check we can represent the target in the instruction format */ in create_branch()
285 /* Check we can represent the target in the instruction format */ in create_cond_branch()
413 #define check(x) \ macro
425 check(instr_is_branch_iform(ppc_inst(0x48000000))); in test_branch_iform()
427 check(instr_is_branch_iform(ppc_inst(0x4bffffff))); in test_branch_iform()
429 check(!instr_is_branch_iform(ppc_inst(0xcbffffff))); in test_branch_iform()
431 check(!instr_is_branch_iform(ppc_inst(0x7bffffff))); in test_branch_iform()
434 check(instr_is_branch_iform(ppc_inst(0x48000001))); in test_branch_iform()
436 check(instr_is_branch_iform(ppc_inst(0x4bfffffd))); in test_branch_iform()
438 check(instr_is_branch_iform(ppc_inst(0x4bff00fd))); in test_branch_iform()
440 check(!instr_is_branch_iform(ppc_inst(0x7bfffffd))); in test_branch_iform()
444 check(instr_is_branch_to_addr(&instr, 0x100)); in test_branch_iform()
447 check(instr_is_branch_to_addr(&instr, 0x420fc)); in test_branch_iform()
450 check(instr_is_branch_to_addr(&instr, addr + 0x1FFFFFC)); in test_branch_iform()
453 check(instr_is_branch_to_addr(&instr, addr - 4)); in test_branch_iform()
456 check(instr_is_branch_to_addr(&instr, addr - 0x2000000)); in test_branch_iform()
460 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_iform()
464 check(instr_is_branch_to_addr(&instr, addr - 0x100)); in test_branch_iform()
468 check(instr_is_branch_to_addr(&instr, addr + 0x100)); in test_branch_iform()
472 check(instr_is_branch_to_addr(&instr, addr - 0x2000000)); in test_branch_iform()
476 check(err); in test_branch_iform()
480 check(err); in test_branch_iform()
484 check(err); in test_branch_iform()
486 /* Check flags are masked correctly */ in test_branch_iform()
488 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_iform()
489 check(ppc_inst_equal(instr, ppc_inst(0x48000000))); in test_branch_iform()
498 /* Check we can create a function call */ in test_create_function_call()
503 check(instr_is_branch_to_addr(iptr, dest)); in test_create_function_call()
517 check(instr_is_branch_bform(ppc_inst(0x40000000))); in test_branch_bform()
519 check(instr_is_branch_bform(ppc_inst(0x43ffffff))); in test_branch_bform()
521 check(!instr_is_branch_bform(ppc_inst(0xc3ffffff))); in test_branch_bform()
523 check(!instr_is_branch_bform(ppc_inst(0x7bffffff))); in test_branch_bform()
527 check(instr_is_branch_to_addr(&instr, 0x100)); in test_branch_bform()
530 check(instr_is_branch_to_addr(&instr, 0x20fc)); in test_branch_bform()
533 check(instr_is_branch_to_addr(&instr, addr + 0x7FFC)); in test_branch_bform()
536 check(instr_is_branch_to_addr(&instr, addr - 4)); in test_branch_bform()
539 check(instr_is_branch_to_addr(&instr, addr - 0x8000)); in test_branch_bform()
546 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_bform()
550 check(instr_is_branch_to_addr(&instr, addr - 0x100)); in test_branch_bform()
554 check(instr_is_branch_to_addr(&instr, addr + 0x100)); in test_branch_bform()
558 check(instr_is_branch_to_addr(&instr, addr - 0x8000)); in test_branch_bform()
562 check(err); in test_branch_bform()
566 check(err); in test_branch_bform()
570 check(err); in test_branch_bform()
572 /* Check flags are masked correctly */ in test_branch_bform()
574 check(instr_is_branch_to_addr(&instr, addr)); in test_branch_bform()
575 check(ppc_inst_equal(instr, ppc_inst(0x43FF0000))); in test_branch_bform()
586 check(buf); in test_translate_branch()
594 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
598 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
607 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
608 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
609 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x4a000000))); in test_translate_branch()
618 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
619 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
620 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x49fffffc))); in test_translate_branch()
629 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
630 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
639 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
640 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
650 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
654 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
664 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
665 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
666 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x43ff8000))); in test_translate_branch()
676 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
677 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
678 check(ppc_inst_equal(ppc_inst_read(q), ppc_inst(0x43ff7ffc))); in test_translate_branch()
688 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
689 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
699 check(instr_is_branch_to_addr(p, addr)); in test_translate_branch()
700 check(instr_is_branch_to_addr(q, addr)); in test_translate_branch()
717 check(!memcmp(code_patching_test1, in test_prefixed_patching()