Skip to content

Commit 6cb062d

Browse files
tesujiAmanieu
andcommitted
mips32: Add f64 hard-float support
co-authored-by: Amanieu <[email protected]>
1 parent 446f86e commit 6cb062d

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

compiler/rustc_target/src/asm/mips.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl MipsInlineAsmRegClass {
3636
) -> &'static [(InlineAsmType, Option<&'static str>)] {
3737
match self {
3838
Self::reg => types! { _: I8, I16, I32, F32; },
39-
Self::freg => types! { _: F32; },
39+
Self::freg => types! { _: F32, F64; },
4040
}
4141
}
4242
}

src/doc/unstable-book/src/library-features/asm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ Each register class has constraints on which value types they can be used with.
551551
| ARM | `dreg` | `vfp2` | `i64`, `f64`, `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2` |
552552
| ARM | `qreg` | `neon` | `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4` |
553553
| MIPS32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
554-
| MIPS32 | `freg` | None | `f32` |
554+
| MIPS32 | `freg` | None | `f32`, `f64` |
555555
| NVPTX | `reg16` | None | `i8`, `i16` |
556556
| NVPTX | `reg32` | None | `i8`, `i16`, `i32`, `f32` |
557557
| NVPTX | `reg64` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |

src/test/assembly/asm/mips-types.rs

+24
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,30 @@ pub unsafe fn f0_f32(x: f32) -> f32 {
108108
y
109109
}
110110

111+
// CHECK-LABEL: reg_f64:
112+
// CHECK: #APP
113+
// CHECK: mov.d $f{{[0-9]+}}, $f{{[0-9]+}}
114+
// CHECK: #NO_APP
115+
#[no_mangle]
116+
pub unsafe fn reg_f64(x: f64) -> f64 {
117+
dont_merge("reg_f64");
118+
let y;
119+
asm!("mov.d {}, {}", out(freg) y, in(freg) x);
120+
y
121+
}
122+
123+
// CHECK-LABEL: f0_f64:
124+
// CHECK: #APP
125+
// CHECK: mov.d $f0, $f0
126+
// CHECK: #NO_APP
127+
#[no_mangle]
128+
pub unsafe fn f0_f64(x: f64) -> f64 {
129+
dont_merge("f0_f64");
130+
let y;
131+
asm!("mov.d $f0, $f0", lateout("$f0") y, in("$f0") x);
132+
y
133+
}
134+
111135
// CHECK-LABEL: reg_ptr:
112136
// CHECK: #APP
113137
// CHECK: move ${{[0-9]+}}, ${{[0-9]+}}

0 commit comments

Comments
 (0)