3482 { |
3482 { |
3483 Unimplemented(); |
3483 Unimplemented(); |
3484 return 0; |
3484 return 0; |
3485 } |
3485 } |
3486 |
3486 |
3487 bool Matcher::is_short_branch_offset(int rule, int br_size, int offset) |
3487 // Is this branch offset short enough that a short branch can be used? |
3488 { |
3488 // |
3489 Unimplemented(); |
3489 // NOTE: If the platform does not provide any short branch variants, then |
3490 return false; |
3490 // this method should return false for offset 0. |
|
3491 bool Matcher::is_short_branch_offset(int rule, int br_size, int offset) { |
|
3492 // The passed offset is relative to address of the branch. |
|
3493 |
|
3494 return (-32768 <= offset && offset < 32768); |
3491 } |
3495 } |
3492 |
3496 |
3493 const bool Matcher::isSimpleConstant64(jlong value) { |
3497 const bool Matcher::isSimpleConstant64(jlong value) { |
3494 // Will one (StoreL ConL) be cheaper than two (StoreI ConI)?. |
3498 // Will one (StoreL ConL) be cheaper than two (StoreI ConI)?. |
3495 // Probably always true, even if a temp register is required. |
3499 // Probably always true, even if a temp register is required. |
13843 ins_pipe(pipe_cmp_branch); |
13847 ins_pipe(pipe_cmp_branch); |
13844 %} |
13848 %} |
13845 |
13849 |
13846 // Test bit and Branch |
13850 // Test bit and Branch |
13847 |
13851 |
13848 instruct cmpL_branch_sign(cmpOp cmp, iRegL op1, immL0 op2, label labl, rFlagsReg cr) %{ |
13852 // Patterns for short (< 32KiB) variants |
|
13853 instruct cmpL_branch_sign(cmpOp cmp, iRegL op1, immL0 op2, label labl) %{ |
13849 match(If cmp (CmpL op1 op2)); |
13854 match(If cmp (CmpL op1 op2)); |
13850 predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt |
13855 predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt |
13851 || n->in(1)->as_Bool()->_test._test == BoolTest::ge); |
13856 || n->in(1)->as_Bool()->_test._test == BoolTest::ge); |
13852 effect(USE labl); |
13857 effect(USE labl); |
13853 |
13858 |
13854 ins_cost(BRANCH_COST); |
13859 ins_cost(BRANCH_COST); |
13855 format %{ "cb$cmp $op1, $labl # long" %} |
13860 format %{ "cb$cmp $op1, $labl # long" %} |
13856 ins_encode %{ |
13861 ins_encode %{ |
13857 Label* L = $labl$$label; |
13862 Label* L = $labl$$label; |
13858 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
13863 Assembler::Condition cond = |
13859 if (cond == Assembler::LT) |
13864 ((Assembler::Condition)$cmp$$cmpcode == Assembler::LT) ? Assembler::NE : Assembler::EQ; |
13860 __ tbnz($op1$$Register, 63, *L); |
13865 __ tbr(cond, $op1$$Register, 63, *L); |
13861 else |
|
13862 __ tbz($op1$$Register, 63, *L); |
|
13863 %} |
13866 %} |
13864 ins_pipe(pipe_cmp_branch); |
13867 ins_pipe(pipe_cmp_branch); |
13865 %} |
13868 ins_short_branch(1); |
13866 |
13869 %} |
13867 instruct cmpI_branch_sign(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl, rFlagsReg cr) %{ |
13870 |
|
13871 instruct cmpI_branch_sign(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl) %{ |
13868 match(If cmp (CmpI op1 op2)); |
13872 match(If cmp (CmpI op1 op2)); |
13869 predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt |
13873 predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt |
13870 || n->in(1)->as_Bool()->_test._test == BoolTest::ge); |
13874 || n->in(1)->as_Bool()->_test._test == BoolTest::ge); |
13871 effect(USE labl); |
13875 effect(USE labl); |
13872 |
13876 |
13873 ins_cost(BRANCH_COST); |
13877 ins_cost(BRANCH_COST); |
13874 format %{ "cb$cmp $op1, $labl # int" %} |
13878 format %{ "cb$cmp $op1, $labl # int" %} |
13875 ins_encode %{ |
13879 ins_encode %{ |
13876 Label* L = $labl$$label; |
13880 Label* L = $labl$$label; |
13877 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
13881 Assembler::Condition cond = |
13878 if (cond == Assembler::LT) |
13882 ((Assembler::Condition)$cmp$$cmpcode == Assembler::LT) ? Assembler::NE : Assembler::EQ; |
13879 __ tbnz($op1$$Register, 31, *L); |
13883 __ tbr(cond, $op1$$Register, 31, *L); |
13880 else |
|
13881 __ tbz($op1$$Register, 31, *L); |
|
13882 %} |
13884 %} |
13883 ins_pipe(pipe_cmp_branch); |
13885 ins_pipe(pipe_cmp_branch); |
13884 %} |
13886 ins_short_branch(1); |
13885 |
13887 %} |
13886 instruct cmpL_branch_bit(cmpOp cmp, iRegL op1, immL op2, immL0 op3, label labl, rFlagsReg cr) %{ |
13888 |
|
13889 instruct cmpL_branch_bit(cmpOp cmp, iRegL op1, immL op2, immL0 op3, label labl) %{ |
13887 match(If cmp (CmpL (AndL op1 op2) op3)); |
13890 match(If cmp (CmpL (AndL op1 op2) op3)); |
13888 predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne |
13891 predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne |
13889 || n->in(1)->as_Bool()->_test._test == BoolTest::eq) |
13892 || n->in(1)->as_Bool()->_test._test == BoolTest::eq) |
13890 && is_power_of_2(n->in(2)->in(1)->in(2)->get_long())); |
13893 && is_power_of_2(n->in(2)->in(1)->in(2)->get_long())); |
13891 effect(USE labl); |
13894 effect(USE labl); |
13894 format %{ "tb$cmp $op1, $op2, $labl" %} |
13897 format %{ "tb$cmp $op1, $op2, $labl" %} |
13895 ins_encode %{ |
13898 ins_encode %{ |
13896 Label* L = $labl$$label; |
13899 Label* L = $labl$$label; |
13897 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
13900 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
13898 int bit = exact_log2($op2$$constant); |
13901 int bit = exact_log2($op2$$constant); |
13899 if (cond == Assembler::EQ) |
13902 __ tbr(cond, $op1$$Register, bit, *L); |
13900 __ tbz($op1$$Register, bit, *L); |
|
13901 else |
|
13902 __ tbnz($op1$$Register, bit, *L); |
|
13903 %} |
13903 %} |
13904 ins_pipe(pipe_cmp_branch); |
13904 ins_pipe(pipe_cmp_branch); |
13905 %} |
13905 ins_short_branch(1); |
13906 |
13906 %} |
13907 instruct cmpI_branch_bit(cmpOp cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl, rFlagsReg cr) %{ |
13907 |
|
13908 instruct cmpI_branch_bit(cmpOp cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{ |
13908 match(If cmp (CmpI (AndI op1 op2) op3)); |
13909 match(If cmp (CmpI (AndI op1 op2) op3)); |
13909 predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne |
13910 predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne |
13910 || n->in(1)->as_Bool()->_test._test == BoolTest::eq) |
13911 || n->in(1)->as_Bool()->_test._test == BoolTest::eq) |
13911 && is_power_of_2(n->in(2)->in(1)->in(2)->get_int())); |
13912 && is_power_of_2(n->in(2)->in(1)->in(2)->get_int())); |
13912 effect(USE labl); |
13913 effect(USE labl); |
13915 format %{ "tb$cmp $op1, $op2, $labl" %} |
13916 format %{ "tb$cmp $op1, $op2, $labl" %} |
13916 ins_encode %{ |
13917 ins_encode %{ |
13917 Label* L = $labl$$label; |
13918 Label* L = $labl$$label; |
13918 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
13919 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
13919 int bit = exact_log2($op2$$constant); |
13920 int bit = exact_log2($op2$$constant); |
13920 if (cond == Assembler::EQ) |
13921 __ tbr(cond, $op1$$Register, bit, *L); |
13921 __ tbz($op1$$Register, bit, *L); |
13922 %} |
13922 else |
13923 ins_pipe(pipe_cmp_branch); |
13923 __ tbnz($op1$$Register, bit, *L); |
13924 ins_short_branch(1); |
|
13925 %} |
|
13926 |
|
13927 // And far variants |
|
13928 instruct far_cmpL_branch_sign(cmpOp cmp, iRegL op1, immL0 op2, label labl) %{ |
|
13929 match(If cmp (CmpL op1 op2)); |
|
13930 predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt |
|
13931 || n->in(1)->as_Bool()->_test._test == BoolTest::ge); |
|
13932 effect(USE labl); |
|
13933 |
|
13934 ins_cost(BRANCH_COST); |
|
13935 format %{ "cb$cmp $op1, $labl # long" %} |
|
13936 ins_encode %{ |
|
13937 Label* L = $labl$$label; |
|
13938 Assembler::Condition cond = |
|
13939 ((Assembler::Condition)$cmp$$cmpcode == Assembler::LT) ? Assembler::NE : Assembler::EQ; |
|
13940 __ tbr(cond, $op1$$Register, 63, *L, /*far*/true); |
|
13941 %} |
|
13942 ins_pipe(pipe_cmp_branch); |
|
13943 %} |
|
13944 |
|
13945 instruct far_cmpI_branch_sign(cmpOp cmp, iRegIorL2I op1, immI0 op2, label labl) %{ |
|
13946 match(If cmp (CmpI op1 op2)); |
|
13947 predicate(n->in(1)->as_Bool()->_test._test == BoolTest::lt |
|
13948 || n->in(1)->as_Bool()->_test._test == BoolTest::ge); |
|
13949 effect(USE labl); |
|
13950 |
|
13951 ins_cost(BRANCH_COST); |
|
13952 format %{ "cb$cmp $op1, $labl # int" %} |
|
13953 ins_encode %{ |
|
13954 Label* L = $labl$$label; |
|
13955 Assembler::Condition cond = |
|
13956 ((Assembler::Condition)$cmp$$cmpcode == Assembler::LT) ? Assembler::NE : Assembler::EQ; |
|
13957 __ tbr(cond, $op1$$Register, 31, *L, /*far*/true); |
|
13958 %} |
|
13959 ins_pipe(pipe_cmp_branch); |
|
13960 %} |
|
13961 |
|
13962 instruct far_cmpL_branch_bit(cmpOp cmp, iRegL op1, immL op2, immL0 op3, label labl) %{ |
|
13963 match(If cmp (CmpL (AndL op1 op2) op3)); |
|
13964 predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne |
|
13965 || n->in(1)->as_Bool()->_test._test == BoolTest::eq) |
|
13966 && is_power_of_2(n->in(2)->in(1)->in(2)->get_long())); |
|
13967 effect(USE labl); |
|
13968 |
|
13969 ins_cost(BRANCH_COST); |
|
13970 format %{ "tb$cmp $op1, $op2, $labl" %} |
|
13971 ins_encode %{ |
|
13972 Label* L = $labl$$label; |
|
13973 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
|
13974 int bit = exact_log2($op2$$constant); |
|
13975 __ tbr(cond, $op1$$Register, bit, *L, /*far*/true); |
|
13976 %} |
|
13977 ins_pipe(pipe_cmp_branch); |
|
13978 %} |
|
13979 |
|
13980 instruct far_cmpI_branch_bit(cmpOp cmp, iRegIorL2I op1, immI op2, immI0 op3, label labl) %{ |
|
13981 match(If cmp (CmpI (AndI op1 op2) op3)); |
|
13982 predicate((n->in(1)->as_Bool()->_test._test == BoolTest::ne |
|
13983 || n->in(1)->as_Bool()->_test._test == BoolTest::eq) |
|
13984 && is_power_of_2(n->in(2)->in(1)->in(2)->get_int())); |
|
13985 effect(USE labl); |
|
13986 |
|
13987 ins_cost(BRANCH_COST); |
|
13988 format %{ "tb$cmp $op1, $op2, $labl" %} |
|
13989 ins_encode %{ |
|
13990 Label* L = $labl$$label; |
|
13991 Assembler::Condition cond = (Assembler::Condition)$cmp$$cmpcode; |
|
13992 int bit = exact_log2($op2$$constant); |
|
13993 __ tbr(cond, $op1$$Register, bit, *L, /*far*/true); |
13924 %} |
13994 %} |
13925 ins_pipe(pipe_cmp_branch); |
13995 ins_pipe(pipe_cmp_branch); |
13926 %} |
13996 %} |
13927 |
13997 |
13928 // Test bits |
13998 // Test bits |