[Git][ghc/ghc][wip/supersven/ghc-9.10-riscv-ncg] 234 commits: Add release notes entry for GHC proposal 575

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Mon Jun 10 13:40:44 UTC 2024



Sven Tennie pushed to branch wip/supersven/ghc-9.10-riscv-ncg at Glasgow Haskell Compiler / GHC


Commits:
b9b3b007 by Matthew Craven at 2024-04-15T10:57:59-04:00
Add release notes entry for GHC proposal 575

- - - - -
26b6c7fd by Matthew Craven at 2024-04-15T10:59:17-04:00
Users' guide: Fix base-ref links containing symbols

- - - - -
f15a854e by Alan Zimmerman at 2024-04-21T09:59:45+01:00
EPA: Add additional comments field to AnnsModule

This is used in exact printing to store comments coming after the
`where` keyword but before any comments allocated to imports or decls.

It is used in ghc-exactprint, see
https://github.com/alanz/ghc-exactprint/commit/44bbed311fd8f0d053053fef195bf47c17d34fa7

- - - - -
c8d25501 by Alan Zimmerman at 2024-04-21T10:41:35+01:00
EPA: Fix comments in mkListSyntaxTy0

Also extend the test to confirm.

Addresses #24669, 1 of 4

(cherry picked from commit f07015858fd79dca41983dbf3a249dfecd8d2eea)

- - - - -
7d6ae7aa by Alan Zimmerman at 2024-04-21T11:39:48+01:00
EPA: Provide correct span for PatBind

And remove unused parameter in checkPatBind

Contributes to #24669

(cherry picked from commit c90c60390aa3949b400f26ee0534273c56e19005)

- - - - -
64013156 by Alan Zimmerman at 2024-04-21T12:43:22+01:00
EPA: Fix span for PatBuilderAppType

Include the location of the prefix @ in the span for InVisPat.

Also removes unnecessary annotations from HsTP.

Contributes to #24669

(cherry picked from commit 26036f96919b1a8b99715dd99724163012c719fc)

- - - - -
898fcbd2 by Alan Zimmerman at 2024-04-21T13:49:41+01:00
EPA: Avoid duplicated comments in splice decls

Contributes to #24669

(cherry picked from commit 2f8e3a254a20f4573aec26fc85ab74b51d661472)

- - - - -
9f509a09 by Alan Zimmerman at 2024-04-21T15:32:17+01:00
EPA: Extend StringLiteral range to include trailing commas

This goes slightly against the exact printing philosophy where
trailing decorations should be in an annotation, but the
practicalities of adding it to the WarningTxt environment, and the
problems caused by deviating do not make a more principles approach
worthwhile.

(cherry picked from commit 00d3ecf0775c1a3f1ab8495e5e125f21d450394e)

- - - - -
45cc3064 by Ben Gamari at 2024-04-24T11:00:59-04:00
Merge remote-tracking branch 'origin/wip/az/ghc-9.10-backports-1' into HEAD

- - - - -
d9cd4bde by Ben Gamari at 2024-04-24T11:01:34-04:00
ghc-internal: Fix mentions of ghc-internal in deprecation warnings

Closes #24609.

(cherry picked from commit 55eb8c98895308d2dd025f7bd64c0b80fce6ace3)

- - - - -
b8f9880c by Zubin Duggal at 2024-04-24T11:01:34-04:00
driver: Make `checkHomeUnitsClosed` faster

The implementation of `checkHomeUnitsClosed` was traversing every single path
in the unit dependency graph - this grows exponentially and quickly grows to be
infeasible on larger unit dependency graphs.

Instead we replace this with a faster implementation which follows from the
specificiation of the closure property - there is a closure error if there are
units which are both are both (transitively) depended upon by home units and
(transitively) depend on home units, but are not themselves home units.

To compute the set of units required for closure, we first compute the closure
of the unit dependency graph, then the transpose of this closure, and find all
units that are reachable from the home units in the transpose of the closure.

(cherry picked from commit a933aff37992ea311a60be878379e7abf650e9fb)

- - - - -
6d6c2640 by Ben Gamari at 2024-04-24T11:01:37-04:00
template-haskell: Declare TH.Lib.Internal as not-home

Rather than `hide`.

Closes #24659.

(cherry picked from commit d7a3d6b5ee5e0c16af295579da3c54d8f0c37a05)

- - - - -
88e31848 by Teo Camarasu at 2024-04-24T11:01:37-04:00
Fix ghc API link in docs/index.html

This was missing part of the unit ID meaning it would 404.

Resolves #24674

(cherry picked from commit f30e4984fb048818051465698ef8e4e20dacb577)

- - - - -
1261ec2f by Simon Peyton Jones at 2024-04-24T11:01:37-04:00
Clone CoVars in CorePrep

This MR addresses #24463.  It's all explained in the new

   Note [Cloning CoVars and TyVars]

(cherry picked from commit 9d38bfa0c0f910208822579acaa999f87c2f8c65)

- - - - -
bcb5a91d by Jade at 2024-04-24T11:06:13-04:00
Put the newline after errors instead of before them

This mainly has consequences for GHCi but also slightly alters how the
output of GHC on the commandline looks.

Fixes: #22499
(cherry picked from commit 275e41a902f4aec8552707ec9924f2d0a20346d0)

- - - - -
be59c02c by Ben Gamari at 2024-04-25T12:51:45-04:00
Bump Cabal submodule to 3.12

- - - - -
5f4848c0 by Cheng Shao at 2024-04-25T12:54:20-04:00
ghc-bignum: remove obsolete ln script

