Skip to content

Commit f68bc7a

Browse files
committed
Auto merge of #147715 - matthiaskrgr:rollup-611b4x4, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang/rust#146841 (Stabilise `rotate_left` and `rotate_right` in `[_]` as `const fn` items.) - rust-lang/rust#146949 (Add vsx register support for ppc inline asm, and implement preserves_flag option) - rust-lang/rust#147539 (resolve: Use primitives for conditional mutability more consistently) - rust-lang/rust#147685 (remove span calls from deprecated attribute checking) - rust-lang/rust#147699 (Clairify docs for `AttributeKind::DocComment`) - rust-lang/rust#147706 (Add myself to review rotation) - rust-lang/rust#147711 (Clarify that UB will occur, not can/may in GlobalAlloc docs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 57ec426 + 7baf34b commit f68bc7a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/asm.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,16 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
546546
}
547547

548548
if !options.contains(InlineAsmOptions::PRESERVES_FLAGS) {
549-
// TODO(@Commeownist): I'm not 100% sure this one clobber is sufficient
550-
// on all architectures. For instance, what about FP stack?
551-
extended_asm.add_clobber("cc");
549+
match asm_arch {
550+
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {
551+
// "cc" is cr0 on powerpc.
552+
}
553+
// TODO(@Commeownist): I'm not 100% sure this one clobber is sufficient
554+
// on all architectures. For instance, what about FP stack?
555+
_ => {
556+
extended_asm.add_clobber("cc");
557+
}
558+
}
552559
}
553560
if !options.contains(InlineAsmOptions::NOMEM) {
554561
extended_asm.add_clobber("memory");
@@ -698,6 +705,7 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str {
698705
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => "b",
699706
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::freg) => "f",
700707
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => "v",
708+
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vsreg) => "wa",
701709
InlineAsmRegClass::PowerPC(
702710
PowerPCInlineAsmRegClass::cr
703711
| PowerPCInlineAsmRegClass::ctr
@@ -778,9 +786,9 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
778786
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg) => cx.type_i32(),
779787
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => cx.type_i32(),
780788
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::freg) => cx.type_f64(),
781-
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => {
782-
cx.type_vector(cx.type_i32(), 4)
783-
}
789+
InlineAsmRegClass::PowerPC(
790+
PowerPCInlineAsmRegClass::vreg | PowerPCInlineAsmRegClass::vsreg,
791+
) => cx.type_vector(cx.type_i32(), 4),
784792
InlineAsmRegClass::PowerPC(
785793
PowerPCInlineAsmRegClass::cr
786794
| PowerPCInlineAsmRegClass::ctr
@@ -957,6 +965,13 @@ fn modifier_to_gcc(
957965
InlineAsmRegClass::LoongArch(_) => None,
958966
InlineAsmRegClass::Mips(_) => None,
959967
InlineAsmRegClass::Nvptx(_) => None,
968+
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vsreg) => {
969+
if modifier.is_none() {
970+
Some('x')
971+
} else {
972+
modifier
973+
}
974+
}
960975
InlineAsmRegClass::PowerPC(_) => None,
961976
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg)
962977
| InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::freg) => None,

0 commit comments

Comments
 (0)