annotate src/hotspot/cpu/s390/bytes_s390.hpp @ 54970:b776653628c5

8218991: s390: Add intrinsic for GHASH algorithm Reviewed-by: lucy, simonis
author mdoerr
date Mon, 18 Feb 2019 12:16:02 +0100
parents 9f6f48d4f9a1
children
rev   line source
goetz@42065 1 /*
coleenp@54304 2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
goetz@48946 3 * Copyright (c) 2016, 2018 SAP SE. All rights reserved.
goetz@42065 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
goetz@42065 5 *
goetz@42065 6 * This code is free software; you can redistribute it and/or modify it
goetz@42065 7 * under the terms of the GNU General Public License version 2 only, as
goetz@42065 8 * published by the Free Software Foundation.
goetz@42065 9 *
goetz@42065 10 * This code is distributed in the hope that it will be useful, but WITHOUT
goetz@42065 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
goetz@42065 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
goetz@42065 13 * version 2 for more details (a copy is included in the LICENSE file that
goetz@42065 14 * accompanied this code).
goetz@42065 15 *
goetz@42065 16 * You should have received a copy of the GNU General Public License version
goetz@42065 17 * 2 along with this work; if not, write to the Free Software Foundation,
goetz@42065 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
goetz@42065 19 *
goetz@42065 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
goetz@42065 21 * or visit www.oracle.com if you need additional information or have any
goetz@42065 22 * questions.
goetz@42065 23 *
goetz@42065 24 */
goetz@42065 25
coleenp@54304 26 #ifndef CPU_S390_BYTES_S390_HPP
coleenp@54304 27 #define CPU_S390_BYTES_S390_HPP
goetz@42065 28
goetz@42065 29 #include "memory/allocation.hpp"
goetz@42065 30
goetz@42065 31 class Bytes: AllStatic {
goetz@42065 32 public:
goetz@42065 33 // Efficient reading and writing of unaligned unsigned data in
goetz@42065 34 // platform-specific byte ordering.
goetz@42065 35
goetz@42065 36 // Use regular load and store for unaligned access.
goetz@42065 37 //
goetz@42065 38 // On z/Architecture, unaligned loads and stores are supported when using the
goetz@42065 39 // "traditional" load (LH, L/LY, LG) and store (STH, ST/STY, STG) instructions.
goetz@42065 40 // The penalty for unaligned access is just very few (two or three) ticks,
goetz@42065 41 // plus another few (two or three) ticks if the access crosses a cache line boundary.
goetz@42065 42 //
goetz@42065 43 // In short, it makes no sense on z/Architecture to piecemeal get or put unaligned data.
goetz@42065 44
goetz@42065 45 static inline u2 get_native_u2(address p) { return *(u2*)p; }
goetz@42065 46 static inline u4 get_native_u4(address p) { return *(u4*)p; }
goetz@42065 47 static inline u8 get_native_u8(address p) { return *(u8*)p; }
goetz@42065 48
goetz@42065 49 static inline void put_native_u2(address p, u2 x) { *(u2*)p = x; }
goetz@42065 50 static inline void put_native_u4(address p, u4 x) { *(u4*)p = x; }
goetz@42065 51 static inline void put_native_u8(address p, u8 x) { *(u8*)p = x; }
goetz@42065 52
goetz@48946 53 // The following header contains the implementations of swap_u2, swap_u4, and swap_u8.
goetz@48946 54 #include OS_CPU_HEADER_INLINE(bytes)
goetz@42065 55
goetz@42065 56 // Efficient reading and writing of unaligned unsigned data in Java byte ordering (i.e. big-endian ordering)
goetz@42065 57 static inline u2 get_Java_u2(address p) { return get_native_u2(p); }
goetz@42065 58 static inline u4 get_Java_u4(address p) { return get_native_u4(p); }
goetz@42065 59 static inline u8 get_Java_u8(address p) { return get_native_u8(p); }
goetz@42065 60
goetz@42065 61 static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, x); }
goetz@42065 62 static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, x); }
goetz@42065 63 static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, x); }
goetz@42065 64 };
goetz@42065 65
coleenp@54304 66 #endif // CPU_S390_BYTES_S390_HPP