2 Copyright (c) 2024, Synopsys, Inc. All rights reserved.
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are met:
7 1) Redistributions of source code must retain the above copyright notice,
8 this list of conditions and the following disclaimer.
10 2) Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
14 3) Neither the name of the Synopsys, Inc., nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 POSSIBILITY OF SUCH DAMAGE.
33 ; This file contains variants of the same function with different
34 ; instructions. The generic one, the implementation that comes the
35 ; last after the #else macro, is the most commented.
37 ; Using 128-bit memory operations
38 #if defined (__ARC64_M128__)
41 ;; Assemble 128b token
51 beq.d @.L_write_63_bytes
54 stdl.ab r6r7, [r4, +16]
55 stdl.ab r6r7, [r4, +16]
56 stdl.ab r6r7, [r4, +16]
57 dbnz.d r5, @.L_write_64_bytes
58 stdl.ab r6r7, [r4, +16]
84 breq r2, 0, @.L_return
91 ; The generic 64-bit implementation without any frills.
92 #elif defined (__ARC64_ARCH64__) || defined (__ARC64_LL64__)
94 #if defined (__ARC64_ARCH32__)
95 # define MOVH mov r7,r6
96 #elif defined (__ARC64_ARCH64__)
97 # define MOVH addhl r6,r6,r6
99 # error Please use either 32-bit or 64-bit version of arc64 compiler
107 ;; Assemble the bytes to 64bit words
108 bmsk_s r1, r1, 7 ; treat it like unsigned char
115 LSRP.f r5, r2, 5 ; counter for 32-byte chunks
116 beq.d @.L_write_31_bytes
117 MOVP r4, r0 ; work on a copy of "r0"
122 dbnz.d r5, @.L_write_32_bytes
146 #elif defined (__ARC64_ARCH32__)
148 ;; Assemble the bytes to 32bit words
149 bmsk_s r1, r1, 7 ; treat it like unsigned char
155 lsr.f r5, r2, 4 ; counter for 16-byte chunks
156 beq.d @.L_write_15_bytes
157 mov r4, r0 ; work on a copy of "r0"
162 dbnz.d r5, @.L_write_16_bytes
183 # error Unknown configuration