@@ -2853,46 +2853,56 @@ defm VFPCLASS : avx512_fp_fpclass_all<"vfpclass", 0x66, 0x67, SchedWriteFCmp>, E
2853
2853
// - copy from GPR to mask register and vice versa
2854
2854
//
2855
2855
multiclass avx512_mask_mov<bits<8> opc_kk, bits<8> opc_km, bits<8> opc_mk,
2856
- string OpcodeStr, RegisterClass KRC,
2857
- ValueType vvt, X86MemOperand x86memop> {
2856
+ string OpcodeStr, RegisterClass KRC, ValueType vvt,
2857
+ X86MemOperand x86memop, string Suffix = ""> {
2858
+ let explicitOpPrefix = !if(!eq(Suffix, ""), NoExplicitOpPrefix, ExplicitEVEX) in {
2858
2859
let isMoveReg = 1, hasSideEffects = 0, SchedRW = [WriteMove] in
2859
- def kk : I<opc_kk, MRMSrcReg, (outs KRC:$dst), (ins KRC:$src),
2860
- !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), []>,
2861
- Sched<[WriteMove]>;
2862
- def km : I<opc_km, MRMSrcMem, (outs KRC:$dst), (ins x86memop:$src),
2863
- !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
2864
- [(set KRC:$dst, (vvt (load addr:$src)))]>,
2865
- Sched<[WriteLoad]>;
2866
- def mk : I<opc_mk, MRMDestMem, (outs), (ins x86memop:$dst, KRC:$src),
2867
- !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
2868
- [(store KRC:$src, addr:$dst)]>,
2869
- Sched<[WriteStore]>;
2860
+ def kk#Suffix : I<opc_kk, MRMSrcReg, (outs KRC:$dst), (ins KRC:$src),
2861
+ !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), []>,
2862
+ Sched<[WriteMove]>;
2863
+ def km#Suffix : I<opc_km, MRMSrcMem, (outs KRC:$dst), (ins x86memop:$src),
2864
+ !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
2865
+ [(set KRC:$dst, (vvt (load addr:$src)))]>,
2866
+ Sched<[WriteLoad]>;
2867
+ def mk#Suffix : I<opc_mk, MRMDestMem, (outs), (ins x86memop:$dst, KRC:$src),
2868
+ !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
2869
+ [(store KRC:$src, addr:$dst)]>,
2870
+ Sched<[WriteStore]>;
2871
+ }
2870
2872
}
2871
2873
2872
2874
multiclass avx512_mask_mov_gpr<bits<8> opc_kr, bits<8> opc_rk,
2873
- string OpcodeStr,
2874
- RegisterClass KRC, RegisterClass GRC> {
2875
- let hasSideEffects = 0 in {
2876
- def kr : I<opc_kr, MRMSrcReg, (outs KRC:$dst), (ins GRC:$src),
2877
- !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), []>,
2878
- Sched<[WriteMove]>;
2879
- def rk : I<opc_rk, MRMSrcReg, (outs GRC:$dst), (ins KRC:$src),
2880
- !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), []>,
2881
- Sched<[WriteMove]>;
2875
+ string OpcodeStr, RegisterClass KRC ,
2876
+ RegisterClass GRC, string Suffix = "" > {
2877
+ let hasSideEffects = 0, explicitOpPrefix = !if(!eq(Suffix, ""), NoExplicitOpPrefix, ExplicitEVEX) in {
2878
+ def kr#Suffix : I<opc_kr, MRMSrcReg, (outs KRC:$dst), (ins GRC:$src),
2879
+ !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), []>,
2880
+ Sched<[WriteMove]>;
2881
+ def rk#Suffix : I<opc_rk, MRMSrcReg, (outs GRC:$dst), (ins KRC:$src),
2882
+ !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), []>,
2883
+ Sched<[WriteMove]>;
2882
2884
}
2883
2885
}
2884
2886
2885
- let Predicates = [HasDQI] in
2887
+ let Predicates = [HasDQI, NoEGPR ] in
2886
2888
defm KMOVB : avx512_mask_mov<0x90, 0x90, 0x91, "kmovb", VK8, v8i1, i8mem>,
2887
2889
avx512_mask_mov_gpr<0x92, 0x93, "kmovb", VK8, GR32>,
2888
2890
VEX, PD;
2891
+ let Predicates = [HasDQI, HasEGPR, In64BitMode] in
2892
+ defm KMOVB : avx512_mask_mov<0x90, 0x90, 0x91, "kmovb", VK8, v8i1, i8mem, "_EVEX">,
2893
+ avx512_mask_mov_gpr<0x92, 0x93, "kmovb", VK8, GR32, "_EVEX">,
2894
+ EVEX, PD;
2889
2895
2890
- let Predicates = [HasAVX512] in
2896
+ let Predicates = [HasAVX512, NoEGPR ] in
2891
2897
defm KMOVW : avx512_mask_mov<0x90, 0x90, 0x91, "kmovw", VK16, v16i1, i16mem>,
2892
2898
avx512_mask_mov_gpr<0x92, 0x93, "kmovw", VK16, GR32>,
2893
2899
VEX, PS;
2900
+ let Predicates = [HasAVX512, HasEGPR, In64BitMode] in
2901
+ defm KMOVW : avx512_mask_mov<0x90, 0x90, 0x91, "kmovw", VK16, v16i1, i16mem, "_EVEX">,
2902
+ avx512_mask_mov_gpr<0x92, 0x93, "kmovw", VK16, GR32, "_EVEX">,
2903
+ EVEX, PS;
2894
2904
2895
- let Predicates = [HasBWI] in {
2905
+ let Predicates = [HasBWI, NoEGPR ] in {
2896
2906
defm KMOVD : avx512_mask_mov<0x90, 0x90, 0x91, "kmovd", VK32, v32i1,i32mem>,
2897
2907
VEX, PD, REX_W;
2898
2908
defm KMOVD : avx512_mask_mov_gpr<0x92, 0x93, "kmovd", VK32, GR32>,
@@ -2902,6 +2912,16 @@ let Predicates = [HasBWI] in {
2902
2912
defm KMOVQ : avx512_mask_mov_gpr<0x92, 0x93, "kmovq", VK64, GR64>,
2903
2913
VEX, XD, REX_W;
2904
2914
}
2915
+ let Predicates = [HasBWI, HasEGPR, In64BitMode] in {
2916
+ defm KMOVD : avx512_mask_mov<0x90, 0x90, 0x91, "kmovd", VK32, v32i1,i32mem, "_EVEX">,
2917
+ EVEX, PD, REX_W;
2918
+ defm KMOVD : avx512_mask_mov_gpr<0x92, 0x93, "kmovd", VK32, GR32, "_EVEX">,
2919
+ EVEX, XD;
2920
+ defm KMOVQ : avx512_mask_mov<0x90, 0x90, 0x91, "kmovq", VK64, v64i1, i64mem, "_EVEX">,
2921
+ EVEX, PS, REX_W;
2922
+ defm KMOVQ : avx512_mask_mov_gpr<0x92, 0x93, "kmovq", VK64, GR64, "_EVEX">,
2923
+ EVEX, XD, REX_W;
2924
+ }
2905
2925
2906
2926
// GR from/to mask register
2907
2927
def : Pat<(v16i1 (bitconvert (i16 GR16:$src))),
0 commit comments