/****************************************************************************** Lab Exercise #12, Part A -- support module ******************************************************************************/ ! Function sum_vector .global sum_vector .section ".text" .align 4 sum_vector: save %sp, -96, %sp ! __________________________________________ set zero, %l7 ! __________________________________________ ldd [%l7], %f0 ! __________________________________________ ldd [%l7], %f30 ! __________________________________________ clr %l1 ! __________________________________________ clr %l2 ! __________________________________________ clr %l3 ! __________________________________________ loop: cmp %l1, %i1 ! __________________________________________ bge endloop ! __________________________________________ nop smul %l1, 8, %l0 ! __________________________________________ ldd [%i0+%l0], %f4 ! __________________________________________ faddd %f0, %f4, %f0 ! __________________________________________ if: fcmpd %f4, %f30 ! __________________________________________ nop fbge else ! __________________________________________ nop then: inc %l2 ! __________________________________________ ba endif ! __________________________________________ nop else: inc %l3 ! __________________________________________ endif: inc %l1 ! __________________________________________ ba loop ! __________________________________________ nop endloop: st %l2, [%i2] ! __________________________________________ st %l3, [%i3] ! __________________________________________ ret restore ! __________________________________________ .align 8 ! __________________________________________ zero: .double 0r0.0 ! __________________________________________