It appears as if the call to getxs has no effect your

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: he destination operand for the setae instruction, since the operand must be a single byte. Instead, we write a code sequence based on a specific register and then use an extra data movement instruction to copy the resulting value to some part of the program state. Practice Problem 3.30: G CC provides a facility for extended-precision arithmetic. This can be used to implement function ok_smul, with the advantage that it is portable across machines. A variable declared as type “ long long” will have twice the size of normal long variable. Thus, the statement: long long prod = (long long) x * y; will compute the full 64-bit product of x and y. Write a version of ok_smul that does not use any asm statements. One would expect the same code sequence could be used for ok_umul, but GCC uses the imull (signed multiply) instruction for both signed and unsigned multiplication. This generates the correct value for either product, but it sets the carry flag according to the rules for signed multiplication. We therefore ne...
View Full Document

Ask a homework question - tutors are online