Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/x86_32.ad Tue Apr 20 13:26:33 2010 -0700 +++ b/src/cpu/x86/vm/x86_32.ad Mon Apr 26 11:27:21 2010 -0700 @@ -1,5 +1,5 @@ // -// Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. +// Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This code is free software; you can redistribute it and/or modify it @@ -6272,6 +6272,30 @@ ins_pipe( ialu_reg_reg); %} +instruct bytes_reverse_unsigned_short(eRegI dst) %{ + match(Set dst (ReverseBytesUS dst)); + + format %{ "BSWAP $dst\n\t" + "SHR $dst,16\n\t" %} + ins_encode %{ + __ bswapl($dst$$Register); + __ shrl($dst$$Register, 16); + %} + ins_pipe( ialu_reg ); +%} + +instruct bytes_reverse_short(eRegI dst) %{ + match(Set dst (ReverseBytesS dst)); + + format %{ "BSWAP $dst\n\t" + "SAR $dst,16\n\t" %} + ins_encode %{ + __ bswapl($dst$$Register); + __ sarl($dst$$Register, 16); + %} + ins_pipe( ialu_reg ); +%} + //---------- Zeros Count Instructions ------------------------------------------