RFR: JDK-8300783: Consolidate byteswap implementations [v13]
    Justin King 
    jcking at openjdk.org
       
    Tue Jan 31 23:32:53 UTC 2023
    
    
  
On Tue, 31 Jan 2023 20:05:21 GMT, Justin King <jcking at openjdk.org> wrote:
>> Deduplicate byte swapping implementations by consolidating them into `utilities/byteswap.hpp`, following `std::byteswap` introduced in C++23. Further simplification of `Bytes` will follow in https://github.com/openjdk/jdk/pull/12078.
>
> Justin King has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix copyright
>   
>   Signed-off-by: Justin King <jcking at google.com>
GCC/Clang and MSVC generate the single instruction for platforms which have it, otherwise they use the fastest method feasible for the architecture. Compiler-explorer confirms this. GCC will always recognize byteswap-like code, Clang doesn't always.
I am not 100% sure of XLC, it should generate a single store instruction. Getting a copy of the old XLC on AIX (not the clang-based one) doesn't seem easy.
-------------
PR: https://git.openjdk.org/jdk/pull/12114
    
    
More information about the hotspot-dev
mailing list