Skip to content

Commit 1af06cb

Browse files
authored
[clang][bytecode] interp__builtin_ia32_pshuf - modulo lane index to allow reuse of PSHUFD/LW/HW mask decode. NFC (#162006)
Removes need to offset PSHUFHW land index to extract the shuffle mask element.
1 parent 76cff3b commit 1af06cb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,7 +2796,7 @@ static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC,
27962796
unsigned LaneBase = (Idx / LaneElts) * LaneElts;
27972797
unsigned LaneIdx = Idx % LaneElts;
27982798
unsigned SrcIdx = Idx;
2799-
unsigned Sel = (Ctl >> (2 * LaneIdx)) & 0x3;
2799+
unsigned Sel = (Ctl >> (2 * (LaneIdx & 0x3))) & 0x3;
28002800
if (ElemBits == 32) {
28012801
SrcIdx = LaneBase + Sel;
28022802
} else {
@@ -2805,8 +2805,6 @@ static bool interp__builtin_ia32_pshuf(InterpState &S, CodePtr OpPC,
28052805
if (!IsShufHW && !InHigh) {
28062806
SrcIdx = LaneBase + Sel;
28072807
} else if (IsShufHW && InHigh) {
2808-
unsigned Rel = LaneIdx - HalfSize;
2809-
Sel = (Ctl >> (2 * Rel)) & 0x3;
28102808
SrcIdx = LaneBase + HalfSize + Sel;
28112809
}
28122810
}

0 commit comments

Comments
 (0)