This is an archive of the discontinued LLVM Phabricator instance.

neon: truncate(smin(smax(a,b),c)) --> vqmovns(a),truncate(smin(a,b)) --> vqmovnu(a)
Needs ReviewPublic

Authored by fantasyRqg on Apr 21 2021, 2:50 AM.

Details

Summary
  • truncate(smin(smax(a,b),c)) --> vqmovns(a)
  • truncate(umin(a,b)) --> vqmovnu(a)

[How to indicate LLVM use VQMOVN.s16 ](https://discuss.tvm.apache.org/t/how-to-indicate-llvm-use-vqmovn-s16/9682)

Diff Detail

Event Timeline

fantasyRqg created this revision.Apr 21 2021, 2:50 AM
fantasyRqg requested review of this revision.Apr 21 2021, 2:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2021, 2:50 AM
fantasyRqg edited the summary of this revision. (Show Details)Apr 21 2021, 3:03 AM
fantasyRqg added reviewers: rengolin, asl, t.p.northover.
fantasyRqg edited the summary of this revision. (Show Details)Apr 21 2021, 3:19 AM
fantasyRqg edited the summary of this revision. (Show Details)

fix: wrong bit-width on PerformNeonTruncateMinMaxCombine::IsUnsignedSaturate

collect all change

RKSimon added a subscriber: RKSimon.

X86 has some very similar code to recognise saturated trunc pattern matchers (detectUSatPattern + detectSSatPattern) - would it make sense to move them to SelectionDAG and reuse them here?

X86 has some very similar code to recognise saturated trunc pattern matchers (detectUSatPattern + detectSSatPattern) - would it make sense to move them to SelectionDAG and reuse them here?

I will take a look.
I need some time to understand TableGen.

Hello. Is it possible to just add a few tablegen patterns for there? As far as I can tell they are just a few nodes combined into one, and (unlike on MVE) we will not need to optimize them further.

X86 has some very similar code to recognise saturated trunc pattern matchers (detectUSatPattern + detectSSatPattern) - would it make sense to move them to SelectionDAG and reuse them here?

I will take a look.
I need some time to understand TableGen.

I didn't mean anything for TableGen - I just mention reusing the existing code (after moving to a generic location) instead of your IsSignedSaturate/IsUnsignedSaturate lambdas

RKSimon resigned from this revision.Jul 9 2021, 1:59 AM