summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmMachOp.hs
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2013-10-01 21:13:14 -0500
committerAustin Seipp <austin@well-typed.com>2013-10-01 21:26:47 -0500
commitfd74014079f14bd3ab50e328e52c44ef97d40e05 (patch)
treeda31c992a76d3816a4f1012ceb1eb4e68d0fb556 /compiler/cmm/CmmMachOp.hs
parent627d1e008cbe4d9318b2466394420a968d1659da (diff)
downloadhaskell-fd74014079f14bd3ab50e328e52c44ef97d40e05.tar.gz
Add support for prefetch with locality levels.
This patch adds support for several new primitive operations which support using processor-specific instructions to help guide data and cache locality decisions. We have levels ranging from [0..3] For LLVM, we generate llvm.prefetch intrinsics at the proper locality level (similar to GCC.) For x86 we generate prefetch{NTA, t2, t1, t0} instructions. On SPARC and PowerPC, the locality levels are ignored. This closes #8256. Authored-by: Carter Tazio Schonwald <carter.schonwald@gmail.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'compiler/cmm/CmmMachOp.hs')
-rw-r--r--compiler/cmm/CmmMachOp.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/compiler/cmm/CmmMachOp.hs b/compiler/cmm/CmmMachOp.hs
index c009d15e25..684a4b9729 100644
--- a/compiler/cmm/CmmMachOp.hs
+++ b/compiler/cmm/CmmMachOp.hs
@@ -107,10 +107,10 @@ data MachOp
-- Vector element insertion and extraction operations
| MO_V_Insert Length Width -- Insert scalar into vector
| MO_V_Extract Length Width -- Extract scalar from vector
-
+
-- Integer vector operations
- | MO_V_Add Length Width
- | MO_V_Sub Length Width
+ | MO_V_Add Length Width
+ | MO_V_Sub Length Width
| MO_V_Mul Length Width
-- Signed vector multiply/divide
@@ -127,8 +127,8 @@ data MachOp
| MO_VF_Extract Length Width -- Extract scalar from vector
-- Floating point vector operations
- | MO_VF_Add Length Width
- | MO_VF_Sub Length Width
+ | MO_VF_Add Length Width
+ | MO_VF_Sub Length Width
| MO_VF_Neg Length Width -- unary -
| MO_VF_Mul Length Width
| MO_VF_Quot Length Width
@@ -528,8 +528,14 @@ data CallishMachOp
| MO_Touch -- Keep variables live (when using interior pointers)
-- Prefetch
- | MO_Prefetch_Data -- Prefetch hint. May change program performance but not
+ | MO_Prefetch_Data Int -- Prefetch hint. May change program performance but not
-- program behavior.
+ -- the Int can be 0-3. Needs to be known at compile time
+ -- to interact with code generation correctly.
+ -- TODO: add support for prefetch WRITES,
+ -- currently only exposes prefetch reads, which
+ -- would the majority of use cases in ghc anyways
+
-- Note that these three MachOps all take 1 extra parameter than the
-- standard C lib versions. The extra (last) parameter contains