Skip to content

Add asm clobbers for PPC / PPC64 #111335

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

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions compiler/rustc_target/src/asm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ pub enum InlineAsmClobberAbi {
AArch64NoX18,
RiscV,
LoongArch,
PowerPC,
}

impl InlineAsmClobberAbi {
Expand Down Expand Up @@ -885,6 +886,10 @@ impl InlineAsmClobberAbi {
"C" | "system" | "efiapi" => Ok(InlineAsmClobberAbi::LoongArch),
_ => Err(&["C", "system", "efiapi"]),
},
InlineAsmArch::PowerPC => match name {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add PowerPC64 here as well if both use the same calling convention. If the registers are different then you need a separate 32-bit and 64-bit InlineAsmClobberAbi.

"C" | "system" | "efiapi" => Ok(InlineAsmClobberAbi::PowerPC),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not include efiapi.

_ => Err(&["C", "system", "efiapi"]),
},
_ => Err(&[]),
}
}
Expand Down Expand Up @@ -1042,6 +1047,23 @@ impl InlineAsmClobberAbi {
f16, f17, f18, f19, f20, f21, f22, f23,
}
},
InlineAsmClobberAbi::PowerPC => clobbered_regs! {
PowerPC PowerPCInlineAsmReg {
// ra
r0,
//
r3, r4, r5, r6, r7, r8, r9, r10,
//r11, r12,
// float
f0, f1, f2, f3, f4, f5, f6, f7, f8, f9,
f10, f11, f12, f13,

// VMX capable only
//v0, v1, v2, v3, v4, v5, v6, v7, v8, v9,
//v10, v11, v12, v13, v14, v15, v16, v17,
//v18, v19,
}
},
}
}
}