CSCI 2400 Lecture 6: Slides 06

44 views10 pages

Document Summary

Location of current code control point (%rip, ) Status of recent tests (cf, zf, sf, of) Implicitly set (as side effect) of arithmetic operations. Ex: addq src, dest (cid:15511) t = a+b. Cf set if carry/borrow out from most significant bit(msb) (unsigned overflow) Sf set if t < 0 (as signed) Of set if 2"s complement (signed) overflow (a>0 && b>0 && t<0) || (a<0 && b<0 && t>=0) For unsigned arithmetic, when result is a negative number this reports overflow. Cmpq b,a like computing a-b without setting destination. Cf set: if carry/borrow out from most significant bit(msb) (used for unsigned comparisons) Sf set: if (a-b) < 0 (as signed) Of set: if 2"s complement (signed) overflow (a>0 && b<0 && (a-b)<0) || (a<0 && b>0 && (a-b)>0) Testq src2, src1 testq b,a like computing a&b without setting destination. Sets condition codes based on value src1 & src2. Useful to have one of the operands be a mask.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents