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

feature/nat_ops #104

Merged
merged 4 commits into from
Oct 12, 2022
Merged

feature/nat_ops #104

merged 4 commits into from
Oct 12, 2022

Conversation

leissa
Copy link
Member

@leissa leissa commented Oct 12, 2022

Just sth we needed when working on #90 and is potentially useful for everyone to have.

@leissa leissa merged commit b5df078 into master Oct 12, 2022
@leissa leissa deleted the feature/nat_ops branch October 12, 2022 15:13
@NeuralCoder3
Copy link
Collaborator

Why are nop as axioms needed?
Isn't the semantics

%core.nop.add (a,b)

the same as

.let a_i32 = %core.bitcast (I32, .Nat) a;
.let b_i32 = %core.bitcast (I32, .Nat) b;
.let c_i32 = %core.wrap.add (0,_32) (a_i32,b_i32);
%core.bitcast (.Nat, I32) c_i32

?
Even the normalization should be (nearly) the same.

@leissa
Copy link
Member Author

leissa commented Oct 20, 2022

It just makes our lives easier to directly have Nat-based operations. I think it makes sense to extend the special axiom namespace to work for all kind of entities - as I've already suggested. Then, we could define those things like this:

.lam %core.nop.add !(a: .Nat, b: .Nat) -> .Nat =
    .let a_i32 = %core.bitcast (I32, .Nat) a;
    .let b_i32 = %core.bitcast (I32, .Nat) b;
    .let c_i32 = %core.wrap.add (0,_32) (a_i32,b_i32);
    %core.bitcast (.Nat, I32) 

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