Hi community,
I have tried to compile the source code for openVGI have given proper cross compiler which is required by the platform still I am getting the error of unknown mnemonics for the instruction UQSUB8
Environment:
- Linux platform
- CROSS COMPILE tool chain = aarch64-linux-gcc
- ARMv8-a architecture
Code snippet:
for (i = 0; i < 256; ++i) { c = lut[i]; /* Extract alpha and clamp color components */ inva = 0x01010101 * ((~c) & 0xFF); c = _mali_osu_sataddu8(c, inva); cpu_ptr[i] = _mali_osu_satsubu8(c, inva); }
MALI_STATIC_INLINE u32 _mali_osu_satsubu8(u32 x, u32 y) { u32 retval; __asm__("UQSUB8 %0, %1, %2" : "=r"(retval) /* output */ : "r"(x), "r"(y) /* input */ ); return retval; }
Can you please suggest me how can I solve this issue?
Thanks,
DP
In 64 bits mode, there is no UQSUB8 in ARMv8. However you might be able to use the SIMD alternative instead :
- ARM Compiler armasm User Guide Version 6.5 | UQSUB (vector) – ARM Developer
UQSUB Vd.T, Vn.T, Vm.T Where:
UQSUB Vd.T, Vn.T, Vm.T
Vd
T
Vn
Vm
Where:
Is the name of the SIMD and FP destination register.
Is an arrangement specifier, and can be one of 8B, 16B, 4H, 8H, 2S, 4S or 2D.
8B
16B
4H
8H
2S
4S
2D
Is the name of the first SIMD and FP source register.
Is the name of the second SIMD and FP source register.
Hi myy,
I have changed the code as suggested by you to
MALI_STATIC_INLINE u32 _mali_osu_satsubu8(u32 x, u32 y) { u32 retval; __asm__("UQSUB %V0.S[0], %V1.S[0], %V2.S[0]" : "=r"(retval) /* output */ : "r"(x), "r"(y) /* input */ ); return retval; }
MALI_STATIC_INLINE u32 _mali_osu_satsubu8(u32 x, u32 y)
{
u32 retval;
__asm__("UQSUB %V0.S[0], %V1.S[0], %V2.S[0]"
: "=r"(retval) /* output */
: "r"(x), "r"(y) /* input */
);
return retval;
}
and I am getting below error:
error: invalid 'asm': incompatible floating point / vector register operand for '%V'
As per my earlier answer, if you have access to the OpenVG source code you must be a licensee, so please raise any questions about building the user-space parts of the Mali driver source for your platform via support@arm.com. We cannot provide support for the proprietary parts of our products on a public forum.
FWIW I doubt the OpenVG driver will work on ARMv8; it was only ever released officially with ARMv7-A support (at the time it was released ARMv8 didn't even exist).
Thanks, Pete
GCC uses 'w' for SIMD registers placeholders.
So the following asm inline :
__asm__("UQSUB %0.8b, %1.8b, %2.8b" : "=w"(retval) /* output */ : "w"(x), "w"(y) /* input */ );
Will compile to :
uqsub v0.8b, v0.8b, v1.8b
You can adapt this to your needs.
However, I do not guarantee that will output the same results as the UQSUB8 mnemonic, as I currently have no experience with NEON and no ARMv8 systems to test it on. I only have a cross-compilling GCC/AS toolset.
You'll have to write some tests to ensure this, using an ARMv7 system to generate a correct output listing and an ARMv8 system that will run the code and check if the results are identical.
That said, you should try GCC Godbolt, which is a website providing a quick look at the assembly output of sample C code.