collab/polyglot-riscv-arm
what if the same machine code was valid riscv and arm asm
git clone https://git.julia.blue/collab/polyglot-riscv-arm
885cc4e
main
1< ?xml version="1.0" encoding="utf-8"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" > 3< html xmlns ="http://www.w3.org/1999/xhtml ">< head >< link rel ="stylesheet "type ="text/css "href ="insn.css "/>< meta name ="generator "content ="iform.xsl "/>< title > POP -- AArch32</ title ></ head >< body >< table style ="margin: 0 auto; ">< tr >< td >< div class ="topbar ">< a href ="index.html "> Base Instructions</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="fpsimdindex.html "> SIMD&FP Instructions</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="a32_encindex.html "> A32 Instructions by Encoding</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="t32_encindex.html "> T32 Instructions by Encoding</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="shared_pseudocode.html "> Shared Pseudocode</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="notice.html "> Proprietary Notice</ a ></ div ></ td ></ tr ></ table >< hr />< h2 class ="instruction-section "> POP</ h2 > 4< p class ="aml "> Pop Multiple Registers from Stack loads multiple general-purpose registers from the stack, loading from consecutive memory locations starting at the address in SP, and updates SP to point just above the loaded data.</ p > 5< p class ="aml "> The lowest-numbered register is loaded from the lowest memory address, through to the highest-numbered register from the highest memory address. See also< a class ="armarm-xref "title ="Reference to Armv8 ARM section "data-linkend ="CHDDBEDG "> Encoding of lists of general-purpose registers and the PC</ a > .</ p > 6< p class ="aml "> The registers loaded can include the PC, causing a branch to a loaded address. This is an interworking branch, see< a class ="armarm-xref "title ="Reference to Armv8 ARM section "data-linkend ="BEICJFEH "> Pseudocode description of operations on the AArch32 general-purpose registers and the PC</ a > .</ p > 7 8< h3 class ="classheading ">< a id ="iclass_t1 "/> T1</ h3 >< p class ="desc "/>< div class ="regdiagram-16 ">< table class ="regdiagram ">< thead >< tr >< td > 15</ td >< td > 14</ td >< td > 13</ td >< td > 12</ td >< td > 11</ td >< td > 10</ td >< td > 9</ td >< td > 8</ td >< td > 7</ td >< td > 6</ td >< td > 5</ td >< td > 4</ td >< td > 3</ td >< td > 2</ td >< td > 1</ td >< td > 0</ td ></ tr ></ thead >< tbody >< tr class ="firstrow ">< td class ="l "> 1</ td >< td > 0</ td >< td > 1</ td >< td class ="r "> 1</ td >< td class ="lr "> 1</ td >< td class ="l "> 1</ td >< td class ="r "> 0</ td >< td class ="lr "> P</ td >< td colspan ="8 "class ="lr "> register_list</ td ></ tr ></ tbody ></ table ></ div >< div class ="encoding ">< h4 class ="encoding "> T1</ h4 >< a id ="POP_T1 "/>< p class ="asm-code "> POP{< a href ="#sa_c "title ="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}} "> <c></ a > }{< a href ="#sa_q "title ="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}} "> <q></ a > }< a href ="#sa_registers "title ="List of one or more registers to be loaded (field "register_list") "> <registers></ a > 9 // 10 11 (Preferred syntax) 12</ p >< p class ="asm-code "> LDM{< a href ="#sa_c "title ="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}} "> <c></ a > }{< a href ="#sa_q "title ="See {xref{ARMARM_Babbefhf}{Standard assembler syntax fields}} "> <q></ a > } SP!,< a href ="#sa_registers "title ="List of one or more registers to be loaded (field "register_list") "> <registers></ a > 13 // 14 15 (Alternate syntax) 16</ p ></ div >< p class ="pseudocode "> constant registers = P:'0000000':register_list; constant UnalignedAllowed = FALSE; 17if< a href ="shared_pseudocode.html#impl-shared.BitCount.1 "title ="function: integer BitCount(bits(N) x) "> BitCount</ a > (registers) < 1 then UNPREDICTABLE; 18if registers<15> == '1' &&< a href ="shared_pseudocode.html#impl-aarch32.InITBlock.0 "title ="function: boolean InITBlock() "> InITBlock</ a > () && !< a href ="shared_pseudocode.html#impl-aarch32.LastInITBlock.0 "title ="function: boolean LastInITBlock() "> LastInITBlock</ a > () then UNPREDICTABLE;</ p >< h3 > CONSTRAINED UNPREDICTABLE behavior</ h3 >< p > If< span class ="pseudocode "> BitCount(registers) < 1</ span > , then one of the following behaviors must occur:</ p >< ul >< li > The instruction is< span class ="arm-defined-word "> undefined</ span > .</ li >< li > The instruction executes as< span class ="asm-code "> NOP</ span > .</ li >< li > The instruction targets an unspecified set of registers. These registers might include R15. If the instruction specifies writeback, the modification to the base address on writeback might differ from the number of registers loaded.</ li ></ ul > 19< div class ="encoding-notes "> 20< p class ="aml "> For more information about the< span class ="arm-defined-word "> constrained unpredictable</ span > behavior of this instruction, see< a class ="armarm-xref "title ="Reference to Armv8 ARM section "data-linkend ="CJAEGDJC "> Architectural Constraints on UNPREDICTABLE behaviors</ a > .</ p > 21</ div >< h3 class ="explanations "> Assembler Symbols</ h3 >< div class ="explanations ">< table >< col class ="asyn-l "/>< col class ="asyn-r "/>< tr >< td > <c></ td >< td >< a id ="sa_c "/> 22 23< p class ="aml "> See< a class ="armarm-xref "title ="Reference to Armv8 ARM section "data-linkend ="Babbefhf "> Standard assembler syntax fields</ a > .</ p > 24 25</ td ></ tr ></ table >< table >< col class ="asyn-l "/>< col class ="asyn-r "/>< tr >< td > <q></ td >< td >< a id ="sa_q "/> 26 27< p class ="aml "> See< a class ="armarm-xref "title ="Reference to Armv8 ARM section "data-linkend ="Babbefhf "> Standard assembler syntax fields</ a > .</ p > 28 29</ td ></ tr ></ table >< table >< col class ="asyn-l "/>< col class ="asyn-r "/>< tr >< td > <registers></ td >< td >< a id ="sa_registers "/> 30 31< p class ="aml "> Is a list of one or more registers to be loaded, separated by commas and surrounded by { and }.</ p > 32< p class ="aml "> The registers in the list must be in the range R0-R7, encoded in the "register_list" field, and can optionally include the PC. If the PC is in the list, the "P" field is set to 1, otherwise this field defaults to 0.</ p > 33< p class ="aml "> If the PC is in the list, the instruction must be either outside any IT block, or the last instruction in an IT block.</ p > 34 35</ td ></ tr ></ table ></ div >< div class ="syntax-notes "/> 36< div class ="ps ">< a id ="execute "/>< h3 class ="pseudocode "> Operation</ h3 > 37< p class ="pseudocode "> if< a href ="shared_pseudocode.html#impl-aarch32.ConditionPassed.0 "title ="function: boolean ConditionPassed() "> ConditionPassed</ a > () then 38 EncodingSpecificOperations(); 39 address =< a href ="shared_pseudocode.html#impl-aarch32.R.read.1 "title ="accessor: bits(32) R[integer n] "> R</ a > [13]; 40 for i = 0 to 14 41 if registers<i> == '1' then 42< a href ="shared_pseudocode.html#impl-aarch32.R.write.1 "title ="accessor: R[integer n] = bits(32) value "> R</ a > [i] = if UnalignedAllowed then< a href ="shared_pseudocode.html#impl-aarch32.MemU.read.2 "title ="accessor: bits(8*size) MemU[bits(32) address, integer size] "> MemU</ a > [address,4] else< a href ="shared_pseudocode.html#impl-aarch32.MemA.read.2 "title ="accessor: bits(8*size) MemA[bits(32) address, integer size] "> MemA</ a > [address,4]; 43 address = address + 4; 44 if registers<15> == '1' then 45 if UnalignedAllowed then 46 if address<1:0> == '00' then 47< a href ="shared_pseudocode.html#impl-aarch32.LoadWritePC.1 "title ="function: LoadWritePC(bits(32) address) "> LoadWritePC</ a > (< a href ="shared_pseudocode.html#impl-aarch32.MemU.read.2 "title ="accessor: bits(8*size) MemU[bits(32) address, integer size] "> MemU</ a > [address,4]); 48 else 49 UNPREDICTABLE; 50 else 51< a href ="shared_pseudocode.html#impl-aarch32.LoadWritePC.1 "title ="function: LoadWritePC(bits(32) address) "> LoadWritePC</ a > (< a href ="shared_pseudocode.html#impl-aarch32.MemA.read.2 "title ="accessor: bits(8*size) MemA[bits(32) address, integer size] "> MemA</ a > [address,4]); 52 if registers<13> == '0' then< a href ="shared_pseudocode.html#impl-aarch32.R.write.1 "title ="accessor: R[integer n] = bits(32) value "> R</ a > [13] =< a href ="shared_pseudocode.html#impl-aarch32.R.read.1 "title ="accessor: bits(32) R[integer n] "> R</ a > [13] + 4*< a href ="shared_pseudocode.html#impl-shared.BitCount.1 "title ="function: integer BitCount(bits(N) x) "> BitCount</ a > (registers); 53 if registers<13> == '1' then< a href ="shared_pseudocode.html#impl-aarch32.R.write.1 "title ="accessor: R[integer n] = bits(32) value "> R</ a > [13] = bits(32) UNKNOWN;</ p > 54</ div > 55< hr />< table style ="margin: 0 auto; ">< tr >< td >< div class ="topbar ">< a href ="index.html "> Base Instructions</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="fpsimdindex.html "> SIMD&FP Instructions</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="a32_encindex.html "> A32 Instructions by Encoding</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="t32_encindex.html "> T32 Instructions by Encoding</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="shared_pseudocode.html "> Shared Pseudocode</ a ></ div ></ td >< td >< div class ="topbar ">< a href ="notice.html "> Proprietary Notice</ a ></ div ></ td ></ tr ></ table >< p class ="versions "> 56 Internal version only: isa v01_31, pseudocode v2024-09_rel 57 ; Build timestamp: 2024-09-26T13:26 58</ p >< p class ="copyconf "> 59 Copyright © 2010-2024 Arm Limited or its affiliates. All rights reserved. 60 This document is Non-Confidential. 61</ p ></ body ></ html >