aarch64: Implement ireduce/breduce in ISLE (#4331)
* aarch64: Implement `ireduce`/`breduce` in ISLE * cranelift: Remove vector versions of `breduce`/`ireduce`
This commit is contained in:
@@ -1193,6 +1193,20 @@
|
||||
(rule (lower (has_type (ty_vec128 ty) (vselect c x y)))
|
||||
(bsl ty c x y))
|
||||
|
||||
;;;; Rules for `ireduce` / `breduce` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; T -> I{64,32,16,8}: We can simply pass through the value: values
|
||||
;; are always stored with high bits undefined, so we can just leave
|
||||
;; them be.
|
||||
(rule (lower (has_type (ty_int_bool_ref_scalar_64 ty) (ireduce src)))
|
||||
(value_regs_get src 0))
|
||||
|
||||
;; Likewise for breduce.
|
||||
|
||||
(rule (lower (has_type (ty_int_bool_ref_scalar_64 ty) (breduce src)))
|
||||
(value_regs_get src 0))
|
||||
|
||||
|
||||
;;;; Rules for `fcmp` 32 bit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(rule (lower (has_type ty @ (multi_lane _ _) (fcmp (fcmp_zero_cond_not_eq cond) x (splat (f32const (zero_value_f32 y))))))
|
||||
|
||||
@@ -423,14 +423,7 @@ pub(crate) fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
|
||||
ctx.emit(Inst::gen_move(rd, rn, ty));
|
||||
}
|
||||
|
||||
Opcode::Breduce | Opcode::Ireduce => {
|
||||
// Smaller integers/booleans are stored with high-order bits
|
||||
// undefined, so we can simply do a copy.
|
||||
let rn = put_input_in_regs(ctx, inputs[0]).regs()[0];
|
||||
let rd = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
|
||||
let ty = ctx.input_ty(insn, 0);
|
||||
ctx.emit(Inst::gen_move(rd, rn, ty));
|
||||
}
|
||||
Opcode::Breduce | Opcode::Ireduce => implemented_in_isle(ctx),
|
||||
|
||||
Opcode::Bextend | Opcode::Bmask => {
|
||||
// Bextend and Bmask both simply sign-extend. This works for:
|
||||
|
||||
Reference in New Issue
Block a user