diff --git a/cranelift/codegen/src/isa/aarch64/inst.isle b/cranelift/codegen/src/isa/aarch64/inst.isle index 578db8e5ca..7a907ca8a7 100644 --- a/cranelift/codegen/src/isa/aarch64/inst.isle +++ b/cranelift/codegen/src/isa/aarch64/inst.isle @@ -1537,6 +1537,13 @@ (_ Unit (emit (MInst.VecMisc op dst src size)))) dst)) +;; Helper for emitting `MInst.VecTbl` instructions. +(decl vec_tbl (Reg Reg bool) Reg) +(rule (vec_tbl rn rm is_extension) + (let ((dst WritableReg (temp_writable_reg $I8X16)) + (_ Unit (emit (MInst.VecTbl dst rn rm is_extension)))) + dst)) + ;; Helper for emitting `MInst.VecRRRLong` instructions. (decl vec_rrr_long (VecRRRLongOp Reg Reg bool) Reg) (rule (vec_rrr_long op src1 src2 high_half) diff --git a/cranelift/codegen/src/isa/aarch64/lower.isle b/cranelift/codegen/src/isa/aarch64/lower.isle index 2f5ffba802..08fd779ec3 100644 --- a/cranelift/codegen/src/isa/aarch64/lower.isle +++ b/cranelift/codegen/src/isa/aarch64/lower.isle @@ -99,6 +99,11 @@ (add_with_flags_paired $I64 x_lo y_lo) (adc_paired $I64 x_hi y_hi)))) +;;;; Rules for `swizzle` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule (lower (has_type vec_i128_ty (swizzle rn rm))) + (vec_tbl rn rm #f)) + ;;;; Rules for `iadd_pairwise` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (rule (lower (has_type $I16X8 (iadd_pairwise (swiden_low x) (swiden_high y)))) diff --git a/cranelift/codegen/src/isa/aarch64/lower_inst.rs b/cranelift/codegen/src/isa/aarch64/lower_inst.rs index 30bb0c46e8..acbfd5095b 100644 --- a/cranelift/codegen/src/isa/aarch64/lower_inst.rs +++ b/cranelift/codegen/src/isa/aarch64/lower_inst.rs @@ -1190,18 +1190,7 @@ pub(crate) fn lower_insn_to_regs>( }); } - Opcode::Swizzle => { - let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap(); - let rm = put_input_in_reg(ctx, inputs[1], NarrowValueMode::None); - let rn = put_input_in_reg(ctx, inputs[0], NarrowValueMode::None); - - ctx.emit(Inst::VecTbl { - rd, - rn, - rm, - is_extension: false, - }); - } + Opcode::Swizzle => implemented_in_isle(ctx), Opcode::Isplit => { let input_ty = ctx.input_ty(insn, 0);