From e0a4a258297b12cb5c6ee4bb57d4372ecf85367e Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Fri, 2 Mar 2018 00:54:38 -0600 Subject: swr/rast: Add VPOPCNT Supports popcnt on vector masks (e.g. <8 x i1>) Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp | 8 ++++++++ src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src/gallium/drivers') 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(); } -- cgit v1.2.3