mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Convert vextracti128/vextractf128 intrinsics to extract_subvector at DAG build time. Similar was previously done for vinserti128/vinsertf128. Add patterns for folding these extract_subvectors with stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f7e0ea6627
commit
f6dc792df1
@ -4874,7 +4874,21 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
Res = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, DestVT,
|
||||
getValue(I.getArgOperand(0)),
|
||||
getValue(I.getArgOperand(1)),
|
||||
DAG.getConstant(Idx, MVT::i32));
|
||||
DAG.getIntPtrConstant(Idx));
|
||||
setValue(&I, Res);
|
||||
return 0;
|
||||
}
|
||||
case Intrinsic::x86_avx_vextractf128_pd_256:
|
||||
case Intrinsic::x86_avx_vextractf128_ps_256:
|
||||
case Intrinsic::x86_avx_vextractf128_si_256:
|
||||
case Intrinsic::x86_avx2_vextracti128: {
|
||||
DebugLoc dl = getCurDebugLoc();
|
||||
EVT DestVT = TLI.getValueType(I.getType());
|
||||
uint64_t Idx = (cast<ConstantInt>(I.getArgOperand(1))->getZExtValue() & 1) *
|
||||
DestVT.getVectorNumElements();
|
||||
Res = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, DestVT,
|
||||
getValue(I.getArgOperand(0)),
|
||||
DAG.getIntPtrConstant(Idx));
|
||||
setValue(&I, Res);
|
||||
return 0;
|
||||
}
|
||||
|
@ -7270,28 +7270,8 @@ def VEXTRACTF128mr : AVXAIi8<0x19, MRMDestMem, (outs),
|
||||
[]>, VEX;
|
||||
}
|
||||
|
||||
// Extract and store.
|
||||
let Predicates = [HasAVX] in {
|
||||
def : Pat<(alignedstore (int_x86_avx_vextractf128_ps_256 VR256:$src1,
|
||||
imm:$src2), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1, imm:$src2)>;
|
||||
def : Pat<(alignedstore (int_x86_avx_vextractf128_pd_256 VR256:$src1,
|
||||
imm:$src2), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1, imm:$src2)>;
|
||||
def : Pat<(alignedstore (int_x86_avx_vextractf128_si_256 VR256:$src1,
|
||||
imm:$src2), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1, imm:$src2)>;
|
||||
}
|
||||
|
||||
// AVX1 patterns
|
||||
let Predicates = [HasAVX] in {
|
||||
def : Pat<(int_x86_avx_vextractf128_pd_256 VR256:$src1, imm:$src2),
|
||||
(VEXTRACTF128rr VR256:$src1, imm:$src2)>;
|
||||
def : Pat<(int_x86_avx_vextractf128_ps_256 VR256:$src1, imm:$src2),
|
||||
(VEXTRACTF128rr VR256:$src1, imm:$src2)>;
|
||||
def : Pat<(int_x86_avx_vextractf128_si_256 VR256:$src1, imm:$src2),
|
||||
(VEXTRACTF128rr VR256:$src1, imm:$src2)>;
|
||||
|
||||
def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)),
|
||||
(v4f32 (VEXTRACTF128rr
|
||||
(v8f32 VR256:$src1),
|
||||
@ -7300,25 +7280,51 @@ def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)),
|
||||
(v2f64 (VEXTRACTF128rr
|
||||
(v4f64 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
|
||||
def : Pat<(alignedstore (v4f32 (vextractf128_extract:$ext (v8f32 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
def : Pat<(alignedstore (v2f64 (vextractf128_extract:$ext (v4f64 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
}
|
||||
|
||||
let Predicates = [HasAVX1Only] in {
|
||||
def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)),
|
||||
(v2i64 (VEXTRACTF128rr
|
||||
(v4i64 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
(v4i64 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)),
|
||||
(v4i32 (VEXTRACTF128rr
|
||||
(v8i32 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
(v8i32 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)),
|
||||
(v8i16 (VEXTRACTF128rr
|
||||
(v16i16 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
(v16i16 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)),
|
||||
(v16i8 (VEXTRACTF128rr
|
||||
(v32i8 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
(v32i8 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
|
||||
def : Pat<(alignedstore (v2i64 (vextractf128_extract:$ext (v4i64 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
def : Pat<(alignedstore (v4i32 (vextractf128_extract:$ext (v8i32 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
def : Pat<(alignedstore (v8i16 (vextractf128_extract:$ext (v16i16 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
def : Pat<(alignedstore (v16i8 (vextractf128_extract:$ext (v32i8 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTF128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -7840,6 +7846,23 @@ def : Pat<(vextractf128_extract:$ext VR256:$src1, (i32 imm)),
|
||||
(v16i8 (VEXTRACTI128rr
|
||||
(v32i8 VR256:$src1),
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext)))>;
|
||||
|
||||
def : Pat<(alignedstore (v2i64 (vextractf128_extract:$ext (v4i64 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTI128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
def : Pat<(alignedstore (v4i32 (vextractf128_extract:$ext (v8i32 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTI128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
def : Pat<(alignedstore (v8i16 (vextractf128_extract:$ext (v16i16 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTI128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
def : Pat<(alignedstore (v16i8 (vextractf128_extract:$ext (v32i8 VR256:$src1),
|
||||
(i32 imm))), addr:$dst),
|
||||
(VEXTRACTI128mr addr:$dst, VR256:$src1,
|
||||
(EXTRACT_get_vextractf128_imm VR128:$ext))>;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
x
Reference in New Issue
Block a user