From: George Kyriazis Date: Fri, 2 Mar 2018 06:54:38 +0000 (-0600) Subject: swr/rast: Add VPOPCNT X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e0a4a258297b12cb5c6ee4bb57d4372ecf85367e;p=mesa.git swr/rast: Add VPOPCNT Supports popcnt on vector masks (e.g. <8 x i1>) Reviewed-by: Bruce Cherniak --- diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index 0738d023321..0148d8eb8ac 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -835,6 +835,14 @@ namespace SwrJit return CALL(pCtPop, std::initializer_list{a}); } + ////////////////////////////////////////////////////////////////////////// + /// @brief pop count on vector mask (e.g. <8 x i1>) + Value* Builder::VPOPCNT(Value* a) + { + Value* b = BITCAST(VMASK(a), mSimdFP32Ty); + return POPCNT(VMOVMSKPS(b)); + } + ////////////////////////////////////////////////////////////////////////// /// @brief C functions called by LLVM IR ////////////////////////////////////////////////////////////////////////// diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h index 50d7a1e71fa..5195678b4c4 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h @@ -148,6 +148,7 @@ CallInst *PRINT(const std::string &printStr); CallInst *PRINT(const std::string &printStr,const std::initializer_list &printArgs); Value* POPCNT(Value* a); +Value* VPOPCNT(Value* a); Value* DEBUGTRAP(); Value* INT3() { return DEBUGTRAP(); }