HomePhabricator

[llvm][AArch64] Simplify (and (sign_extend..) #bitmask).

Authored by fpetrogalli on Nov 9 2020, 3:37 AM.

Description

[llvm][AArch64] Simplify (and (sign_extend..) #bitmask).

Fold

VT = (and (sign_extend NarrowVT to VT) #bitmask)

into

VT = (zero_extend NarrowVT)

With this combine, the test replaces a sign extended load + an
unsigned extention with a zero extended load to render one of the
operands of the last multiplication.

BEFORE                       |  AFTER
  f_i16_i32:                 |    f_i16_i32:
       .fnstart              |           .fnstart
       ldrsh   r0, [r0]      |           ldrh    r1, [r1]
       ldrsh   r1, [r1]      |           ldrsh   r0, [r0]
       smulbb  r0, r1, r0    |           smulbb  r0, r0, r1
       uxth    r1, r1        |           mul     r0, r0, r1
       mul     r0, r0, r1    |           bx      lr
       bx      lr            |

Reviewed By: resistor

Differential Revision: https://reviews.llvm.org/D90605

Details

Committed
fpetrogalliNov 9 2020, 4:53 AM
Reviewer
resistor
Differential Revision
D90605: [llvm][AArch64] Simplify (and (sign_extend..) #bitmask).
Parents
rG091c5c9a187f: [VPlan] Add printOperands helper to VPUser (NFC).
Branches
Unknown
Tags
Unknown