If the target allows the alignment, this should be OK. This is the partner change to D17306.
This currently breaks 1 ARM test (test/CodeGen/ARM/vector-store.ll), which looks to me like allowsMisalignedMemoryAccesses is incorrectly reporting fast.
The changes all look like this:
define void @store_v8i8_update(<8 x i8>** %ptr, <8 x i8> %val) { ;CHECK-LABEL: store_v8i8_update: ;CHECK: vst1.8 {{{d[0-9]+}}}, [{{r[0-9]+}}]! %A = load <8 x i8>*, <8 x i8>** %ptr store <8 x i8> %val, <8 x i8>* %A, align 1 %inc = getelementptr <8 x i8>, <8 x i8>* %A, i38 1 store <8 x i8>* %inc, <8 x i8>** %ptr ret void }
DAG at replacement time:
SelectionDAG has 17 nodes: t0: ch = EntryToken t2: i32,ch = CopyFromReg t0, Register:i32 %vreg0 t9: i32 = Constant<0> t11: i32,ch = load<LD4[%ptr]> t0, t2, undef:i32 t4: i32,ch = CopyFromReg t0, Register:i32 %vreg1 t6: i32,ch = CopyFromReg t0, Register:i32 %vreg2 t7: f64 = ARMISD::VMOVDRR t4, t6 t8: v8i8 = bitcast t7 t12: ch = store<ST8[%A](align=1)> t11:1, t8, t11, undef:i32 t14: i32 = add t11, Constant:i32<8> t15: ch = store<ST4[%ptr]> t12, t14, t2, undef:i32 t16: ch = ARMISD::RET_FLAG t15
Before:
_store_v8i8_update: @ BB#0: vmov d16, r1, r2 ldr r1, [r0] vst1.8 {d16}, [r1]! str r1, [r0] bx lr
After:
_store_v8i8_update: @ BB#0: ldr r3, [r0] str r1, [r3] str r2, [r3, #4] add.w r1, r3, #8 str r1, [r0] bx lr
It also breaks 2 other X86 tests, both of which appear to be i1-vector related:
X86/avx-vextractf128.ll, which replaces a
vxorps %xmm0, %xmm0, %xmm0
with a
vxorps %ymm0, %ymm0, %ymm0
X86/avx512-mask-op.ll, where an extra move is introduced