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

  • Home
  • SEARCH
  • 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 45679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:50:49+00:00 2026-05-10T15:50:49+00:00

Does anyone know how I can get rid of the following assembler warning? Code

  • 0

Does anyone know how I can get rid of the following assembler warning?

Code is x86, 32 bit:

int test (int x) {   int y;   // do a bit-rotate by 8 on the lower word. leave upper word intact.   asm ('rorw $8, %0\n\t': '=q'(y) :'0'(x));   return y; } 

If I compile it I get the following (very valid) warning:

Warning: using `%ax' instead of `%eax' due to `w' suffix 

What I’m looking for is a way to tell the compiler/assembler that I want to access the lower 16 bit sub-register of %0. Accessing the byte sub-registers (in this case AL and AH) would be nice to know as well.

I’ve already chosen the ‘q’ modifier, so the compiler is forced to use EAX, EBX, ECX or EDX. I’ve made sure the compiler has to pick a register that has sub-registers.

I know that I can force the asm-code to use a specific register (and its sub-registers), but I want to leave the register-allocation job up to the compiler.

  • 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. 2026-05-10T15:50:50+00:00Added an answer on May 10, 2026 at 3:50 pm

    You can use %w0 if I remember right. I just tested it, too. 🙂

    int test(int x) {     int y;     asm ("rorw $8, %w0" : "=q" (y) : "0" (x));     return y; } 

    Edit: In response to the OP, yes, you can do the following too:

    int test(int x) {     int y;     asm ("xchg %b0, %h0" : "=Q" (y) : "0" (x));     return y; } 

    For x86 it’s documented in the x86 Operand Modifiers section of the Extended Asm part of the manual.

    For non-x86 instruction sets, you may have to dig through their .md files in the GCC source. For example, gcc/config/i386/i386.md was the only place to find this before it was officially documented.

    (Related: In GNU C inline asm, what are the size-override modifiers for xmm/ymm/zmm for a single operand? for vector registers.)

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

Sidebar

Ask A Question

Stats

  • Questions 145k
  • Answers 145k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try using a low priority on the dispatcher, it still… May 12, 2026 at 8:51 am
  • Editorial Team
    Editorial Team added an answer All you need is this: using (localhost.Service1 svc = new… May 12, 2026 at 8:51 am
  • Editorial Team
    Editorial Team added an answer Microsoft's Application Architecture Guide describes MVC and MVP, and explores… May 12, 2026 at 8:51 am

Related Questions

Whenever I include boost in my project I get a million of these warnings.
I'm one of those people who rather dislike it when random non-source files are
For a very long time, when I have an error handler I make it
Does anyone know how I can get a format string to use bankers rounding

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.