Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 8405c94

Browse files
committed
ARM64: nick some AArch64 patterns for extract/insert -> INS.
Tests will be committed shortly when all optimisations needed to support AArch64's neon-copy.ll file are supported. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206571 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 66643da commit 8405c94

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

lib/Target/ARM64/ARM64InstrInfo.td

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,6 +3137,43 @@ def : Pat<(v2i64 (int_arm64_neon_vcopy_lane
31373137
V128:$Vd, VectorIndexD:$idx, V128:$Vs, VectorIndexD:$idx2)
31383138
)>;
31393139

3140+
multiclass Neon_INS_elt_pattern<ValueType VT128, ValueType VT64,
3141+
ValueType VTScal, Instruction INS> {
3142+
def : Pat<(VT128 (vector_insert V128:$src,
3143+
(VTScal (vector_extract (VT128 V128:$Rn), imm:$Immn)),
3144+
imm:$Immd)),
3145+
(INS V128:$src, imm:$Immd, V128:$Rn, imm:$Immn)>;
3146+
3147+
def : Pat<(VT128 (vector_insert V128:$src,
3148+
(VTScal (vector_extract (VT64 V64:$Rn), imm:$Immn)),
3149+
imm:$Immd)),
3150+
(INS V128:$src, imm:$Immd,
3151+
(SUBREG_TO_REG (i64 0), V64:$Rn, dsub), imm:$Immn)>;
3152+
3153+
def : Pat<(VT64 (vector_insert V64:$src,
3154+
(VTScal (vector_extract (VT128 V128:$Rn), imm:$Immn)),
3155+
imm:$Immd)),
3156+
(EXTRACT_SUBREG (INS (SUBREG_TO_REG (i64 0), V64:$src, dsub),
3157+
imm:$Immd, V128:$Rn, imm:$Immn),
3158+
dsub)>;
3159+
3160+
def : Pat<(VT64 (vector_insert V64:$src,
3161+
(VTScal (vector_extract (VT64 V64:$Rn), imm:$Immn)),
3162+
imm:$Immd)),
3163+
(EXTRACT_SUBREG
3164+
(INS (SUBREG_TO_REG (i64 0), V64:$src, dsub), imm:$Immd,
3165+
(SUBREG_TO_REG (i64 0), V64:$Rn, dsub), imm:$Immn),
3166+
dsub)>;
3167+
}
3168+
3169+
defm : Neon_INS_elt_pattern<v4f32, v2f32, f32, INSvi32lane>;
3170+
defm : Neon_INS_elt_pattern<v2f64, v1f64, f64, INSvi64lane>;
3171+
defm : Neon_INS_elt_pattern<v16i8, v8i8, i32, INSvi8lane>;
3172+
defm : Neon_INS_elt_pattern<v8i16, v4i16, i32, INSvi16lane>;
3173+
defm : Neon_INS_elt_pattern<v4i32, v2i32, i32, INSvi32lane>;
3174+
defm : Neon_INS_elt_pattern<v2i64, v1i64, i64, INSvi32lane>;
3175+
3176+
31403177
// Floating point vector extractions are codegen'd as either a sequence of
31413178
// subregister extractions, possibly fed by an INS if the lane number is
31423179
// anything other than zero.

0 commit comments

Comments
 (0)