Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/x86_64.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 2003-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 // Copyright 2003-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. |
7369 opcode(0x0F, 0xC8); /* Opcode 0F /C8 */ | 7369 opcode(0x0F, 0xC8); /* Opcode 0F /C8 */ |
7370 ins_encode( REX_reg_wide(dst), OpcP, opc2_reg(dst) ); | 7370 ins_encode( REX_reg_wide(dst), OpcP, opc2_reg(dst) ); |
7371 ins_pipe( ialu_reg); | 7371 ins_pipe( ialu_reg); |
7372 %} | 7372 %} |
7373 | 7373 |
7374 instruct bytes_reverse_unsigned_short(rRegI dst) %{ | |
7375 match(Set dst (ReverseBytesUS dst)); | |
7376 | |
7377 format %{ "bswapl $dst\n\t" | |
7378 "shrl $dst,16\n\t" %} | |
7379 ins_encode %{ | |
7380 __ bswapl($dst$$Register); | |
7381 __ shrl($dst$$Register, 16); | |
7382 %} | |
7383 ins_pipe( ialu_reg ); | |
7384 %} | |
7385 | |
7386 instruct bytes_reverse_short(rRegI dst) %{ | |
7387 match(Set dst (ReverseBytesS dst)); | |
7388 | |
7389 format %{ "bswapl $dst\n\t" | |
7390 "sar $dst,16\n\t" %} | |
7391 ins_encode %{ | |
7392 __ bswapl($dst$$Register); | |
7393 __ sarl($dst$$Register, 16); | |
7394 %} | |
7395 ins_pipe( ialu_reg ); | |
7396 %} | |
7397 | |
7374 instruct loadI_reversed(rRegI dst, memory src) %{ | 7398 instruct loadI_reversed(rRegI dst, memory src) %{ |
7375 match(Set dst (ReverseBytesI (LoadI src))); | 7399 match(Set dst (ReverseBytesI (LoadI src))); |
7376 | 7400 |
7377 format %{ "bswap_movl $dst, $src" %} | 7401 format %{ "bswap_movl $dst, $src" %} |
7378 opcode(0x8B, 0x0F, 0xC8); /* Opcode 8B 0F C8 */ | 7402 opcode(0x8B, 0x0F, 0xC8); /* Opcode 8B 0F C8 */ |