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 8807629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:24:51+00:00 2026-06-14T02:24:51+00:00

Can a variable shift generate a partial register stall (or register recombining µops) on

  • 0

Can a variable shift generate a partial register stall (or register recombining µops) on ecx? If so, on which microarchitecture(s)?

I have tested this on Core2 (65nm), which seems to read only cl.

_shiftbench:
    push rbx
    mov edx, -10000000
    mov ecx, 5
  _shiftloop:
    mov bl, 5   ; replace by cl to see possible recombining
    shl eax, cl
    add edx, 1
    jnz _shiftloop
    pop rbx
    ret

Replacing mov bl, 5 by mov cl, 5 made no difference, which it would have if there was register recombining going on, as can be demonstrated by replacing shl eax, cl by add eax, ecx (in my tests the version with add experienced a 2.8x slowdown when writing to cl instead of bl).


Test results:

  • Merom: no stall observed
  • Penryn: no stall observed
  • Nehalem: no stall observed

Update: the new shrx-group of shifts in Haswell does show that stall. The shift-count argument is not written as an 8-bit register, so that might have been expected, but the textual representation really doesn’t say anything about such micro-architectural details.

  • 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-14T02:24:52+00:00Added an answer on June 14, 2026 at 2:24 am

    As currently phrased (“Can a shift using the CL register …”) the question’s title contains its own answer: with a modern processor, there is never a partial register stall on CL because CL can never be recombined from something smaller.

    Yes, the processor knows that the amount you are shifting by is effectively contained in CL, the 5 or 6 least significant bits of CL to be precise. One way it could have stalled on ECX was if the granularity at which it considered instruction dependencies did not go below full registers. This worry is obsolete, though: the newest Intel processor that would have consider the whole ECX register as dependency was the Pentium 4. See Agner Fog’s unofficial optimization manual, page 121. But then again, with the P4 this would not be called a partial register stall, the program could only be victim of a false dependency (say, if CH was modifier just before the shift).

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

Sidebar

Related Questions

I have a variable coming into a stored procedure. This variable can either have
How I can have variable number of parameters in my function in C++. Analog
How can return a variable from a thead (I have the threads handle too).
In java can an instance variable and a method have the same name without
I'm trying to parse returned information that can have a variable amount of data
How can I resolve this case of 'Useless use of a variable in a
I have this code which shifts the alphabet by a certain amount. The size
Possible Duplicate: C++ Returning reference to local variable Can a local variable’s memory be
Can we get variable name('PHPSESSID') defined php.ini through some function in PHP? I know
How can we access variable from one Xaml file in to another xaml file

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.