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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:24:22+00:00 2026-06-08T00:24:22+00:00

I have the following assembly code: __asm__ __volatile__ ( 1: subi %0, 1 \n\t

  • 0

I have the following assembly code:

  __asm__ __volatile__ (
  "1: subi %0, 1"        "\n\t"
  "brne 1b"
  : "=d" (__count)
  : "M" (__count));

which results in the following compiler ouptut

  ce:   81 50           subi    r24, 0x01   ; 1
  d0:   f1 f7           brne    .-4         ; 0xce <main>
  d2:   80 e0           ldi r24, 0x00   ; 0
  d4:   90 e0           ldi r25, 0x00   ; 0

How can i achieve the following:

  ce:   81 50           subi    r16, 0x01   ; 1
  d0:   f1 f7           brne    .-4         ; 0xce <main>
  d2:   80 e0           ldi r16, 0x00   ; 0

Is it even possible to tell the compiler to use r16 instead of r24:r25? That way i can reduce the cycle count by 1 which is used by the ldi r25,0x00 line.

Thanks
Jack

  • 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-08T00:24:23+00:00Added an answer on June 8, 2026 at 12:24 am

    This question is old and you most certainly already solved it, but for archiving purposes, let me answer it: yes, you can. Declare __count like this:

    register <type> __count __asm__ ("r16");
    

    And voilá! Using the GNU extension explicit register variables, you’ve declared that the C variable __count should always be placed in r16 wherever it is used – including outside of an ASM call.

    Note that this declaration should have local scope, otherwise the compiler will avoid using this register in other functions.

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

Sidebar

Related Questions

So I have the following assembly language code which I need to convert into
My EAX register contains the xxxxxx9D value and I have the following assembly code:
I have a simple assembly code file called exit.s that looks like the following:
I have the following code: namespace ConectorV2 { [assembly:InternalsVisibleTo(Pruebas)] internal static class Utilidades {
I have the following Powershell code: Add-Type -Assembly System.Configuration [ExeConfigurationFileMap] $configMap = New-Object ExeConfigurationFileMap
I have the following assembly code snippet I am trying to understand. It is
I have the following code which assembles and runs fine on Windows XP 32
OK, I have the following bit of code: Assembly assembly = Assembly.LoadFile(W:\\AssemblyFoo.dll); foreach (Type
I were asked to analyze an assembly code, which was generated from following c++
Consider i have an assembly(class library dll) which i have loaded using the following

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.