| ... |
... |
@@ -4359,6 +4359,8 @@ genPrim bid (MO_AtomicRMW width amop) [dst] [addr, n] |
|
4359
|
4359
|
= genAtomicRMW bid width amop dst addr n
|
|
4360
|
4360
|
genPrim bid (MO_Ctz width) [dst] [src]
|
|
4361
|
4361
|
= genCtz bid width dst src
|
|
|
4362
|
+genPrim bid (MO_UF_Conv width) [dst] [src]
|
|
|
4363
|
+ = genWordToFloat bid width dst src
|
|
4362
|
4364
|
|
|
4363
|
4365
|
-- Then we deal with cases which not introducing new blocks in the stream.
|
|
4364
|
4366
|
genPrim bid prim dst args
|
| ... |
... |
@@ -4385,7 +4387,6 @@ genSimplePrim bid (MO_PopCnt width) [dst] [src] = genPopCnt bid wi |
|
4385
|
4387
|
genSimplePrim bid (MO_Pdep width) [dst] [src,mask] = genPdep bid width dst src mask
|
|
4386
|
4388
|
genSimplePrim bid (MO_Pext width) [dst] [src,mask] = genPext bid width dst src mask
|
|
4387
|
4389
|
genSimplePrim bid (MO_Clz width) [dst] [src] = genClz bid width dst src
|
|
4388
|
|
-genSimplePrim bid (MO_UF_Conv width) [dst] [src] = genWordToFloat bid width dst src
|
|
4389
|
4390
|
genSimplePrim _ (MO_AtomicRead w mo) [dst] [addr] = genAtomicRead w mo dst addr
|
|
4390
|
4391
|
genSimplePrim _ (MO_AtomicWrite w mo) [] [addr,val] = genAtomicWrite w mo addr val
|
|
4391
|
4392
|
genSimplePrim bid (MO_Cmpxchg width) [dst] [addr,old,new] = genCmpXchg bid width dst addr old new
|
| ... |
... |
@@ -6924,7 +6925,11 @@ The constant 65536.0 (= 0x47800000 in float32 bit-pattern) is loaded |
|
6924
|
6925
|
via a MOV + MOVD, avoiding a memory load.
|
|
6925
|
6926
|
-}
|
|
6926
|
6927
|
|
|
6927
|
|
-genWordToFloat :: BlockId -> Width -> CmmFormal -> CmmActual -> NatM InstrBlock
|
|
|
6928
|
+-- | Convert an unsigned word to a float.
|
|
|
6929
|
+--
|
|
|
6930
|
+-- On x86-64 this introduces new blocks: the returned BlockId is the new current
|
|
|
6931
|
+-- block (#27915). See Note [Keeping track of the current block].
|
|
|
6932
|
+genWordToFloat :: BlockId -> Width -> CmmFormal -> CmmActual -> NatM (InstrBlock, Maybe BlockId)
|
|
6928
|
6933
|
genWordToFloat bid width dst src = do
|
|
6929
|
6934
|
is32Bit <- is32BitPlatform
|
|
6930
|
6935
|
platform <- getPlatform
|
| ... |
... |
@@ -6946,7 +6951,7 @@ genWordToFloat bid width dst src = do |
|
6946
|
6951
|
cst_r <- getNewRegNat srcFormat
|
|
6947
|
6952
|
cst_v <- getNewRegNat dstFormat
|
|
6948
|
6953
|
flip_r <- getNewRegNat srcFormat
|
|
6949
|
|
- return $ code_src `appOL` toOL
|
|
|
6954
|
+ return $ (,Nothing) $ code_src `appOL` toOL
|
|
6950
|
6955
|
[ MOV srcFormat (OpImm (ImmInt 0x4F000000)) (OpReg cst_r) -- load the constant
|
|
6951
|
6956
|
, MOVD srcFormat (floatFormat W32) (OpReg cst_r) (OpReg cst_v)
|
|
6952
|
6957
|
, CVTSS2SD cst_v cst_v
|
| ... |
... |
@@ -6968,7 +6973,7 @@ genWordToFloat bid width dst src = do |
|
6968
|
6973
|
cst_r <- getNewRegNat srcFormat
|
|
6969
|
6974
|
high_r <- getNewRegNat srcFormat
|
|
6970
|
6975
|
low_r <- getNewRegNat srcFormat
|
|
6971
|
|
- return $ code_src `appOL` toOL
|
|
|
6976
|
+ return $ (,Nothing) $ code_src `appOL` toOL
|
|
6972
|
6977
|
[ MOV srcFormat (OpImm (ImmInt 0x47800000)) (OpReg cst_r) -- load the constant
|
|
6973
|
6978
|
, MOVD srcFormat dstFormat (OpReg cst_r) (OpReg cst_v)
|
|
6974
|
6979
|
, MOVZxL II16 (OpReg src_r) (OpReg low_r) -- low_r = low 16 bits
|
| ... |
... |
@@ -7006,7 +7011,7 @@ genWordToFloat bid width dst src = do |
|
7006
|
7011
|
. addWeightEdge lblLarge lblAfter 1
|
|
7007
|
7012
|
. delEdge bid lblAfter )
|
|
7008
|
7013
|
|
|
7009
|
|
- return $ appOL (code_src)
|
|
|
7014
|
+ return $ (,Just lblAfter) $ appOL (code_src)
|
|
7010
|
7015
|
$ toOL
|
|
7011
|
7016
|
[ TEST srcFormat (OpReg src_r) (OpReg src_r)
|
|
7012
|
7017
|
, JXX NEG lblLarge
|