From a548516f97ce0e62fedcf7a22ebe9b0106343bc4 Mon Sep 17 00:00:00 2001 From: Johnnie Birch <45402135+jlb6740@users.noreply.github.com> Date: Sun, 29 Nov 2020 15:06:05 -0800 Subject: [PATCH] Enable SIMD spec tests for f32x4_rounding and f64x4_rounding. Also address some review comments pointing out minor issues. --- build.rs | 13 +++++-------- cranelift/codegen/src/isa/x64/inst/args.rs | 5 +++++ cranelift/codegen/src/isa/x64/lower.rs | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build.rs b/build.rs index 4937f6bf12bf..aa791aeda12e 100644 --- a/build.rs +++ b/build.rs @@ -212,6 +212,8 @@ fn experimental_x64_should_panic(testsuite: &str, testname: &str, strategy: &str ("simd", "simd_splat") => return false, ("simd", "simd_store") => return false, ("simd", "simd_conversions") => return false, + ("simd", "simd_f32x4_rounding") => return false, + ("simd", "simd_f64x2_rounding") => return false, ("simd", _) => return true, _ => {} } @@ -240,18 +242,13 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { // These are only implemented on aarch64 and x64. ("simd", "simd_boolean") | ("simd", "simd_f32x4_pmin_pmax") - | ("simd", "simd_f64x2_pmin_pmax") => { + | ("simd", "simd_f64x2_pmin_pmax") + | ("simd", "simd_f32x4_rounding") + | ("simd", "simd_f64x2_rounding") => { return !(cfg!(feature = "experimental_x64") || env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "aarch64") } - // These are only implemented on aarch64. - ("simd", "simd_f32x4_rounding") | ("simd", "simd_f64x2_rounding") => { - return env::var("CARGO_CFG_TARGET_ARCH").unwrap() != "aarch64"; - } - - // These tests have simd operators which aren't implemented yet. - // (currently none) _ => {} }, _ => panic!("unrecognized strategy"), diff --git a/cranelift/codegen/src/isa/x64/inst/args.rs b/cranelift/codegen/src/isa/x64/inst/args.rs index 817e7f830c8d..7e3b3f22a23e 100644 --- a/cranelift/codegen/src/isa/x64/inst/args.rs +++ b/cranelift/codegen/src/isa/x64/inst/args.rs @@ -1245,6 +1245,11 @@ impl From for FcmpImm { } /// Encode the rounding modes used as part of the Rounding Control field. +/// Note, these rounding immediates only consider the rounding control field +/// (i.e. the rounding mode) which only take up the first two bits when encoded. +/// However the rounding immediate which this field helps make up, also includes +/// bits 3 and 4 which define the rounding select and precision mask respectively. +/// These two bits are not defined here and are implictly set to zero when encoded. pub(crate) enum RoundImm { RoundNearest = 0x00, RoundDown = 0x01, diff --git a/cranelift/codegen/src/isa/x64/lower.rs b/cranelift/codegen/src/isa/x64/lower.rs index 30cd1b4d2da9..4b09681548d3 100644 --- a/cranelift/codegen/src/isa/x64/lower.rs +++ b/cranelift/codegen/src/isa/x64/lower.rs @@ -3240,7 +3240,7 @@ fn lower_insn_to_regs>( ctx.emit(Inst::gen_move(dst, src, ty)); ctx.emit(Inst::xmm_rm_r_imm( op, - RegMem::reg(dst.to_reg()), + RegMem::from(dst), dst, mode.encode(), false,