ARM Neon指令vst1.8与vst1.32是否存在差异?
ARM Neon中vst1.32与vst1.8指令的差异分析
对比以下两条ARM Neon指令是否存在差异:
vst1.32 {d12, d13, d14, d15}, [r4]
和
vst1.8 {d12, d13, d14, d15}, [r4]
根据ARM官方文档中的伪代码:
case type of when '0111' regs = 1; if align<1> == '1' then UNDEFINED; when '1010' regs = 2; if align == '11' then UNDEFINED; when '0110' regs = 3; if align<1> == '1' then UNDEFINED; when '0010' regs = 4; otherwise SEE "Related encodings"; alignment = if align == '00' then 1 else 4 << UInt(align); ebytes = 1 << UInt(size); esize = 8 * ebytes; elements = 8 DIV ebytes; d = UInt(D:Vd); n = UInt(Rn); m = UInt(Rm); wback = (m != 15); register_index = (m != 15 && m != 13); if n == 15 || d+regs > 32 then UNPREDICTABLE; if ConditionPassed() then EncodingSpecificOperations(); CheckAdvSIMDEnabled(); NullCheckIfThumbEE(n); address = R[n]; if (address MOD alignment) != 0 then GenerateAlignmentException(); if wback then R[n] = R[n] + (if register_index then R[m] else 8*regs); for r = 0 to regs-1 for e = 0 to elements-1 if ebytes != 8 then MemU[address,ebytes] = Elem[D[d+r],e,esize]; else data =Elem[D[d+r],e,esize]; MemU[address,4] = if BigEndian() then data<63:32> else data<31:0>; MemU[address+4,4] = if BigEndian() then data<31:0> else data<63:32>; address = address + ebytes;
分析上述伪代码后发现,无论指定的size对应何种指令后缀(.8、.16、.32),D寄存器的完整64位(8字节)数据都会被复制到内存中,看起来vst1.32、vst1.8、vst1.16这几条指令似乎等效。但ARM ISA的设计原则中不应存在冗余的存储语义,因此疑惑自身的推理或假设存在何种漏洞。
内容的提问来源于stack exchange,提问作者0xcaff
相关产品推荐
相关产品推荐

