This is an archive of the discontinued LLVM Phabricator instance.

[X86][CodeGen]Fix extract f16 from big vectors
ClosedPublic

Authored by XinWang10 on Jan 9 2023, 8:11 PM.

Details

Summary

When use llc -mattr=+avx512fp16, it will crash.

define half @test(<64 x half> %x, i64 %idx){
   %res = extractelement <64 x half> %x, i64 %idx
   ret half %res
}

The root cause is when we enable avx512fp16 we lose custom handler
for extract f16 from big vectors which is not loaded from pointer.

Diff Detail

Event Timeline

XinWang10 created this revision.Jan 9 2023, 8:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 8:11 PM
XinWang10 requested review of this revision.Jan 9 2023, 8:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 8:11 PM
XinWang10 edited the summary of this revision. (Show Details)Jan 9 2023, 8:19 PM
XinWang10 updated this revision to Diff 487669.Jan 9 2023, 9:29 PM
XinWang10 edited the summary of this revision. (Show Details)
This comment was removed by XinWang10.
XinWang10 updated this revision to Diff 487670.Jan 9 2023, 9:31 PM
This comment was removed by XinWang10.
XinWang10 abandoned this revision.Jan 9 2023, 9:34 PM
XinWang10 updated this revision to Diff 487671.Jan 9 2023, 9:37 PM
This comment was removed by XinWang10.
XinWang10 updated this revision to Diff 487676.Jan 9 2023, 9:59 PM
This comment was removed by XinWang10.
XinWang10 updated this revision to Diff 487681.Jan 9 2023, 10:17 PM
This comment was removed by XinWang10.
XinWang10 abandoned this revision.Jan 9 2023, 10:18 PM
XinWang10 updated this revision to Diff 487682.Jan 9 2023, 10:21 PM

Fix extract f16 from big vectors

pengfei added inline comments.Jan 9 2023, 10:47 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
34125

We usually use vNf16

34126–34128

Try to avoid defining variable used by assert only. Compiler may report used variable when do releast build.

34131–34132

You can use changeVectorElementTypeToInteger.

llvm/test/CodeGen/X86/avx512fp16-mov.ll
1352

Add nounwind.

XinWang10 updated this revision to Diff 487695.Jan 9 2023, 11:30 PM

Updating D141348: [X86][CodeGen]Fix extract f16 from big vectors

pengfei added inline comments.Jan 9 2023, 11:35 PM
llvm/lib/Target/X86/X86ISelLowering.cpp
34125

Sorry, I want to say vXf16.

XinWang10 updated this revision to Diff 487696.Jan 9 2023, 11:35 PM

Change tests

XinWang10 updated this revision to Diff 487699.Jan 9 2023, 11:38 PM

Update comments

XinWang10 marked 5 inline comments as done.Jan 9 2023, 11:39 PM
XinWang10 added inline comments.
llvm/lib/Target/X86/X86ISelLowering.cpp
34125

Thanks.

pengfei accepted this revision.Jan 9 2023, 11:45 PM

LGTM.

This revision is now accepted and ready to land.Jan 9 2023, 11:45 PM
This revision was automatically updated to reflect the committed changes.