Showing results for

- Intel Community
- Software Development Technologies
- Intel® ISA Extensions
- Opcode semantics

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted
##

Hi,

Firstly, I apologize if this is the wrong forum; I could not find any other more relevant.

I'm looking for clarification in regards to a statement made that asserts there is a 1-cycle difference between the instructions:

0x3B (cmp reg, mem)

0x39 (cmp mem, reg)

As the two are functionally equivalent, I assume it would have to have something to do with the decoding circuit logic, but would like clarification if this statement reigns true in the first place.

Additionally, if this is true, where would I be able to find documentation of such details? All of the manuals I've read (even the IA32 optimization manual) does not mention these things.

Thanks,

Matt.

matt_j

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-13-2009
06:24 PM

21 Views

Opcode semantics

Firstly, I apologize if this is the wrong forum; I could not find any other more relevant.

I'm looking for clarification in regards to a statement made that asserts there is a 1-cycle difference between the instructions:

0x3B (cmp reg, mem)

0x39 (cmp mem, reg)

As the two are functionally equivalent, I assume it would have to have something to do with the decoding circuit logic, but would like clarification if this statement reigns true in the first place.

Additionally, if this is true, where would I be able to find documentation of such details? All of the manuals I've read (even the IA32 optimization manual) does not mention these things.

Thanks,

Matt.

3 Replies

Highlighted
##

matt_j

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-31-2009
02:28 AM

21 Views

Any ideas, anyone?

Highlighted
##

*Any ideas, anyone?*

no idea, but here is the best place I know forthis kind of subtleties:

http://www.agner.org/optimize/

bronxzv

New Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-31-2009
02:53 AM

21 Views

Quoting - matt.j

no idea, but here is the best place I know forthis kind of subtleties:

http://www.agner.org/optimize/

Highlighted
##

*Hi,*

Firstly, I apologize if this is the wrong forum; I could not find any other more relevant.

I'm looking for clarification in regards to a statement made that asserts there is a 1-cycle difference between the instructions:

0x3B (cmp reg, mem)

0x39 (cmp mem, reg)

As the two are functionally equivalent, I assume it would have to have something to do with the decoding circuit logic, but would like clarification if this statement reigns true in the first place.

Additionally, if this is true, where would I be able to find documentation of such details? All of the manuals I've read (even the IA32 optimization manual) does not mention these things.

Thanks,

Matt.

Just a guess, but normally an instruction with a memory location as the 'destination' operand takes an extra cycle for the write operation. cmp doesn't actually write anything to the destination, but it might simplify the logic to handle these instructions uniformly and skip the write at a later point (where latencymight also beless of an issue). Compilers shouldn't emit this anyway, so they can make compromises like these.

capens__nicolas

New Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-02-2009
12:38 AM

21 Views

Quoting - matt.j

Firstly, I apologize if this is the wrong forum; I could not find any other more relevant.

I'm looking for clarification in regards to a statement made that asserts there is a 1-cycle difference between the instructions:

0x3B (cmp reg, mem)

0x39 (cmp mem, reg)

As the two are functionally equivalent, I assume it would have to have something to do with the decoding circuit logic, but would like clarification if this statement reigns true in the first place.

Additionally, if this is true, where would I be able to find documentation of such details? All of the manuals I've read (even the IA32 optimization manual) does not mention these things.

Thanks,

Matt.

Just a guess, but normally an instruction with a memory location as the 'destination' operand takes an extra cycle for the write operation. cmp doesn't actually write anything to the destination, but it might simplify the logic to handle these instructions uniformly and skip the write at a later point (where latencymight also beless of an issue). Compilers shouldn't emit this anyway, so they can make compromises like these.

For more complete information about compiler optimizations, see our Optimization Notice.