On 12/04/17 14:44, Dmitry Eremin-Solenikov wrote:
> On 12.04.2017 16:37, Joe Savage wrote:
>> On 12/04/17 14:24, Dmitry Eremin-Solenikov wrote:
>>> On 12.04.2017 16:01, Joe Savage wrote:
>>>> I'm not sure I quite follow your comments regarding $(ARCH_DIR) though. Are
>>>> there some ODP-defined macros that I can use instead of "__ARM_ARCH" and
>>>> friends or something?
>>>
>>> You can have arm, arm64, mips64, etc. directories inside
>>> examples/ipfrag. With smth. like odp_cas_dblptr.h header inside. Then
>>> make _helpers.h include odp_case_dblptr.h, adding -I$(ARCH_DIR) to
>>> CPPFLAGS in you example Makefile.
>>
>> Ah, I see. That's a really nice idea. I'm not sure it would quite give the
>> accuracy I need here though — it seems like "arm64" isn't an auto-detected
>> $(ARCH_DIR) option out of the box, and there isn't any way to single out 
>> ARMv7
>> dependent stuff specifically either.
>
> See below.
>
>> Also, I'm not sure how a generic fallback
>> would best be established in a system like that.
>
> You can have generic/dblptr.h . Then mips/ppc/x86 would just include
> that header.
>
> Inside arm/dblptr.h you can the following code:
>
> #if ARMv7
>
> void atomic_cas_dblptr()
> {
> }
>
> #else
> #include "generic/dblptr.h"
> #endif

Yeah, that would work. It seems a bit fragile to enumerate every known
ARCH_DIR (e.g. what if another architecture gets added), but I'll roll
with it if this is the preferred way to do things.

Reply via email to