aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-03-02 00:54:38 -0600
committerGeorge Kyriazis <[email protected]>2018-03-09 09:36:23 -0600
commite0a4a258297b12cb5c6ee4bb57d4372ecf85367e (patch)
treeec2b0a16319f1538f11ba38f1fd97f0f32db332b
parentb56afe1a4f019a98356afe0a76fe9dcf719a817a (diff)
swr/rast: Add VPOPCNT
Supports popcnt on vector masks (e.g. <8 x i1>) Reviewed-by: Bruce Cherniak <[email protected]>
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp8
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h1
2 files changed, 9 insertions, 0 deletions
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
@@ -836,6 +836,14 @@ namespace SwrJit
}
//////////////////////////////////////////////////////////////////////////
+ /// @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<Value*> &printArgs);
Value* POPCNT(Value* a);
+Value* VPOPCNT(Value* a);
Value* DEBUGTRAP();
Value* INT3() { return DEBUGTRAP(); }