PSLLH/PSRLH/PSRAH: shift amounts 16-31 should use sa[3:0] (SSE gives 0 / sign fill)
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
mmi_translator.cpp の110~115行目では、3つのhalfwordシフトケースが生の sa をSSEに渡しています。それらのケースを読み、issueで引用されているEEの根拠と動作を比較してください。まず ps2autotests/tests/cpu/ee_simd/logic.expected を確認します。それらのケースではシフト量を下位4ビットにマスクし、次に sa 16 と31の再現カーネルがEEの動作と一致することを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Hi! The halfword shift-immediate MMI ops pass the full 5-bit sa field to SSE. On the EE only the low 4 bits count for halfwords, so with sa 16-31 the results differ.
Where: mmi_translator.cpp lines 110-115 (at e5636981) emit _mm_slli_epi16 / _mm_srli_epi16 / _mm_srai_epi16 with the raw sa. SSE returns 0 (or a sign fill for srai) for any count above 15.
What the EE does:
| op | sa | EE | PS2Recomp |
|---|---|---|---|
| psllh / psrlh | 16 | value unchanged (shift by 0) | 0 in every lane |
| psrah | 16 | value unchanged | sign fill |
| psllh / psrlh | 31 | shift by 15 | 0 in every lane |
| psrah | 31 | shift by 15 | sign fill (same result, by coincidence) |
Evidence for the EE rule:
- Real PS2 output in ps2autotests
tests/cpu/ee_simd/logic.expected:psllh -1, 16comes back unchanged andpsllh -1, 31gives8000in every halfword. All 144 shift-immediate lines there fit sa[3:0] for the halfword forms. - PCSX2
MMI.cpp_PSLLH:<< (_Sa_ & 0xf). - DobieStation
emotion_mmi.cpp:shift = (instruction >> 6) & 0xF.
Repro: a one-instruction kernel (lq, psllh t0, a3, 16, sq) built with ps2dev EE gcc, run through PS2Recomp e5636981: every lane comes back 0, where the EE leaves the value unchanged. With sa 15 everything matches. Masking the count to sa & 15 in the three halfword cases fixes all of our sa 16/31 kernels (the word forms PSLLW/PSRLW/PSRAW are fine as they are; there all 5 bits count).
To be fair about impact: a C compiler shouldn't emit a halfword shift of 16 or more, so this most likely only matters for hand-written asm with an unusual count. Happy to open a small PR with the & 15 if that's useful.
AI tools helped with the testing and this write-up. I've reviewed it.
- 主要言語
- C++
- スター
- 3.3k
- フォーク
- 149
- 平均マージ
- 8時間 46分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ran-j/PS2Recomp のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ran-j/PS2Recomp#393 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
EE sceCdStatus stub always reports READ (6), hanging games that wait for PAUSE対応中かも @ahmedgamalalzatary が 19 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
メンテナーはふだん 4 日以内に返信
-
VU0 macro VSQI / VSQD: address and source registers swapped in generated code対応中かも @yanm1103 が 26 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 4 日以内に返信
-
Runtime: SampleTexture casts unbounded or NaN texture coordinates to int, which is undefined behaviour再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ran-j/PS2Recomp#273 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
ran-j/PS2Recomp の issue をすべて見る
似ている issue
-
area:qmc bug
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 3 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ASGC-Game-Jam/asgc-gamejam-2026#563 ·
メンテナーはふだん 1 日以内に返信
-
area/ysql kind/bug priority/medium status/awaiting-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
yugabyte/yugabyte-db#37523 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Cockatrice/Cockatrice#7896 ·
メンテナーはふだん 1 日以内に返信