Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra_ops.hpp: adapt to AIX assembler #50

Closed
wants to merge 1 commit into from

Conversation

Helflym
Copy link
Contributor

@Helflym Helflym commented Oct 27, 2021

AIX assembler doesn't allow "bne- 1b" to jump to the previous label "1".
It must be replaced by "bne- $N", N being the memory offset between
the current instruction and the targeted label.

@Lastique
Copy link
Member

As a general comment, I would prefer to avoid #ifdefs all over the code and instead use macros to expand to either labels or offsets.

@Helflym
Copy link
Contributor Author

Helflym commented Oct 27, 2021

Yes, that would be better indeed. I see if I can do that.
By the way, do you know why I don't need to modify "core_arch_ops" header too ? It doesn't seem to be used by "atomic" tests on AIX, but I'm not sure why.

@Lastique
Copy link
Member

By the way, do you know why I don't need to modify "core_arch_ops" header too ?

I suspect, your compiler supports __atomic intrinsics, so core_ops_gcc_atomic.hpp is implementing the atomic operations. For completeness, core_arch_ops_gcc_ppc.hpp needs to be updated too.

@Lastique
Copy link
Member

Lastique commented Oct 27, 2021

I have something like this in mind:

#if !defined(_AIX)
#define BOOST_ATOMIC_DETAIL_PPC_ASM_LABEL(label) label ":\n\t"
#define BOOST_ATOMIC_DETAIL_PPC_ASM_JUMP(insn, label, offset) insn " " label "\n\t"
#else
#define BOOST_ATOMIC_DETAIL_PPC_ASM_LABEL(label)
#define BOOST_ATOMIC_DETAIL_PPC_ASM_JUMP(insn, label, offset) insn " " offset "\n\t"
#endif

And then use these macros in both headers.

@Lastique
Copy link
Member

Also, I suppose, _AIX indicates AIX OS. Is there a macro specific to your compiler? I mean, if there is a standard gcc that supports labels on AIX, it would be better to enable labels in the code.

@Helflym
Copy link
Contributor Author

Helflym commented Oct 27, 2021

The problem isn't related to the compiler but the assembler being used behind. I'm currently working with gcc-10, which is supporting labels. But it's calling AIX assembler instead of GNU as, and as far as I know it doesn't allow the "1b","1f" syntax. I'm not sure any macro is able to detect that.

AIX assembler doesn't allow "bne- 1b" or "bne- 1f" symtax to jump to a
given label. It must be replaced by "bne- $N", N being the memory
offset between the current instruction and the targeted label.
@Lastique
Copy link
Member

Thanks, merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants