-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[X86][CodeGen] Prefer KMOVkk_EVEX than KMOVkk when EGPR is supported #74048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx512f,+egpr -show-mc-encoding | FileCheck --check-prefix=EGPR %s | ||
|
||
define <16 x i32> @kmovkk(ptr %base, <16 x i32> %ind, i16 %mask) { | ||
; EGPR: kmovq %k1, %k2 # EVEX TO VEX Compression encoding: [0xc4,0xe1,0xf8,0x90,0xd1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to add a test to cover the memory fold case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not straightforward to me. And I think the memory fold is already tested by ./llvm/test/TableGen/x86-fold-tables.inc |
||
%broadcast.splatinsert = insertelement <16 x ptr> undef, ptr %base, i32 0 | ||
%broadcast.splat = shufflevector <16 x ptr> %broadcast.splatinsert, <16 x ptr> undef, <16 x i32> zeroinitializer | ||
%gep.random = getelementptr i32, <16 x ptr> %broadcast.splat, <16 x i32> %ind | ||
%imask = bitcast i16 %mask to <16 x i1> | ||
%gt1 = call <16 x i32> @llvm.masked.gather.v16i32.v16p0(<16 x ptr> %gep.random, i32 4, <16 x i1> %imask, <16 x i32>undef) | ||
%gt2 = call <16 x i32> @llvm.masked.gather.v16i32.v16p0(<16 x ptr> %gep.random, i32 4, <16 x i1> %imask, <16 x i32>%gt1) | ||
%res = add <16 x i32> %gt1, %gt2 | ||
ret <16 x i32> %res | ||
} | ||
declare <16 x i32> @llvm.masked.gather.v16i32.v16p0(<16 x ptr>, i32, <16 x i1>, <16 x i32>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we access + repurpose the EVEX->VEX tables to do this for us?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting the usage like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's probably not worth it. First, KMOV may be the only instruction that needs to be promoted in CPP, and other instructions are implemented in TD through predicate HasEGPR/NoEGPR. Second, looking up the table will change the complexity from O(1) to O(lgN) and increase compile time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, no need to do it - I have found during debugging that tracking down all the places that we switch instruction encoding is not always easy. But maybe we should just improve debug output - the X86DomainReassignment pass for instance doesn't do a good job listing all the changes it makes.