0

If i have a binary value of 10000001 in cl and i execute the following command shl cl,2 (x86) will the carry flag be set to 1 or 0?

im a little confused since the last number to "fall off" was a 0 however we are losing data.

bla bla
  • 83
  • 1
  • 1
  • 10
  • possible duplicate of [Difference between SHL and SAL in 80x86](http://stackoverflow.com/questions/8373415/difference-between-shl-and-sal-in-80x86) –  Mar 19 '14 at 20:28
  • @MikeW that doesn't actually address this question, as far as I can tell – harold Mar 19 '14 at 20:30
  • After your edit, you're not losing anything anymore. Don't you mean `cl`? Otherwise this question doesn't actually ask what it's asking, so to speak. – harold Mar 19 '14 at 20:32
  • @Harold First answer to that question specifically refers to what happens to Carry. –  Mar 19 '14 at 20:34
  • @MikeW ok I suppose it does - but sort of accidentally, it's really about something else. – harold Mar 19 '14 at 20:36
  • 1
    Shift inevitably loses data. So does AND and OR :) – Seva Alekseyev Mar 19 '14 at 20:50

1 Answers1

5

The manual explicitly says:

At the end of the shift operation, the CF flag contains the last bit shifted out of the destination operand.

The other bits don't matter. They're just gone.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
harold
  • 61,398
  • 6
  • 86
  • 164