diff options
author | Steven Perron <31666470+s-perron@users.noreply.github.com> | 2018-07-13 11:20:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 11:20:02 -0400 |
commit | 63c1d8fb1569bcac0462863c726ae6af7a105abe (patch) | |
tree | ed77a2c7dd96a2daa2922c9611ab12c92dcb99c7 /test/opt/fold_test.cpp | |
parent | 7603944a10a06f075bac369122dba3ddcc2f6ad3 (diff) | |
download | spirv-tools-63c1d8fb1569bcac0462863c726ae6af7a105abe.tar.gz |
Fix size error when folding vector shuffle. (#1721)
When folding a vector shuffle that feeds another vector shuffle causes
the size of the first operand to change, when other indices have to be
adjusted reletive to the new size.
Diffstat (limited to 'test/opt/fold_test.cpp')
-rw-r--r-- | test/opt/fold_test.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/opt/fold_test.cpp b/test/opt/fold_test.cpp index ff4a1b59..3be8cde9 100644 --- a/test/opt/fold_test.cpp +++ b/test/opt/fold_test.cpp @@ -5816,6 +5816,44 @@ INSTANTIATE_TEST_CASE_P(VectorShuffleMatchingTest, MatchingInstructionWithNoResu "%9 = OpVectorShuffle %v4double %7 %8 2 0 7 5\n" + "OpReturn\n" + "OpFunctionEnd", + 9, true), + // Test case 9: Replace first operand with a smaller vector. + InstructionFoldingCase<bool>( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %5 %7 0 0 5 3\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v2double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v2double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %5 0 1 2 3\n" + + "%9 = OpVectorShuffle %v4double %8 %7 2 0 7 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 10: Replace first operand with a larger vector. + InstructionFoldingCase<bool>( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %5 %7 3 0 7 5\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v2double %5 %5 0 3\n" + + "%9 = OpVectorShuffle %v4double %8 %7 1 0 5 3\n" + + "OpReturn\n" + + "OpFunctionEnd", 9, true) )); #endif |