< prev index next >

src/cpu/aarch64/vm/aarch64_ad.m4

Print this page
rev 13535 : 8187022: AArch64: UBFX instructions have wrong format string
Reviewed-by: duke
Contributed-by: daniel.stewart@linaro.org


 166     int r = (rshift - lshift) & $2;
 167     __ $4(as_Register($dst$$reg),
 168             as_Register($src$$reg),
 169             r, s);
 170   %}
 171 
 172   ins_pipe(ialu_reg_shift);
 173 %}')
 174 BFM_INSN(L, 63, RShift, sbfm)
 175 BFM_INSN(I, 31, RShift, sbfmw)
 176 BFM_INSN(L, 63, URShift, ubfm)
 177 BFM_INSN(I, 31, URShift, ubfmw)
 178 dnl
 179 // Bitfield extract with shift & mask
 180 define(`BFX_INSN',
 181 `instruct $3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI rshift, imm$1_bitmask mask)
 182 %{
 183   match(Set dst (And$1 ($2$1 src rshift) mask));
 184 
 185   ins_cost(INSN_COST);
 186   format %{ "$3 $dst, $src, $mask" %}
 187   ins_encode %{
 188     int rshift = $rshift$$constant;
 189     long mask = $mask$$constant;
 190     int width = exact_log2(mask+1);
 191     __ $3(as_Register($dst$$reg),
 192             as_Register($src$$reg), rshift, width);
 193   %}
 194   ins_pipe(ialu_reg_shift);
 195 %}')
 196 BFX_INSN(I,URShift,ubfxw)
 197 BFX_INSN(L,URShift,ubfx)
 198 
 199 // We can use ubfx when extending an And with a mask when we know mask
 200 // is positive.  We know that because immI_bitmask guarantees it.
 201 instruct ubfxIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI rshift, immI_bitmask mask)
 202 %{
 203   match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask)));
 204 
 205   ins_cost(INSN_COST * 2);
 206   format %{ "ubfx $dst, $src, $mask" %}
 207   ins_encode %{
 208     int rshift = $rshift$$constant;
 209     long mask = $mask$$constant;
 210     int width = exact_log2(mask+1);
 211     __ ubfx(as_Register($dst$$reg),
 212             as_Register($src$$reg), rshift, width);
 213   %}
 214   ins_pipe(ialu_reg_shift);
 215 %}
 216 
 217 define(`UBFIZ_INSN',
 218 // We can use ubfiz when masking by a positive number and then left shifting the result.
 219 // We know that the mask is positive because imm$1_bitmask guarantees it.
 220 `instruct $2$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift, imm$1_bitmask mask)
 221 %{
 222   match(Set dst (LShift$1 (And$1 src mask) lshift));
 223   predicate((unsigned int)n->in(2)->get_int() <= $3 &&
 224     (exact_log2$5(n->in(1)->in(2)->get_$4()+1) + (unsigned int)n->in(2)->get_int()) <= ($3+1));
 225 
 226   ins_cost(INSN_COST);




 166     int r = (rshift - lshift) & $2;
 167     __ $4(as_Register($dst$$reg),
 168             as_Register($src$$reg),
 169             r, s);
 170   %}
 171 
 172   ins_pipe(ialu_reg_shift);
 173 %}')
 174 BFM_INSN(L, 63, RShift, sbfm)
 175 BFM_INSN(I, 31, RShift, sbfmw)
 176 BFM_INSN(L, 63, URShift, ubfm)
 177 BFM_INSN(I, 31, URShift, ubfmw)
 178 dnl
 179 // Bitfield extract with shift & mask
 180 define(`BFX_INSN',
 181 `instruct $3$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI rshift, imm$1_bitmask mask)
 182 %{
 183   match(Set dst (And$1 ($2$1 src rshift) mask));
 184 
 185   ins_cost(INSN_COST);
 186   format %{ "$3 $dst, $src, $rshift, $mask" %}
 187   ins_encode %{
 188     int rshift = $rshift$$constant;
 189     long mask = $mask$$constant;
 190     int width = exact_log2(mask+1);
 191     __ $3(as_Register($dst$$reg),
 192             as_Register($src$$reg), rshift, width);
 193   %}
 194   ins_pipe(ialu_reg_shift);
 195 %}')
 196 BFX_INSN(I,URShift,ubfxw)
 197 BFX_INSN(L,URShift,ubfx)
 198 
 199 // We can use ubfx when extending an And with a mask when we know mask
 200 // is positive.  We know that because immI_bitmask guarantees it.
 201 instruct ubfxIConvI2L(iRegLNoSp dst, iRegIorL2I src, immI rshift, immI_bitmask mask)
 202 %{
 203   match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask)));
 204 
 205   ins_cost(INSN_COST * 2);
 206   format %{ "ubfx $dst, $src, $rshift, $mask" %}
 207   ins_encode %{
 208     int rshift = $rshift$$constant;
 209     long mask = $mask$$constant;
 210     int width = exact_log2(mask+1);
 211     __ ubfx(as_Register($dst$$reg),
 212             as_Register($src$$reg), rshift, width);
 213   %}
 214   ins_pipe(ialu_reg_shift);
 215 %}
 216 
 217 define(`UBFIZ_INSN',
 218 // We can use ubfiz when masking by a positive number and then left shifting the result.
 219 // We know that the mask is positive because imm$1_bitmask guarantees it.
 220 `instruct $2$1(iReg$1NoSp dst, iReg$1`'ORL2I($1) src, immI lshift, imm$1_bitmask mask)
 221 %{
 222   match(Set dst (LShift$1 (And$1 src mask) lshift));
 223   predicate((unsigned int)n->in(2)->get_int() <= $3 &&
 224     (exact_log2$5(n->in(1)->in(2)->get_$4()+1) + (unsigned int)n->in(2)->get_int()) <= ($3+1));
 225 
 226   ins_cost(INSN_COST);


< prev index next >