< prev index next >

src/hotspot/cpu/aarch64/aarch64_ad.m4

Print this page

        

*** 152,166 **** // Shift Left followed by Shift Right. // This idiom is used by the compiler for the i2b bytecode etc. instruct $4$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift_count, immI rshift_count) %{ match(Set dst EXTEND($1, $3, src, lshift_count, rshift_count)); ins_cost(INSN_COST * 2); format %{ "$4 $dst, $src, $rshift_count - $lshift_count, #$2 - $lshift_count" %} ins_encode %{ ! int lshift = $lshift_count$$constant & $2; ! int rshift = $rshift_count$$constant & $2; int s = $2 - lshift; int r = (rshift - lshift) & $2; __ $4(as_Register($dst$$reg), as_Register($src$$reg), r, s); --- 152,169 ---- // Shift Left followed by Shift Right. // This idiom is used by the compiler for the i2b bytecode etc. instruct $4$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift_count, immI rshift_count) %{ match(Set dst EXTEND($1, $3, src, lshift_count, rshift_count)); + // Make sure we are not going to exceed what $4 can do. + predicate((unsigned int)n->in(2)->get_int() <= $2 + && (unsigned int)n->in(1)->in(2)->get_int() <= $2); + ins_cost(INSN_COST * 2); format %{ "$4 $dst, $src, $rshift_count - $lshift_count, #$2 - $lshift_count" %} ins_encode %{ ! int lshift = $lshift_count$$constant, rshift = $rshift_count$$constant; int s = $2 - lshift; int r = (rshift - lshift) & $2; __ $4(as_Register($dst$$reg), as_Register($src$$reg), r, s);
*** 176,214 **** // Bitfield extract with shift & mask define(`BFX_INSN', `instruct $3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI rshift, imm$1_bitmask mask) %{ match(Set dst (And$1 ($2$1 src rshift) mask)); - // Make sure we are not going to exceed what $3 can do. - predicate((exact_log2$6(n->in(2)->get_$5() + 1) + (n->in(1)->in(2)->get_int() & $4)) <= ($4 + 1)); ins_cost(INSN_COST); format %{ "$3 $dst, $src, $rshift, $mask" %} ins_encode %{ ! int rshift = $rshift$$constant & $4; long mask = $mask$$constant; ! int width = exact_log2$6(mask+1); __ $3(as_Register($dst$$reg), as_Register($src$$reg), rshift, width); %} ins_pipe(ialu_reg_shift); %}') ! BFX_INSN(I, URShift, ubfxw, 31, int) ! BFX_INSN(L, URShift, ubfx, 63, long, _long) // We can use ubfx when extending an And with a mask when we know mask // is positive. We know that because immI_bitmask guarantees it. instruct ubfxIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI rshift, immI_bitmask mask) %{ match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask))); - // Make sure we are not going to exceed what ubfxw can do. - predicate((exact_log2(n->in(1)->in(2)->get_int() + 1) + (n->in(1)->in(1)->in(2)->get_int() & 31)) <= (31 + 1)); ins_cost(INSN_COST * 2); format %{ "ubfx $dst, $src, $rshift, $mask" %} ins_encode %{ ! int rshift = $rshift$$constant & 31; long mask = $mask$$constant; int width = exact_log2(mask+1); __ ubfx(as_Register($dst$$reg), as_Register($src$$reg), rshift, width); %} --- 179,213 ---- // Bitfield extract with shift & mask define(`BFX_INSN', `instruct $3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI rshift, imm$1_bitmask mask) %{ match(Set dst (And$1 ($2$1 src rshift) mask)); ins_cost(INSN_COST); format %{ "$3 $dst, $src, $rshift, $mask" %} ins_encode %{ ! int rshift = $rshift$$constant; long mask = $mask$$constant; ! int width = exact_log2(mask+1); __ $3(as_Register($dst$$reg), as_Register($src$$reg), rshift, width); %} ins_pipe(ialu_reg_shift); %}') ! BFX_INSN(I,URShift,ubfxw) ! BFX_INSN(L,URShift,ubfx) // We can use ubfx when extending an And with a mask when we know mask // is positive. We know that because immI_bitmask guarantees it. instruct ubfxIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI rshift, immI_bitmask mask) %{ match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask))); ins_cost(INSN_COST * 2); format %{ "ubfx $dst, $src, $rshift, $mask" %} ins_encode %{ ! int rshift = $rshift$$constant; long mask = $mask$$constant; int width = exact_log2(mask+1); __ ubfx(as_Register($dst$$reg), as_Register($src$$reg), rshift, width); %}
*** 219,254 **** // We can use ubfiz when masking by a positive number and then left shifting the result. // We know that the mask is positive because imm$1_bitmask guarantees it. `instruct $2$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift, imm$1_bitmask mask) %{ match(Set dst (LShift$1 (And$1 src mask) lshift)); ! predicate((exact_log2$5(n->in(1)->in(2)->get_$4() + 1) + (n->in(2)->get_int() & $3)) <= ($3 + 1)); ins_cost(INSN_COST); format %{ "$2 $dst, $src, $lshift, $mask" %} ins_encode %{ ! int lshift = $lshift$$constant & $3; long mask = $mask$$constant; ! int width = exact_log2$5(mask+1); __ $2(as_Register($dst$$reg), as_Register($src$$reg), lshift, width); %} ins_pipe(ialu_reg_shift); %}') UBFIZ_INSN(I, ubfizw, 31, int) ! UBFIZ_INSN(L, ubfiz, 63, long, _long) // If there is a convert I to L block between and AndI and a LShiftL, we can also match ubfiz instruct ubfizIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI lshift, immI_bitmask mask) %{ ! match(Set dst (LShiftL (ConvI2L (AndI src mask)) lshift)); ! predicate((exact_log2(n->in(1)->in(1)->in(2)->get_int() + 1) + (n->in(2)->get_int() & 63)) <= (63 + 1)); ins_cost(INSN_COST); format %{ "ubfiz $dst, $src, $lshift, $mask" %} ins_encode %{ ! int lshift = $lshift$$constant & 63; long mask = $mask$$constant; int width = exact_log2(mask+1); __ ubfiz(as_Register($dst$$reg), as_Register($src$$reg), lshift, width); %} --- 218,255 ---- // We can use ubfiz when masking by a positive number and then left shifting the result. // We know that the mask is positive because imm$1_bitmask guarantees it. `instruct $2$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift, imm$1_bitmask mask) %{ match(Set dst (LShift$1 (And$1 src mask) lshift)); ! predicate((unsigned int)n->in(2)->get_int() <= $3 && ! (exact_log2$5(n->in(1)->in(2)->get_$4()+1) + (unsigned int)n->in(2)->get_int()) <= ($3+1)); ins_cost(INSN_COST); format %{ "$2 $dst, $src, $lshift, $mask" %} ins_encode %{ ! int lshift = $lshift$$constant; long mask = $mask$$constant; ! int width = exact_log2(mask+1); __ $2(as_Register($dst$$reg), as_Register($src$$reg), lshift, width); %} ins_pipe(ialu_reg_shift); %}') UBFIZ_INSN(I, ubfizw, 31, int) ! UBFIZ_INSN(L, ubfiz, 63, long, _long) // If there is a convert I to L block between and AndI and a LShiftL, we can also match ubfiz instruct ubfizIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI lshift, immI_bitmask mask) %{ ! match(Set dst (LShiftL (ConvI2L(AndI src mask)) lshift)); ! predicate((unsigned int)n->in(2)->get_int() <= 31 && ! (exact_log2((unsigned int)n->in(1)->in(1)->in(2)->get_int()+1) + (unsigned int)n->in(2)->get_int()) <= 32); ins_cost(INSN_COST); format %{ "ubfiz $dst, $src, $lshift, $mask" %} ins_encode %{ ! int lshift = $lshift$$constant; long mask = $mask$$constant; int width = exact_log2(mask+1); __ ubfiz(as_Register($dst$$reg), as_Register($src$$reg), lshift, width); %}
*** 259,269 **** define(`EXTRACT_INSN', `instruct extr$3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, immI lshift, immI rshift, rFlagsReg cr) %{ match(Set dst ($3$1 (LShift$1 src1 lshift) (URShift$1 src2 rshift))); ! predicate(0 == (((n->in(1)->in(2)->get_int() & $2) + (n->in(2)->in(2)->get_int() & $2)) & $2)); ins_cost(INSN_COST); format %{ "extr $dst, $src1, $src2, #$rshift" %} ins_encode %{ --- 260,270 ---- define(`EXTRACT_INSN', `instruct extr$3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src1, iReg$1`'ORL2I($1) src2, immI lshift, immI rshift, rFlagsReg cr) %{ match(Set dst ($3$1 (LShift$1 src1 lshift) (URShift$1 src2 rshift))); ! predicate(0 == ((n->in(1)->in(2)->get_int() + n->in(2)->in(2)->get_int()) & $2)); ins_cost(INSN_COST); format %{ "extr $dst, $src1, $src2, #$rshift" %} ins_encode %{
< prev index next >