@@ -3627,23 +3627,23 @@ std::ostream& operator<<(std::ostream& os, const DupAndShuffleInst& inst) {
36273627const DupAndShuffleInst kDupAndShuffles [] = {
36283628 {" Dup 0 and UnzipLeft" ,
36293629 kArm64S128UnzipLeft ,
3630- 2 ,
3630+ 3 ,
36313631 0 ,
36323632 16 ,
36333633 0 ,
36343634 true ,
36353635 {{0 , 1 , 4 , 5 , 8 , 9 , 12 , 13 , 0 , 1 , 0 , 1 , 0 , 1 , 0 , 1 }}},
36363636 {" Dup 1 and UnzipLeft" ,
36373637 kArm64S128UnzipLeft ,
3638- 2 ,
3638+ 3 ,
36393639 0 ,
36403640 16 ,
36413641 1 ,
36423642 true ,
36433643 {{0 , 1 , 4 , 5 , 8 , 9 , 12 , 13 , 2 , 3 , 2 , 3 , 2 , 3 , 2 , 3 }}},
36443644 {" Dup 0 and UnzipRight" ,
36453645 kArm64S128UnzipRight ,
3646- 2 ,
3646+ 3 ,
36473647 0 ,
36483648 16 ,
36493649 0 ,
@@ -3738,28 +3738,29 @@ TEST_P(TurboshaftInstructionSelectorDupAndShuffleTest, DupAndShuffle) {
37383738 Stream s = m.Build ();
37393739 EXPECT_EQ (inst.expected_num_insts , s.size ());
37403740
3741- if (inst.expected_num_insts > 1 ) {
3741+ if (inst.expected_num_insts == 3 ) {
3742+ // The dup
37423743 EXPECT_EQ (kArm64S128Dup , s[0 ]->arch_opcode ());
3744+ EXPECT_EQ (inst.lane_size , LaneSizeField::decode (s[0 ]->opcode ()));
37433745 EXPECT_EQ (s.ToVreg (s[0 ]->InputAt (0 )),
37443746 s.ToVreg (m.Parameter (inst.expected_param_index )));
37453747 EXPECT_EQ (s.ToInt32 (s[0 ]->InputAt (1 )), inst.index );
37463748
3747- EXPECT_EQ (inst. lane_size , LaneSizeField::decode (s[ 0 ]-> opcode ()));
3749+ // The shuffle
37483750 EXPECT_EQ (inst.arch_opcode , s[1 ]->arch_opcode ());
37493751 EXPECT_EQ (inst.lane_size , LaneSizeField::decode (s[1 ]->opcode ()));
3750-
3751- if (inst.expected_num_insts == 3 ) {
3752- EXPECT_EQ (s.ToVreg (s[1 ]->InputAt (0 )), s.ToVreg (m.Parameter (0 )));
3753- EXPECT_EQ (s.ToVreg (s[1 ]->InputAt (1 )), s.ToVreg (m.Parameter (1 )));
3754- EXPECT_EQ (kArm64S128MoveLane , s[2 ]->arch_opcode ());
3755- EXPECT_EQ (1U , s[2 ]->OutputCount ());
3752+ EXPECT_EQ (s.ToVreg (s[1 ]->InputAt (0 )), s.ToVreg (m.Parameter (0 )));
3753+ if (inst.is_swizzle ) {
3754+ EXPECT_EQ (s.ToVreg (s[1 ]->InputAt (1 )), s.ToVreg (m.Parameter (0 )));
37563755 } else {
3757- EXPECT_EQ (s.ToVreg (s[1 ]->InputAt (0 )),
3758- s.ToVreg (m.Parameter (inst.expected_param_index )));
3759- EXPECT_EQ (s.ToVreg (s[1 ]->InputAt (1 )), s.ToVreg (s[0 ]->Output ()));
3760- EXPECT_EQ (1U , s[1 ]->OutputCount ());
3756+ EXPECT_EQ (s.ToVreg (s[1 ]->InputAt (1 )), s.ToVreg (m.Parameter (1 )));
37613757 }
3758+
3759+ // Copy the top half of the dup into the result register.
3760+ EXPECT_EQ (kArm64S128MoveLane , s[2 ]->arch_opcode ());
3761+ EXPECT_EQ (1U , s[2 ]->OutputCount ());
37623762 } else {
3763+ DCHECK_EQ (inst.expected_num_insts , 1 );
37633764 EXPECT_EQ (inst.arch_opcode , s[0 ]->arch_opcode ());
37643765 }
37653766}
0 commit comments