Abstract:
An apparatus and a method for extended-precision vector arithmetic capable of extremely long precision (i.e., precision to as many bits as a user desires or is limited to due to memory, disk-storage, or other resource constraints). Vector carry-out bits can be used as vector carry-in bits for successive operations. In performing add or subtract operations on integers that are longer than the word size of the computer, the operands a broken into word-sized parts which are used as operands. A vector of long-integer numbers is thus broken into a series of sub-vectors, each having word-sized elements. Vector add or subtract operations are performed successively on the sub-vectors, starting with the lowest-order sub-vectors. Carry-out (or borrow-out) bits from a first vector operation are used as carry-in (or borrow-in) bits for a successive vector operation. In one embodiment, instructions are added to the instruction set of a vector processor to assist in propagating carry (or borrow) bits between components of long operands, and to assist users in accessing and controlling the carry (or borrow) bits.

Description:
FIELD OF THE INVENTION 
     This invention relates to the field of vector processor computers, and more specifically to a method and apparatus of long/extended-length integer arithmetic using an improved vector processor. 
     BACKGROUND OF THE INVENTION 
     Extended-length (or “long”) integer arithmetic is arithmetic that provides a number of significant bits (precision) that significantly exceeds the native, built-in capabilities of the computer being used. For example, a sixteen-bit processor can be used to handle arithmetic for the much larger numbers needed for scientific or financial spreadsheets or other calculations. An addition, for example, typically involves loading the lowest 16 bits from each operand in memory into internal registers, adding them together, storing the result into a result field in memory, then loading the next-significant 16 bits from each operand in memory into internal registers, adding them together along with the propagated carry from the first operation, storing the second result into the next-significant 16 bits of the result field in memory, and so on until the desired number of bits has been added, while propagating the carry from each operation into the next operation. 
     When taken to great lengths, such extended-length arithmetic can be used to compute pi to a million digits (for example), or for other desired applications carried out to as many significant bits as the programmer desires (within limits imposed by the storage capabilities of the computer and the time needed for the operations). 
     Vector processors have been used to improve the performance of a number of very-high-end computing applications such as weather forecasting and finite-element analysis. Many such applications use floating-point numbers and operations since they require only a correct magnitude (called the exponent) and a certain number of significant bits (called the mantissa or fraction). Therefore, many vector processors have been optimized for floating-point registers and operations. While suitable for many applications, floating-point operations are not suitable for applications requiring exact precision to hundreds or thousands of bits. 
     What is needed is improvements to the architecture and methods for vector processors and vector processing to improve extended-length (or “long”) integer arithmetic. 
     SUMMARY OF THE INVENTION 
     An apparatus and a method for extended-precision vector arithmetic is described capable of extremely long precision (i.e., precision to as many bits as a user desires or is limited to due to memory, disk-storage, or other resource constraints). Vector carry-out bits can be used as vector carry-in bits for successive operations. 
     In performing add or subtract operations on integers that are longer than the word size of the computer, the operands are broken into word-sized parts which are used as operands. A vector of long-integer numbers is thus broken into a series of sub-vectors, each having word-sized elements. Vector add or subtract operations are performed successively on the sub-vectors, starting with the lowest-order sub-vectors. Carry-out (or borrow-out) bits from a first vector operation are used as carry-in (or borrow-in) bits for a successive vector operation. In one embodiment, instructions are added to the instruction set of a vector processor to assist in propagating carry (or borrow) bits between components of long operands, and to assist users in accessing and controlling the carry (or borrow) bits. 
     One embodiment provides vector computer that includes a memory and an input-output subsystem including magnetic disk drives. The computer also includes vector element registers. Each vector element register can be selectively loaded with data from the memory. Each vector element register includes N elements, and each element has a plurality of bits. The computer also includes a vector carry register that has N bits. The computer also includes a vector arithmetic or logical functional unit having an input coupled to receive data operands from the respective elements of two vector element registers and the vector carry register, and operable to produce a result, wherein the result has successive elements and carry-out bits, and wherein each element of the result is based on an element from the first vector element register, a corresponding element from the second vector element register, and a corresponding bit from the vector carry register. A controller associated with the vector registers is responsive to program instructions to successively transmit one or more corresponding elements from each of the two vector element registers and one or more corresponding bits from the vector carry register to the functional unit as inputs, and to successively store results from the functional unit as elements into a vector element register. 
     In one such embodiment, the controller is adapted to transmit successive elements from any selected pair of the vector element registers and successive corresponding bits from the vector carry register as operands to the functional unit and to transmit results from the functional unit to successive elements of any selected one of the vector element registers and to successive corresponding bits of the vector carry register. 
     In another such embodiment, the functional unit is adapted to successively add pairs of elements of the vector element registers along with a corresponding carry-in bit from the vector carry register as operands to the functional unit and to successively output sum and carry-out results from the functional unit. 
     In yet another such embodiment, the functional unit is adapted to successively subtract an element of one vector element register and a corresponding borrow-in bit from the vector carry register from an element of another vector element register as operands to the functional unit and to successively output difference and borrow-out results from the functional unit. 
     In some embodiments, the controller is adapted to transmit two or more successive elements from each one of any selected pair of the vector element registers and two or more successive corresponding bits from the vector carry register as operands to the functional unit and to transmit two or more results from the functional unit to successive elements of any selected one of the vector element registers and to successive corresponding bits of the vector carry register. 
     In other embodiments, the controller is adapted to transmit four or more successive elements from each one of any selected pair of the vector element registers and four or more successive corresponding bits from the vector carry register as operands to the functional unit and to transmit four or more results from the functional unit to successive elements of any selected one of the vector element registers and to successive corresponding bits of the vector carry register. 
     Other aspects of the present invention provide a method for performing the above-described extended-precision arithmetic. 
     Yet other aspects of the present invention provide a vector processor for performing the above-described extended-precision arithmetic. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 shows a simplified schematic of one embodiment of the present invention, multiprocessor system  10  having a main memory  600  and a vector processor  100   n.    
     FIG. 2A shows the first step of a single number (non-vector or single-element vector) extended-precision arithmetic. 
     FIG. 2B shows the next step of single number extended-precision arithmetic. 
     FIG. 3A shows the first step of a vector extended-precision arithmetic. 
     FIG. 3B shows the next step of the vector extended-precision arithmetic. 
     FIG. 4 shows a two-pipe parallel pipeline vector extended-precision arithmetic processor. 
     FIG. 5 shows a process according to the present invention having vector extended-precision arithmetic processor. 
    
    
     DESCRIPTION OF PREFERRED EMBODIMENTS 
     In the following detailed description of the preferred embodiments, reference is made to the accompanying drawings that form a part hereof, and in which are shown by way of illustration specific embodiments in which the invention may be practiced. It is understood that other embodiments may be utilized and structural changes may be made without departing from the scope of the present invention. 
     FIG. 1 shows a simplified view of one embodiment of the present invention, multiprocessor system  10  having a main memory  602  and one or more vector processors  100 . In one embodiment, a typical multiprocessor system  10  will include up to sixteen or more vector processors  100 , of which only one (vector processor  100   n ) is shown. In the embodiment shown, each vector processor  100  includes a plurality of vector element registers  160  (one embodiment includes eight vector element registers  160 , each of which includes 128 elements, numbered 0 through 127, each element holding 64 bits), and a vector carry register  169  (see FIG. 2A; one embodiment includes one vector carry register  169  which includes 128 locations, numbered 0 through 127, each location holding 1 bit, that bit is used to indicate the presence or absence of a carry or a borrow or other function). Any of the vector element registers  160 , as well as the vector carry register  169  can be selected as inputs (i.e., as providing operands) or outputs (i.e., providing a destination for results) to vector arithmetic or logical functional unit  165 . 
     In the example shown in FIGS. 2A and 2B, extended-length arithmetic is to be performed on long integers (i.e., non-vectors, or single-element vectors) normally held in main memory  600 . FIG. 2A shows the first step of a single number (non-vector) extended-precision arithmetic. Operands A and B, each having a number of significant bits that exceeds the word length of the arithmetic processor  100 , e.g., operands each being 1024 bits long (for example), are to be added together (for example), and the result R, which can be 1025 bits long is stored in R. In one embodiment, A, B and R are each considered single-element vectors. Each vector has 1 element which, for example has 1024 bits) and operated on to and from the vector registers (in one embodiment, each vector register holds 128 elements each having 64 bits, but only element  0  is used) in the processor  100 . The vectors A, B, and R in memory are denoted as A 0    621 , B 0    622 , and R 0    623 , respectively. 
     The vector carry register (V C  register)  169  is initialized by zeroing the location- 0  bit, for example, by zeroing all bits of V C  register  169 . Operands A and B are each loaded into vector processor  100   n  in a repeated sequence of: a single 64-bit load operation for each operand (i.e., load operation  210  loads the 64 LSBs of A into the 0th element of vector register V A    161 , and load operation  212  loads the 64 LSBs of B into the 0th element of vector register V B    162 ), the pair of operands operated on in functional unit  125  (e.g., an addition operation), and store operations of the results (e.g., store operation  214  stores the 64 LSBs of the 0th element of vector register V R    163  into R. I.e., the initial carry-in (for the 2 0  bit position) of location  0  of V C  register  169  is zeroed, the least-significant-bit-position (LSB) 64 bits of operand A  621  (the 2 0 -2 63  bit positions) are loaded into element  0  of V A    161 , the LSB 64 bits of operand B  622  (the 2 0 -2 63  bit positions) are loaded into element  0  of V B    162 , element  0  of V A    161  and element  0  of V B    162  are added together with the zero carry-in from location  0  of V C  register  169  (at the 2 0  bit position), the sum is placed in element  0  of V R    163  and the carry-out (the 2 64  bit position) is placed in location  0  of V C  register  169 , element  0  of V R    163  is then stored to the LSB position of result R  623 . (See FIG.  2 A). 
     It should be realized that, in one embodiment, vector processor  100  has a set of vector registers  160 , any one of which can be used to hold operands or results. 
     Thus, in this embodiment, V R  is specified as Vi, V A  is specified as Vj, and V B  is specified as Vk, and arithmetic is specified as Vi=Vj+Vk. In other embodiments, any desired mapping of operands or results to particular vector registers is used. 
     FIG. 2B show the next step of single number extended-precision arithmetic. Location  0  of V C  register  169  is now set up to propagate the carry (the 2 64  bit position) to the next operation, the next-least-significant-bit-position (NLSB) 64 bits of operand A  621  (the 2 64 -2 127  bit positions of the extended-length operand number) are loaded into element  0  of V A    161  (the 2 0 -2 63  bit positions of the register), the NLSB 64 bits of operand B  622  (the 2 64 14 2 127  bit positions of the extended-length operand number) are loaded into element  0  of V B    162  (the 2 0 -2 63  bit positions of the register), element  0  of V A    161  and element  0  of V B    162  are added together with the propagated carry-in from location  0  of V C  register  169 , the sum is placed in element  0  of V R    163  and the carry-out (the 2 128  bit position of the extended-length number) is placed in location  0  of V C  register  169 , element  0  of V R    163  is then stored to the NLSB position of result R  623  (the 2 64 -2 127  bit positions of the extended-length result number). This process is repeated for a total of sixteen 64-bit operations in order to add all 1024 bits of the source operands, and after the last operation, the location  0  of V C  register  169  (i.e., the final carry-out bit (the 1025th bit position of the extended-length result number)) is then stored to the 1025 th bit of the result R  623  (labeled C). It will be realized that this process can be extended to almost any length operands, for example two one-million-bit operands can be added together by approximately 16,000 such 64-bit operations. 
     In a similar manner, extended-length subtraction can be performed. Two&#39;s complement arithmetic is accomplished by performing a one&#39;s complement of the subtrahend (i.e., bit-wise inverting every bit of the subtrahend B, equivalent to a bit-by-bit logical B-NOT, or {overscore (B)}), and adding 1 (i.e., a carry-in) to the low-order bit (the 2 0  bit position of the extended-length number) while adding to the minuend, i.e., (A−B)=(A+{overscore (B)}+1). Likewise, a borrow is indicated by lack of carry-in, i.e., (A−B−1)=(A+{overscore (B)}+0). Thus, for a subtraction, the locations of V C  register  169  are used to indicate borrows, wherein a one indicates no borrow, and a zero indicates a borrow of one. Therefore, a single extended-length subtraction is accomplished by setting the initial carry-in of location  0  of V C  register  169  to one, and the least-significant-bit-position (LSB) 64 bits of operand A  621  are loaded into element  0  of V A    161 , the LSB 64 bits of operand B  622  are loaded into element  0  of V B    162 , element  0  of V A    161  and element  0  of V B    162  are added together (after inverting every bit of the B operand) with the one carry-in (i.e., zero borrow-in) from location  0  of V C  register  169 , the result (i.e., the difference A LSB -B LSB ) is placed in element  0  of V R    163  and the borrow-out is placed in location  0  of V C  register  169 , element  0  of V R    163  is then stored to the LSB position of result R  623 . (See FIG. 3B.) The bit at location  0  of V C  register  169  is now set up to propagate the borrow to the next operation (wherein a zero indicates borrow-in and one indicates no borrow-in), and the next-least-significant-bit-position (NLSB) 64 bits of operand A  621  are loaded into element  0  of V A    161 , the NLSB 64 bits of operand B  622  are loaded into element  0  of V B    162 , element  0  of V A    161  and element  0  of V B    162  are added together (again, after inverting every bit of the B operand) with the propagated borrow-in from location  0  of V C  register  169 , with from location  0  of V C  register  169 , the result (i.e., the difference A NLSB -B NLSB  with the propagated borrow bit) is placed in element  0  of V R    163  and the borrow-out is placed in location  0  of V C  register  169 , element  0  of V R    163  is then stored to the NLSB position of result R  623 . This process is repeated for a total of sixteen 64-bit operations in order to subtract all 1024 bits of the source operands, and after the last operation, the location  0  of V C  register  169  (i.e., the final borrow-out bit) can be then stored to the 1025th bit of the result R  623  (labeled C), or analyzed to determine overflow or other properties of the result. It will be realized that this subtraction process can be extended to almost any length operands, for example two one-million-bit operands can be subtracted, one from the other, by approximately 16,000 such 64-bit operations. 
     In the above two examples, the carry or borrow bit is held inside the vector processor  100   n  (in location  0  of V C  register  169 ), and reused (or propagated) across the necessary number of operations or bits without having to be stored to memory and reloaded. The programmer (or operating system) also has the option of interrupting the series of extended-length operations by performing such a store operation on the carry bit, and then later reloading V C  register  169  with the saved carry bit to resume the addition or subtraction. For example, a task swap would need to save the carry bits from a task being swapped out, and then later, when the task is swapped back in, reload the carry bits to the state that was saved. 
     In another embodiment, the borrow bits (used for a subtract operation) in V C  register  169  are stored as a 0 bit for no borrow, and a 1 bit for a borrow (i.e., inverted from the description above). Such borrow bits are inverted going to the vector functional unit  165 , operated on as described above, then inverted going back into V C  register  169 . When V C  register  169  is initialized for an extended precision subtract in such an embodiment, V C  register  169  is zeroed (rather than set to all ones, as above), thus making initialization of V C  register  169  for subtract operations the same as in the addition operations. 
     The above example provides a simple case of adding (or subtracting) a single pair of numbers, each having an extended-length number of bits. To take better advantage of the vector-processing capabilities of vector processor  100   n , each of up to 128 (or more) extended-length numbers can be added to or subtracted from another corresponding number of extended-length numbers. 
     FIGS. 3A and 3B (together, FIG. 3) expand on the examples given above. 128 operands {right arrow over (A)}, each 1024 bits long (for example), are to be added to 128 operands {right arrow over (B)}, each 1024 bits long, and the 128 results {right arrow over (R)}, which each can be 1025 bits long is stored in result {right arrow over (R)}. The vector carry register (V C  register)  169  is initialized by zeroing all 128 bits of V C  register  169 . 
     In the example shown in FIG. 3, extended-length arithmetic is to be performed on vectors of long integers normally held in main memory  600 . Operands A and B, each having a number of significant bits that exceeds the word length of the arithmetic processor  100 , e.g., operands each being 1024 bits long (for example), are to be added together (for example), and the result R, which can be 1025 bits long is stored in R. In one embodiment, A, B and R are each vectors, representing ordered sets of numbers. Each vector has M elements, where M may exceed the number of elements in the vector registers (in one embodiment, each vector register holds 128 elements each having 64 bits) in the processor  100 . The vectors A, B, and R in memory are denoted as A 0  to A M , B 0  to B M , and R 0  to R M , respectively. 
     In one embodiment, the vectors A, B, and R are stored in memory by mapping (reordering) the bits to an order that facilitates fast loading and storing to and from the vector registers. For example, the 64 least-significant bits (LSBs) of element A 0  are held adjacent to the 64 LSBs of element A 1 , which are held adjacent to the 64 LSBs of element A 2 , and so on until the 64 LSBs of element A M . Similarly, the 64 LSBs of element B 0  are held adjacent to the 64 LSBs of element B 1 , which are held adjacent to the 64 LSBs of element B 2 , and so on until the 64 LSBs of element B M ; and the 64 LSBs of element R 0  are held adjacent to the 64 LSBs of element R 1 , which are held adjacent to the 64 LSBs of element R 2 , and so on until the 64 LSBs of element R M . Then, the 64 next-least-significant bits (NLSBs) of element A 0  are held adjacent to the 64 NLSBs of element A 1 , which are held adjacent to the 64 NLSBs of element A 2 , and so on until the 64 NLSBs of element A M . Similarly for the 64 NLSBs of each element of B and R. 
     In this way, (see FIG. 3A) the same order bits of each operands elements are fetched using a single vector load operation into a vector operand register (e.g., the 64 LSBs of each of 128 consecutive elements of A are fetched using one vector load operation  310  into V A  , and the 64 LSBs of each of 128 consecutive elements of B are fetched using one vector load operation  312  into V B ). 
     Operands {right arrow over (A)} and {right arrow over (B)} are each loaded into vector processor  100   n  in a sequence of: up to one-hundred-twenty-eight 64-bit load operations for each operand, operated on, and store operations of the results. I.e., the initial carry-in bits of locations 0 to 127 of V C  register  169  are zeroed, the least-significant-bit-position (LSB) 64 bits of each of the 128 operands {right arrow over (A)}  661  are loaded (load operation  310 ) into V A    161 , the LSB 64 bits of each of the 128 operands {right arrow over (B)}  662  are loaded (load operation  312 ) into element  0  of V B    162 , and a single vector command adds each element, starting with element  0 , of V A    161  and each corresponding element, starting with element  0 , of V B    162  together with the zero carry-in from each corresponding location, starting with location  0 , of V C  register  169 , the  128  sums are placed in the 128 corresponding elements, starting with element  0 , of V R    163  and the 128 carry-outs are placed in the 128 corresponding locations, starting with location  0  of V C  register  169 , and all 128 elements of V R    163  are then stored (store operation  314 ) to the LSB positions of result {right arrow over (R)}  663 . In one embodiment, the vector add operation is performed as a serial pipelined operation, in which one pair of elements is operated on in each successive clock cycle, and results are output serially, one result per clock cycle. Thus an earlier operation need not complete before the next operation commenses, and indeed, a pipeline can be 10 to 20 or more stages deep (i.e., 10 to 20 elements are fed into the pipeline before the first result is loaded into the result vector register). 
     In another embodiment, shown in FIG. 4 (which shows a two-pipe parallel pipeline vector extended-precision arithmetic processor), a plurality of elements are read from each operand register each clock cycle and fed into parallel pipelines (e.g., two pipelines as shown in FIG. 4, or four pipelines, or other number of parallel pipelines, based on the cost/performance needs of the designer) in order that results can be generated faster than the read/write cycle time of the vector registers. In the embodiment shown, the even-numbered vector register elements are fed into one pipeline ( 410 ,  412  and  414  for even elements from V A , V B  and V C  respectively), and the odd-numbered elements into a second pipeline ( 411 ,  413  and  415  for odd elements from V A , V B  and V C  respectively) for each operand (elements and carries) and each result (pipeline  416  for even result elements, pipeline  417  for odd result elements, pipeline  418  for even result carries and pipeline  419  for odd result carries), and parallel vector functional units  125 A and  125 B produce two results on each successive clock. For further details on vector pipeline operations, see U.S. Pat. No. 4,128,880 to Seymour Cray et al., which is hereby incorporated by reference. 
     FIG. 5 shows a process according to the present invention having vector extended-precision arithmetic processor. At block  510 , the vector registers (e.g., V A    161  and V B    162 ) are loaded from memory  600 . At block  512 , the V C  register  169  is initialized (e.g., in the first pass, it is zeroed for addition operations, or set to all ones for subtraction operations). At block  514 , a vector extended-precision instruction is decoded, and the operand and result vector registers are selected to connect to the respective pipelines. At block  516 , the vector functional unit performs successive arithmetic operations on the pipelined operands and carry bits. At block  518 , the arithmetic results and respective carry bits are output into the result vector register. At block  520 , the result vector register  163  is stored into memory. Control then loops back to block  510 . In one embodiment, the operations in the respective blocks are overlapped with operations of other blocks. For example, the vector arithmetic operations (block  514 - 518 ) can start with the first several elements before all of the last elements have been obtained from memory (block  510 ). Further, the store operation of block  520  for the first elements can start before all the result elements have been computed. In one embodiment, the order shown by the blocks and arrows of FIG. 5 is used. However, in some other embodiments, other orders of operations are used. 
     As noted above, in one embodiment, vector processor  100  has a set of vector registers  160 , any one of which can be used to hold operands or results. Thus, in this embodiment, V R  is specified as Vi, V A  is specified as Vj, and V B  is specified as Vk, and arithmetic is specified as Vi=Vj+Vk. 
     The 128 locations of V C  register  169  are now set up to propagate the carry its to the next vector operation, the 128 next-least-significant-bit-position (NLSB) 64 bits of operand {right arrow over (A)}  661  are loaded into elements  0 - 127  of Vj  161 , the 128 NLSB 64 bits of operand {right arrow over (B)}  662  are loaded into elements  0 - 127  of Vk  162 , with a single vector command Vj  161  and Vk  162  are added together with the propagated carry-ins from V C  register  169 , the sums are placed in elements  0 - 127  of Vi  163  and the carry-outs are placed in location  0 - 127  of V C  register  169 , the 128 elements of Vi  163  are then stored to the NLSB positions of result {right arrow over (R)}  663 . This process is repeated for a total of sixteen 128-by-64-bit operations in order to add all 1024 bits of the 128 pairs of source operands, and after the last operation, the locations  0 - 127  of V C  register  169  (i.e., the final 128 carry-out bits) are then stored to the 1025th bit of the result {right arrow over (R)}  663  (labeled C). It will be realized that this process can be extended to almost any length operands, for example 128 pairs of one-million-bit operands can be added together by approximately 16,000 such 128-by-64-bit vector operations. 
     Vector subtractions are performed in order to subtract multiple pairs one from the other, in like manner by extending the single-element subtraction operation described above to vector operations having up to 128 element operations, each with carry/borrow. The V C  register  169  is initialized to all ones (i.e., 128 one bits, one per location). 
     One embodiment of the present invention includes instructions for vector/vector integer add with carry (Vi, c←Vj+Vk, c); where the instruction specifies i, j, and k); scalar/vector integer add with carry (Vi, c←Sj+Vk, c); vector/vector integer subtract with carry (Vi, c←Vj−Vk, c); and scalar/vector integer subtract with carry (Vi, c←Sj−Vk, c). One such embodiment uses the vector mask register to hold the carry bits, i.e., this embodiment merges the vector mask register and V C  register  169 . In this embodiment for the vector/vector integer add, the n th  elements of the source registers and the n th  location of the vector mask register are added: Vi n , M n ←Vj n +Vk n +M n . For the scalar/vector integer add: Vi n , M n ←Sj+Vk n +M n . For the vector/vector integer subtract, the bits of source operand k are inverted, and n th  elements of the source registers and the n th  location of the vector mask register are added: Vi n , M n ←Vj n +NOT(Vk n )+M n . For the scalar/vector integer subtract: Vi n , M n ←Sj+NOT(Vk n )+M n . In one such embodiment, the carry/borrow bits are initialized by an instruction that loads the vector mask register from memory, and the carry/borrow bits are saved by an instruction that stores the vector mask register to memory. In one such embodiment, a task swap operation causes the current contents of the vector mask register to be saved into a task object in memory, and the vector mask register contents to be replaced with the proper corresponding information from the task object being swapped in. 
     In order to add more than 128 extended-length pairs of numbers, multiple series of vector operations are performed, i.e., the first 128 pairs are added (each from the LSB to the MSB (least-significant bits to the most-significant bits)), then the next 128 pairs of numbers are added (each from the LSB to the MSB), and so on until all the required numbers are added. 
     In one embodiment, extended-length vector operands, e.g., for the vector addition and subtraction operations described above, are stored in memory grouped for efficient loading and storing of bits to and from the vector registers. In one such embodiment, the LSB 64-bits of each of the 128 numbers to be transferred to one vector register are held in 128 successive consecutive 64-bit locations in memory, and the NLSB 64-bits of each of the 128 numbers to be transferred to that vector register are held in the next 128 successive consecutive 64-bit locations in memory, and so on. This organization allows the memory system to use page-mode accesses or other fast-mode sequential access methods to efficiently load and store operands, wherein each vector load and each vector store operations loads (or stores) vector elements from consecutive locations in memory. 
     Alternatively, the numbers can be held in memory in bit-order for every number, (i.e., each number having the entire number from LSB to MSB stored in consecutive locations in memory, followed by the entire next number, etc.) and the fetch mechanism of processor  100   n  can stride through memory while loading vectors, i.e., load the LSB 64 bits of the first number into element  0  of Vj, skip the rest of the first number, load the LSB 64 bits of the second number into element  1  of Vj, skip the rest of the second number, load the LSB 64 bits of the third number into element  2  of Vj, etc. For example, if each extended-length number (ELN) is 1024 bits wide, and each vector element is 64 bits wide, the corresponding bits of each ELN held in bit-order can be fetched by using a stride of 16 * 64 bits, i.e., loading 64 bits (the LSB of the first number going to element  0  of a vector register), skipping 960 bits in memory, loading 64 bits (the LSB of the second number going to element  1  of the vector register), skipping 960 bits in memory, loading 64 bits, etc. However, for extended-length numbers having very long lengths, the stride becomes very large, and efficient sequential memory access methods cannot be easily used. 
     In one embodiment, extended-length logical operations are provided using the V C  register  169  to accumulate condition codes (e.g., a cumulative zero (CZ) bit is initialized to one, and used as an input, if the input CZ bit is one and the logical operation produces zero results, the bit is output as one, else it is zeroed; If the bit is zero upon input, it is left as zero, regardless of the results of the logical operation). This produces extended-length logical operations. 
     In one embodiment, extended-length shift operations are provided using the V C  register  169  to hold shift-out bits from one operation for use as shift-in bits for successive operations on corresponding elements. In one such embodiment, each location of V C  register  169  hold a plurality of shift-in bits (as inputs) or shift-out bits (as outputs). This produces extended-length shift operations. In another such embodiment, another vector register (i.e., any one of the vector registers  160 ) wherein each element of the vector register holds a plurality of shift-in bits (as inputs) or shift-out bits (as outputs). 
     In one embodiment, extended-length multiplication is supported by extended-precision multiply operations that generate multiple extended-length partial results, which are then combined by successively adding multiple pairs of the extended-length partial results until all are summed to a final result. For example, in a first extended-length vector add operation, the first and second partial results are added to one another, the third and fourth partial results are added to one another, the fifth and sixth partial results are added to one another, the seventh and eighth partial results are added to one another, etc. Then, in a second extended-length vector add operation, the sum, from the first operation, of the first and second partial results are added to sum of the third and fourth partial results from the first operation, the sum of the fifth and sixth partial results, from the first operation, are added to the sum of the seventh and eighth partial results from the first operation, etc. Subsequent extended-length vector add operations further consolidate the partial-sum results until a single final sum is achieved, representing the product of the extended-length multiplication. In one such embodiment, an extended-length integer vector multiply instruction is performed in two passes; one pass to generate the lower results, and another pass to generate the upper results, and then an extended precision addition operation controls the operation to generate a product from the partial results. (E.g., in one embodiment, a 64-bit multiplier times a 64-bit multiplicand generates a 128-bit product, and to extend such an operation to N * 64-bit multiplicands, the multiplication is done in two passes, one pass generates the lower 64 bits of each 128-bit partial product, a second pass generates the upper 64 bits of each 128-bit partial product, each as an N-element vector. These N-element vectors are then added to one another with the proper alignment to generate the final result of the 64-bit multiplier times the N * 64-bit multiplicand. For longer multipliers, this process is repeated as many times as needed, and the partial results for each 64-bits of multiplier are accumulated.) 
     The extended-length arithmetic and logical operations of the present invention are used advantageously in a number of applications such as extended-precision precision mathematics (e.g., calculating pi to a large number of digits), navigation, and cryptography. 
     It is understood that the above description is intended to be illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reviewing the above description. The scope of the invention should, therefore, be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.