From 08f261afbfbc6b1f10b6e64f491f611d3527012b Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Thu, 25 Sep 2014 23:48:49 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218480 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrAVX512.td | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/Target/X86/X86InstrAVX512.td b/lib/Target/X86/X86InstrAVX512.td index 047686fcdc6..274dea90b9b 100644 --- a/lib/Target/X86/X86InstrAVX512.td +++ b/lib/Target/X86/X86InstrAVX512.td @@ -422,10 +422,12 @@ multiclass vextract_for_size { let hasSideEffects = 0, ExeDomain = To.ExeDomain in { def rr : AVX512AIi8, 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, EVEX, EVEX_V512, EVEX_CD8; } - // Codegen pattern, e.g. v16i32 -> v4i32 for vextracti32x4 - def : Pat<(vextract_extract:$ext (From.VT VR512:$src1), (iPTR imm)), - (To.VT (!cast(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)),