module GHC.CmmToAsm.CPrim
( atomicReadLabel
, atomicWriteLabel
, atomicRMWLabel
, cmpxchgLabel
, xchgLabel
, popCntLabel
, pdepLabel
, pextLabel
, bSwapLabel
, bRevLabel
, clzLabel
, ctzLabel
, word2FloatLabel
) where
import GHC.Prelude
import GHC.Cmm.Type
import GHC.Cmm.MachOp
import GHC.Utils.Outputable
import GHC.Utils.Panic
popCntLabel :: Width -> String
popCntLabel :: Width -> String
popCntLabel Width
w = String
"hs_popcnt" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"popCntLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
pdepLabel :: Width -> String
pdepLabel :: Width -> String
pdepLabel Width
w = String
"hs_pdep" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"pdepLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
pextLabel :: Width -> String
pextLabel :: Width -> String
pextLabel Width
w = String
"hs_pext" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"pextLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
bSwapLabel :: Width -> String
bSwapLabel :: Width -> String
bSwapLabel Width
w = String
"hs_bswap" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"bSwapLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
bRevLabel :: Width -> String
bRevLabel :: Width -> String
bRevLabel Width
w = String
"hs_bitrev" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"bRevLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
clzLabel :: Width -> String
clzLabel :: Width -> String
clzLabel Width
w = String
"hs_clz" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"clzLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
ctzLabel :: Width -> String
ctzLabel :: Width -> String
ctzLabel Width
w = String
"hs_ctz" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"ctzLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
word2FloatLabel :: Width -> String
word2FloatLabel :: Width -> String
word2FloatLabel Width
w = String
"hs_word2float" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"word2FloatLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
atomicRMWLabel :: Width -> AtomicMachOp -> String
atomicRMWLabel :: Width -> AtomicMachOp -> String
atomicRMWLabel Width
w AtomicMachOp
amop = String
"hs_atomic_" forall a. [a] -> [a] -> [a]
++ AtomicMachOp -> String
pprFunName AtomicMachOp
amop forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"atomicRMWLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
pprFunName :: AtomicMachOp -> String
pprFunName AtomicMachOp
AMO_Add = String
"add"
pprFunName AtomicMachOp
AMO_Sub = String
"sub"
pprFunName AtomicMachOp
AMO_And = String
"and"
pprFunName AtomicMachOp
AMO_Nand = String
"nand"
pprFunName AtomicMachOp
AMO_Or = String
"or"
pprFunName AtomicMachOp
AMO_Xor = String
"xor"
xchgLabel :: Width -> String
xchgLabel :: Width -> String
xchgLabel Width
w = String
"hs_xchg" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"xchgLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
cmpxchgLabel :: Width -> String
cmpxchgLabel :: Width -> String
cmpxchgLabel Width
w = String
"hs_cmpxchg" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"cmpxchgLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
atomicReadLabel :: Width -> String
atomicReadLabel :: Width -> String
atomicReadLabel Width
w = String
"hs_atomicread" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"atomicReadLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)
atomicWriteLabel :: Width -> String
atomicWriteLabel :: Width -> String
atomicWriteLabel Width
w = String
"hs_atomicwrite" forall a. [a] -> [a] -> [a]
++ Width -> String
pprWidth Width
w
where
pprWidth :: Width -> String
pprWidth Width
W8 = String
"8"
pprWidth Width
W16 = String
"16"
pprWidth Width
W32 = String
"32"
pprWidth Width
W64 = String
"64"
pprWidth Width
w = forall a. HasCallStack => String -> SDoc -> a
pprPanic String
"atomicWriteLabel: Unsupported word width " (forall a. Outputable a => a -> SDoc
ppr Width
w)