簡體   English   中英

為什么_mm_insert_ps的偽代碼計算的是%8?

[英]Why does the pseudocode of _mm_insert_ps calculate %8?

在 intel 內在函數指南中, _mm_insert_ps操作的偽代碼定義如下:

FOR j := 0 to 3
    i := j*32
    IF imm8[j%8]
        dst[i+31:i] := 0
    ELSE
        dst[i+31:i] := tmp2[i+31:i]
    FI
ENDFOR

. imm8的訪問讓我感到困惑: IF imm8[j%8] 由於j0..3范圍內,模 8 部分似乎沒有做任何事情。 這是否可能表示我不知道的轉換? 或者在這種情況下%不是“模”?

似乎是一個毫無意義的模數。

Intel 的相應 asm 指令文檔insertps沒有在偽代碼中使用任何%模運算。 它使用ZMASK ←imm8[3:0]然后基本上展開使用循環的偽代碼部分,檢查如下

IF (ZMASK[2] = 1) THEN DEST[95:64]←00000000H
    ELSE DEST[95:64]←TMP2[95:64]

這只是顯示在插入來自另一個向量的元素或 memory 中的標量之后,立即數的低 4 位如何對最終結果的 4 個 dword 元素執行零屏蔽。

(There's no intrinsic for insert directly from memory; you'd need an intrinsic for movss and then hope the compiler folds that load into a memory operand for insertps . With a memory source, imm8[7:6] are ignored, just taking that標量 dword 作為要插入的元素(即 asm 偽代碼中的ELSE COUNT_S←0 ),但其他一切都一樣,包括您要詢問的零掩碼。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM