Fortunately you have access to a o version of code

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: character. Input and output operands are denoted by references %0, %1, and so on, up to possibly %9. Operands are numbered, according to their ordering first in the output list and then in the input list. Register names such as “%eax” must be written with an extra ‘%’ symbol, e.g., “%%eax.” The following is a better implementation of ok_smul using the extended assembly statement to indicate to the compiler that the assembly code generates the value for variable result: code/asm/okmul.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 /* Uses the extended assembly statement to get reliable code */ int ok_smul3(int x, int y, int *dest) { int result; *dest = x*y; /* Insert the following setae %bl movzbl %bl, result */ asm("setae %%bl; movzbl : "=r" (result) /* : /* : "%ebx" /* ); return result; } code/asm/okmul.c assembly code: # Set low-order byte # Zero extend to be result %%bl,%0" Output */ No inputs */ Overwrites */ The first assembly instruction stores the test re...
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.

Ask a homework question - tutors are online