Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
fixup! [codegen] legalize imul.I64 for 32-bit ISAs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzokuken committed Oct 3, 2019
1 parent f436801 commit 6f8d8aa
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions cranelift-codegen/meta/src/shared/legalize.rs
Expand Up @@ -275,20 +275,22 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro

// TODO(ryzokuken): explore the perf diff w/ x86_umulx and consider have a
// separate legalization for x86.
narrow.legalize(
def!(a = imul.I64(x, y)),
vec![
def!((xl, xh) = isplit(x)),
def!((yl, yh) = isplit(y)),
def!(al = imul(xl, yl)),
def!(a1 = imul(xh, yl)),
def!(a2 = imul(xl, yh)),
def!(a3 = umulhi(xl, yl)),
def!(a4 = iadd(a1, a2)),
def!(ah = iadd(a4, a3)),
def!(a = iconcat(al, ah)),
],
);
for &(ty, ty_half) in &[(I64, I32), (I128, I64)] {
narrow.legalize(
def!(a = imul.ty(x, y)),
vec![
def!((xl, xh) = isplit.ty(x)),
def!((yl, yh) = isplit.ty(y)),
def!(al = imul.ty_half(xl, yl)),
def!(a1 = imul.ty_half(xh, yl)),
def!(a2 = imul.ty_half(xl, yh)),
def!(a3 = umulhi.ty_half(xl, yl)),
def!(a4 = iadd.ty_half(a1, a2)),
def!(ah = iadd.ty_half(a4, a3)),
def!(a = iconcat.ty_half(al, ah)),
],
);
}

// Widen instructions with one input operand.
for &op in &[bnot, popcnt] {
Expand Down

0 comments on commit 6f8d8aa

Please sign in to comment.