Forums - Problem with LLVM 3.6 when Loading and Storing

2 posts / 0 new
Last post
Problem with LLVM 3.6 when Loading and Storing
andre.trofino
Join Date: 13 Apr 15
Posts: 2
Posted: Mon, 2015-06-29 13:37

Hello,

I made simple code to test inline NEON assembly using LLVM 3.6:
void jmpTest(float *a) {

    float b[4] = {1.0, 2.0, 3.0, 4.0};

    asm (
            "vld1.f32 q0, [%[b]]    \n\t"
            "mov r1, #2                \n\t"
            "vdup.f32 q1, r1        \n\t"
            "vmul.f32 q0, q0, q1       \n\t"
            "vst1.f32 q0, [%[a]]    \n\t"
        :
        : [a] "r" (a), [b] "r" (b)
        : "memory", "r1", "q0", "q1"
    );
}

But i get this error:

Error: Neon quad precision register expected -- `vld1.f32 q0,[r2]'
Error: Neon quad precision register expected -- `vst1.f32 q0,[r0]'

it only happens when i try to load or store C++ variables. Also, this was not happening when i was using LLVM 3.5.

The syntax is the same as i have seen around the internet, what is it that it's not working?

  • Up0
  • Down0
andre.trofino
Join Date: 13 Apr 15
Posts: 2
Posted: Wed, 2015-07-01 04:14

I've solved this problem by replacing "q0" in the store and load instructions for "{d0,d1}"

            "vld1.f32 {d0,d1}, [%[b]]    \n\t"
            "mov r1, #2                \n\t"
            "vdup.f32 q1, r1        \n\t"
            "vmul.f32 q0, q0, q1       \n\t"
            "vst1.f32 {d0,d1}, [%[a]]    \n\t"
        :
        : [a] "r" (a), [b] "r" (b)
        : "memory", "r1", "q0", "q1"

I have no idea why 3.6 doesn't accept the other one, by this way it works

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.