Page MenuHomePhabricator

[LV][SLP] Mark is_fpclass as vectorizable
Needs RevisionPublic

Authored by Nuullll on Aug 21 2022, 9:05 PM.

Details

Summary

This adds is_fpclass to the list of trivially vectorizable intrinsics, so that LV can vectorize it and SLP can vectorize/scalarize it.

Unlike other intrinsics, the signature of an is_fpclass doesn't use the return type as an overloaded type (i1 @llvm.is.fpclass.f32) -- the return element type is always i1 and the return vector width matches with the first operand.
This patch introduces a new utility function isVectorIntrinsicWithReturnOverloadType, to determine whether an intrinsic uses the return type as the first overloaded type.

Signed-off-by: Yilong Guo <yilong.guo@intel.com>

Diff Detail

Event Timeline

Nuullll created this revision.Aug 21 2022, 9:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2022, 9:05 PM
Nuullll updated this revision to Diff 454371.Aug 21 2022, 9:13 PM

Fix format and add a test.

Nuullll updated this revision to Diff 454372.Aug 21 2022, 9:21 PM
Nuullll edited the summary of this revision. (Show Details)

Update commit message.

Nuullll updated this revision to Diff 454373.Aug 21 2022, 9:24 PM
Nuullll edited the summary of this revision. (Show Details)

Add Signed-off.

Nuullll published this revision for review.Aug 21 2022, 9:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2022, 9:28 PM
eopXD added a subscriber: eopXD.Sep 20 2022, 11:14 PM
eopXD added inline comments.Sep 21 2022, 12:53 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
4185

I guess you will need the same change under VPlanRecipes::widenPredicateCallHelper too?

eopXD added inline comments.Sep 21 2022, 1:08 AM
llvm/include/llvm/Analysis/VectorUtils.h
325

I personally think OverloadReturnType makes more sense.

eopXD added a comment.Sep 21 2022, 3:12 AM

Title should also add [Scalarizer]

lebedev.ri resigned from this revision.Thu, Jan 12, 5:39 PM

I guess this makes sense.

arsenm requested changes to this revision.Thu, Jan 12, 5:46 PM
arsenm added a subscriber: arsenm.
arsenm added inline comments.
llvm/test/Transforms/SLPVectorizer/X86/intrinsic.ll
558

Should use opaque pointers

573

Should add tests where elements have different test masks

llvm/test/Transforms/Scalarizer/intrinsics.ll
165–169

Scalarizer is a separate patch

This revision now requires changes to proceed.Thu, Jan 12, 5:46 PM