// MAXIMUM           Scalar Product of N-vectors

// This program locates the algebraically largest number
// in the list of quad word values at 'num'.
        NEG = 0x8000000000000000  // Most negative number
        .data                     // Declare storage
        .align  16                // Desired alignment
num:    data8   -1,+3,+5,-77,+99,0,-17
endnum:                           // Next (unused) location
        .text                     // Section for code
        .align  32                // Desired alignment
        .global main              // These three lines
        .proc   main              //  mark the mandatory
main:                             //   'main' program entry
        .body                     // Now we really begin...
first:  movl    r8  = NEG         // r8 = largest thus far
        movl    r14 = num         // r14 -> current element
        movl    r15 = endnum;;    // r15 -> end of list
again:  cmp.geu p6,p0 = r14,r15   // When r14 >= r15
        (p6) br.cond.spnt.few done // we're done
        ld8     r9 = [r14],8;;    // r9 = number to assess
        cmp.gt  p7,p0 = r9,r8;;   // If new > previous
        (p7) mov r8 = r9          //  remember new maximum
        br.cond.sptk.few again    // Look for next element
done:                             // Largest in r8 now
        br.ret.sptk.many b0;;     // Back to command line
        .endp   main              // Mark end of procedure