Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7825409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:57:58+00:00 2026-06-02T08:57:58+00:00

I tried to find out the speed difference between plain loops, loop loops and

  • 0

I tried to find out the speed difference between plain loops, loop loops and builtin rep loops. I wrote three programs to compare the behavior:

Program 1

_start: xor %ecx,%ecx
0:      not %ecx
        dec %ecx
        jnz 0b
        mov $1,%eax
        xor %ebx,%ebx
        int $0x80       # syscall 1: exit

Program 2

_start: xor %ecx,%ecx
        not %ecx
        loop .
        mov $1,%eax
        xor %ebx,%ebx
        int $0x80

Program 3

_start: xor %ecx,%ecx
        not %ecx
        rep nop # Do nothing but decrement ecx
        mov $1,%eax
        xor %ebx,%ebx
        int $0x80

It turned out the third program doesn’t work as expected, and some recherche tells me, that rep nop aka pause does something completely unrelated.

What are the rep, repz and repnz prefixes doing, when the instruction following them is not a string instruction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:58:00+00:00Added an answer on June 2, 2026 at 8:58 am

    It depends. rep ret is sometimes used to avoid bad performance of jumping directly to a ret on certain AMD processors. The rep (F3) and repne (F2) prefixes are also used as Mandatory Prefix for many SSE instructions (for example they change packed-single variants to scalar-singe or scalar-double variants). pause (spin lock hint) is an alias of rep nop. Some other new instructions use a “fake rep prefix” as well (popcnt, crc32, vmxon, etc). The “fake” or Mandatory Prefix comes before the optional REX prefix, so it can’t be said to be part of the opcode, it really is a prefix.

    Other operations generate an #UD if prefixed with a rep.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found many similar posts and even tried to find out how to
i tried to find it out with previous answers but i cannot do it
Ive tried searching for hours now and cannot find out why my code (aka,
I've tried my best to find out a solution with the many script questions
I tried to find the difference on Google. BUT I 'm not able to
I tried to find out that gd means in boost library name and I
I tried to find out how to move my working copy. I know SVN
I tried to find out, but I couldn't. A image, for example, 241x76 has
Using Fiddler and also Live HTTP Headers I tried to find out how Firefox
I tried to find out how to safely assert that preferences aren't stored anywhere.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.