1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * arch/alpha/lib/memmove.S 2 * arch/alpha/lib/memmove.S 4 * 3 * 5 * Barely optimized memmove routine for Alpha 4 * Barely optimized memmove routine for Alpha EV5. 6 * 5 * 7 * This is hand-massaged output from the origi 6 * This is hand-massaged output from the original memcpy.c. We defer to 8 * memcpy whenever possible; the backwards cop 7 * memcpy whenever possible; the backwards copy loops are not unrolled. 9 */ 8 */ 10 #include <linux/export.h> !! 9 11 .set noat 10 .set noat 12 .set noreorder 11 .set noreorder 13 .text 12 .text 14 13 15 .align 4 14 .align 4 >> 15 .globl bcopy >> 16 .ent bcopy >> 17 bcopy: >> 18 ldgp $29, 0($27) >> 19 .prologue 1 >> 20 mov $16,$0 >> 21 mov $17,$16 >> 22 mov $0,$17 >> 23 br $31, memmove !samegp >> 24 .end bcopy >> 25 >> 26 .align 4 16 .globl memmove 27 .globl memmove 17 .ent memmove 28 .ent memmove 18 memmove: 29 memmove: 19 ldgp $29, 0($27) 30 ldgp $29, 0($27) 20 unop 31 unop 21 nop 32 nop 22 .prologue 1 33 .prologue 1 23 34 24 addq $16,$18,$4 35 addq $16,$18,$4 25 addq $17,$18,$5 36 addq $17,$18,$5 26 cmpule $4,$17,$1 /* de 37 cmpule $4,$17,$1 /* dest + n <= src */ 27 cmpule $5,$16,$2 /* de 38 cmpule $5,$16,$2 /* dest >= src + n */ 28 39 29 bis $1,$2,$1 40 bis $1,$2,$1 30 mov $16,$0 41 mov $16,$0 31 xor $16,$17,$2 42 xor $16,$17,$2 32 bne $1,memcpy !sameg 43 bne $1,memcpy !samegp 33 44 34 and $2,7,$2 /* Tes 45 and $2,7,$2 /* Test for src/dest co-alignment. */ 35 and $16,7,$1 46 and $16,7,$1 36 cmpule $16,$17,$3 47 cmpule $16,$17,$3 37 bne $3,$memmove_up /* des 48 bne $3,$memmove_up /* dest < src */ 38 49 39 and $4,7,$1 50 and $4,7,$1 40 bne $2,$misaligned_dn 51 bne $2,$misaligned_dn 41 unop 52 unop 42 beq $1,$skip_aligned_byte_loop_head_dn 53 beq $1,$skip_aligned_byte_loop_head_dn 43 54 44 $aligned_byte_loop_head_dn: 55 $aligned_byte_loop_head_dn: 45 lda $4,-1($4) 56 lda $4,-1($4) 46 lda $5,-1($5) 57 lda $5,-1($5) 47 unop 58 unop 48 ble $18,$egress 59 ble $18,$egress 49 60 50 ldq_u $3,0($5) 61 ldq_u $3,0($5) 51 ldq_u $2,0($4) 62 ldq_u $2,0($4) 52 lda $18,-1($18) 63 lda $18,-1($18) 53 extbl $3,$5,$1 64 extbl $3,$5,$1 54 65 55 insbl $1,$4,$1 66 insbl $1,$4,$1 56 mskbl $2,$4,$2 67 mskbl $2,$4,$2 57 bis $1,$2,$1 68 bis $1,$2,$1 58 and $4,7,$6 69 and $4,7,$6 59 70 60 stq_u $1,0($4) 71 stq_u $1,0($4) 61 bne $6,$aligned_byte_loop_head_dn 72 bne $6,$aligned_byte_loop_head_dn 62 73 63 $skip_aligned_byte_loop_head_dn: 74 $skip_aligned_byte_loop_head_dn: 64 lda $18,-8($18) 75 lda $18,-8($18) 65 blt $18,$skip_aligned_word_loop_dn 76 blt $18,$skip_aligned_word_loop_dn 66 77 67 $aligned_word_loop_dn: 78 $aligned_word_loop_dn: 68 ldq $1,-8($5) 79 ldq $1,-8($5) 69 nop 80 nop 70 lda $5,-8($5) 81 lda $5,-8($5) 71 lda $18,-8($18) 82 lda $18,-8($18) 72 83 73 stq $1,-8($4) 84 stq $1,-8($4) 74 nop 85 nop 75 lda $4,-8($4) 86 lda $4,-8($4) 76 bge $18,$aligned_word_loop_dn 87 bge $18,$aligned_word_loop_dn 77 88 78 $skip_aligned_word_loop_dn: 89 $skip_aligned_word_loop_dn: 79 lda $18,8($18) 90 lda $18,8($18) 80 bgt $18,$byte_loop_tail_dn 91 bgt $18,$byte_loop_tail_dn 81 unop 92 unop 82 ret $31,($26),1 93 ret $31,($26),1 83 94 84 .align 4 95 .align 4 85 $misaligned_dn: 96 $misaligned_dn: 86 nop 97 nop 87 fnop 98 fnop 88 unop 99 unop 89 beq $18,$egress 100 beq $18,$egress 90 101 91 $byte_loop_tail_dn: 102 $byte_loop_tail_dn: 92 ldq_u $3,-1($5) 103 ldq_u $3,-1($5) 93 ldq_u $2,-1($4) 104 ldq_u $2,-1($4) 94 lda $5,-1($5) 105 lda $5,-1($5) 95 lda $4,-1($4) 106 lda $4,-1($4) 96 107 97 lda $18,-1($18) 108 lda $18,-1($18) 98 extbl $3,$5,$1 109 extbl $3,$5,$1 99 insbl $1,$4,$1 110 insbl $1,$4,$1 100 mskbl $2,$4,$2 111 mskbl $2,$4,$2 101 112 102 bis $1,$2,$1 113 bis $1,$2,$1 103 stq_u $1,0($4) 114 stq_u $1,0($4) 104 bgt $18,$byte_loop_tail_dn 115 bgt $18,$byte_loop_tail_dn 105 br $egress 116 br $egress 106 117 107 $memmove_up: 118 $memmove_up: 108 mov $16,$4 119 mov $16,$4 109 mov $17,$5 120 mov $17,$5 110 bne $2,$misaligned_up 121 bne $2,$misaligned_up 111 beq $1,$skip_aligned_byte_loop_head_up 122 beq $1,$skip_aligned_byte_loop_head_up 112 123 113 $aligned_byte_loop_head_up: 124 $aligned_byte_loop_head_up: 114 unop 125 unop 115 ble $18,$egress 126 ble $18,$egress 116 ldq_u $3,0($5) 127 ldq_u $3,0($5) 117 ldq_u $2,0($4) 128 ldq_u $2,0($4) 118 129 119 lda $18,-1($18) 130 lda $18,-1($18) 120 extbl $3,$5,$1 131 extbl $3,$5,$1 121 insbl $1,$4,$1 132 insbl $1,$4,$1 122 mskbl $2,$4,$2 133 mskbl $2,$4,$2 123 134 124 bis $1,$2,$1 135 bis $1,$2,$1 125 lda $5,1($5) 136 lda $5,1($5) 126 stq_u $1,0($4) 137 stq_u $1,0($4) 127 lda $4,1($4) 138 lda $4,1($4) 128 139 129 and $4,7,$6 140 and $4,7,$6 130 bne $6,$aligned_byte_loop_head_up 141 bne $6,$aligned_byte_loop_head_up 131 142 132 $skip_aligned_byte_loop_head_up: 143 $skip_aligned_byte_loop_head_up: 133 lda $18,-8($18) 144 lda $18,-8($18) 134 blt $18,$skip_aligned_word_loop_up 145 blt $18,$skip_aligned_word_loop_up 135 146 136 $aligned_word_loop_up: 147 $aligned_word_loop_up: 137 ldq $1,0($5) 148 ldq $1,0($5) 138 nop 149 nop 139 lda $5,8($5) 150 lda $5,8($5) 140 lda $18,-8($18) 151 lda $18,-8($18) 141 152 142 stq $1,0($4) 153 stq $1,0($4) 143 nop 154 nop 144 lda $4,8($4) 155 lda $4,8($4) 145 bge $18,$aligned_word_loop_up 156 bge $18,$aligned_word_loop_up 146 157 147 $skip_aligned_word_loop_up: 158 $skip_aligned_word_loop_up: 148 lda $18,8($18) 159 lda $18,8($18) 149 bgt $18,$byte_loop_tail_up 160 bgt $18,$byte_loop_tail_up 150 unop 161 unop 151 ret $31,($26),1 162 ret $31,($26),1 152 163 153 .align 4 164 .align 4 154 $misaligned_up: 165 $misaligned_up: 155 nop 166 nop 156 fnop 167 fnop 157 unop 168 unop 158 beq $18,$egress 169 beq $18,$egress 159 170 160 $byte_loop_tail_up: 171 $byte_loop_tail_up: 161 ldq_u $3,0($5) 172 ldq_u $3,0($5) 162 ldq_u $2,0($4) 173 ldq_u $2,0($4) 163 lda $18,-1($18) 174 lda $18,-1($18) 164 extbl $3,$5,$1 175 extbl $3,$5,$1 165 176 166 insbl $1,$4,$1 177 insbl $1,$4,$1 167 mskbl $2,$4,$2 178 mskbl $2,$4,$2 168 bis $1,$2,$1 179 bis $1,$2,$1 169 stq_u $1,0($4) 180 stq_u $1,0($4) 170 181 171 lda $5,1($5) 182 lda $5,1($5) 172 lda $4,1($4) 183 lda $4,1($4) 173 nop 184 nop 174 bgt $18,$byte_loop_tail_up 185 bgt $18,$byte_loop_tail_up 175 186 176 $egress: 187 $egress: 177 ret $31,($26),1 188 ret $31,($26),1 178 nop 189 nop 179 nop 190 nop 180 nop 191 nop 181 192 182 .end memmove 193 .end memmove 183 EXPORT_SYMBOL(memmove) <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.