This commit removes an obsolete ln script in ghc-bignum/gmp. See
060251c24ad160264ae8553efecbb8bed2f06360 for its original intention,
but it's been obsolete for a long time, especially since the removal
of the make build system. Hence the house cleaning.

(cherry picked from commit c62dc317c21026396a7a5581b90d17ef4c44f9ac)

- - - - -
f845a792 by Cheng Shao at 2024-04-25T12:54:22-04:00
ghc-bignum: update gmp to 6.3.0

This patch bumps the gmp-tarballs submodule and updates gmp to 6.3.0.
The tarball format is now xz, and gmpsrc.patch has been patched into
the tarball so hadrian no longer needs to deal with patching logic
when building in-tree GMP.

(cherry picked from commit 6399d52ba10d510a94c9db6552a4ea8aae8e003b)

- - - - -
92065500 by Cheng Shao at 2024-04-25T12:54:23-04:00
hadrian: remove obsolete Patch logic

This commit removes obsolete Patch logic from hadrian, given we no
longer need to patch the gmp tarball when building in-tree GMP.

(cherry picked from commit 65b4b92fa1e1989d055108a6077cc9119ee28acd)

- - - - -
1e77ded1 by Cheng Shao at 2024-04-25T12:54:24-04:00
autoconf: remove obsolete patch detection

This commit removes obsolete deletection logic of the patch command
from autoconf scripts, given we no longer need to patch anything in
the GHC build process.

(cherry picked from commit 71f28958454872db9c21c7d974dd0f0a7c7e8f3d)

