Subzero: Enable Non-SFI vector cross tests. The driver programs for vector tests use a loop to initialize vector-type values one element at a time. The PNaCl ABI requires the vector element index to be a constant, and the createConstantInsertExtractElementIndexPass() transformation creates an alloca instruction. When this alloca is inside a loop, it can (and does in the cross tests) cause a stack overflow. The workaround here is to use a noinline helper function to do the insertelement. We didn't run into this problem until now because native and sandbox cross tests build the driver in a different way that presumably avoids running the PNaCl ABI simplification passes. BUG= none R=jpp@chromium.org Review URL: https://codereview.chromium.org/1560933002 .
diff --git a/crosstest/test_select_main.cpp b/crosstest/test_select_main.cpp index 1973416..d3408a0 100644 --- a/crosstest/test_select_main.cpp +++ b/crosstest/test_select_main.cpp
@@ -25,6 +25,8 @@ #include "test_select.h" } +#include "insertelement.h" + static const size_t MaxTestsPerFunc = 100000; template <typename T, typename TI1> @@ -43,9 +45,9 @@ TyI1 Cond; Ty Value1, Value2; for (size_t j = 0; j < NumElements; ++j) { - Cond[j] = Index() % 2; - Value1[j] = Values[Index() % NumValues]; - Value2[j] = Values[Index() % NumValues]; + setElement(Cond, j, Index() % 2); + setElement(Value1, j, Values[Index() % NumValues]); + setElement(Value2, j, Values[Index() % NumValues]); } Ty ResultLlc = select(Cond, Value1, Value2); Ty ResultSz = Subzero_::select(Cond, Value1, Value2); @@ -79,9 +81,9 @@ v4si32 Cond; v4f32 Value1, Value2; for (size_t j = 0; j < NumElements; ++j) { - Cond[j] = Index() % 2; - Value1[j] = Values[Index() % NumValues]; - Value2[j] = Values[Index() % NumValues]; + setElement(Cond, j, Index() % 2); + setElement(Value1, j, Values[Index() % NumValues]); + setElement(Value2, j, Values[Index() % NumValues]); } v4f32 ResultLlc = select(Cond, Value1, Value2); v4f32 ResultSz = Subzero_::select(Cond, Value1, Value2); @@ -109,9 +111,9 @@ Ty Cond; Ty Value1, Value2; for (size_t j = 0; j < NumElements; ++j) { - Cond[j] = Index() % 2; - Value1[j] = Index() % 2; - Value2[j] = Index() % 2; + setElement(Cond, j, Index() % 2); + setElement(Value1, j, Index() % 2); + setElement(Value2, j, Index() % 2); } Ty ResultLlc = select_i1(Cond, Value1, Value2); Ty ResultSz = Subzero_::select_i1(Cond, Value1, Value2);