Bug 740187 - [Skia] Prevent the ARM implementation of memset16 from failing if count=0 r=mattwoodrow
authorGeorge Wright <gwright@mozilla.com>
Wed, 28 Mar 2012 22:20:55 -0400
changeset 93899 ca5328d3c661e035ee1b74a88881353182862100
parent 93898 b00bf7f3869c471073f6ade173b50617904066e0
child 93900 b6a1c1c85ca364cb7743de0a1b3b14b5c85eb679
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs740187
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 740187 - [Skia] Prevent the ARM implementation of memset16 from failing if count=0 r=mattwoodrow
gfx/skia/src/opts/memset.arm.S
--- a/gfx/skia/src/opts/memset.arm.S
+++ b/gfx/skia/src/opts/memset.arm.S
@@ -27,36 +27,44 @@
  * void arm_memset16(uint16_t* dst, uint16_t value, int count);
  * void arm_memset32(uint32_t* dst, uint32_t value, int count);
  *
  */
 arm_memset16:
         .fnstart
         push        {lr}
 
+        /* if count is equal to zero then abort */
+        teq         r2, #0
+        beq         .Lfinish
+
+        /* Multiply count by 2 - go from the number of 16-bit shorts
+         * to the number of bytes desired. */
+        mov         r2, r2, lsl #1
+
         /* expand the data to 32 bits */
         orr         r1, r1, lsl #16
 
         /* align to 32 bits */
         tst         r0, #2
         strneh      r1, [r0], #2
         subne       r2, r2, #2
 
-        /* Multiply count by 2 - go from the number of 16-bit shorts
-         * to the number of bytes desired. */
-        mov         r2, r2, lsl #1
-
         /* Now jump into the main loop below. */
         b           .Lwork_32
         .fnend
 
 arm_memset32:
         .fnstart
         push        {lr}
 
+        /* if count is equal to zero then abort */
+        teq         r2, #0
+        beq         .Lfinish
+
         /* Multiply count by 4 - go from the number of 32-bit words to
          * the number of bytes desired. */
         mov         r2, r2, lsl #2
 
 .Lwork_32:
         /* Set up registers ready for writing them out. */
         mov         ip, r1
         mov         lr, r1
@@ -92,10 +100,11 @@ 1:      subs        r2, r2, #32
          * (0-30 bytes, length in r2) */
         movs        r2, r2, lsl #28
         stmcsia     r0!, {r1,r3,ip,lr}
         stmmiia     r0!, {r1,lr}
         movs        r2, r2, lsl #2
         strcs       r1, [r0], #4
         strmih      lr, [r0], #2
 
+.Lfinish:
         pop         {pc}
         .fnend