1 1.1 mrg /* Move double-word library function. 2 1.10 mrg Copyright (C) 2000-2022 Free Software Foundation, Inc. 3 1.1 mrg Contributed by Red Hat, Inc. 4 1.1 mrg 5 1.1 mrg This file is part of GCC. 6 1.1 mrg 7 1.1 mrg GCC is free software ; you can redistribute it and/or modify 8 1.1 mrg it under the terms of the GNU General Public License as published by 9 1.1 mrg the Free Software Foundation; either version 3, or (at your option) 10 1.1 mrg any later version. 11 1.1 mrg 12 1.1 mrg GCC is distributed in the hope that it will be useful, 13 1.1 mrg but WITHOUT ANY WARRANTY ; without even the implied warranty of 14 1.1 mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 1.1 mrg GNU General Public License for more details. 16 1.1 mrg 17 1.1 mrg Under Section 7 of GPL version 3, you are granted additional 18 1.1 mrg permissions described in the GCC Runtime Library Exception, version 19 1.1 mrg 3.1, as published by the Free Software Foundation. 20 1.1 mrg 21 1.1 mrg You should have received a copy of the GNU General Public License and 22 1.1 mrg a copy of the GCC Runtime Library Exception along with this program; 23 1.1 mrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24 1.1 mrg <http://www.gnu.org/licenses/>. */ 25 1.1 mrg 26 1.1 mrg void 27 1.1 mrg __cmovd (long long *dest, const long long *src, unsigned len) 28 1.1 mrg { 29 1.1 mrg unsigned i; 30 1.1 mrg unsigned num = len >> 3; 31 1.1 mrg unsigned xlen = len & ~7; 32 1.1 mrg char *dest_byte = (char *)dest; 33 1.1 mrg const char *src_byte = (const char *)src; 34 1.1 mrg 35 1.1 mrg if (dest_byte < src_byte || dest_byte > src_byte+len) 36 1.1 mrg { 37 1.1 mrg for (i = 0; i < num; i++) 38 1.1 mrg dest[i] = src[i]; 39 1.1 mrg 40 1.1 mrg while (len > xlen) 41 1.1 mrg { 42 1.1 mrg dest_byte[xlen] = src_byte[xlen]; 43 1.1 mrg xlen++; 44 1.1 mrg } 45 1.1 mrg } 46 1.1 mrg else 47 1.1 mrg { 48 1.1 mrg while (len-- > 0) 49 1.1 mrg dest_byte[len] = src_byte[len]; 50 1.1 mrg } 51 1.1 mrg } 52