Skip to content

Conversation

@LiqinWeng
Copy link
Contributor

@LiqinWeng LiqinWeng commented Oct 15, 2023

Refer to #68972

; CHECK-T1: @ %bb.0: @ %entry
; CHECK-T1-NEXT: lsls r2, r0, #3
; CHECK-T1-NEXT: adds r1, r1, r2
; CHECK-T1-NEXT: ldr r1, [r1, #4]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a regression?

; CHECK-NEXT: vsll.vi v8, v9, 7
; CHECK-NEXT: vsrl.vi v9, v9, 1
; CHECK-NEXT: vor.vv v8, v9, v8
; CHECK-NEXT: vmul.vx v8, v8, a0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vmv.v.x+vmacc.vx to vmul.vx+vadd.vx may be a regression.


if (!N->getOperand(0)->hasOneUse())
return false;
return true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just say return N->getOperand(0)->hasOneUse() ?

// into a shift.
if ((N0.getOpcode() == ISD::ADD || N0.getOpcode() == ISD::OR) &&
N0->hasOneUse() && TLI.isDesirableToCommuteWithShift(N, Level)) {
TLI.isDesirableToCommuteWithShift(N, Level)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simpler might be to make TLI.isDesirableToComputeWithShift return an enum s.t based on return its either:

  1. Always preferable
  2. Preferable if one use
  3. Never preferable

Then you can just leave the 1-use check here as opposed to putting it in each backend.

@LiqinWeng LiqinWeng closed this Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment