Assembler Language Reference
Total Page:16
File Type:pdf, Size:1020Kb
AIX Version 7.1 Assembler Language Reference IBM Note Before using this information and the product it supports, read the information in “Notices” on page 635 . This edition applies to AIX Version 7.1 and to all subsequent releases and modifications until otherwise indicated in new editions. © Copyright International Business Machines Corporation 2010, 2018. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this document.............................................................................................xi Highlighting..................................................................................................................................................xi Case sensitivity in AIX................................................................................................................................. xi ISO 9000......................................................................................................................................................xi Assembler language reference...............................................................................1 What's new...................................................................................................................................................1 Assembler overview.....................................................................................................................................1 Features of the AIX® assembler............................................................................................................. 1 Assembler installation............................................................................................................................8 Processing and storage................................................................................................................................8 POWER® family and PowerPC® architecture overview...........................................................................8 Branch processor................................................................................................................................. 17 Fixed-point processor.......................................................................................................................... 18 Floating-point processor......................................................................................................................22 Syntax and semantics................................................................................................................................24 Character set........................................................................................................................................ 24 Reserved words....................................................................................................................................25 Line format............................................................................................................................................25 Statements........................................................................................................................................... 26 Symbols................................................................................................................................................ 28 Relocation specifiers............................................................................................................................31 Constants..............................................................................................................................................32 Operators..............................................................................................................................................35 Expressions.......................................................................................................................................... 36 Addressing................................................................................................................................................. 42 Absolute addressing.............................................................................................................................42 Absolute immediate addressing.......................................................................................................... 42 Relative immediate addressing............................................................................................................42 Explicit-based addressing....................................................................................................................43 Implicit-based addressing................................................................................................................... 43 Location counter...................................................................................................................................44 Assembling and linking a program............................................................................................................ 44 Assembling and linking a program.......................................................................................................44 Understanding assembler passes........................................................................................................46 Interpreting an assembler listing.........................................................................................................47 Interpreting a symbol cross-reference................................................................................................51 Subroutine linkage convention............................................................................................................ 52 Understanding and programming the toc............................................................................................72 Using thread local storage................................................................................................................... 77 Running a program............................................................................................................................... 79 Extended instruction mnemonics............................................................................................................. 80 Extended mnemonics of branch instructions......................................................................................80 Extended mnemonics of condition register logical instructions.........................................................87 Extended mnemonics of fixed-point arithmetic instructions............................................................. 88 Extended mnemonics of fixed-point compare instructions................................................................88 Extended mnemonics of fixed-point load instructions....................................................................... 89 Extended mnemonics of fixed-point logical instructions....................................................................89 Extended mnemonics of fixed-point trap instructions........................................................................89 Extended mnemonic mtcr for moving to the condition register......................................................... 91 iii Extended mnemonics of moving from or to special-purpose registers..............................................91 Extended mnemonics of 32-bit fixed-point rotate and shift instructions.......................................... 96 Extended mnemonics of 64-bit fixed-point rotate and shift instructions.......................................... 99 Migrating source programs......................................................................................................................101 Functional differences for POWER® family and PowerPC® instructions........................................... 101 Differences between POWER® family and PowerPC® instructions with the same op code............. 102 Extended mnemonics changes..........................................................................................................104 POWER® family instructions deleted from PowerPC®....................................................................... 106 Added PowerPC® instructions............................................................................................................107 Instructions available only for the PowerPC® 601 RISC microprocessor.........................................108 Migration of branch conditional statements with no separator after mnemonic.............................108 Instruction set......................................................................................................................................... 109 abs (Absolute) instruction..................................................................................................................109 add (Add) or cax (Compute Address) instruction..............................................................................111 addc or a (Add Carrying) instruction..................................................................................................113 adde or ae (Add Extended) instruction..............................................................................................115 addi (Add Immediate) or cal (Compute Address Lower) instruction................................................117