@@ -539,7 +539,7 @@ struct VECTOR_SHL_V128
539539 }
540540 if (all_same) {
541541 // Every count is the same, so we can use SHL
542- e.SHL (i.dest .reg ().B16 (), i.src1 .reg ().B16 (), shamt.u8 [0 ]);
542+ e.SHL (i.dest .reg ().B16 (), i.src1 .reg ().B16 (), shamt.u8 [0 ] & 0x7 );
543543 return ;
544544 }
545545 e.ADD (e.GetNativeParam (1 ), SP, e.StashConstantV (1 , i.src2 .constant ()));
@@ -563,7 +563,7 @@ struct VECTOR_SHL_V128
563563 }
564564 if (all_same) {
565565 // Every count is the same, so we can use SHL
566- e.SHL (i.dest .reg ().H8 (), i.src1 .reg ().H8 (), shamt.u8 [0 ]);
566+ e.SHL (i.dest .reg ().H8 (), i.src1 .reg ().H8 (), shamt.u8 [0 ] & 0xF );
567567 return ;
568568 }
569569 e.ADD (e.GetNativeParam (1 ), SP, e.StashConstantV (1 , i.src2 .constant ()));
@@ -587,7 +587,7 @@ struct VECTOR_SHL_V128
587587 }
588588 if (all_same) {
589589 // Every count is the same, so we can use SHL
590- e.SHL (i.dest .reg ().S4 (), i.src1 .reg ().S4 (), shamt.u8 [0 ]);
590+ e.SHL (i.dest .reg ().S4 (), i.src1 .reg ().S4 (), shamt.u8 [0 ] & 0x1F );
591591 return ;
592592 }
593593 e.ADD (e.GetNativeParam (1 ), SP, e.StashConstantV (1 , i.src2 .constant ()));
0 commit comments