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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:09:55+00:00 2026-06-01T00:09:55+00:00

In our embedded architecture we have a 64-bit IAB (Instruction Alignment Buffer). In order

  • 0

In our embedded architecture we have a 64-bit IAB (Instruction Alignment Buffer). In order to optimize the fetch sequence, it is required that the body of a loop will start aligned to an 8-byte boundary.

It is easy to achieve this in assembly using the .balign directive, but I cannot find a syntax that will hint the C compiler to align the code.

Trying to precede the for loop with inline assembly with the .balign directive doesn’t work as it aligns the for loop prolog (setup) and not the loop body itself.

Doing the same where the asm() line is inside the loop, adds nop-s to the loop body that cost precious cycles.

EDIT 1: assume the code:

    __asm__ volatile("nop");  
    __asm__ volatile("nop");  

    for (j0=0; j0<N; j0+=4)
    {
        c[j0+ 0] = a[j0+ 0] + b[j0+ 0];
        c[j0+ 1] = a[j0+ 1] + b[j0+ 1];
        c[j0+ 2] = a[j0+ 2] + b[j0+ 2];
        c[j0+ 3] = a[j0+ 3] + b[j0+ 3];
    }

I want the first c=a+b to be aligned to an 8-byte address. I can add the nop-s like above after a preliminary compilation, but this is an ad-hoc solution that will break with the 1st code change.

EDIT 2: Thanks to @R.., the solution is to use the -falign-loops=8 compiler option.

  • 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-01T00:09:56+00:00Added an answer on June 1, 2026 at 12:09 am

    Umm, isn’t this what GCC’s -falign-loops option is for?

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

Sidebar

Related Questions

I was playing with this option to optimize a for-loop in our embedded architecture
We have two tasks (T1 and T2) in our vxWorks embedded system that have
I have create a site embedded Google mapusing api V3 that shows our 4
I have a web reference for our report server embedded in our application. The
I have for the most part successfully embedded firefox/xulrunner into our c# application, but
Around 90% of the pages for our websites have no .Net code embedded in
I would like to test the logging that happens in our app (an embedded
I'm working on an embedded Linux project. Our build process makes an image that
We've built a javascript based widget that our client has embedded in their website.
We have embedded JasperReports into our application to generate reports, but I've been rather

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.