Home | History | Annotate | Download | only in libagl
      1 /* libs/opengles/iterators.S
      2 **
      3 ** Copyright 2006, The Android Open Source Project
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 
     19     .text
     20     .align 2
     21     .arm
     22 
     23     .global iterators0032
     24     .type iterators0032, %function
     25 
     26 /*
     27  * iterators0032
     28  *
     29  * MUST BE CALLED FROM ARM CODE
     30  *
     31  * r0: const compute_iterators_t* (this)
     32  *      r0 + 0: m_dx01
     33  *      r0 + 4: m_dy10
     34  *      r0 + 8: m_dx20
     35  *      r0 +12: m_dy02
     36  *      r0 +16: m_x0
     37  *      r0 +20: m_y0
     38  *      r0 +24: m_area
     39  *		r0 +28: m_scale
     40  *		r0 +29: m_area_scale;
     41  * r1: int32_t* (out)
     42  *      r1 + 0: c
     43  *      r1 + 4: dcdx
     44  *      r1 + 8: dcdy
     45  *   r2: c0
     46  *   r3: c1
     47  * [sp]: c2
     48  */
     49 
     50 iterators0032:
     51         stmfd	sp!, {r4, r5, r6, r7, r8, lr}
     52         ldr     r4, [sp, #4*6]
     53 
     54         ldrb    r12, [r0, #29]
     55         sub     r3, r3, r2
     56         sub     r4, r4, r2
     57         sub     r12, r12, #16
     58         mov     r3, r3, asr r12
     59         mov     r4, r4, asr r12
     60 
     61         ldr     r5, [r0, #0]
     62         ldr     r12, [r0, #4]
     63         smull   r8, lr, r4, r5
     64         ldr     r5, [r0, #8]
     65         smull   r6, r7, r4, r12
     66         ldr     r12, [r0, #12]
     67         smlal   r8, lr, r3, r5
     68         smlal   r6, r7, r3, r12
     69 
     70         ldr     r3, [r0, #16]        // m_x0
     71         ldr     r4, [r0, #20]        // m_x1
     72 
     73         str     r6, [r1, #4]
     74         str     r8, [r1, #8]
     75 
     76         umull   r6, r5, r3, r6
     77         umull   r8, r0, r4, r8
     78         mla     r7, r3, r7, r5
     79         mla     lr, r4, lr, r0
     80         adds    r6, r6, r8
     81         adc     r7, r7, lr
     82 
     83         movs    r6, r6, lsr #4
     84         adc     r6, r6, r7, lsl #28
     85         rsb     r6, r6, r2, lsl #16
     86         str     r6, [r1, #0]
     87 
     88         ldmfd	sp!, {r4, r5, r6, r7, r8, pc}
     89 
     90