{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture3-ia32-control

Lecture3-ia32-control - Announcements CS 3214 Computer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 3214 Computer Systems Godmar Back Lecture 3 Announcements Exercise 1 due Aug 30 Stay tuned for exercise 2 Project 1 due Sep 7 Should have teamed up now Should now have access to systems lab (McB 124) via Should now have access to systems lab (McB 124) via keycard Has Unix workstations for you to use Send email to me if it doesn’t work Make sure you’re on piazza CS 3214 Fall 2011 The following slides are taken with permission from Complete Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective 2 nd Edition (CS:APP 2e) Randal E. Bryant and David R. O'Hallaron http://csapp.cs.cmu.edu/public/instructors.html PROGRAMS AND DATA Part 2 CS 3214 Fall 2011 Condition Codes • Single Bit Registers CF Carry Flag SF Sign Flag ZF Zero Flag OF Overflow Flag • Implicitly Set By Arithmetic Operations addl Src , Dest C analog: t = a + b –CF set if carry out from most significant bit • Used to detect unsigned overflow –ZF set if t == 0 –SF set if t < 0 –OF set if two’s complement overflow (a>0 && b>0 && t<0) || (a<0 && b<0 && t>=0) Not Set by leal instruction CS 3214 Fall 2011 Setting Condition Codes (cont.) Explicit Setting by Compare Instruction cmpl Src2 , Src1 cmpl b,a like computing a-b without setting destination – CF set if carry out from most significant bit • Used for unsigned comparisons – ZF set if a == b – SF set if (a-b) < 0 – OF set if two’s complement overflow (a>0 && b<0 && (a-b)<0) || (a<0 && b>0 && (a-b)>0) CS 3214 Fall 2011 Setting Condition Codes (cont.) Explicit Setting by Test instruction testl Src2 , Src1 – Sets condition codes based on value of Src1 & Src2 • Useful to have one of the operands be a mask testl b,a like computing a&b without setting destination – ZF set when a&b == 0 – SF set when a&b < 0 CS 3214 Fall 2011
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon