Mercurial > hg > graal-compiler
comparison src/share/vm/opto/library_call.cpp @ 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 | cd37471eaecc |
children | e8e83be27dd7 ae8f909e5fc7 |
comparison
equal
deleted
inserted
replaced
1385:bc32f286fae0 | 1396:d7f654633cfe |
---|---|
634 case vmIntrinsics::_bitCount_l: | 634 case vmIntrinsics::_bitCount_l: |
635 return inline_bitCount(intrinsic_id()); | 635 return inline_bitCount(intrinsic_id()); |
636 | 636 |
637 case vmIntrinsics::_reverseBytes_i: | 637 case vmIntrinsics::_reverseBytes_i: |
638 case vmIntrinsics::_reverseBytes_l: | 638 case vmIntrinsics::_reverseBytes_l: |
639 case vmIntrinsics::_reverseBytes_s: | |
640 case vmIntrinsics::_reverseBytes_c: | |
639 return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id()); | 641 return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id()); |
640 | 642 |
641 case vmIntrinsics::_get_AtomicLong: | 643 case vmIntrinsics::_get_AtomicLong: |
642 return inline_native_AtomicLong_get(); | 644 return inline_native_AtomicLong_get(); |
643 case vmIntrinsics::_attemptUpdate: | 645 case vmIntrinsics::_attemptUpdate: |
2008 ShouldNotReachHere(); | 2010 ShouldNotReachHere(); |
2009 } | 2011 } |
2010 return true; | 2012 return true; |
2011 } | 2013 } |
2012 | 2014 |
2013 //----------------------------inline_reverseBytes_int/long------------------- | 2015 //----------------------------inline_reverseBytes_int/long/char/short------------------- |
2014 // inline Integer.reverseBytes(int) | 2016 // inline Integer.reverseBytes(int) |
2015 // inline Long.reverseBytes(long) | 2017 // inline Long.reverseBytes(long) |
2018 // inline Character.reverseBytes(char) | |
2019 // inline Short.reverseBytes(short) | |
2016 bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) { | 2020 bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) { |
2017 assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l, "not reverse Bytes"); | 2021 assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l || |
2018 if (id == vmIntrinsics::_reverseBytes_i && !Matcher::has_match_rule(Op_ReverseBytesI)) return false; | 2022 id == vmIntrinsics::_reverseBytes_c || id == vmIntrinsics::_reverseBytes_s, |
2019 if (id == vmIntrinsics::_reverseBytes_l && !Matcher::has_match_rule(Op_ReverseBytesL)) return false; | 2023 "not reverse Bytes"); |
2024 if (id == vmIntrinsics::_reverseBytes_i && !Matcher::has_match_rule(Op_ReverseBytesI)) return false; | |
2025 if (id == vmIntrinsics::_reverseBytes_l && !Matcher::has_match_rule(Op_ReverseBytesL)) return false; | |
2026 if (id == vmIntrinsics::_reverseBytes_c && !Matcher::has_match_rule(Op_ReverseBytesUS)) return false; | |
2027 if (id == vmIntrinsics::_reverseBytes_s && !Matcher::has_match_rule(Op_ReverseBytesS)) return false; | |
2020 _sp += arg_size(); // restore stack pointer | 2028 _sp += arg_size(); // restore stack pointer |
2021 switch (id) { | 2029 switch (id) { |
2022 case vmIntrinsics::_reverseBytes_i: | 2030 case vmIntrinsics::_reverseBytes_i: |
2023 push(_gvn.transform(new (C, 2) ReverseBytesINode(0, pop()))); | 2031 push(_gvn.transform(new (C, 2) ReverseBytesINode(0, pop()))); |
2024 break; | 2032 break; |
2025 case vmIntrinsics::_reverseBytes_l: | 2033 case vmIntrinsics::_reverseBytes_l: |
2026 push_pair(_gvn.transform(new (C, 2) ReverseBytesLNode(0, pop_pair()))); | 2034 push_pair(_gvn.transform(new (C, 2) ReverseBytesLNode(0, pop_pair()))); |
2035 break; | |
2036 case vmIntrinsics::_reverseBytes_c: | |
2037 push(_gvn.transform(new (C, 2) ReverseBytesUSNode(0, pop()))); | |
2038 break; | |
2039 case vmIntrinsics::_reverseBytes_s: | |
2040 push(_gvn.transform(new (C, 2) ReverseBytesSNode(0, pop()))); | |
2027 break; | 2041 break; |
2028 default: | 2042 default: |
2029 ; | 2043 ; |
2030 } | 2044 } |
2031 return true; | 2045 return true; |