Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/x86_32.ad @ 3839:3d42f82cd811
7063628: Use cbcond on T4
Summary: Add new short branch instruction to Hotspot sparc assembler.
Reviewed-by: never, twisti, jrose
author | kvn |
---|---|
date | Thu, 21 Jul 2011 11:25:07 -0700 |
parents | bad7ecd0b6ed |
children | c7b60b601eb4 |
comparison
equal
deleted
inserted
replaced
3838:6a991dcb52bb | 3839:3d42f82cd811 |
---|---|
1711 emit_rm(cbuf, 0x3, $tertiary, HIGH_FROM_LOW($dst$$reg)); | 1711 emit_rm(cbuf, 0x3, $tertiary, HIGH_FROM_LOW($dst$$reg)); |
1712 if ((con >= -128) && (con <= 127)) emit_d8 (cbuf,con); | 1712 if ((con >= -128) && (con <= 127)) emit_d8 (cbuf,con); |
1713 else emit_d32(cbuf,con); | 1713 else emit_d32(cbuf,con); |
1714 %} | 1714 %} |
1715 | 1715 |
1716 enc_class Lbl (label labl) %{ // JMP, CALL | 1716 enc_class Lbl (label labl) %{ // GOTO |
1717 Label *l = $labl$$label; | 1717 Label *l = $labl$$label; |
1718 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0); | 1718 emit_d32(cbuf, (l->loc_pos() - (cbuf.insts_size()+4))); |
1719 %} | 1719 %} |
1720 | 1720 |
1721 enc_class LblShort (label labl) %{ // JMP, CALL | 1721 enc_class LblShort (label labl) %{ // GOTO |
1722 Label *l = $labl$$label; | 1722 Label *l = $labl$$label; |
1723 int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0; | 1723 int disp = l->loc_pos() - (cbuf.insts_size()+1); |
1724 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); | 1724 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
1725 emit_d8(cbuf, disp); | 1725 emit_d8(cbuf, disp); |
1726 %} | 1726 %} |
1727 | 1727 |
1728 enc_class OpcSReg (eRegI dst) %{ // BSWAP | 1728 enc_class OpcSReg (eRegI dst) %{ // BSWAP |
1749 | 1749 |
1750 enc_class Jcc (cmpOp cop, label labl) %{ // JCC | 1750 enc_class Jcc (cmpOp cop, label labl) %{ // JCC |
1751 Label *l = $labl$$label; | 1751 Label *l = $labl$$label; |
1752 $$$emit8$primary; | 1752 $$$emit8$primary; |
1753 emit_cc(cbuf, $secondary, $cop$$cmpcode); | 1753 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
1754 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0); | 1754 emit_d32(cbuf, (l->loc_pos() - (cbuf.insts_size()+4))); |
1755 %} | 1755 %} |
1756 | 1756 |
1757 enc_class JccShort (cmpOp cop, label labl) %{ // JCC | 1757 enc_class JccShort (cmpOp cop, label labl) %{ // JCC |
1758 Label *l = $labl$$label; | 1758 Label *l = $labl$$label; |
1759 emit_cc(cbuf, $primary, $cop$$cmpcode); | 1759 emit_cc(cbuf, $primary, $cop$$cmpcode); |
1760 int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0; | 1760 int disp = l->loc_pos() - (cbuf.insts_size()+1); |
1761 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); | 1761 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
1762 emit_d8(cbuf, disp); | 1762 emit_d8(cbuf, disp); |
1763 %} | 1763 %} |
1764 | 1764 |
1765 enc_class enc_cmov(cmpOp cop ) %{ // CMOV | 1765 enc_class enc_cmov(cmpOp cop ) %{ // CMOV |
13170 emit_cc(cbuf, $secondary, Assembler::parity); | 13170 emit_cc(cbuf, $secondary, Assembler::parity); |
13171 int parity_disp = -1; | 13171 int parity_disp = -1; |
13172 bool ok = false; | 13172 bool ok = false; |
13173 if ($cop$$cmpcode == Assembler::notEqual) { | 13173 if ($cop$$cmpcode == Assembler::notEqual) { |
13174 // the two jumps 6 bytes apart so the jump distances are too | 13174 // the two jumps 6 bytes apart so the jump distances are too |
13175 parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0; | 13175 parity_disp = l->loc_pos() - (cbuf.insts_size() + 4); |
13176 } else if ($cop$$cmpcode == Assembler::equal) { | 13176 } else if ($cop$$cmpcode == Assembler::equal) { |
13177 parity_disp = 6; | 13177 parity_disp = 6; |
13178 ok = true; | 13178 ok = true; |
13179 } else { | 13179 } else { |
13180 ShouldNotReachHere(); | 13180 ShouldNotReachHere(); |
13181 } | 13181 } |
13182 emit_d32(cbuf, parity_disp); | 13182 emit_d32(cbuf, parity_disp); |
13183 $$$emit8$primary; | 13183 $$$emit8$primary; |
13184 emit_cc(cbuf, $secondary, $cop$$cmpcode); | 13184 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
13185 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0; | 13185 int disp = l->loc_pos() - (cbuf.insts_size() + 4); |
13186 emit_d32(cbuf, disp); | 13186 emit_d32(cbuf, disp); |
13187 %} | 13187 %} |
13188 ins_pipe(pipe_jcc); | 13188 ins_pipe(pipe_jcc); |
13189 ins_pc_relative(1); | 13189 ins_pc_relative(1); |
13190 %} | 13190 %} |
13366 ins_encode %{ | 13366 ins_encode %{ |
13367 Label* l = $labl$$label; | 13367 Label* l = $labl$$label; |
13368 emit_cc(cbuf, $primary, Assembler::parity); | 13368 emit_cc(cbuf, $primary, Assembler::parity); |
13369 int parity_disp = -1; | 13369 int parity_disp = -1; |
13370 if ($cop$$cmpcode == Assembler::notEqual) { | 13370 if ($cop$$cmpcode == Assembler::notEqual) { |
13371 parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; | 13371 parity_disp = l->loc_pos() - (cbuf.insts_size() + 1); |
13372 } else if ($cop$$cmpcode == Assembler::equal) { | 13372 } else if ($cop$$cmpcode == Assembler::equal) { |
13373 parity_disp = 2; | 13373 parity_disp = 2; |
13374 } else { | 13374 } else { |
13375 ShouldNotReachHere(); | 13375 ShouldNotReachHere(); |
13376 } | 13376 } |
13377 emit_d8(cbuf, parity_disp); | 13377 emit_d8(cbuf, parity_disp); |
13378 emit_cc(cbuf, $primary, $cop$$cmpcode); | 13378 emit_cc(cbuf, $primary, $cop$$cmpcode); |
13379 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; | 13379 int disp = l->loc_pos() - (cbuf.insts_size() + 1); |
13380 emit_d8(cbuf, disp); | 13380 emit_d8(cbuf, disp); |
13381 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); | 13381 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
13382 assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); | 13382 assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); |
13383 %} | 13383 %} |
13384 ins_pipe(pipe_jcc); | 13384 ins_pipe(pipe_jcc); |