Skip to content

Add logic builtins to Julia and update type conversion prototypes#3238

Merged
chriseth merged 3 commits intodevelopfrom
julia-specs
May 14, 2018
Merged

Add logic builtins to Julia and update type conversion prototypes#3238
chriseth merged 3 commits intodevelopfrom
julia-specs

Conversation

@axic
Copy link
Contributor

@axic axic commented Nov 22, 2017

Part of #3226.

docs/julia.rst Outdated
| gtu256(x:u256, y:u256) -> z:bool | true if x > y, false otherwise |
+---------------------------------------------------------------------------------------------------------------+
| gtu256(x:u256, y:u256) -> z:bool | 1 if x > y, 0 otherwise |
| sltu256(x:s256, y:s256) -> z:bool | true if x < y, false otherwise, for signed numbers in two's complement |
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you re-align the |? (it is fine to break the line, it will not result in an explicit line break in the rendered version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not only that, some other parts are broken, wanted to finish that in this PR hence it is WIP.

docs/julia.rst Outdated
The following type conversion functions must be available:
- ``u32tobool(x:u32) -> y:bool``
- ``booltou32(x:bool) -> y:u32``
- ``u32tobool(x:u32) -> y:bool`` aka``y := not(iszerou256(x))``
Copy link
Contributor

Choose a reason for hiding this comment

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

Why only for 32 bits?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has TBD below, need to be extended.

@axic
Copy link
Contributor Author

axic commented Nov 29, 2017

Agreed on today's meeting that a superset of all target-specific builtins will be defined here and supported by the analyser. That means helpers for u32, u64 and u256 types.

+---------------------------------------------------------------------------------------------------------------+
| mulmodu256(x:u256, y:u256, m:u256) -> z:u256| (x * y) % m with arbitrary precision arithmetics |
+---------------------------------------------------------------------------------------------------------------+
| ltu256(x:u256, y:u256) -> z:bool | 1 if x < y, 0 otherwise |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we be going for ltu256 or lt_u256?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we change it for lt, we have to change it for everything. I'm not really sure what the best option is, though ...

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also do "crazy" things like lt.u256

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like lt.u256 for the looks, but it goes against the grammar we have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also how do you feel about allowing # in identifiers in julia?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would actually prefer ..

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't llvm also use .?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought we agreed on . already. # was in addition.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah sorry.

@axic axic changed the title [WIP] Add logic builtins to Julia Add logic builtins to Julia and update type conversion prototypes May 9, 2018
@axic
Copy link
Contributor Author

axic commented May 9, 2018

@chriseth I think this can be merged now, we can create a new PR if #4108 is settled.

@chriseth chriseth merged commit 8f17f72 into develop May 14, 2018
@axic axic deleted the julia-specs branch May 15, 2018 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants