diff --git a/build.rs b/build.rs index d6651d1324..596f39caf6 100644 --- a/build.rs +++ b/build.rs @@ -225,6 +225,7 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { // These are new instructions that are not really implemented in any backend. ("simd", "simd_i16x8_extadd_pairwise_i8x16") | ("simd", "simd_i32x4_extadd_pairwise_i16x8") => return true, + _ => {} }, _ => panic!("unrecognized strategy"), diff --git a/cranelift/codegen/src/isa/aarch64/lower.rs b/cranelift/codegen/src/isa/aarch64/lower.rs index cd4af48e30..12535cf382 100644 --- a/cranelift/codegen/src/isa/aarch64/lower.rs +++ b/cranelift/codegen/src/isa/aarch64/lower.rs @@ -1253,6 +1253,9 @@ pub(crate) fn maybe_input_insn_via_conv>( None } +/// Pattern match an extending vector multiplication. +/// Returns a tuple of the opcode to use, the two input registers and whether +/// it's the 'high half' version of the instruction. pub(crate) fn match_vec_long_mul>( c: &mut C, insn: IRInst, diff --git a/cranelift/wasm/src/code_translator.rs b/cranelift/wasm/src/code_translator.rs index 72ff52a63d..864cb10f9d 100644 --- a/cranelift/wasm/src/code_translator.rs +++ b/cranelift/wasm/src/code_translator.rs @@ -1879,6 +1879,37 @@ pub fn translate_operator( let a = pop1_with_bitcast(state, I32X4, builder); state.push1(builder.ins().uwiden_high(a)) } + Operator::F32x4Ceil | Operator::F64x2Ceil => { + // This is something of a misuse of `type_of`, because that produces the return type + // of `op`. In this case we want the arg type, but we know it's the same as the + // return type. Same for the 3 cases below. + let arg = pop1_with_bitcast(state, type_of(op), builder); + state.push1(builder.ins().ceil(arg)); + } + Operator::F32x4Floor | Operator::F64x2Floor => { + let arg = pop1_with_bitcast(state, type_of(op), builder); + state.push1(builder.ins().floor(arg)); + } + Operator::F32x4Trunc | Operator::F64x2Trunc => { + let arg = pop1_with_bitcast(state, type_of(op), builder); + state.push1(builder.ins().trunc(arg)); + } + Operator::F32x4Nearest | Operator::F64x2Nearest => { + let arg = pop1_with_bitcast(state, type_of(op), builder); + state.push1(builder.ins().nearest(arg)); + } + Operator::I32x4DotI16x8S => { + let (a, b) = pop2_with_bitcast(state, I16X8, builder); + state.push1(builder.ins().widening_pairwise_dot_product_s(a, b)); + } + Operator::I8x16Popcnt => { + let arg = pop1_with_bitcast(state, type_of(op), builder); + state.push1(builder.ins().popcnt(arg)); + } + Operator::I16x8Q15MulrSatS => { + let (a, b) = pop2_with_bitcast(state, I16X8, builder); + state.push1(builder.ins().sqmul_round_sat(a, b)) + } Operator::I16x8ExtMulLowI8x16S => { let (a, b) = pop2_with_bitcast(state, I8X16, builder); let a_low = builder.ins().swiden_low(a); @@ -1951,37 +1982,6 @@ pub fn translate_operator( let b_high = builder.ins().uwiden_high(b); state.push1(builder.ins().imul(a_high, b_high)); } - Operator::F32x4Ceil | Operator::F64x2Ceil => { - // This is something of a misuse of `type_of`, because that produces the return type - // of `op`. In this case we want the arg type, but we know it's the same as the - // return type. Same for the 3 cases below. - let arg = pop1_with_bitcast(state, type_of(op), builder); - state.push1(builder.ins().ceil(arg)); - } - Operator::F32x4Floor | Operator::F64x2Floor => { - let arg = pop1_with_bitcast(state, type_of(op), builder); - state.push1(builder.ins().floor(arg)); - } - Operator::F32x4Trunc | Operator::F64x2Trunc => { - let arg = pop1_with_bitcast(state, type_of(op), builder); - state.push1(builder.ins().trunc(arg)); - } - Operator::F32x4Nearest | Operator::F64x2Nearest => { - let arg = pop1_with_bitcast(state, type_of(op), builder); - state.push1(builder.ins().nearest(arg)); - } - Operator::I32x4DotI16x8S => { - let (a, b) = pop2_with_bitcast(state, I16X8, builder); - state.push1(builder.ins().widening_pairwise_dot_product_s(a, b)); - } - Operator::I8x16Popcnt => { - let arg = pop1_with_bitcast(state, type_of(op), builder); - state.push1(builder.ins().popcnt(arg)); - } - Operator::I16x8Q15MulrSatS => { - let (a, b) = pop2_with_bitcast(state, I16X8, builder); - state.push1(builder.ins().sqmul_round_sat(a, b)) - } Operator::I16x8ExtAddPairwiseI8x16S | Operator::I16x8ExtAddPairwiseI8x16U | Operator::I32x4ExtAddPairwiseI16x8S