Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • compiler/GHC/CmmToAsm/Config.hs
    ... ... @@ -48,6 +48,7 @@ data NCGConfig = NCGConfig
    48 48
        , ncgEnableInterModuleFarJumps:: !Bool            -- ^ Use far-jumps for cross-module jumps.
    
    49 49
        , ncgComputeUnwinding      :: !Bool            -- ^ Compute block unwinding tables
    
    50 50
        , ncgEnableDeadCodeElimination :: !Bool        -- ^ Whether to enable the dead-code elimination
    
    51
    +   , ncgLa664Enabled          :: !Bool            -- ^ la664 is equal to isav1.1
    
    51 52
        }
    
    52 53
     
    
    53 54
     -- | Return Word size
    

  • compiler/GHC/Driver/Config/CmmToAsm.hs
    ... ... @@ -66,6 +66,8 @@ initNCGConfig dflags this_mod = NCGConfig
    66 66
                 _          -> Nothing
    
    67 67
        , ncgAvx512fEnabled = isAvx512fEnabled dflags
    
    68 68
     
    
    69
    +   , ncgLa664Enabled = isLa664Enabled dflags
    
    70
    +
    
    69 71
        , ncgDwarfEnabled        = osElfTarget (platformOS (targetPlatform dflags)) && debugLevel dflags > 0 && platformArch (targetPlatform dflags) /= ArchAArch64
    
    70 72
        , ncgDwarfUnwindings     = osElfTarget (platformOS (targetPlatform dflags)) && debugLevel dflags > 0
    
    71 73
        , ncgDwarfStripBlockInfo = osElfTarget (platformOS (targetPlatform dflags)) && debugLevel dflags < 2 -- We strip out block information when running with -g0 or -g1.
    

  • compiler/GHC/Driver/DynFlags.hs
    ... ... @@ -89,7 +89,9 @@ module GHC.Driver.DynFlags (
    89 89
             isAvx512pfEnabled,
    
    90 90
             isFmaEnabled,
    
    91 91
             isBmiEnabled,
    
    92
    -        isBmi2Enabled
    
    92
    +        isBmi2Enabled,
    
    93
    +        -- For LoongArch platform
    
    94
    +        isLa664Enabled
    
    93 95
     ) where
    
    94 96
     
    
    95 97
     import GHC.Prelude
    
    ... ... @@ -457,6 +459,7 @@ data DynFlags = DynFlags {
    457 459
       avx512f               :: Bool, -- Enable AVX-512 instructions.
    
    458 460
       avx512pf              :: Bool, -- Enable AVX-512 PreFetch Instructions.
    
    459 461
       fma                   :: Bool, -- ^ Enable FMA instructions.
    
    462
    +  la664                 :: Bool, -- Enable LA664 instructions
    
    460 463
     
    
    461 464
       -- Constants used to control the amount of optimization done.
    
    462 465
     
    
    ... ... @@ -740,6 +743,8 @@ defaultDynFlags mySettings =
    740 743
             avx512pf = False,
    
    741 744
             -- Use FMA by default on AArch64
    
    742 745
             fma = (platformArch . sTargetPlatform $ mySettings) == ArchAArch64,
    
    746
    +        -- For LoongArch, la464 is used by default.
    
    747
    +        la664 = False,
    
    743 748
     
    
    744 749
             maxInlineAllocSize = 128,
    
    745 750
             maxInlineMemcpyInsns = 32,
    
    ... ... @@ -1662,6 +1667,11 @@ We handle this as follows:
    1662 1667
          to `AVX2`.
    
    1663 1668
     -}
    
    1664 1669
     
    
    1670
    +-- -----------------------------------------------------------------------------
    
    1671
    +-- LA664
    
    1672
    +isLa664Enabled :: DynFlags -> Bool
    
    1673
    +isLa664Enabled dflags = la664 dflags
    
    1674
    +
    
    1665 1675
     -- -----------------------------------------------------------------------------
    
    1666 1676
     -- BMI2
    
    1667 1677
     
    

  • compiler/GHC/Driver/Session.hs
    ... ... @@ -218,6 +218,9 @@ module GHC.Driver.Session (
    218 218
             isAvx512pfEnabled,
    
    219 219
             isFmaEnabled,
    
    220 220
     
    
    221
    +        -- LoongArch: ISA version: la664, la464(default)
    
    222
    +        isLa664Enabled,
    
    223
    +
    
    221 224
             -- * Linker/compiler information
    
    222 225
             useXLinkerRPath,
    
    223 226
     
    
    ... ... @@ -1729,6 +1732,9 @@ dynamic_flags_deps = [
    1729 1732
                                                              d { avx512pf = True }))
    
    1730 1733
       , make_ord_flag defGhcFlag "mfma"         (noArg (\d -> d { fma = True }))
    
    1731 1734
     
    
    1735
    +
    
    1736
    +  , make_ord_flag defGhcFlag "mla664"       (noArg (\d -> d { la664 = True }))
    
    1737
    +
    
    1732 1738
             ------ Plugin flags ------------------------------------------------
    
    1733 1739
       , make_ord_flag defGhcFlag "fplugin-opt" (hasArg addPluginModuleNameOption)
    
    1734 1740
       , make_ord_flag defGhcFlag "fplugin-trustworthy"
    

  • docs/users_guide/using.rst
    ... ... @@ -1781,6 +1781,17 @@ Some flags only make sense for particular target platforms.
    1781 1781
         multiply-add, which might perform non-IEEE-compliant software emulation on
    
    1782 1782
         some platforms (depending on the implementation of the C standard library).
    
    1783 1783
     
    
    1784
    +.. ghc-flag:: -mla664
    
    1785
    +    :shortdesc: (LoongArch only) Used for new instructions for la664 uarch
    
    1786
    +    :type: dynamic
    
    1787
    +    :category: platform-options
    
    1788
    +
    
    1789
    +    :default: off by default, avoid to generate invalid instructions for non-la664 uarchs.
    
    1790
    +
    
    1791
    +    GHC currently does not use LA664 specific instructions,
    
    1792
    +    so this flag has no effect when used with the :ref:`native code generator <native-code-gen>`
    
    1793
    +    or the :ref:`LLVM backend <llvm-code-gen>`.
    
    1794
    +
    
    1784 1795
     Haddock
    
    1785 1796
     -------
    
    1786 1797