소스 검색

Fix WaveActiveAllEqual test (#288)

Young Kim 8 년 전
부모
커밋
80b5648342
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      tools/clang/unittests/HLSL/ExecutionTest.cpp

+ 7 - 4
tools/clang/unittests/HLSL/ExecutionTest.cpp

@@ -336,10 +336,13 @@ struct computeExpected<InType, OutType, ShaderOpKind::WaveActiveAllTrue> {
 template <typename InType, typename OutType>
 template <typename InType, typename OutType>
 struct computeExpected<InType, OutType, ShaderOpKind::WaveActiveAllEqual> {
 struct computeExpected<InType, OutType, ShaderOpKind::WaveActiveAllEqual> {
   OutType operator()(const std::vector<InType> &inputs, const std::vector<int> &masks, int maskValue) {
   OutType operator()(const std::vector<InType> &inputs, const std::vector<int> &masks, int maskValue) {
-    OutType val = inputs.at(0); // assuming there is always one lane per wave
-    for (size_t i = 1; i < inputs.size(); ++i) {
-      if (masks.at(i) == maskValue && val != inputs.at(i)) {
-        return 0;
+    const InType *val = nullptr;
+    for (size_t i = 0; i < inputs.size(); ++i) {
+      if (masks.at(i) == maskValue) {
+        if (val && *val != inputs.at(i)) {
+          return 0;
+        }
+        val = &inputs.at(i);
       }
       }
     }
     }
     return 1;
     return 1;