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

PowerPC64 inline assembly doesn't support clobbering xer and cr #88315

Closed
programmerjake opened this issue Aug 25, 2021 · 0 comments · Fixed by #88350
Closed

PowerPC64 inline assembly doesn't support clobbering xer and cr #88315

programmerjake opened this issue Aug 25, 2021 · 0 comments · Fixed by #88350

Comments

@programmerjake
Copy link
Member

I'm working on porting power-instruction-analyzer to use the new asm! macro instead of llvm_asm!, however I can't translate clobbers for xer and cr (which aren't included by not specifying preserve_flags).

llvm_asm! example (generated by a proc-macro, so excuse the naming):

llvm_asm!(
    "mfxer $0\n\
    and $0, $0, $2\n\
    or $0, $0, $3\n\
    mtxer $0\n\
    cmplw $4, $5\n\
    mfxer $0\n\
    mfcr $1"
    : "=&b"(xer_out), "=&b"(cr)
    : "b"(xer_mask_in), "b"(xer_in), "b"(ra), "b"(rb)
    : "xer", "cr"
);

attempted asm! translation:

asm!(
    "mfxer {0}",
    "and {0}, {0}, {2}",
    "or {0}, {0}, {3}",
    "mtxer {0}",
    "cmplw {4}, {5}",
    "mfxer {0}",
    "mfcr {1}",
    out(reg_nonzero) xer_out,
    out(reg_nonzero) cr,
    in(reg_nonzero) xer_mask_in,
    in(reg_nonzero) xer_in,
    in(reg_nonzero) ra,
    in(reg_nonzero) rb,
    out("xer") _,
    out("cr") _
);
m-ou-se added a commit to m-ou-se/rust that referenced this issue Sep 1, 2021
…ers, r=Amanieu

add support for clobbering xer, cr, and cr[0-7] for asm! on OpenPower/PowerPC

Fixes rust-lang#88315
@bors bors closed this as completed in 5802f60 Sep 1, 2021
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 a pull request may close this issue.

1 participant