Skip to content

Commit

Permalink
mips32: Add f64 hard-float support
Browse files Browse the repository at this point in the history
co-authored-by: Amanieu <amanieu@gmail.com>
  • Loading branch information
tesuji and Amanieu committed Oct 4, 2020
1 parent 446f86e commit 6cb062d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/asm/mips.rs
Expand Up @@ -36,7 +36,7 @@ impl MipsInlineAsmRegClass {
) -> &'static [(InlineAsmType, Option<&'static str>)] {
match self {
Self::reg => types! { _: I8, I16, I32, F32; },
Self::freg => types! { _: F32; },
Self::freg => types! { _: F32, F64; },
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/unstable-book/src/library-features/asm.md
Expand Up @@ -551,7 +551,7 @@ Each register class has constraints on which value types they can be used with.
| ARM | `dreg` | `vfp2` | `i64`, `f64`, `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2` |
| ARM | `qreg` | `neon` | `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4` |
| MIPS32 | `reg` | None | `i8`, `i16`, `i32`, `f32` |
| MIPS32 | `freg` | None | `f32` |
| MIPS32 | `freg` | None | `f32`, `f64` |
| NVPTX | `reg16` | None | `i8`, `i16` |
| NVPTX | `reg32` | None | `i8`, `i16`, `i32`, `f32` |
| NVPTX | `reg64` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
Expand Down
24 changes: 24 additions & 0 deletions src/test/assembly/asm/mips-types.rs
Expand Up @@ -108,6 +108,30 @@ pub unsafe fn f0_f32(x: f32) -> f32 {
y
}

// CHECK-LABEL: reg_f64:
// CHECK: #APP
// CHECK: mov.d $f{{[0-9]+}}, $f{{[0-9]+}}
// CHECK: #NO_APP
#[no_mangle]
pub unsafe fn reg_f64(x: f64) -> f64 {
dont_merge("reg_f64");
let y;
asm!("mov.d {}, {}", out(freg) y, in(freg) x);
y
}

// CHECK-LABEL: f0_f64:
// CHECK: #APP
// CHECK: mov.d $f0, $f0
// CHECK: #NO_APP
#[no_mangle]
pub unsafe fn f0_f64(x: f64) -> f64 {
dont_merge("f0_f64");
let y;
asm!("mov.d $f0, $f0", lateout("$f0") y, in("$f0") x);
y
}

// CHECK-LABEL: reg_ptr:
// CHECK: #APP
// CHECK: move ${{[0-9]+}}, ${{[0-9]+}}
Expand Down

0 comments on commit 6cb062d

Please sign in to comment.