comparison src/cpu/x86/vm/x86_32.ad @ 1396:d7f654633cfe

6946040: add intrinsic for short and char reverseBytes Reviewed-by: never, twisti Contributed-by: Hiroshi Yamauchi <yamauchi@google.com>
author never
date Mon, 26 Apr 2010 11:27:21 -0700
parents 2883969d09e7
children c18cbe5936b8 110501f54a99
comparison
equal deleted inserted replaced
1385:bc32f286fae0 1396:d7f654633cfe
1 // 1 //
2 // Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 2 // Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 // 4 //
5 // This code is free software; you can redistribute it and/or modify it 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 6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation. 7 // published by the Free Software Foundation.
6268 "XCHG $dst.lo $dst.hi" %} 6268 "XCHG $dst.lo $dst.hi" %}
6269 6269
6270 ins_cost(125); 6270 ins_cost(125);
6271 ins_encode( bswap_long_bytes(dst) ); 6271 ins_encode( bswap_long_bytes(dst) );
6272 ins_pipe( ialu_reg_reg); 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 );
6273 %} 6297 %}
6274 6298
6275 6299
6276 //---------- Zeros Count Instructions ------------------------------------------ 6300 //---------- Zeros Count Instructions ------------------------------------------
6277 6301