[llvm] r218480 - [AVX512] Pull pattern for subvector extract into the instruction definition
Adam Nemet
anemet at apple.com
Thu Sep 25 16:48:49 PDT 2014
Author: anemet
Date: Thu Sep 25 18:48:49 2014
New Revision: 218480
URL: http://llvm.org/viewvc/llvm-project?rev=218480&view=rev
Log:
[AVX512] Pull pattern for subvector extract into the instruction definition
No functional change.
I initially thought that pulling the Pat<> into the instruction pattern was
not possible because it was doing a transform on the index in order to convert
it from a per-element (extract_subvector) index into a per-chunk (vextract*x4)
index.
Turns out this also works inside the pattern because the vextract_extract
PatFrag has an OperandTransform EXTRACT_get_vextract{128,256}_imm, so the
index in $idx goes through the same conversion.
The existing test CodeGen/X86/avx512-insert-extract.ll extended in the
previous commit provides coverage for this change.
Modified:
llvm/trunk/lib/Target/X86/X86InstrAVX512.td
Modified: llvm/trunk/lib/Target/X86/X86InstrAVX512.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrAVX512.td?rev=218480&r1=218479&r2=218480&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrAVX512.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrAVX512.td Thu Sep 25 18:48:49 2014
@@ -422,10 +422,12 @@ multiclass vextract_for_size<int Opcode,
SDNodeXForm EXTRACT_get_vextract_imm> {
let hasSideEffects = 0, ExeDomain = To.ExeDomain in {
def rr : AVX512AIi8<Opcode, MRMDestReg, (outs To.RC:$dst),
- (ins VR512:$src1, i8imm:$src2),
- "vextract" # To.EltTypeName # "x4\t{$src2, $src1, $dst|"
- "$dst, $src1, $src2}",
- []>, EVEX, EVEX_V512;
+ (ins VR512:$src1, i8imm:$idx),
+ "vextract" # To.EltTypeName # "x4\t{$idx, $src1, $dst|"
+ "$dst, $src1, $idx}",
+ [(set To.RC:$dst, (vextract_extract:$idx (From.VT VR512:$src1),
+ (iPTR imm)))]>,
+ EVEX, EVEX_V512;
let mayStore = 1 in
def rm : AVX512AIi8<Opcode, MRMDestMem, (outs),
(ins To.MemOp:$dst, VR512:$src1, i8imm:$src2),
@@ -434,11 +436,6 @@ multiclass vextract_for_size<int Opcode,
[]>, EVEX, EVEX_V512, EVEX_CD8<To.EltSize, CD8VT4>;
}
- // Codegen pattern, e.g. v16i32 -> v4i32 for vextracti32x4
- def : Pat<(vextract_extract:$ext (From.VT VR512:$src1), (iPTR imm)),
- (To.VT (!cast<Instruction>(NAME # To.EltSize # "x4rr") VR512:$src1,
- (EXTRACT_get_vextract_imm To.RC:$ext)))>;
-
// Codegen pattern with the alternative types, e.g. v8i64 -> v2i64 for
// vextracti32x4
def : Pat<(vextract_extract:$ext (AltFrom.VT VR512:$src1), (iPTR imm)),
More information about the llvm-commits
mailing list