mirror of https://github.com/acidanthera/audk.git
MdePkg/BaseMemoryLibOptDxe: replace deprecated uses of IT blocks
The ARM architecture version 8 deprecates all uses of the IT instruction except cases where it is followed by a single narrow instruction. So replace any occurrences with equivalent sequences that adhere to the new rules. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
c4f637077e
commit
eab2678815
|
@ -42,7 +42,7 @@ ASM_PFX(InternalMemCompareGuid):
|
||||||
ldr lr, [r1, #4]
|
ldr lr, [r1, #4]
|
||||||
cmp r2, ip
|
cmp r2, ip
|
||||||
it eq
|
it eq
|
||||||
cmpeq r3, lr
|
cmpeq.n r3, lr
|
||||||
beq 0f
|
beq 0f
|
||||||
movs r0, #0
|
movs r0, #0
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
@ -51,7 +51,7 @@ ASM_PFX(InternalMemCompareGuid):
|
||||||
ldr r3, [r1, #12]
|
ldr r3, [r1, #12]
|
||||||
cmp r4, r2
|
cmp r4, r2
|
||||||
it eq
|
it eq
|
||||||
cmpeq r0, r3
|
cmpeq.n r0, r3
|
||||||
bne 2f
|
bne 2f
|
||||||
movs r0, #1
|
movs r0, #1
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
@ -61,5 +61,5 @@ ASM_PFX(InternalMemCompareGuid):
|
||||||
movs r0, #1
|
movs r0, #1
|
||||||
orrs r2, r2, r4
|
orrs r2, r2, r4
|
||||||
2: it ne
|
2: it ne
|
||||||
movne r0, #0
|
movne.n r0, #0
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
|
@ -132,7 +132,7 @@ ASM_PFX(InternalMemCompareMem):
|
||||||
ldrb data2, [src2], #1
|
ldrb data2, [src2], #1
|
||||||
subs limit, limit, #1
|
subs limit, limit, #1
|
||||||
it cs
|
it cs
|
||||||
cmpcs data1, data2
|
cmpcs.n data1, data2
|
||||||
beq 1b
|
beq 1b
|
||||||
sub result, data1, data2
|
sub result, data1, data2
|
||||||
pop {r4-r8, pc}
|
pop {r4-r8, pc}
|
||||||
|
|
|
@ -65,16 +65,18 @@ memcopy_check_optim_default:
|
||||||
// Check if we can use an optimized path ((length >= 32) && destination word-aligned && source word-aligned) for the memcopy (optimized path if r0 == 1)
|
// Check if we can use an optimized path ((length >= 32) && destination word-aligned && source word-aligned) for the memcopy (optimized path if r0 == 1)
|
||||||
tst r0, #0xF
|
tst r0, #0xF
|
||||||
it ne
|
it ne
|
||||||
movne r0, #0
|
movne.n r0, #0
|
||||||
bne memcopy_default
|
bne memcopy_default
|
||||||
tst r1, #0xF
|
tst r1, #0xF
|
||||||
ite ne
|
it ne
|
||||||
movne r3, #0
|
movne.n r3, #0
|
||||||
moveq r3, #1
|
it eq
|
||||||
|
moveq.n r3, #1
|
||||||
cmp r2, #31
|
cmp r2, #31
|
||||||
ite ls
|
it ls
|
||||||
movls r0, #0
|
movls.n r0, #0
|
||||||
andhi r0, r3, #1
|
bls memcopy_default
|
||||||
|
and r0, r3, #1
|
||||||
b memcopy_default
|
b memcopy_default
|
||||||
|
|
||||||
memcopy_check_optim_overlap:
|
memcopy_check_optim_overlap:
|
||||||
|
@ -84,15 +86,16 @@ memcopy_check_optim_overlap:
|
||||||
|
|
||||||
// Are we in the optimized case ((length >= 32) && dest_end word-aligned && source_end word-aligned)
|
// Are we in the optimized case ((length >= 32) && dest_end word-aligned && source_end word-aligned)
|
||||||
cmp r2, #31
|
cmp r2, #31
|
||||||
ite ls
|
it ls
|
||||||
movls r0, #0
|
movls.n r0, #0
|
||||||
movhi r0, #1
|
it hi
|
||||||
|
movhi.n r0, #1
|
||||||
tst r10, #0xF
|
tst r10, #0xF
|
||||||
it ne
|
it ne
|
||||||
movne r0, #0
|
movne.n r0, #0
|
||||||
tst r14, #0xF
|
tst r14, #0xF
|
||||||
it ne
|
it ne
|
||||||
movne r0, #0
|
movne.n r0, #0
|
||||||
b memcopy_overlapped
|
b memcopy_overlapped
|
||||||
|
|
||||||
memcopy_overlapped_non_optim:
|
memcopy_overlapped_non_optim:
|
||||||
|
@ -123,7 +126,7 @@ memcopy_overlapped:
|
||||||
|
|
||||||
// If length is less than 32 then disable optim
|
// If length is less than 32 then disable optim
|
||||||
it ls
|
it ls
|
||||||
movls r0, #0
|
movls.n r0, #0
|
||||||
|
|
||||||
cmp r12, #0
|
cmp r12, #0
|
||||||
|
|
||||||
|
@ -157,7 +160,7 @@ memcopy_default_loop:
|
||||||
|
|
||||||
// If length is less than 32 then disable optim
|
// If length is less than 32 then disable optim
|
||||||
it ls
|
it ls
|
||||||
movls r0, #0
|
movls.n r0, #0
|
||||||
|
|
||||||
cmp r12, #0
|
cmp r12, #0
|
||||||
|
|
||||||
|
|
|
@ -123,11 +123,12 @@ ASM_PFX(InternalMemScanMem8):
|
||||||
60: // We're here because the fast path found a hit - now we have to track down exactly which word it was
|
60: // We're here because the fast path found a hit - now we have to track down exactly which word it was
|
||||||
// r0 points to the start of the double word after the one that was tested
|
// r0 points to the start of the double word after the one that was tested
|
||||||
// r5 has the 00/ff pattern for the first word, r6 has the chained value
|
// r5 has the 00/ff pattern for the first word, r6 has the chained value
|
||||||
|
subs r0, r0, #3
|
||||||
cmp r5, #0
|
cmp r5, #0
|
||||||
itte eq
|
it eq
|
||||||
moveq r5, r6 // the end is in the 2nd word
|
moveq.n r5, r6 // the end is in the 2nd word
|
||||||
subeq r0, r0, #3 // Points to 2nd byte of 2nd word
|
it ne
|
||||||
subne r0, r0, #7 // or 2nd byte of 1st word
|
subne.n r0, r0, #4 // or 2nd byte of 1st word
|
||||||
|
|
||||||
// r0 currently points to the 3rd byte of the word containing the hit
|
// r0 currently points to the 3rd byte of the word containing the hit
|
||||||
tst r5, #CHARTSTMASK(0) // 1st character
|
tst r5, #CHARTSTMASK(0) // 1st character
|
||||||
|
|
|
@ -73,15 +73,17 @@ ASM_PFX(InternalMemZeroMem):
|
||||||
cmp r4, #4 // between 4 and 15 bytes?
|
cmp r4, #4 // between 4 and 15 bytes?
|
||||||
blt 4f
|
blt 4f
|
||||||
cmp r4, #8 // between 8 and 15 bytes?
|
cmp r4, #8 // between 8 and 15 bytes?
|
||||||
str r2, [lr, #-16] // overlapping store of 4 + (4 + 4) + 4 bytes
|
sub r4, lr, #16
|
||||||
itt gt
|
str r2, [r4] // overlapping store of 4 + (4 + 4) + 4 bytes
|
||||||
strgt r3, [lr, #-12]
|
it gt
|
||||||
strgt r2, [r1]
|
strgt.n r3, [r4, #4]
|
||||||
|
it gt
|
||||||
|
strgt.n r2, [r1]
|
||||||
str r3, [r1, #4]
|
str r3, [r1, #4]
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
||||||
4: cmp r4, #2 // 2 or 3 bytes?
|
4: cmp r4, #2 // 2 or 3 bytes?
|
||||||
strb r2, [lr, #-16] // store 1 byte
|
strb r2, [lr, #-16] // store 1 byte
|
||||||
it ge
|
it ge
|
||||||
strhge r2, [r1, #6] // store 2 bytes
|
strhge.n r2, [r1, #6] // store 2 bytes
|
||||||
pop {r4, pc}
|
pop {r4, pc}
|
||||||
|
|
Loading…
Reference in New Issue