Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update compiler_rt README and prettify it #13261

Merged
merged 1 commit into from
Oct 22, 2022
Merged

Conversation

matu3ba
Copy link
Contributor

@matu3ba matu3ba commented Oct 22, 2022

This documents status of routines and adds the next work item "Decimal float library routines", which are only recommended for binary data. Complete absence of tests is also documented. This does not document the various aliases, e.g. those for ARM.

Missing Integer library routines:

  • __addvsi3
  • __addvdi3
  • __addvti3
  • __addvdi3
  • __addvti3
  • __subvsi3
  • __subvdi3
  • __subvti3
  • __subvdi3
  • __subvti3
  • __mulvsi3
  • __mulvdi3
  • __mulvti3
  • __mulvdi3
  • __mulvti3

Missing floating library routines:

  • __powisf2
  • __powidf2
  • __powitf2
  • __powixf2

Missing routines for symbol-level compatibility to gcc:

  • __ashlsi3
  • __ashrsi3
  • __lshrsi3

This documents status of routines and adds the next work item
"Decimal float library routines", which are only recommended for
binary data. Complete absence of tests is also documented.
This does not document the various aliases, e.g. those for ARM.

Missing Integer library routines:
- __addvsi3
- __addvdi3
- __addvti3
- __addvdi3
- __addvti3
- __subvsi3
- __subvdi3
- __subvti3
- __subvdi3
- __subvti3
- __mulvsi3
- __mulvdi3
- __mulvti3
- __mulvdi3
- __mulvti3

Missing floating library routines:
- __powisf2
- __powidf2
- __powitf2
- __powixf2

Missing routines for symbol-level compatibility to gcc:
- __ashlsi3
- __ashrsi3
- __lshrsi3
Copy link
Contributor Author

@matu3ba matu3ba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make things more pretty.

- __gtdf2 //
- __gttf2 //

- dev other __cmpsf2 // a,b:f32, (a<b)->-1,(a==b)->0,(a>b)->1,Nan->1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixme, use same logic as the other Comparison

- __bid_adddd3 // a,b: dec64 -> dec64
- __dpd_addtd3 // a,b: dec128-> dec128
- __bid_addtd3 // a,b: dec128-> dec128
- __dpd_subsd3 // a,b: dec32, a - b
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixme

- __bid_unordtd2 // a,b: dec128

- __dpd_eqsd2 // a,b: dec32, a!=+-NaN and b!=+-Nan and a==b -> 0, else -> 1(nonzero)
- __bid_eqsd2 // a,b: dec32
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repeated types

- __divdc3 //
- __divtc3 //
- __divxc3 //
- dev unclear __powisf2 // a ^ b, TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number representation?

@matu3ba
Copy link
Contributor Author

matu3ba commented Oct 22, 2022

Purpose of this PR is to show status of compiler_rt with missing items and missing tests. While on it, I also added the next potential work package with severe limitation of not having Binary Encoded Decimals (BCD): Inability to represent accurately numbers like 0.2.

@andrewrk
Copy link
Member

Thanks!

@andrewrk andrewrk merged commit 776f7de into ziglang:master Oct 22, 2022
@andrewrk
Copy link
Member

I have a suggestion for how to make this more readable, which is to tableify all the symbols, like this:

Key

symbol meaning
This symbol is available in Zig's compiler-rt.
TODO! We need to implement this symbol.
🍴 This symbol has been enhanced from its original port.
This symbol is a strict port from the origin.

Implementation Status

status symbol category origin description
__clzsi2 Integer Bit 🍴HackersDelight count leading zeroes
__clzdi2 Integer Bit 🍴HackersDelight count leading zeroes
__clzti2 Integer Bit 🍴HackersDelight count leading zeroes
__ctzsi2 Integer Bit 🍴HackersDelight count trailing zeroes
__ctzdi2 Integer Bit 🍴HackersDelight count trailing zeroes
__ctzti2 Integer Bit 🍴HackersDelight count trailing zeroes

markdown source:

## Key

| symbol | meaning                                                      |
|--------|--------------------------------------------------------------|
| ✅     | This symbol is available in Zig's compiler-rt.               |
| ❌     | TODO! We need to implement this symbol.                      |
| 🍴     | This symbol has been enhanced from its original port.        |
| ⛵     | This symbol is a strict port from the origin.                |

## Implementation Status

| status | symbol     | category    | origin           | description           |
|--------|------------|-------------|------------------|-----------------------|
| ✅     | `__clzsi2` | Integer Bit | 🍴HackersDelight | count leading zeroes  |
| ✅     | `__clzdi2` | Integer Bit | 🍴HackersDelight | count leading zeroes  |
| ✅     | `__clzti2` | Integer Bit | 🍴HackersDelight | count leading zeroes  |
| ✅     | `__ctzsi2` | Integer Bit | 🍴HackersDelight | count trailing zeroes |
| ✅     | `__ctzdi2` | Integer Bit | 🍴HackersDelight | count trailing zeroes |
| ✅     | `__ctzti2` | Integer Bit | 🍴HackersDelight | count trailing zeroes |

@matu3ba
Copy link
Contributor Author

matu3ba commented Oct 22, 2022

I have a suggestion for how to make this more readable, which is to tableify all the symbols, like this:

I like the idea of a table, but there are some shortcomings to this very proposal:

    1. The category can get very long ("Integer Arithmetic with trapping overflow", "Integer Arithmetic which returns if overflow", "Floating point raised to integer power"), so multiple tables are probably needed. I'll try to squeeze the text abit, but I'm not sure the default github view will show it properly.
    1. The description does sometimes require a long text. One should then use Markdown footnotes.

@andrewrk
Copy link
Member

The category is not a useful data point. It can be omitted entirely.

@matu3ba matu3ba deleted the crt_readme branch October 22, 2022 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants