swr/rast: SIMD16 Frontend - Fix USE_SIMD16_FRONTEND build
authorTim Rowley <timothy.o.rowley@intel.com>
Wed, 28 Jun 2017 21:32:19 +0000 (16:32 -0500)
committerTim Rowley <timothy.o.rowley@intel.com>
Thu, 13 Jul 2017 13:47:10 +0000 (08:47 -0500)
Previous check-ins without testing with USE_SIMD16_FRONTEND have
introduced regressions. This fixes the build, not the regressions.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/common/simd16intrin.h
src/gallium/drivers/swr/rasterizer/common/simdlib_512_avx512.inl
src/gallium/drivers/swr/rasterizer/core/binner.cpp
src/gallium/drivers/swr/rasterizer/core/clip.h

index 29151682e0755ad47d4370286ad7f54dc486fc22..a160ca2c5eda66278da4acaa952e625a8ba935ee 100644 (file)
@@ -126,7 +126,7 @@ typedef SIMD512                             SIMD16;
 #define _simd16_add_epi8                    SIMD16::add_epi8
 #define _simd16_shuffle_epi8                SIMD16::shuffle_epi8
 
-#define _simd16_i32gather_ps(m, index, scale)               SIMD16::i32gather_ps<SIMD16::ScaleFactor(scale)>(index, m)
+#define _simd16_i32gather_ps(m, index, scale)               SIMD16::i32gather_ps<SIMD16::ScaleFactor(scale)>(m, index)
 #define _simd16_mask_i32gather_ps(a, m, index, mask, scale) SIMD16::mask_i32gather_ps<SIMD16::ScaleFactor(scale)>(a, m, index, mask)
 
 #define _simd16_abs_epi32                   SIMD16::abs_epi32
@@ -162,6 +162,18 @@ typedef SIMD512                             SIMD16;
 #define _simd16_int2mask(mask)              simd16mask(mask)
 #define _simd16_mask2int(mask)              int(mask)
 
+// convert bitmask to vector mask
+SIMDINLINE simd16scalar vMask16(int32_t mask)
+{
+    simd16scalari temp = _simd16_set1_epi32(mask);
+
+    simd16scalari bits = _simd16_set_epi32(0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100, 0x0080, 0x0040, 0x0020, 0x0010, 0x0008, 0x0004, 0x0002, 0x0001);
+
+    simd16scalari result = _simd16_cmplt_epi32(_simd16_setzero_si(), _simd16_and_si(temp, bits));
+
+    return _simd16_castsi_ps(result);
+}
+
 #endif//ENABLE_AVX512_SIMD16
 
 #endif//__SWR_SIMD16INTRIN_H_
index 226952e282e8bbddd8762df0065b008dd781ba79..535e4ed8ca0fb8444685d8ce52da2c326463edc3 100644 (file)
@@ -543,7 +543,7 @@ static SIMDINLINE Float SIMDCALL mask_i32gather_ps(Float old, float const* p, In
 {
     __mmask16 k = _mm512_cmpneq_ps_mask(mask, setzero_ps());
 
-    return _mm512_mask_i32gather_ps(old, k, idx, p, ScaleT);
+    return _mm512_mask_i32gather_ps(old, k, idx, p, static_cast<int>(ScaleT));
 }
 
 static SIMDINLINE void SIMDCALL maskstore_ps(float *p, Integer mask, Float src)
index 34789cf03566c566f995f7633bd7150343018ffc..de6691b4cf8b181de92b652e9e6a3277980bea92 100644 (file)
@@ -1076,13 +1076,14 @@ void SIMDCALL BinTriangles_simd16(
             (SWR_INPUT_COVERAGE)pDC->pState->state.psState.inputCoverage, EdgeValToEdgeState(ALL_EDGES_VALID), (state.scissorsTileAligned == false));
     }
 
+    simd16BBox bbox;
+
     if (!triMask)
     {
         goto endBinTriangles;
     }
 
     // Calc bounding box of triangles
-    simd16BBox bbox;
     calcBoundingBoxIntVertical<CT>(tri, vXi, vYi, bbox);
 
     // determine if triangle falls between pixel centers and discard
@@ -2102,7 +2103,7 @@ void SIMDCALL BinPoints_simd16(
 
         // OOB indices => forced to zero.
         simd16scalari vpai = _simd16_castps_si(vpiAttrib[0][VERTEX_SGV_VAI_COMP]);
-        vpai = _simd16_max_epi32(_simd16_setzero_si(), vpai)
+        vpai = _simd16_max_epi32(_simd16_setzero_si(), vpai);
         simd16scalari vNumViewports = _simd16_set1_epi32(KNOB_NUM_VIEWPORTS_SCISSORS);
         simd16scalari vClearMask = _simd16_cmplt_epi32(vpai, vNumViewports);
         viewportIdx = _simd16_and_si(vClearMask, vpai);
@@ -2461,6 +2462,13 @@ void BinPostSetupLines_simd16(
 
     const simdscalar unused = _simd_setzero_ps();
 
+    // transpose verts needed for backend
+    /// @todo modify BE to take non-transformed verts
+    simd4scalar vHorizX[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
+    simd4scalar vHorizY[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
+    simd4scalar vHorizZ[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
+    simd4scalar vHorizW[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
+
     if (!primMask)
     {
         goto endBinLines;
@@ -2479,13 +2487,6 @@ void BinPostSetupLines_simd16(
     _simd16_store_si(reinterpret_cast<simd16scalari *>(aMTTop),     bbox.ymin);
     _simd16_store_si(reinterpret_cast<simd16scalari *>(aMTBottom),  bbox.ymax);
 
-    // transpose verts needed for backend
-    /// @todo modify BE to take non-transformed verts
-    simd4scalar vHorizX[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
-    simd4scalar vHorizY[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
-    simd4scalar vHorizZ[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
-    simd4scalar vHorizW[2][KNOB_SIMD_WIDTH]; // KNOB_SIMD16_WIDTH
-
     vTranspose3x8(vHorizX[0], _simd16_extract_ps(prim[0].x, 0), _simd16_extract_ps(prim[1].x, 0), unused);
     vTranspose3x8(vHorizY[0], _simd16_extract_ps(prim[0].y, 0), _simd16_extract_ps(prim[1].y, 0), unused);
     vTranspose3x8(vHorizZ[0], _simd16_extract_ps(prim[0].z, 0), _simd16_extract_ps(prim[1].z, 0), unused);
index 8a4fe6dcfa06d4b256752d64bcf0c838bb3e18b5..36c84025957e92d6c6ee550a844d720340596e15 100644 (file)
@@ -1095,7 +1095,7 @@ public:
             AR_BEGIN(FEGuardbandClip, pa.pDC->drawId);
             // we have to clip tris, execute the clipper, which will also
             // call the binner
-            ClipSimd(_simd16_vmask_ps(primMask), _simd16_vmask_ps(clipMask), pa, primId);
+            ClipSimd(vMask(primMask), vMask(clipMask), pa, primId);
             AR_END(FEGuardbandClip, 1);
         }
         else if (validMask)