From 2002afa2468ee8694d870c2b248f0572428cc303 Mon Sep 17 00:00:00 2001 From: Tristan Ravitch Date: Fri, 10 Nov 2017 16:52:38 -0800 Subject: [PATCH] [ppc] Add preliminary support for popcount It isn't supported in SimpleBuilder, so we use an uninterpreted function in the formula language for now. --- macaw-ppc/src/Data/Macaw/PPC/Semantics/TH.hs | 14 ++++++++++++++ submodules/semmc | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/macaw-ppc/src/Data/Macaw/PPC/Semantics/TH.hs b/macaw-ppc/src/Data/Macaw/PPC/Semantics/TH.hs index 30d6916c..7040d2de 100644 --- a/macaw-ppc/src/Data/Macaw/PPC/Semantics/TH.hs +++ b/macaw-ppc/src/Data/Macaw/PPC/Semantics/TH.hs @@ -468,6 +468,20 @@ evalNonceAppTH bvi nonceApp = addExpr (AppExpr (M.Bsr (NR.knownNat @64) locExp)) |] _ -> fail ("Unsupported argument list for clz: " ++ showF args) + "popcnt_32" -> + case FC.toListFC Some args of + [Some loc] -> do + [| do locExp <- $(addEltTH bvi loc) + addExpr (AppExpr (M.PopCount (NR.knownNat @32) locExp)) + |] + _ -> fail ("Unsupported argument list for popcnt: " ++ showF args) + "popcnt_64" -> + case FC.toListFC Some args of + [Some loc] -> do + [| do locExp <- $(addEltTH bvi loc) + addExpr (AppExpr (M.PopCount (NR.knownNat @64) locExp)) + |] + _ -> fail ("Unsupported argument list for popcnt: " ++ showF args) _ | Just nBytes <- readMemBytes fnName -> do case FC.toListFC Some args of [_, Some addrElt] -> do diff --git a/submodules/semmc b/submodules/semmc index 2e5ce7f6..cef6197e 160000 --- a/submodules/semmc +++ b/submodules/semmc @@ -1 +1 @@ -Subproject commit 2e5ce7f6797466c09cd9e5799a351aaa16016a12 +Subproject commit cef6197ed5a53b22f41a9c7961689543b9dd8f1c