]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/BaseMemoryLibOptDxe: replace deprecated uses of IT blocks
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 26 Sep 2016 22:55:05 +0000 (15:55 -0700)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 27 Sep 2016 16:12:14 +0000 (09:12 -0700)
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>
MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S
MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S
MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S
MdePkg/Library/BaseMemoryLibOptDxe/Arm/ScanMem.S
MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S

index d729994e8cc62327e376fceed5726a6ebde6141b..6d0089049d48134dab034e51ff5f13b9362f8b5b 100644 (file)
@@ -42,7 +42,7 @@ ASM_PFX(InternalMemCompareGuid):
     ldr     lr, [r1, #4]\r
     cmp     r2, ip\r
     it      eq\r
-    cmpeq   r3, lr\r
+    cmpeq.n r3, lr\r
     beq     0f\r
     movs    r0, #0\r
     pop     {r4, pc}\r
@@ -51,7 +51,7 @@ ASM_PFX(InternalMemCompareGuid):
     ldr     r3, [r1, #12]\r
     cmp     r4, r2\r
     it      eq\r
-    cmpeq   r0, r3\r
+    cmpeq.n r0, r3\r
     bne     2f\r
     movs    r0, #1\r
     pop     {r4, pc}\r
@@ -61,5 +61,5 @@ ASM_PFX(InternalMemCompareGuid):
     movs    r0, #1\r
     orrs    r2, r2, r4\r
 2:  it      ne\r
-    movne   r0, #0\r
+    movne.n r0, #0\r
     pop     {r4, pc}\r
index 3aadebace30f1b18ea1dd982d546c3f826b0d019..9483aab61a0c8810bf0bdc75e4e5a791081c84b6 100644 (file)
@@ -132,7 +132,7 @@ ASM_PFX(InternalMemCompareMem):
     ldrb    data2, [src2], #1\r
     subs    limit, limit, #1\r
     it      cs\r
-    cmpcs   data1, data2\r
+    cmpcs.n data1, data2\r
     beq     1b\r
     sub     result, data1, data2\r
     pop     {r4-r8, pc}\r
index fb5293befc10b822211a6d843f5e7b82f32e11f4..195a0b23f770a30a6dbb2fcdb83d1d5ef55c9d39 100644 (file)
@@ -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)\r
     tst     r0, #0xF\r
     it      ne\r
-    movne   r0, #0\r
+    movne.n r0, #0\r
     bne     memcopy_default\r
     tst     r1, #0xF\r
-    ite     ne\r
-    movne   r3, #0\r
-    moveq   r3, #1\r
+    it      ne\r
+    movne.n r3, #0\r
+    it      eq\r
+    moveq.n r3, #1\r
     cmp     r2, #31\r
-    ite     ls\r
-    movls   r0, #0\r
-    andhi   r0, r3, #1\r
+    it      ls\r
+    movls.n r0, #0\r
+    bls     memcopy_default\r
+    and     r0, r3, #1\r
     b       memcopy_default\r
 \r
 memcopy_check_optim_overlap:\r
@@ -84,15 +86,16 @@ memcopy_check_optim_overlap:
 \r
     // Are we in the optimized case ((length >= 32) && dest_end word-aligned && source_end word-aligned)\r
     cmp     r2, #31\r
-    ite     ls\r
-    movls   r0, #0\r
-    movhi   r0, #1\r
+    it      ls\r
+    movls.n r0, #0\r
+    it      hi\r
+    movhi.n r0, #1\r
     tst     r10, #0xF\r
     it      ne\r
-    movne   r0, #0\r
+    movne.n r0, #0\r
     tst     r14, #0xF\r
     it      ne\r
-    movne   r0, #0\r
+    movne.n r0, #0\r
     b       memcopy_overlapped\r
 \r
 memcopy_overlapped_non_optim:\r
@@ -123,7 +126,7 @@ memcopy_overlapped:
 \r
     // If length is less than 32 then disable optim\r
     it      ls\r
-    movls   r0, #0\r
+    movls.n r0, #0\r
 \r
     cmp     r12, #0\r
 \r
@@ -157,7 +160,7 @@ memcopy_default_loop:
 \r
     // If length is less than 32 then disable optim\r
     it      ls\r
-    movls   r0, #0\r
+    movls.n r0, #0\r
 \r
     cmp     r12, #0\r
 \r
index 1c269547b07263a93047c32924af1109c8d4b417..5dcf153a61a9da4c67d24f3ce8ad5bf4998b365e 100644 (file)
@@ -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\r
     // r0 points to the start of the double word after the one that was tested\r
     // r5 has the 00/ff pattern for the first word, r6 has the chained value\r
+    subs    r0, r0, #3\r
     cmp     r5, #0\r
-    itte    eq\r
-    moveq   r5, r6        // the end is in the 2nd word\r
-    subeq   r0, r0, #3    // Points to 2nd byte of 2nd word\r
-    subne   r0, r0, #7    // or 2nd byte of 1st word\r
+    it      eq\r
+    moveq.n r5, r6        // the end is in the 2nd word\r
+    it      ne\r
+    subne.n r0, r0, #4    // or 2nd byte of 1st word\r
 \r
     // r0 currently points to the 3rd byte of the word containing the hit\r
     tst     r5, #CHARTSTMASK(0)     // 1st character\r
index add04443b2e9946dc48875693e8cd4180f74e391..2d8f4d5b86213df2ad8a01f1b42c7974a0b41baf 100644 (file)
@@ -73,15 +73,17 @@ ASM_PFX(InternalMemZeroMem):
     cmp     r4, #4                  // between 4 and 15 bytes?\r
     blt     4f\r
     cmp     r4, #8                  // between 8 and 15 bytes?\r
-    str     r2, [lr, #-16]          // overlapping store of 4 + (4 + 4) + 4 bytes\r
-    itt     gt\r
-    strgt   r3, [lr, #-12]\r
-    strgt   r2, [r1]\r
+    sub     r4, lr, #16\r
+    str     r2, [r4]                // overlapping store of 4 + (4 + 4) + 4 bytes\r
+    it      gt\r
+    strgt.n r3, [r4, #4]\r
+    it      gt\r
+    strgt.n r2, [r1]\r
     str     r3, [r1, #4]\r
     pop     {r4, pc}\r
 \r
 4:  cmp     r4, #2                  // 2 or 3 bytes?\r
     strb    r2, [lr, #-16]          // store 1 byte\r
     it      ge\r
-    strhge  r2, [r1, #6]            // store 2 bytes\r
+    strhge.n r2, [r1, #6]           // store 2 bytes\r
     pop     {r4, pc}\r