- - - - -
bb67e8d5 by Sylvain Henry at 2024-04-25T12:56:03-04:00
JS: correctly handle RUBBISH literals (#24664)

(cherry picked from commit daeda83478d5b800d29661408dd67cc4b23df374)

- - - - -
57b07e02 by Ben Gamari at 2024-04-26T09:26:51-04:00
docs: Don't use str.isascii

`str.isascii` is only supported in Python 3.7 and later.

- - - - -
2c6375b9 by Hécate Moonlight at 2024-05-01T01:44:10+02:00
Add missing entries in the base-4.20 release notes

- - - - -
b8c66bf3 by Rodrigo Mesquita at 2024-05-08T02:08:37-04:00
bindist: Fix xattr cleaning

The original fix (725343aa) was incorrect because it used the shell
bracket syntax which is the quoting syntax in autoconf, making the test
for existence be incorrect and therefore `xattr` was never run.

Fixes #24554

(cherry picked from commit e03760db6713068ad8ba953d2252ec12b3278c9b)

- - - - -
250c5df7 by Ben Gamari at 2024-05-08T02:08:37-04:00
ghcup-metadata: Drop output_name field

This is entirely redundant to the filename of the URL. There is no
compelling reason to name the downloaded file differently from its
source.

- - - - -
7b327164 by Alan Zimmerman at 2024-05-08T02:08:37-04:00
EPA: check-exact: check that the roundtrip reproduces the source

Closes #24670

(cherry picked from commit 981c2c2c5017cb7ae47babff4d2163324d7cbde6)

- - - - -
a8c27c7c by Alan Zimmerman at 2024-05-08T02:09:14-04:00
EPA: Preserve comments in Match Pats

Closes #24708
Closes #24715
Closes #24734

(cherry picked from commit 1c2fd963d6fd78d1c752a21348c7db85f5d64df2)

- - - - -
e8603c75 by Alan Zimmerman at 2024-05-08T02:09:27-04:00
EPA: Preserve comments for PrefixCon

Preserve comments in

    fun (Con {- c1 -} a b)
        = undefined

Closes #24736

(cherry picked from commit 40026ac30fcdbe84a551f445f5e20691c0527ded)

- - - - -
015a0430 by Alan Zimmerman at 2024-05-08T02:09:27-04:00
EPA: fix span for empty \case(s)

In
    instance SDecide Nat where
      SZero %~ (SSucc _) = Disproved (\case)

Ensure the span for the HsLam covers the full construct.

Closes #24748

(cherry picked from commit 167a56a003106ed84742e3970cc2189ffb98b0c7)

- - - - -
c5a65a7f by Alan Zimmerman at 2024-05-08T02:09:27-04:00
EPA: preserve comments in class and data decls

Fix checkTyClHdr which was discarding comments.

Closes #24755

(cherry picked from commit 35d34fde62cd9e0002ac42f10bf705552f5c654e)

- - - - -
43a7dc68 by Alan Zimmerman at 2024-05-08T02:09:27-04:00
EPA: fix mkHsOpTyPV duplicating comments

Closes #24753

(cherry picked from commit 18f4ff84b323236f6dfd07f3bbc2842308a01e91)

- - - - -
01eeecec by Alan Zimmerman at 2024-05-08T02:09:27-04:00
EPA: preserve comments in data decls

Closes #24771

(cherry picked from commit 46328a49d988143111ab530d7907b9426b58311a)

- - - - -
2c7a0cf7 by Simon Peyton Jones at 2024-05-08T02:09:27-04:00
Track in-scope variables in ruleCheckProgram

This small patch fixes #24726, by tracking in-scope variables
properly in -drule-check.  Not hard to do!

(cherry picked from commit be1e60eec0ec37da41643af17d78c698ab2a7083)

- - - - -
4896c50b by Andrew Lelechenko at 2024-05-08T02:09:27-04:00
Document that setEnv is not thread-safe

(cherry picked from commit a86167471a7a471fb75ae9ba6c641bd1e74bc16d)

- - - - -
843f95b1 by Matthew Pickering at 2024-05-08T02:09:27-04:00
Don't depend on registerPackage function in Cabal

More recent versions of Cabal modify the behaviour of libAbiHash which
breaks our usage of registerPackage.

It is simpler to inline the part of registerPackage that we need and
avoid any additional dependency and complication using the higher-level
function introduces.

(cherry picked from commit 3fff09779d5830549ae455a15907b7bb9fe7859a)

- - - - -
720ff1f9 by Hécate Moonlight at 2024-05-08T02:09:27-04:00
Correct `@since` metadata in HpcFlags

It was introduced in base-4.20, not 4.22.
Fix #24721

(cherry picked from commit 9213478931b18402998c18f5c4e6f0ee09054b18)

- - - - -
7f9b05a8 by Teo Camarasu at 2024-05-08T02:09:27-04:00
doc: Fix type error in hs_try_putmvar example

(cherry picked from commit 06f7db4001e4eee0f3076d949876f8f4af0eb6fb)

- - - - -
d5f45368 by Cheng Shao at 2024-05-08T09:39:29+01:00
driver: always merge objects when possible

This patch makes the driver always merge objects with `ld -r` when
possible, and only fall back to calling `ar -L` when merge objects
command is unavailable. This completely reverts !8887 and !12313,
given more fixes in Cabal seems to be needed to avoid breaking certain
configurations and the maintainence cost is exceeding the behefits in
this case :/

(cherry picked from commit 631cefec222e2db951c58db0b15a8d80ef5549cb)

- - - - -
255f44e7 by Alan Zimmerman at 2024-05-08T20:07:57+01:00
EPA: Fix range for GADT decl with sig only

Closes #24714

(cherry picked from commit d5bea4d6bce785b1d09f1b8faad7451af23b728d)

- - - - -
ea1bca98 by Alan Zimmerman at 2024-05-08T20:36:04+01:00
EPA: Preserve comments for pattern synonym sig

Closes #24749

(cherry picked from commit bf3d4db0894233ec72f092a4a34bce9ed4ff4e21)

- - - - -
2cb0fb44 by Alan Zimmerman at 2024-05-08T20:36:33+01:00
EPA: Widen stmtslist to include last semicolon

Closes #24754

(cherry picked from commit 7eab4e019205cfced90f06242a9afa23dfcaa70b)

- - - - -
776fa6e1 by Alan Zimmerman at 2024-05-08T20:49:33+01:00
EPA: Keep comments in a CaseAlt match

The comments now live in the surrounding location, not inside the
Match. Make sure we keep them.

Closes #24707

(cherry picked from commit e916fc9215e66b15c7e2387cc087a9d1cc57bf77)

- - - - -
c192d254 by Ben Gamari at 2024-05-09T11:49:25-04:00
Revert "ghcup-metadata: Drop output_name field"

This reverts commit 250c5df7875658f172804f511cd7eb325392f347.

- - - - -
923e21bc by Ben Gamari at 2024-05-09T11:49:26-04:00
ghcup-metadata: Drop output_name

This is entirely redundant to the filename of the URL. There is no
compelling reason to name the downloaded file differently from its
source.

- - - - -
78092043 by Ryan Scott at 2024-05-09T11:49:26-04:00
unboxedSum{Type,Data}Name: Use GHC.Types as the module

Unboxed sum constructors are now defined in the `GHC.Types` module, so if you
manually quote an unboxed sum (e.g., `''Sum2#`), you will get a `Name` like:

```hs
GHC.Types.Sum2#
```

The `unboxedSumTypeName` function in `template-haskell`, however, mistakenly
believes that unboxed sum constructors are defined in `GHC.Prim`, so
`unboxedSumTypeName 2` would return an entirely different `Name`:

```hs
GHC.Prim.(#|#)
```

This is a problem for Template Haskell users, as it means that they can't be
sure which `Name` is the correct one. (Similarly for `unboxedSumDataName`.)

This patch fixes the implementations of `unboxedSum{Type,Data}Name` to use
`GHC.Types` as the module. For consistency with `unboxedTupleTypeName`, the
`unboxedSumTypeName` function now uses the non-punned syntax for unboxed sums
(`Sum<N>#`) as the `OccName`.

Fixes #24750.

- - - - -
2cc6968a by Andrei Borzenkov at 2024-05-09T11:51:06-04:00
Fix tuple puns renaming (24702)

Move tuple renaming short cutter from `isBuiltInOcc_maybe` to `isPunOcc_maybe`, so we consider incoming module.

I also fixed some hidden bugs that raised after the change was done.

(cherry picked from commit 94da936507c685aa8101a714e7619b4d428d0187)

- - - - -
017c52b7 by Ben Gamari at 2024-05-09T18:39:46-04:00
Bump version to 9.10.1

- - - - -
d07219d8 by Ben Gamari at 2024-05-09T22:52:06-04:00
generate_bootstrap_plans: Update

- - - - -
6d779c0f by Ben Gamari at 2024-05-10T00:36:54-04:00
base: Fix release date in changelog

- - - - -
0d2160de by Ben Gamari at 2024-05-13T11:54:20-04:00
releng/uploads: .gz files are release artifacts

- - - - -
b63f7ba0 by Ben Gamari at 2024-05-23T17:33:27-04:00
base: Fix changelog reference to setBacktraceMechanismState

- - - - -
6ccd1c03 by Ben Gamari at 2024-05-23T17:33:27-04:00
ghcup-metadata: update to reflect upstream preferences

- - - - -
a5325ded by Ben Gamari at 2024-05-23T17:33:27-04:00
Bump haddock version

Somehow the submodule bump which performed the version increment of
`haddock` and friends in was lost in the pre-release shuffle.
Fix this.

Closes #24827.

- - - - -
559e73fb by Ben Gamari at 2024-05-28T09:37:46-04:00
base: Ensure that CHANGELOG is included in extra-source-files

This was missed in the `ghc-internal` split.

Closes #24831.

- - - - -
e6b940c3 by Ben Gamari at 2024-05-28T14:31:42-04:00
Bump haddock submodule with fix to #24853

It appears that this reversion was not merged to ghc-9.10, again
breaking quick-jump in `base`'s Haddocks.

Also bump version to 2.31

Fixes #24853.

- - - - -
c453ac59 by Ben Gamari at 2024-05-29T07:28:32-04:00
base: Bump version

We are bumping the version by a patch-level to upload to Hackage to fix
Haddock issues with the 9.10 release. See #24875.

- - - - -
1b157ab3 by Ben Gamari at 2024-05-29T10:41:50-04:00
testsuite: Normalize version of base in T19847a

- - - - -
2fe96b6e by Zubin Duggal at 2024-05-30T18:06:57+05:30
Bump haddock submodule to fix #24907

- - - - -
0c301d33 by Zubin Duggal at 2024-05-31T13:01:18+05:30
Bump haddock submodule to fix #24912

- - - - -
934a8bb9 by Zubin Duggal at 2024-05-31T13:01:18+05:30
base: Add changelog entry for 4.20.0.1

- - - - -
c99aea68 by Moritz Angermann at 2024-06-10T13:40:05+00:00
Add RV64 backend

- - - - -
6fb8713e by Moritz Angermann at 2024-06-10T13:40:05+00:00
Add RV64 notes

- - - - -
a3e621b4 by Moritz Angermann at 2024-06-10T13:40:05+00:00
Fixup Rebase mistake

- - - - -
54fa33e3 by Sven Tennie at 2024-06-10T13:40:05+00:00
Remove TAB character

The whitespace linter doesn't like it.

- - - - -
f2ab5fc9 by Sven Tennie at 2024-06-10T13:40:05+00:00
Fix compiler warning about importing GHC.Utils.Panic.Plain in CodeGen.Platform.h

- - - - -
bc731d6a by Sven Tennie at 2024-06-10T13:40:05+00:00
Pretty-print registers by their alias names

The alias name is easier to memorize and simplifies reasoning
about what's going on.

- - - - -
e931b9a6 by Sven Tennie at 2024-06-10T13:40:05+00:00
Fix getAmode: Only signed 12bit immediates

The symptom to find this was a too big immediate in a LW instruction in
test arr020:
    Error: illegal operands `lw t0,4016(t0)'

- - - - -
a1ae283c by Ben Gamari at 2024-06-10T13:40:05+00:00
testsuite/driver: Add basic support for testing cross-compilers

- - - - -
f6e582cf by Sven Tennie at 2024-06-10T13:40:05+00:00
Add OR and ORI instructions

ORR doesn't exist on RISCV. OR with register load is used when the
immediate is too big for ORI (i.e. >12bits.)

- - - - -
847fe8a2 by Sven Tennie at 2024-06-10T13:40:05+00:00
Refine TODO comment: Stack frame header size is 2 * 8 byte

The stack frame header should contain two registers: ra and previous fp

- - - - -
52f6ff5a by Sven Tennie at 2024-06-10T13:40:05+00:00
Fix MOV with immediate

There are three cases:
- Fits in a 12bit immediate slot -> ADDI
- Fits in 32bit -> %hi / %lo piecewise loading
- Else: Let the assembler solve this issue for now, LI

- - - - -
5dcf9960 by Sven Tennie at 2024-06-10T13:40:05+00:00
Add DIV and REM

REM calculates the remainder and replaces the more complex logic copied
from AARCH64.

- - - - -
9f82ee62 by Sven Tennie at 2024-06-10T13:40:05+00:00
Fix: LDRB -> LB, LDRH -> LH

A simple translation of these instructions from ARM to RISCV.

Add panic-ing pattern matches to fetch the outstanding STR and LDR
cases.

- - - - -
0d8b8195 by Sven Tennie at 2024-06-10T13:40:05+00:00
Implement MO_S_Shr and truncateReg

These store and load on the stack to move values in changed widths into
registers.

- - - - -
21c3d4b3 by Sven Tennie at 2024-06-10T13:40:05+00:00
CmmInt 0 should refer to zero register

A constant 0 can always be taken from the zero register.

- - - - -
09fe423e by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix signed shift right

This includes overhauling the sign extension and width truncation logic.

- - - - -
2561b085 by Sven Tennie at 2024-06-10T13:40:06+00:00
Replace SXTH & SXTB

Both do not exist on RISCV64. While touching the sign extension code,
also fix the integer calling convention in this sense and update the
sign extension note.

- - - - -
34cfb757 by Sven Tennie at 2024-06-10T13:40:06+00:00
Allow truncation to from smaller to larger Width

This is used as inverse of sign extension to 64bit at many places.

- - - - -
f026aeba by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement MO_NOT: Replace MVN

MVN does not exist in RV64. Replace it by pseudo-instr not's effective
assembly.

- - - - -
6e31a23c by Sven Tennie at 2024-06-10T13:40:06+00:00
Replace UXTB & UXTH, Fix UDIV

Replace UXTB and UXTB with truncateReg as these instructions do not
exist in RISCV64. UDIV is named DIVU in RISCV64.

- - - - -
3bb11e53 by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement XOR

Delete EOR which does not exist on RISCV64.

- - - - -
ec82d581 by Sven Tennie at 2024-06-10T13:40:06+00:00
Rename UDIV -> DIVU

That's how unsigned div is called on RISCV64. This should avoid confusion.

- - - - -
dbce457f by Sven Tennie at 2024-06-10T13:40:06+00:00
Delete unused EON

It does not exist on RISCV64.

- - - - -
84a4fd9f by Sven Tennie at 2024-06-10T13:40:06+00:00
WIP: MO_S_MulMayOflo

- - - - -
576f2194 by Moritz Angermann at 2024-06-10T13:40:06+00:00
float: first stab at supporting float ins

- - - - -
3c9c8cfb by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix & test MulMayOflo

- - - - -
b58e31ff by Sven Tennie at 2024-06-10T13:40:06+00:00
Cleanup the MulMayOflo story

- - - - -
a90c3797 by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement MO_ReadBarrier and MO_WriteBarrier

The levels are taken from SMP.h write_barrier() and load_load_barrier().

- - - - -
374a9b7d by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement MO_AtomicRead and MO_AtomicWrite

- - - - -
5f8a7fe8 by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement register -> stack spilling

- - - - -
ddd050d1 by Sven Tennie at 2024-06-10T13:40:06+00:00
Add free reg counts for trivColorable

- - - - -
898c6fc0 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix immediate operand related guards

For most operations, the immediate's boundaries are those of a 12bit
integer.

- - - - -
a12b198c by Sven Tennie at 2024-06-10T13:40:06+00:00
Assign x31 to be IP register

And, use it for register spilling.

- - - - -
84ba5914 by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement MO_FS_Conv and MO_SF_Conv (integer <-> float conversion)

- - - - -
5ff878f4 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix MO_U_Shr (UBFX does not exist in RISCV ISA)

- - - - -
ac0aa8a6 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix (CmmLit (CmmInt w i)) where i doesn't fit in w

- - - - -
3668e3d5 by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement MOV for ImmInt immediates

These cases were likely just forgotten.

- - - - -
e472f8d8 by Sven Tennie at 2024-06-10T13:40:06+00:00
Load integers in their positive representation and don't sign extend unsigned values in foreign C calls

Otherwise, the sign bits mess up everything!

- - - - -
b0ff6f91 by Sven Tennie at 2024-06-10T13:40:06+00:00
Just narrow all CmmLit . CmmInt to the expected width

There may appear immediates that don't fit the size. Just truncate them
with narrowU. Otherwise, some bit operations fail for the highest bit.

- - - - -
5bcf8890 by Sven Tennie at 2024-06-10T13:40:06+00:00
Implement MO_UU_Conv

Expect zero extended (!) register. If the source Width is smaller or
equal to the target Width just move (copy) the value. Otherwise (target
Width is smaller), truncate it.

We don't need to care about sign-extension, as this mach op is unsigned.

- - - - -
bb8f93dd by Sven Tennie at 2024-06-10T13:40:06+00:00
CmmLoad: Load sub-words unsigned (no sign-extension)

The contract is that each operation should leave sub-words
zero-extended.

This fixes the test (test-primops):

//    Failed:
//    0::W64 - (~(zext[W32→W64](load[W32](0x8c::W64))))
//    ((0 :: bits64) - (~%zx64(bits32[buffer + (140 :: bits64)])))
//    0x8f8e8d8d /= 0xffffffff8f8e8d8d

test(bits64 buffer) {
    bits64 ret;
    ret = ((0 :: bits64) - (~%zx64(bits32[buffer + (140 :: bits64)])));
    return (ret);
}

- - - - -
56918220 by Sven Tennie at 2024-06-10T13:40:06+00:00
Annotate more instructions

- - - - -
40bed354 by Sven Tennie at 2024-06-10T13:40:06+00:00
Truncate after left shift

Shifted values may exceed the target Width.

- - - - -
8bda632f by Sven Tennie at 2024-06-10T13:40:06+00:00
MO_SS_Conv: Don't give up the highest bit for sign

According to this test, reducing the value for the sign is not correct.

narrow[W32→W8](sext[W16→W32](load[W16](0x223972::W64)))
test ( bits64 buffer ) {
    bits64 ret;
    (ret) = prim %popcnt8(%lobits8(%sx32(bits16[buffer + (2242930 :: bits64)])));
    return (ret);
}

4 /= 5

- - - - -
aeb92507 by Sven Tennie at 2024-06-10T13:40:06+00:00
Unsigned remainder (modulo): REMU

- - - - -
596be5e6 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix loading 12bit < imm <= 32bit immediates

The prior version sign extended the immediate.

- - - - -
e37ca908 by Sven Tennie at 2024-06-10T13:40:06+00:00
WIP: Check C calling convention

- - - - -
db2dc5f7 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix & test C calling convention (parameters)

I think the gist is: Sub-word ints are sign-extended, sub-word words are
give as is, because they were truncated before.

- - - - -
09ef0698 by Sven Tennie at 2024-06-10T13:40:06+00:00
Truncate C return values to their expected width

Otherwise, values that may be too big are floating around.

- - - - -
d60fa557 by Sven Tennie at 2024-06-10T13:40:06+00:00
Single precision float comparisons

- - - - -
828ade68 by Sven Tennie at 2024-06-10T13:40:06+00:00
Float conditional jumps

- - - - -
84e10c66 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix float absolute (fabs)

- - - - -
9bdd4da7 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix float negation

- - - - -
f0f6418f by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix unsigned float loading

- - - - -
8683177f by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix float comparisions

- - - - -
b4691499 by Sven Tennie at 2024-06-10T13:40:06+00:00
Fix float calling convention (a bit)

If fp regs are taken, use go regs instead.

- - - - -
ea6106bd by Sven Tennie at 2024-06-10T13:40:06+00:00
Add calling conv test for doubles

- - - - -
d86cadff by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix float -> int conversion (width)

- - - - -
4ba84881 by Sven Tennie at 2024-06-10T13:40:07+00:00
MO_FS_Conv: Truncate register after conversion

Otherwise, sign-extension bits may stay around.

- - - - -
442db0d6 by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix float operation attributes

This is its own little hell...

- - - - -
687d9340 by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix MO_FF_CONV

The instruction needs precision suffixes to be valid.

- - - - -
250669e6 by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix wrong fcvt widths

- - - - -
29a4c09d by Sven Tennie at 2024-06-10T13:40:07+00:00
Sign-extend branche conditionals W32 -> W64

Otherwise, negative ints are used as positive ints.

- - - - -
f60612fd by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix float NE: Needed width

- - - - -
53a06812 by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix TrivColorable register counts

- - - - -
844d3302 by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix MulMayOflo test

- - - - -
a0759b2f by Sven Tennie at 2024-06-10T13:40:07+00:00
Adjust stackFrameHeaderSize

- - - - -
9c8df4fd by Sven Tennie at 2024-06-10T13:40:07+00:00
Delete unnecessary Ppr cases

- - - - -
f1a7c7d3 by Sven Tennie at 2024-06-10T13:40:07+00:00
Suppress orphan instance warning

Similar to other archs, this seems to be the expected place.

- - - - -
3f61c22e by Sven Tennie at 2024-06-10T13:40:07+00:00
Delete commented-out code

- - - - -
7b198296 by Sven Tennie at 2024-06-10T13:40:07+00:00
Adjust panix message

- - - - -
a8dab5b7 by Sven Tennie at 2024-06-10T13:40:07+00:00
Add TODOs

- - - - -
a8e128ac by Sven Tennie at 2024-06-10T13:40:07+00:00
Formatting

- - - - -
fc8c7389 by Sven Tennie at 2024-06-10T13:40:07+00:00
Eta reduction

- - - - -
a3820072 by Sven Tennie at 2024-06-10T13:40:07+00:00
Remove unused LANGUAGE pragma

- - - - -
dbf912ca by Sven Tennie at 2024-06-10T13:40:07+00:00
Syntax cleanup

- - - - -
28459d29 by Sven Tennie at 2024-06-10T13:40:07+00:00
Update comments

- - - - -
cfa5fc07 by Sven Tennie at 2024-06-10T13:40:07+00:00
Remove unused function: toImm

- - - - -
fa2a5b8f by Sven Tennie at 2024-06-10T13:40:07+00:00
Remove unused function: withTempIntReg

- - - - -
d937acbe by Sven Tennie at 2024-06-10T13:40:07+00:00
Remove doubled comment

- - - - -
960f4fec by Sven Tennie at 2024-06-10T13:40:07+00:00
Refactor ss_conv to mute incomplete-pattern-match warning

- - - - -
0e1d450a by Sven Tennie at 2024-06-10T13:40:07+00:00
Advertise code-gen capability in Hadrian

- - - - -
31e52f3c by Sven Tennie at 2024-06-10T13:40:07+00:00
Define DWARF regs

- - - - -
8d096129 by Sven Tennie at 2024-06-10T13:40:07+00:00
Reduce duplication in conditionals

All non-W64 width had the same code.

- - - - -
641771ab by Sven Tennie at 2024-06-10T13:40:07+00:00
Add TODOS

- - - - -
7a83c486 by Sven Tennie at 2024-06-10T13:40:07+00:00
Far branches

- - - - -
3393c122 by Sven Tennie at 2024-06-10T13:40:07+00:00
Far unconditional jumps / branches

Introduce B_FAR.

- - - - -
539410e3 by Sven Tennie at 2024-06-10T13:40:07+00:00
Fix DWARF labels

Some were missing...

- - - - -
5b741a33 by Sven Tennie at 2024-06-10T13:40:07+00:00
Add TODOs

- - - - -
2321bc03 by Sven Tennie at 2024-06-10T13:40:07+00:00
Cleanup makeFarBranches

- - - - -
c2bb0ca7 by Sven Tennie at 2024-06-10T13:40:07+00:00
WIP: Add GHC Linker

This is likely not correct, yet.

- - - - -
5e57df13 by Sven Tennie at 2024-06-10T13:40:07+00:00
Runtime  linker LLVM style

- - - - -
3a86cd38 by Sven Tennie at 2024-06-10T13:40:07+00:00
Linker: Delete invalid check

- - - - -
bc3ad1aa by Sven Tennie at 2024-06-10T13:40:07+00:00
Linker: Add missing cases

- - - - -
aaf6a879 by Sven Tennie at 2024-06-10T13:40:07+00:00
Linker: Trace int size issue

- - - - -
c9cd0a82 by Sven Tennie at 2024-06-10T13:40:07+00:00
Linker: warnings

- - - - -
120cfe19 by Sven Tennie at 2024-06-10T13:40:07+00:00
Linker: Add missing relocation

- - - - -
015e3443 by Sven Tennie at 2024-06-10T13:40:07+00:00
Linker: Missing break statement

- - - - -
15637126 by Sven Tennie at 2024-06-10T13:40:08+00:00
Add missing relocation

- - - - -
af793f5b by Sven Tennie at 2024-06-10T13:40:08+00:00
Add R_RISCV_JAL encoding

- - - - -
c40060d6 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Cleanup relocations, Add missing

- - - - -
fecc49a0 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Fix R_RISCV_SET8

- - - - -
11e2eff3 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Fix U-Type assertion

Instructions are 32 bits wide in RISCV(64).

- - - - -
d3b08cc1 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Delete unused variable

- - - - -
281a6b31 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Fix PLT jumps

- - - - -
22125ec7 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Belch only when asked

- - - - -
6e368605 by Sven Tennie at 2024-06-10T13:40:08+00:00
linker: More fixing

- - - - -
c464b1dd by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Add local labels to the GOT

- - - - -
dae860d3 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: uint32_t addend

This seems to be a good representation:
- We're dealing with negative values as well (e.g. negative PC offset)
- We cannot deal with more than 20 + 12 = 32 bits

- - - - -
b9aef261 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Rework debug traces

- - - - -
6a85de65 by Sven Tennie at 2024-06-10T13:40:08+00:00
Ensure __clzdi2 builtin is around

- - - - -
04a85878 by Sven Tennie at 2024-06-10T13:40:08+00:00
Add symbol prototype for __ctzdi2

- - - - -
00f47c8d by Sven Tennie at 2024-06-10T13:40:08+00:00
Add comment

- - - - -
30679fa8 by Sven Tennie at 2024-06-10T13:40:08+00:00
Only trace message on flag

- - - - -
c4a0748d by Sven Tennie at 2024-06-10T13:40:08+00:00
Check int size on 32 bit width

We're handing around 32bit integers.

- - - - -
da63cd99 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Use SymbolExtras for GOT relative relocations to local symbols

This is (hopefully!) faster than emitting real GOT entries for all local
labels (which was implemented before.)

- - - - -
9a84ff17 by Sven Tennie at 2024-06-10T13:40:08+00:00
Linker: Optimize lookup of dependent relocation

Always iteration over everything was a real performance issue. Now,
start with the second relocation and go back to the first one. Expect it
in the same section.

- - - - -
66e7ad23 by Sven Tennie at 2024-06-10T13:40:08+00:00
Beauify allMachRegNos

- - - - -
fe278d67 by Sven Tennie at 2024-06-10T13:40:08+00:00
Delete unused function strImmLit

- - - - -
a337e9c5 by Sven Tennie at 2024-06-10T13:40:08+00:00
Introduce constant firstFpRegNo

Makes usages more readable.

- - - - -
73b8a7fb by Sven Tennie at 2024-06-10T13:40:08+00:00
Add TODOs

- - - - -
83851509 by Sven Tennie at 2024-06-10T13:40:08+00:00
Cleanup register constants

- - - - -
5cc53f8e by Sven Tennie at 2024-06-10T13:40:08+00:00
Make reg numbers less magic

- - - - -
66dac7fc by Sven Tennie at 2024-06-10T13:40:08+00:00
More on RegNo

- - - - -
d8758f0d by Sven Tennie at 2024-06-10T13:40:08+00:00
Improve comment

- - - - -
b9305f3b by Sven Tennie at 2024-06-10T13:40:08+00:00
Remove unused / non-existent addressing mode

- - - - -
0359dd88 by Sven Tennie at 2024-06-10T13:40:08+00:00
Reformat / cleanup

- - - - -
22cf3a9c by Sven Tennie at 2024-06-10T13:40:08+00:00
Add TODOs

- - - - -
f743d4ce by Sven Tennie at 2024-06-10T13:40:08+00:00
More on RegNos

- - - - -
f0920d2e by Sven Tennie at 2024-06-10T13:40:08+00:00
Trim trailing whitespace

- - - - -
194a42c8 by Sven Tennie at 2024-06-10T13:40:08+00:00
No sign extension attribute in RISCV instructions

RISCV takes the meaning of reduced instruction set much more serious:
One cannot sign extend an operant in the same instruction. Delete this
unused code - We're handling sign extension differently.

- - - - -
d556fc68 by Sven Tennie at 2024-06-10T13:40:08+00:00
There are no shifts in RISCV instructions

Remove this unused code. RISCV does everything in small steps...

- - - - -
14f18e06 by Sven Tennie at 2024-06-10T13:40:08+00:00
pprReg: Remove unused parameter

- - - - -
10754464 by Sven Tennie at 2024-06-10T13:40:08+00:00
Cleanup Cond

- - - - -
65df2ce8 by Sven Tennie at 2024-06-10T13:40:08+00:00
More cleanup

Mostly haddock, formatting, minor refactorings

- - - - -
dfb40f6e by Sven Tennie at 2024-06-10T13:40:08+00:00
Implement takeRegRegMoveInstr

- - - - -
a3a4f4df by Sven Tennie at 2024-06-10T13:40:08+00:00
Cleanup mkStackAllocInstr & mkStackDeallocInstr

- - - - -
4ea4eacd by Sven Tennie at 2024-06-10T13:40:08+00:00
Move Reg definitions to Regs module

- - - - -
9169aacb by Sven Tennie at 2024-06-10T13:40:08+00:00
Typo

- - - - -
89e19ff6 by Sven Tennie at 2024-06-10T13:40:08+00:00
Circumvent "incomplete pattern match" warning

- - - - -
ee6c1f29 by Sven Tennie at 2024-06-10T13:40:08+00:00
Delete commented out / dead code

- - - - -
b89e5f37 by Sven Tennie at 2024-06-10T13:40:08+00:00
Add TODOs

- - - - -
ab226689 by Sven Tennie at 2024-06-10T13:40:08+00:00
Reduce duplication in stack alloc / free

- - - - -
8240722f by Sven Tennie at 2024-06-10T13:40:09+00:00
Delete unused instructions

As they are unused, we don't even know if using them would work at all.

- - - - -
a65bbb91 by Sven Tennie at 2024-06-10T13:40:09+00:00
Lint

- - - - -
7f3d593a by Sven Tennie at 2024-06-10T13:40:09+00:00
Fix odd register move reduction

Probably, there're OpRegs with wrong format around.

- - - - -
43c62192 by Sven Tennie at 2024-06-10T13:40:09+00:00
Re-implement takeRegRegMoveInstr

- - - - -
d9bb9186 by Sven Tennie at 2024-06-10T13:40:09+00:00
Implement switch (case) jump tables

- - - - -
808f411e by Sven Tennie at 2024-06-10T13:40:09+00:00
adjustor: Fence for generated code

- - - - -
12f34c40 by Sven Tennie at 2024-06-10T13:40:09+00:00
Skip divbyzero test (like most archs)

- - - - -
3fb2fe86 by Sven Tennie at 2024-06-10T13:40:09+00:00
More instruction cache flushing

Flush in the Linker, which creates code in the PLT. And, cleanup the
link code by using built-ins instead of inline assembly.

- - - - -
37bf4573 by Sven Tennie at 2024-06-10T13:40:09+00:00
Add todos

- - - - -
4d7f3054 by Sven Tennie at 2024-06-10T13:40:09+00:00
Cleanup

Delete dead code, useless/obsolete comments ...

- - - - -
986dcae6 by Sven Tennie at 2024-06-10T13:40:09+00:00
Remove unused constructors

Aarch64 and RISCV64 are just too different...

- - - - -
7e231cd0 by Sven Tennie at 2024-06-10T13:40:09+00:00
Remove more dead code

- - - - -
2e457c69 by Sven Tennie at 2024-06-10T13:40:09+00:00
Replace duplicated source Note by reference

- - - - -
beb267c5 by Sven Tennie at 2024-06-10T13:40:09+00:00
Delete commented out code

- - - - -
6f567ed9 by Sven Tennie at 2024-06-10T13:40:09+00:00
TLabel was unused / unsupported

- - - - -
f6b4f8d5 by Sven Tennie at 2024-06-10T13:40:09+00:00
Cleanup immediate pretty printing

- - - - -
758bbc7e by Sven Tennie at 2024-06-10T13:40:09+00:00
Cleanup C calling conv code

- - - - -
d2869385 by Sven Tennie at 2024-06-10T13:40:09+00:00
Fix invalid Haddock

- - - - -
1e984da1 by Sven Tennie at 2024-06-10T13:40:09+00:00
Fix linker issue

Local symbols don't get GOT entries. Fake them with extra symbols instead. Such that R_RISCV_CALL_PLT has an address to load and jump to.

- - - - -
22b3c5ac by Sven Tennie at 2024-06-10T13:40:09+00:00
Add missing relocation to name (string) mapping

- - - - -
6c8cc7d6 by Sven Tennie at 2024-06-10T13:40:09+00:00
Increase Clang happiness

Otherwise, it newer versions refuse to build.

- - - - -
917898e7 by Sven Tennie at 2024-06-10T13:40:09+00:00
Implement -falignment-sanitisation

- - - - -
81105374 by Sven Tennie at 2024-06-10T13:40:09+00:00
Ensure there's always a well defined skip label (far branches)

Just th be sure, we don't accidentally land somewhere unexpected.

- - - - -
51497c5a by Sven Tennie at 2024-06-10T13:40:09+00:00
Move alignment check

- - - - -
7fc1a7ab by Sven Tennie at 2024-06-10T13:40:09+00:00
Add TODO (reminder) about fences

- - - - -
904d0074 by Sven Tennie at 2024-06-10T13:40:09+00:00
Fix type of makeFarBranches

It changed during releases

- - - - -
a84c4c68 by Sven Tennie at 2024-06-10T13:40:09+00:00
Fix MulMayOflo test

A merge/rebase issue...

- - - - -
5202c002 by Sven Tennie at 2024-06-10T13:40:09+00:00
GHC 9.10 rebasing FIXUP

- - - - -
f569612d by Sven Tennie at 2024-06-10T13:40:09+00:00
Add fused multiplication/addition (FMA)

- - - - -
58a1d506 by Sven Tennie at 2024-06-10T13:40:09+00:00
Increase C compiler happiness

New warnings (-Werror) prevented the validate flavour from being built.

- - - - -
782cdda1 by Sven Tennie at 2024-06-10T13:40:09+00:00
Ignore signedness for MO_XX_Conv

MO_XX_Conv is used on (unsigned) words, too. Interpreting them as signed
may lead to weird conversions / sign-extensions: E.g. on RISCV64 this
conversion happened for a Word64#:

%MO_XX_Conv_W32_W64(4294967293 :: W32) -> CmmLit (CmmInt (-3) W64)

- - - - -


14 changed files:

- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- .gitlab/rel_eng/upload.sh
- compiler/CodeGen.Platform.h
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/Dwarf/Constants.hs
- compiler/GHC/CmmToAsm/PIC.hs
- + compiler/GHC/CmmToAsm/RV64-notes.md
- + compiler/GHC/CmmToAsm/RV64.hs
- + compiler/GHC/CmmToAsm/RV64/CodeGen.hs
- + compiler/GHC/CmmToAsm/RV64/Cond.hs
- + compiler/GHC/CmmToAsm/RV64/Instr.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5d82e90884a61740476d00bbf000a8d31143c37f...782cdda1edd69138635b29d0108d8bc42d8ee6a7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5d82e90884a61740476d00bbf000a8d31143c37f...782cdda1edd69138635b29d0108d8bc42d8ee6a7
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240610/8ab3680f/attachment-0001.html>


More information about the ghc-commits mailing list