Implement new CLZ and CTZ primops (re #9340)

This implements the new primops

  clz#, clz32#, clz64#,
  ctz#, ctz32#, ctz64#

which provide efficient implementations of the popular
count-leading-zero and count-trailing-zero respectively
(see testcase for a pure Haskell reference implementation).

On x86, NCG as well as LLVM generates code based on the BSF/BSR
instructions (which need extra logic to make the 0-case well-defined).

Test Plan: validate and succesful tests on i686 and amd64

Reviewers: rwbarton, simonmar, ezyang, austin

Subscribers: simonmar, relrod, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D144

GHC Trac Issues: #9340
Declare `ghc-head` to be haddock's upstream branch

This will affect commands such as

   git submodule update --remote utils/haddock

to use `ghc-head` instead of the default `master` branch
Merge remote-tracking branch 'origin/master' into wip/landmine-param-family
Starting to work in SPJ comments, got kernel panic

http://lpaste.net/7546033955959472128

"/home/alanz/.ghc-config/ghc/bin/ghc" -hisuf hi -osuf  o -hcsuf hc -static  -H32m -O -Werror -Wall -H64m -O0  -package-db libraries/bootstrapping.conf  -package-name ghc-7.9 -hide-all-packages -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils -icompiler/vectorise -icompiler/stage1/build -icompiler/stage1/build/autogen -Icompiler/stage1/build -Icompiler/stage1/build/autogen -Icompiler/. -Icompiler/parser -Icompiler/utils -Icompiler/stage1    -optP-include -optPcompiler/stage1/build/autogen/cabal_macros.h -package Cabal-1.21.0.0 -package array-0.4.0.1 -package base-4.6.0.1 -package bin-package-db-0.0.0.0 -package bytestring-0.10.0.2 -package containers-0.5.0.0 -package directory-1.2.0.1 -package filepath-1.3.0.1 -package hoopl-3.10.0.1 -package hpc-0.6.0.1 -package process-1.1.0.2 -package time-1.4.0.1 -package transformers-0.4.1.0 -package unix-2.6.0.1 -Wall -fno-warn-name-shadowing -XHaskell2010 -DSTAGE=1 -Rghc-timing  -fwarn-tabs -O  -no-user-package-db -rtsopts      -odir compiler/stage1/build -hidir compiler/stage1/build -stubdir compiler/stage1/build   -c compiler/hsSyn/HsLit.lhs -o compiler/stage1/build/HsLit.o
ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.3 for x86_64-unknown-linux):
	tcIfaceGlobal (local): not found:
    ghc-7.9:HsLit.TypeAnnot{tc r6c}
    [(rN, Identifier `ghc-7.9:HsLit.OverLit{v rN}'),
     (r1p, Coercion axiom `ghc-7.9:HsLit.NTCo:PlaceHolderType{tc r1p}'),
     (r1v,
      Coercion axiom `ghc-7.9:HsLit.NTCo:PlaceHolderNames{tc r1v}'),
     (r3l, Identifier `ghc-7.9:HsLit.HsIsString{v r3l}'),
     (r3n, Identifier `ghc-7.9:HsLit.HsFractional{v r3n}'),
     (r3p, Identifier `ghc-7.9:HsLit.HsIntegral{v r3p}'),
     (r3A, Identifier `ghc-7.9:HsLit.$WHsIntegral{v r3A}'),
     (r3B, Identifier `ghc-7.9:HsLit.$WHsFractional{v r3B}'),
     (r3D, Identifier `ghc-7.9:HsLit.$WHsIsString{v r3D}'),
     (r6h, Type constructor `ghc-7.9:HsLit.PostTcKind{tc r6h}'),
     (r6i, Identifier `ghc-7.9:HsLit.placeHolderType{v r6i}'),
     (r6j, Class `ghc-7.9:HsLit.PlaceHolderType{tc r6j}'),
     (r6k, Identifier `ghc-7.9:HsLit.placeHolderNames{v r6k}'),
     (r6l, Class `ghc-7.9:HsLit.PlaceHolderNames{tc r6l}'),
     (r6m, Data constructor `ghc-7.9:HsLit.HsIsString{d r6m}'),
     (r6n, Data constructor `ghc-7.9:HsLit.HsIntegral{d r6n}'),
     (r6o, Data constructor `ghc-7.9:HsLit.HsFractional{d r6o}'),
     (r6p, Type constructor `ghc-7.9:HsLit.OverLitVal{tc r6p}'),
     (r6r, Identifier `ghc-7.9:HsLit.ol_witness{v r6r}'),
     (r6s, Identifier `ghc-7.9:HsLit.ol_val{v r6s}'),
     (r6t, Identifier `ghc-7.9:HsLit.ol_type{v r6t}'),
     (r6u, Identifier `ghc-7.9:HsLit.ol_rebindable{v r6u}'),
     (r6v, Data constructor `ghc-7.9:HsLit.OverLit{d r6v}'),
     (r6w, Type constructor `ghc-7.9:HsLit.HsOverLit{tc r6w}'),
     (r6x, Data constructor `ghc-7.9:HsLit.HsWordPrim{d r6x}'),
     (r6y, Data constructor `ghc-7.9:HsLit.HsWord64Prim{d r6y}'),
     (r6z, Data constructor `ghc-7.9:HsLit.HsStringPrim{d r6z}'),
     (r6A, Data constructor `ghc-7.9:HsLit.HsString{d r6A}'),
     (r6B, Data constructor `ghc-7.9:HsLit.HsRat{d r6B}'),
     (r6C, Data constructor `ghc-7.9:HsLit.HsInteger{d r6C}'),
     (r6D, Data constructor `ghc-7.9:HsLit.HsIntPrim{d r6D}'),
     (r6E, Data constructor `ghc-7.9:HsLit.HsInt64Prim{d r6E}'),
     (r6F, Data constructor `ghc-7.9:HsLit.HsInt{d r6F}'),
     (r6G, Data constructor `ghc-7.9:HsLit.HsFloatPrim{d r6G}'),
     (r6H, Data constructor `ghc-7.9:HsLit.HsDoublePrim{d r6H}'),
     (r6I, Data constructor `ghc-7.9:HsLit.HsCharPrim{d r6I}'),
     (r6J, Data constructor `ghc-7.9:HsLit.HsChar{d r6J}'),
     (r6K, Type constructor `ghc-7.9:HsLit.HsLit{tc r6K}'),
     (r2OW, Type constructor `ghc-7.9:HsLit.PostRn{tc r2OW}'),
     (r2OX, Type constructor `ghc-7.9:HsLit.PostTc{tc r2OX}'),
     (r37O, Identifier `ghc-7.9:HsLit.HsChar{v r37O}'),
     (r37Q, Identifier `ghc-7.9:HsLit.HsCharPrim{v r37Q}'),
     (r37S, Identifier `ghc-7.9:HsLit.HsString{v r37S}'),
     (r37U, Identifier `ghc-7.9:HsLit.HsStringPrim{v r37U}'),
     (r37W, Identifier `ghc-7.9:HsLit.HsInt{v r37W}'),
     (r37Y, Identifier `ghc-7.9:HsLit.HsIntPrim{v r37Y}'),
     (r380, Identifier `ghc-7.9:HsLit.HsWordPrim{v r380}'),
     (r382, Identifier `ghc-7.9:HsLit.HsInt64Prim{v r382}'),
     (r384, Identifier `ghc-7.9:HsLit.HsWord64Prim{v r384}'),
     (r386, Identifier `ghc-7.9:HsLit.HsInteger{v r386}'),
     (r388, Identifier `ghc-7.9:HsLit.HsRat{v r388}'),
     (r38a, Identifier `ghc-7.9:HsLit.HsFloatPrim{v r38a}'),
     (r38c, Identifier `ghc-7.9:HsLit.HsDoublePrim{v r38c}'),
     (r38o,
      Data constructor `ghc-7.9:HsLit.D:PlaceHolderNames{d r38o}'),
     (r38q, Identifier `ghc-7.9:HsLit.D:PlaceHolderNames{v r38q}'),
     (r38r, Data constructor `ghc-7.9:HsLit.D:PlaceHolderType{d r38r}'),
     (r38t, Identifier `ghc-7.9:HsLit.D:PlaceHolderType{v r38t}'),
     (r3cD,
      Coercion axiom `ghc-7.9:HsLit.TFCo:R:PostRnRdrNamety{tc r3cD}'),
     (r3cE,
      Coercion axiom `ghc-7.9:HsLit.TFCo:R:PostRnNamety{tc r3cE}'),
     (r3cF, Coercion axiom `ghc-7.9:HsLit.TFCo:R:PostRnVarty{tc r3cF}'),
     (r3cG,
      Coercion axiom `ghc-7.9:HsLit.TFCo:R:PostTcRdrNamety{tc r3cG}'),
     (r3cH,
      Coercion axiom `ghc-7.9:HsLit.TFCo:R:PostTcNamety{tc r3cH}'),
     (r3cI, Coercion axiom `ghc-7.9:HsLit.TFCo:R:PostTcVarty{tc r3cI}')]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug