HPlogo HP Assembler Reference Manual: HP 9000 Computers > Chapter 2 Program Structure

Registers and Register Mnemonics

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

PA-RISC processors have four sets of registers:

  • General

  • Floating-point

  • Space

  • Control

Data is loaded from memory into general or floating-point registers and stored into memory from general or floating-point registers. Arithmetic and logical operations are performed on the contents of the general registers. On PA-RISC 1.0 or 1.1 each general register is 32 bits wide. On PA-RISC 2.0 each general register is 64 bits wide. On PA-RISC 2.0W (true 64-bit environment) each general register is 64 bits wide.

There are 32 general registers, denoted as %r0 through %r31. General register %r0 is special because "writes" into it are ignored, and it always reads as zero. The remaining general registers can be used normally, with the caution that %r1 is the implicit target register for the ADDIL instruction, %r31 is the implicit link register for the BLE instruction, and for PA-RISC 2.0 only, %r2 is the implicit link register for the BLVE instruction. Certain general registers also have predefined conventional uses. Refer to Table 2-7 “Register Procedure Calling Conventions”. You can find detailed information on both 32-bit and 64-bit runtime architecture under the topic PA-RISC Architecture at http://www.software.hp.com/STK/.

PA-RISC 1.0 machines have 16 floating-point registers; PA-RISC 1.1, 2.0, and 2.0W (true 64-bit environment) machines have 32 floating-point registers. Each register is capable of holding either a single- or double-precision floating-point number in IEEE format. These registers are denoted %fr0 through %fr15 for PA-RISC 1.0 and %fr0 through %fr31 for PA-RISC 1.1, 2.0, and 2.0W.

Registers %fr1, %fr2, and %fr3 are exception registers and are not available to the programmer. Floating-point register %fr0 contains a permanent floating-point zero when used in an arithmetic operation; when written or read with floating-point loads or stores, the floating-point status register is actually accessed.

In addition, on PA-RISC 1.1, 2.0. and 2.0W the left and right halves of the floating-point registers can be accessed as separate single-precision registers by using an L or R suffix.

For example, %fr8R accesses the right-most 32 bits of %fr8 as a single-precision number.

The L or R suffixes can only be used on the predefined floating-point registers in the form %frnn, where nn is the register number. It is not legal to use L or R with an integer value. For example, %fr8R is legal; 8R is not legal.

The space registers form the basis of the virtual memory system. Each of the eight space registers can hold a 16- or 32-bit space identifier, depending on the hardware model. The space registers are denoted as %sr0 through %sr7. Space register %sr0 is set implicitly by the BLE instruction, and space registers %sr5 through %sr7 cannot be modified except by code running at the most privileged level.

The control registers contain system-state information. There are 25 control registers, denoted as %cr0 and %cr8 through %cr31. Of these registers, only %cr11 (%sar), the shift amount register, and %cr16 (%itmt), the interval timer, are normally accessible to the user-level programmer. The other registers are accessed only by code running at the most privileged level.

Register operands are denoted by register-typed constants because the Assembler needs to be able to differentiate between general registers, space registers, floating point registers, and ordinary integer constants.

To make assembly code more readable, you can use the .REG directive to declare a symbolic name as an alias for a predefined register. The predefined registers have a register type associated with them. The Assembler enforces register type checking and issues a warning message if the wrong kind of register is used within an operand. A warning is also issued when an integer constant or absolute expression is found where a register is expected. You must use the .REG directive to define symbolic register names. If a symbolic name defined in an .EQU directive is used where a register symbol is expected, the Assembler issues a warning message, because it considers an .EQU defined symbol to be a simple integer constant.

NOTE: If an absolute expression is used instead of a register or register-typed symbol name, the Assembler issues warning message number 41.

This warning can be suppressed with the -w41 command-line option. Future versions of the Assembler may not always allow an absolute expression where a register is expected.

The following example demonstrates the correct usage of the .REG directive:

tblptr    .REG   %r20
aka_tbl .REG tblptr

Predefined registers are shown in the following tables. All of the mnemonics begin with the % character, so they do not conflict with any programmer-defined symbols.

Table 2-2 General Registers

%r0

%r8

%r16

%r24

%r1

%r9

%r17

%r25

%r2

%r10

%r18

%r26

%r3

%r11

%r19

%r27

%r4

%r12

%r20

%r28

%r5

%r13

%r21

%r29

%r6

%r14

%r22

%r30

%r7

%r15

%r23

%r31

 

Table 2-3 Single-Precision Floating-Point Registers

%fr0L

%fr8L

%fr16L

%fr24L

%fr1L

%fr9L

%fr17L

%fr25L

%fr2L

%fr10L

%fr18L

%fr26L

%fr3L

%fr11L

%fr19L

%fr27L

%fr4L

%fr12L

%fr20L

%fr28L

%fr5L

%fr13L

%fr21L

%fr29L

%fr6L

%fr14L

%fr22L

%fr30L

%fr7L

%fr15L

%fr23L

%fr31L

%fr0R

%fr8R

%fr16R

%fr24R

%fr1R

%fr9R

%fr17R

%fr25R

%fr2R

%fr10R

%fr18R

%fr26R

%fr3R

%fr11R

%fr19R

%fr27R

%fr4R

%fr12R

%fr20R

%fr28R

%fr5R

%fr13R

%fr21R

%fr29R

%fr6R

%fr14R

%fr22R

%fr30R

%fr7R

%fr15R

%fr23R

%fr31R

Accessing the right half of floating-point registers separately is possible only on PA-RISC 1.1 or later architectures.

Registers %fr16L through %fr31L and %fr16R through %fr31R are available only on PA-RISC 1.1 or later architectures.

 

Table 2-4 Double-Precision Floating-Point Registers

%fr0

%fr8

%fr16

%fr24

%fr1

%fr9

%fr17

%fr25

%fr2

%fr10

%fr18

%fr26

%fr3

%fr11

%fr19

%fr27

%fr4

%fr12

%fr20

%fr28

%fr5

%fr13

%fr21

%fr29

%fr6

%fr14

%fr22

%fr30

%fr7

%fr15

%fr23

%fr31

Registers %fr16 through %fr31 are available only on PA-RISC 1.1 or later architectures.

 

Table 2-5 Space Registers

%sr0

%sr2

%sr4

%sr6

%sr1

%sr3

%sr5

%sr7

 

Table 2-6 Control Registers

Registers

Synonyms

Registers

Synonyms

%cr0

%rctr

%cr20

%isr

%cr8

%pidr1

%cr21

%ior

%cr9

%pidr2

%cr22

%ipsw

%cr10

%ccr

%cr23

%eirr

%cr11

%sar

%cr24

%tr0 %ppda

%cr12

%pidr3

%cr25

%tr1 %hta

%cr13

%pidr4

%cr26

%tr2

%cr14

%iva

%cr27

%tr3

%cr15

%eiem

%cr28

%tr4

%cr16

%itmr

%cr29

%tr5

%cr17

%pcsq

%cr30

%tr6

%cr18

%pcoq

%cr31

%tr7

%cr19

%iir

 

Some additional predefined register mnemonics are provided in Table 2-7 “Register Procedure Calling Conventions” to match the standard procedure-calling convention. This is discussed briefly in Chapter 3 “HP-UX Architecture Conventions”. You can find detailed information on both 32-bit and 64-bit calling conventions under the topic PA-RISC Architecture at URL: http://www.software.hp.com/STK/.

Table 2-7 Register Procedure Calling Conventions

Register

Synonyms

Description

%fr4

%farg0 %fret

Floating argument, return value

%fr5

%farg1

Second floating argument

%fr6

%farg2

Third floating argument

%fr7

%farg3

Fourth floating argument

%r2

%rp

Return link

%r19

%t4

Fourth temporary register

%r20

%t3

Third temporary register

%r21

%t2

Second temporary register

%r22

%t1

First temporary register

%r23

%arg3

Argument word 3

%r24

%arg2

Argument word 2

%r25

%arg1

Argument word 1

%r26

%arg0

Argument word 0

%r27

%dp

Data pointer

%r28

%ret0

Return value

%r29

%ret1 %sl

Return value, static link

%r30

%sp

Stack pointer

%r31

%mrp

Millicode return link

%sr1

%sret %sarg

Return value, argument

 

In addition, there is a special register mnemonic defined as %previous_sp, that allows access to the previous value of the stack pointer.

%previous_sp must be used in the position of a base register; it can be used only between .ENTER and .LEAVE pseudo-operations. %previous_sp is the same as %sp unless the current .PROC has a large frame (that is, .CALLINFO specified FRAME > 8191) or .CALLINFO specified .ALLOCA_FRAME. In those two cases, %previous_sp is the same as %r3, and %r3 is set up by the .ENTER pseudo-operation.

© 1998 Hewlett-Packard Development Company, L.P.