This preview shows page 1. Sign up to view the full content.
Unformatted text preview: d some other stack element as the other, but they vary in the argument ordering, the result destination, and whether or not they pop the top stack element. Observe that the assembly code line fsubp is shorthand for fsubp %st,%st(1). This line corresponds to the subp instruction of our hypothetical stack evaluator. That is, it computes the difference between the top two stack elements, storing the result in %st(1), and then popping %st(0) so that the computed value ends up on the top of the stack. All of the binary operations listed in Figure 3.32 come in all of the variants listed for fsub in Figure 3.33. As an example, we can rewrite the code for the expression x = (a-b)*(-b+c) using the IA32 instructions. For exposition purposes we will still use symbolic names for memory locations and we assume these are double-precision values. 1 fldl b %st(0) 5 fsubl b · %st(1) %st(0) 2 fchs · %st(0) 6 fmulp ´ µ´ · µ %st(0) 3 faddl c %st(0) 7 fstpl x · %st(1) %st(0) fldl a As another example, we can write the code for the expr...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American