2016-04-24 6 views
0

次のコードでは、 'in *'配列から 'out *'配列にデータをコピーしようとしていますが、最初のvst1.32命令でsegfaultsを実行します。アームネオンvst1.32 segfault

int* in0 = new int[4]{ 0x0, 0x1, 0x2, 0x3 }; 
int* in1 = new int[4]{ 0x4, 0x5, 0x6, 0x7 }; 
int* in2 = new int[4]{ 0x8, 0x9, 0xA, 0xB }; 
int* in3 = new int[4]{ 0xC, 0xD, 0xE, 0xF }; 

int* out0 = new int[4]{}; 
int* out1 = new int[4]{}; 
int* out2 = new int[4]{}; 
int* out3 = new int[4]{}; 

asm volatile("vld1.32 {d0, d1}, [%[in0]]  \n" 
      "vld1.32 {d2, d3}, [%[in1]]  \n" 
      "vld1.32 {d4, d5}, [%[in2]]  \n" 
      "vld1.32 {d6, d7}, [%[in3]]  \n" 
      "vst1.32 {d0, d1}, [%[out0]]  \n" 
      "vst1.32 {d2, d3}, [%[out1]]  \n" 
      "vst1.32 {d4, d5}, [%[out2]]  \n" 
      "vst1.32 {d6, d7}, [%[out3]]  \n" 
      : [out0]"=r"(out0), [out1]"=r"(out1), [out2]"=r"(out2), [out3]"=r"(out3) 
      : [in0]"r"(in0), [in1]"r"(in1), [in2]"r"(in2), [in3]"r"(in3) 
      : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "memory", "cc" 
      ); 
+0

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491f/BABDCGGF.htmlには、「置き換えられた」と透かしが入れられています。おそらく、あなたはこのコマンドに取って代わるものを探すべきでしょう。 – BitTickler

+0

検索機能を使用すると、このページが作成されました:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491f/BABDCGGF.html - 私はそれが実際には個々の指示ではなく、置き換えられた全体としての文書。 – bitwise

+1

'[out0]" = r "(out0)'は、out0の値がasmによって上書きされることを意味します。また、値が上書きされる前に値が使用されていないので、何かを割り当てるポイントは何ですか? IOWは、直感に反して、out0は入力です。だからあなたはgccにout0の* contents *を変更しているとどのように伝えますか?この場合には、メモリクローバーで十分です。 –

答えて

3

[out0]"=r"(out0)は、as0の値がasmによって上書きされることを意味します。また、値が上書きされる前に値が使用されていないので、何かを割り当てるポイントは何ですか?

つまり、見た目に反するように、out0は入力です。

したがって、の内容を変更しているとgccに伝えますか? out0?この場合には、メモリクローバーで十分です。