build-many-glibcs.py: Add openrisc hard float glibc variant
[glibc.git] / sysdeps / hppa / memcopy.h
blobe1da978713430c65d93d2728862c4ede09f22c53
1 /* Definitions for memory copy functions, PA-RISC version.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <sysdeps/generic/memcopy.h>
21 /* Use a single double-word shift instead of two shifts and an ior.
22 If the uses of MERGE were close to the computation of shl/shr,
23 the compiler might have been able to create this itself.
24 But instead that computation is well separated.
26 Using an inline function instead of a macro is the easiest way
27 to ensure that the types are correct. */
29 #undef MERGE
31 static __always_inline op_t
32 MERGE (op_t w0, int shl, op_t w1, int shr)
34 _Static_assert (OPSIZ == 4 || OPSIZ == 8, "Invalid OPSIZE");
36 op_t res;
37 if (OPSIZ == 4)
38 asm ("shrpw %1,%2,%%sar,%0" : "=r"(res) : "r"(w0), "r"(w1), "q"(shr));
39 else if (OPSIZ == 8)
40 asm ("shrpd %1,%2,%%sar,%0" : "=r"(res) : "r"(w0), "r"(w1), "q"(shr));
41 return res;