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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:24:25+00:00 2026-06-17T20:24:25+00:00

i tried to improve some code, but it seems so difficult to me. i

  • 0

i tried to improve some code, but it seems so difficult to me.
i develop on Android NDK.
the C++ code i want to improve followed:

unsigned int test_add_C(unsigned int *x, unsigned int *y) {
unsigned int result = 0;
for (int i = 0; i < 8; i++) {
    result += x[i] * y[i];
}
return result;

}

and neon code:

unsigned int test_add_neon(unsigned *x, unsigned *y) {

unsigned int result;
__asm__ __volatile__(
        "vld1.32    {d2-d5}, [%[x]] \n\t"
        "vld1.32    {d6-d9}, [%[y]]!    \n\t"
        "vmul.s32   d0, d2, d6      \n\t"
        "vmla.s32   d0, d3, d7      \n\t"
        "vmla.s32   d0, d4, d8      \n\t"
        "vmla.s32   d0, d5, d9      \n\t"
        "vpadd.s32  d0, d0          \n\t"
        "vmov       %0, r4, d0      \n\t"
        :"=r"(result)
        :"r"(x)
        :"d0", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "r4"
);
return result;

}

but when i compile the code, it msg that undefined named operand ‘x’ and ‘y’.
i dont know how to load the data from array x and y.
someone can help me?
thanks a lot.

  • 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-17T20:24:26+00:00Added an answer on June 17, 2026 at 8:24 pm

    Variable names inside inline assembly can’t be “seen” by the compiler, and must be included in the input/output operands list.

    Changing the line

    :"r"(x)
    

    to

    :[x]"r"(x),[y]"r"(y)
    

    will fix your ‘undefined named operand’ problem. However, I see a few more potential issues right away.

    First, the datatype s32 of your multiplication instructions should be u32, since you specify x and y are of unsigned int type.

    Second, you post-increment y but not x in the lines

    "vld1.32    {d2-d5}, [%[x]]     \n\t"
    "vld1.32    {d6-d9}, [%[y]]!    \n\t"
    

    Unless this is on purpose, it is better to be consistent.

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

Sidebar

Related Questions

I'm new to OpenGL. I've successfully drawn cubes, and tried to improve the code,
tried uncommenting pam_limits.so from the pam.d directory but no luck. Basic PAM seems to
I just wrote some C++ code roughly as follows:— int i; string out; map<char,
I'm rewriting some code to improve tableview performance. I'm trying to implement the dequeueReusableCellWithIdentifier
Tried searching the site, but cannot find an answer to my problem: Lets say
Tried a bunch of things but I can't get it to work consistently amid
tried to find the answer by googling and in MSDN but with no luck.
I'm looking for a way to improve the performance of some drawing I am
I'm getting some very jerky scrolling while using the code below to create a
I'm running through a tutorial that is a little dated, but I've tried to

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.