This is an archive of the discontinued LLVM Phabricator instance.

[X86] Update SSE/AVX ABS intrinsics to emit llvm.abs.* (PR46851)
ClosedPublic

Authored by RKSimon on Sep 3 2020, 10:43 AM.

Details

Summary

We're now getting close to having the necessary analysis/combines etc. for the new generic llvm.abs.* intrinsics.

This patch updates the SSE/AVX ABS intrinsics to emit the generic equivalents instead of the icmp+sub+select code pattern.

Diff Detail

Event Timeline

RKSimon created this revision.Sep 3 2020, 10:43 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 3 2020, 10:43 AM
RKSimon requested review of this revision.Sep 3 2020, 10:43 AM
nikic added a comment.Sep 3 2020, 1:09 PM

I think our abs intrinsic support is already sufficient to start canonicalizing to the intrinsic variant (the same is not true for min/max intrinsics). We might want to make the InstCombine change before this one, to make sure we don't lose CSE opportunities between the intrinsic and the expanded forms. Though if that's not a concern for these vector intrinsics, then this LG to me.

spatel accepted this revision.Sep 4 2020, 8:29 AM

LGTM - I think the odds of code that is using intrinsic vector abs inter-mixing with auto-vectorized code using the abs idiom are small.

I noticed one other LLVM codegen test that might want to be updated to use the IR intrinsics to be more relevant -- llvm-project/llvm/test/CodeGen/X86/combine-abs.ll. That can be done with this patch or later.

This revision is now accepted and ready to land.Sep 4 2020, 8:29 AM

I noticed one other LLVM codegen test that might want to be updated to use the IR intrinsics to be more relevant -- llvm-project/llvm/test/CodeGen/X86/combine-abs.ll. That can be done with this patch or later.

I'm going to address that one in a followup that cleans up the x86 PABS intrinsic handling in AutoUpgrade.cpp

This revision was landed with ongoing or failed builds.Sep 7 2020, 5:54 AM
This revision was automatically updated to reflect the committed changes.