diff --git a/cranelift/codegen/src/isa/x64/lower.rs b/cranelift/codegen/src/isa/x64/lower.rs index a80a269517..dbfb54ebaa 100644 --- a/cranelift/codegen/src/isa/x64/lower.rs +++ b/cranelift/codegen/src/isa/x64/lower.rs @@ -1942,7 +1942,7 @@ fn lower_insn_to_regs( assert_eq!( ty, types::I128, - "Iconcat not expected to be used for non-128-bit type" + "Isplit not expected to be used for non-128-bit type" ); assert_eq!(ctx.output_ty(insn, 0), types::I64); assert_eq!(ctx.output_ty(insn, 1), types::I64); diff --git a/cranelift/fuzzgen/src/function_generator.rs b/cranelift/fuzzgen/src/function_generator.rs index 522130d81d..17614cb1d8 100644 --- a/cranelift/fuzzgen/src/function_generator.rs +++ b/cranelift/fuzzgen/src/function_generator.rs @@ -30,8 +30,18 @@ fn insert_opcode( arg_vals.push(val, &mut builder.func.dfg.value_lists); } - let typevar = rets.first().copied().unwrap_or(INVALID); - let (inst, dfg) = builder.ins().MultiAry(opcode, typevar, arg_vals); + // For pretty much every instruction the control type is the return type + // except for Iconcat and Isplit which are *special* and the control type + // is the input type. + let ctrl_type = if opcode == Opcode::Iconcat || opcode == Opcode::Isplit { + args.first() + } else { + rets.first() + } + .copied() + .unwrap_or(INVALID); + + let (inst, dfg) = builder.ins().MultiAry(opcode, ctrl_type, arg_vals); let results = dfg.inst_results(inst).to_vec(); for (val, &ty) in results.into_iter().zip(rets) { @@ -315,6 +325,21 @@ const OPCODE_SIGNATURES: &'static [( (Opcode::Sextend, &[I32], &[I64], insert_opcode), (Opcode::Sextend, &[I32], &[I128], insert_opcode), (Opcode::Sextend, &[I64], &[I128], insert_opcode), + // Ireduce + (Opcode::Ireduce, &[I16], &[I8], insert_opcode), + (Opcode::Ireduce, &[I32], &[I8], insert_opcode), + (Opcode::Ireduce, &[I32], &[I16], insert_opcode), + (Opcode::Ireduce, &[I64], &[I8], insert_opcode), + (Opcode::Ireduce, &[I64], &[I16], insert_opcode), + (Opcode::Ireduce, &[I64], &[I32], insert_opcode), + (Opcode::Ireduce, &[I128], &[I8], insert_opcode), + (Opcode::Ireduce, &[I128], &[I16], insert_opcode), + (Opcode::Ireduce, &[I128], &[I32], insert_opcode), + (Opcode::Ireduce, &[I128], &[I64], insert_opcode), + // Isplit + (Opcode::Isplit, &[I128], &[I64, I64], insert_opcode), + // Iconcat + (Opcode::Iconcat, &[I64, I64], &[I128], insert_opcode), // Fadd (Opcode::Fadd, &[F32, F32], &[F32], insert_opcode), (Opcode::Fadd, &[F64, F64], &[F64], insert_opcode),