[AVX512] Add vpermil variable version

This is implemented via a multiclass that derives from the vperm imm
multiclass.

Fixes <rdar://problem/18426089>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220737 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet 2014-10-27 23:08:40 +00:00
parent 5c76721372
commit 6bc8d95153
2 changed files with 41 additions and 2 deletions

View File

@ -783,14 +783,37 @@ multiclass avx512_perm_imm<bits<8> opc, string OpcodeStr, SDNode OpNode,
}
}
multiclass avx512_permil<bits<8> OpcImm, bits<8> OpcVar, X86VectorVTInfo _,
X86VectorVTInfo Ctrl> :
avx512_perm_imm<OpcImm, "vpermil" # _.Suffix, X86VPermilpi, _> {
let ExeDomain = _.ExeDomain in {
def rr : AVX5128I<OpcVar, MRMSrcReg, (outs _.RC:$dst),
(ins _.RC:$src1, _.RC:$src2),
!strconcat("vpermil" # _.Suffix,
" \t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set _.RC:$dst,
(_.VT (X86VPermilpv _.RC:$src1,
(Ctrl.VT Ctrl.RC:$src2))))]>,
EVEX_4V;
def rm : AVX5128I<OpcVar, MRMSrcMem, (outs _.RC:$dst),
(ins _.RC:$src1, Ctrl.MemOp:$src2),
!strconcat("vpermil" # _.Suffix,
" \t{$src2, $src1, $dst|$dst, $src1, $src2}"),
[(set _.RC:$dst,
(_.VT (X86VPermilpv _.RC:$src1,
(Ctrl.VT (Ctrl.MemOpFrag addr:$src2)))))]>,
EVEX_4V;
}
}
defm VPERMQZ : avx512_perm_imm<0x00, "vpermq", X86VPermi, v8i64_info>,
EVEX_V512, VEX_W;
defm VPERMPDZ : avx512_perm_imm<0x01, "vpermpd", X86VPermi, v8f64_info>,
EVEX_V512, VEX_W;
defm VPERMILPSZ : avx512_perm_imm<0x04, "vpermilps", X86VPermilpi, v16f32_info>,
defm VPERMILPSZ : avx512_permil<0x04, 0x0C, v16f32_info, v16i32_info>,
EVEX_V512;
defm VPERMILPDZ : avx512_perm_imm<0x05, "vpermilpd", X86VPermilpi, v8f64_info>,
defm VPERMILPDZ : avx512_permil<0x05, 0x0D, v8f64_info, v8i64_info>,
EVEX_V512, VEX_W;
def : Pat<(v16i32 (X86VPermilpi VR512:$src1, (i8 imm:$imm))),

View File

@ -4375,3 +4375,19 @@ vfnmadd231ps %zmm5, %zmm6, %zmm7
// CHECK: vfnmsub231pd
// CHECK: encoding: [0x62,0xf2,0xcd,0x48,0xbe,0xfd]
vfnmsub231pd %zmm5, %zmm6, %zmm7
// CHECK: vpermilps
// CHECK: encoding: [0x62,0xf2,0x6d,0x48,0x0c,0xd9]
vpermilps %zmm1, %zmm2, %zmm3
// CHECK: vpermilpd
// CHECK: encoding: [0x62,0xf2,0xed,0x48,0x0d,0x5b,0x10]
vpermilpd 0x400(%rbx), %zmm2, %zmm3
// CHECK: vpermilps
// CHECK: encoding: [0x62,0xf2,0x6d,0x48,0x0c,0x5b,0x10]
vpermilps 0x400(%rbx), %zmm2, %zmm3
// CHECK: vpermilpd
// CHECK: encoding: [0x62,0xf3,0xfd,0x48,0x05,0x53,0x10,0x23]
vpermilpd $0x23, 0x400(%rbx), %zmm2