1 //
2 // Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
5 // This code is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 // CA 95054 USA or visit www.sun.com if you need additional information or
21 // have any questions.
22 //
6255 match(Set dst (ReverseBytesI dst));
6256
6257 format %{ "BSWAP $dst" %}
6258 opcode(0x0F, 0xC8);
6259 ins_encode( OpcP, OpcSReg(dst) );
6260 ins_pipe( ialu_reg );
6261 %}
6262
6263 instruct bytes_reverse_long(eRegL dst) %{
6264 match(Set dst (ReverseBytesL dst));
6265
6266 format %{ "BSWAP $dst.lo\n\t"
6267 "BSWAP $dst.hi\n\t"
6268 "XCHG $dst.lo $dst.hi" %}
6269
6270 ins_cost(125);
6271 ins_encode( bswap_long_bytes(dst) );
6272 ins_pipe( ialu_reg_reg);
6273 %}
6274
6275
6276 //---------- Zeros Count Instructions ------------------------------------------
6277
6278 instruct countLeadingZerosI(eRegI dst, eRegI src, eFlagsReg cr) %{
6279 predicate(UseCountLeadingZerosInstruction);
6280 match(Set dst (CountLeadingZerosI src));
6281 effect(KILL cr);
6282
6283 format %{ "LZCNT $dst, $src\t# count leading zeros (int)" %}
6284 ins_encode %{
6285 __ lzcntl($dst$$Register, $src$$Register);
6286 %}
6287 ins_pipe(ialu_reg);
6288 %}
6289
6290 instruct countLeadingZerosI_bsr(eRegI dst, eRegI src, eFlagsReg cr) %{
6291 predicate(!UseCountLeadingZerosInstruction);
6292 match(Set dst (CountLeadingZerosI src));
6293 effect(KILL cr);
6294
|
1 //
2 // Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
5 // This code is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 // CA 95054 USA or visit www.sun.com if you need additional information or
21 // have any questions.
22 //
6255 match(Set dst (ReverseBytesI dst));
6256
6257 format %{ "BSWAP $dst" %}
6258 opcode(0x0F, 0xC8);
6259 ins_encode( OpcP, OpcSReg(dst) );
6260 ins_pipe( ialu_reg );
6261 %}
6262
6263 instruct bytes_reverse_long(eRegL dst) %{
6264 match(Set dst (ReverseBytesL dst));
6265
6266 format %{ "BSWAP $dst.lo\n\t"
6267 "BSWAP $dst.hi\n\t"
6268 "XCHG $dst.lo $dst.hi" %}
6269
6270 ins_cost(125);
6271 ins_encode( bswap_long_bytes(dst) );
6272 ins_pipe( ialu_reg_reg);
6273 %}
6274
6275 instruct bytes_reverse_unsigned_short(eRegI dst) %{
6276 match(Set dst (ReverseBytesUS dst));
6277
6278 format %{ "BSWAP $dst\n\t"
6279 "SHR $dst,16\n\t" %}
6280 ins_encode %{
6281 __ bswapl($dst$$Register);
6282 __ shrl($dst$$Register, 16);
6283 %}
6284 ins_pipe( ialu_reg );
6285 %}
6286
6287 instruct bytes_reverse_short(eRegI dst) %{
6288 match(Set dst (ReverseBytesS dst));
6289
6290 format %{ "BSWAP $dst\n\t"
6291 "SAR $dst,16\n\t" %}
6292 ins_encode %{
6293 __ bswapl($dst$$Register);
6294 __ sarl($dst$$Register, 16);
6295 %}
6296 ins_pipe( ialu_reg );
6297 %}
6298
6299
6300 //---------- Zeros Count Instructions ------------------------------------------
6301
6302 instruct countLeadingZerosI(eRegI dst, eRegI src, eFlagsReg cr) %{
6303 predicate(UseCountLeadingZerosInstruction);
6304 match(Set dst (CountLeadingZerosI src));
6305 effect(KILL cr);
6306
6307 format %{ "LZCNT $dst, $src\t# count leading zeros (int)" %}
6308 ins_encode %{
6309 __ lzcntl($dst$$Register, $src$$Register);
6310 %}
6311 ins_pipe(ialu_reg);
6312 %}
6313
6314 instruct countLeadingZerosI_bsr(eRegI dst, eRegI src, eFlagsReg cr) %{
6315 predicate(!UseCountLeadingZerosInstruction);
6316 match(Set dst (CountLeadingZerosI src));
6317 effect(KILL cr);
6318
|