Prevent the memset16 ARM opt from failing when count is 0.
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 13 Feb 2012 15:46:26 +0000 (15:46 +0000)
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 13 Feb 2012 15:46:26 +0000 (15:46 +0000)
Review URL: http://codereview.appspot.com/5639051

git-svn-id: http://skia.googlecode.com/svn/trunk@3173 2bbb7eff-a529-9590-31e7-b0007b416f81

src/opts/memset.arm.S

index bc0c060ac9238d907ac27726570a8a66c9971bf3..1248631c1634e0aaf561a0565e9914b5f4edfc20 100644 (file)
@@ -32,6 +32,10 @@ arm_memset16:
         .fnstart
         push        {lr}
 
+        /* if count is equal to zero then abort */
+        teq         r2, #0
+        ble         .Lfinish
+
         /* Multiply count by 2 - go from the number of 16-bit shorts
          * to the number of bytes desired. */
         mov         r2, r2, lsl #1
@@ -52,6 +56,10 @@ arm_memset32:
         .fnstart
         push        {lr}
 
+        /* if count is equal to zero then abort */
+        teq         r2, #0
+        ble         .Lfinish
+
         /* Multiply count by 4 - go from the number of 32-bit words to
          * the number of bytes desired. */
         mov         r2, r2, lsl #2
@@ -97,5 +105,6 @@ arm_memset32:
         strcs       r1, [r0], #4
         strmih      lr, [r0], #2
 
+.Lfinish:
         pop         {pc}
         .fnend