Re: Compiler optimizing variables in inline assembly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/20/2014 07:29 PM, Cody Rigney wrote:
> On Thu, Feb 20, 2014 at 4:14 AM, Andrew Haley <aph@xxxxxxxxxx> wrote:
>> Hi,
>>
>> On 02/19/2014 07:04 PM, Cody Rigney wrote:
>>> I'm trying to add NEON optimizations to OpenCV's LK optical flow.  See
>>> link below.
>>> https://github.com/Itseez/opencv/blob/2.4/modules/video/src/lkpyramid.cpp
>>>
>>> The gcc version could vary since this is an open source project, but
>>> the one I'm currently using is 4.8.1. The target architecture is ARMv7
>>> w/ NEON. The processor I'm testing on is an ARM
>>> Cortex-A15(big.LITTLE).
>>>
>>> The problem is, in release mode (where optimizations are set) it does
>>> not work properly. However, in debug mode, it works fine. I tracked
>>> down a specific variable(FLT_SCALE) that was being optimized out and
>>> made it volatile and that part worked fine after that. However, I'm
>>> still having incorrect behavior from some other optimization.
>>
>> Forget about using volatile here.  That's just wrong.
>>
>> You have to mark your inputs, outputs, and clobbers correctly.
>>
> That makes sense.  In this case, the input parameters are actually
> memory addresses.  So how would I do an output or clobber that would
> tell the compiler that the memory at those addresses will change?

You can use a memory operand as an output, as in "=m"(*a) or simply
add "memory" to the clobber list.  And you must add all clobbered
registers to the clobber list.  Then it should work.

Andrew.






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux