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

Add add compiler_rt routines for float to signed integer conversion #1820

Merged
merged 1 commit into from
Dec 12, 2018

Conversation

winksaville
Copy link
Contributor

The routines are:

__fixdfdi, __fixdfsi, __fixdfti,
__fixsfdi, __fixsfsi, __fixsfti,
__fixtfdi, __fixtfsi, __fixtfti.

These all call fixint which is a generic zig function that does the
conversion:

pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t

There are also a set tests:

__fixdfdi_test, __fixdfsi_test, __fixdfti_test,
__fixsfdi_test, __fixsfsi_test, __fixsfti_test,
__fixtfdi_test, __fixtfsi_test, __fixtfti_test.

There is also fixint_test.zig which does some basic tests
including tests small integers i1, i2, i3.

@tiehuis
Copy link
Member

tiehuis commented Dec 7, 2018

I think the CI failures on Windows may be similar to an issue encountered with other compiler-rt functions. See an example workaround here: https://github.com/ziglang/zig/blob/master/std/special/compiler_rt/udivmodti4.zig#L10.

@winksaville
Copy link
Contributor Author

Txs

@winksaville
Copy link
Contributor Author

How do I start a CI build after adding a new commit?

@winksaville
Copy link
Contributor Author

Close and reopen to see if that will kickoff a CI build

@winksaville winksaville closed this Dec 8, 2018
@winksaville
Copy link
Contributor Author

Reopne

@winksaville winksaville reopened this Dec 8, 2018
@winksaville
Copy link
Contributor Author

@andrewrk, anything addional you'd like me to do on this? I assume you'd like it to be squashed, but want to wait until you approve it.

@andrewrk
Copy link
Member

andrewrk commented Dec 11, 2018

Hi @winksaville, thanks for doing this work! I've been visiting my family for holiday travel and I have a lot of pull requests to review, including this one. I can get to a couple tomorrow as I travel home, and then I'll have a full day Wednesday to make sure everybody's code gets looked at and merged.

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

Looks good to me. If you go ahead and finish the TODO items (move f128_max, etc to std.math), and squash, then I'll merge right away.

assert(x == expected);
}

const f128_max = @bitCast(f128, u128(0x7FFEFFFFFFFFFFFFFFFFFFFFFFFFFFFF)); // TODO: Remove when std.math.f128_max defined
Copy link
Member

Choose a reason for hiding this comment

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

Want to go ahead and move these to std.math?

And add std.math.f128_* constants.

The routines are:

  __fixdfdi, __fixdfsi, __fixdfti,
  __fixsfdi, __fixsfsi, __fixsfti,
  __fixtfdi, __fixtfsi, __fixtfti.

These all call fixint which is a generic zig function that does the
conversion:

  pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t

There are also a set tests:

  __fixdfdi_test, __fixdfsi_test, __fixdfti_test,
  __fixsfdi_test, __fixsfsi_test, __fixsfti_test,
  __fixtfdi_test, __fixtfsi_test, __fixtfti_test.
@winksaville
Copy link
Contributor Author

Close and reopen to kick off build

@winksaville
Copy link
Contributor Author

Reopen

@winksaville winksaville reopened this Dec 12, 2018
@andrewrk andrewrk merged commit 634d11a into ziglang:master Dec 12, 2018
@winksaville winksaville deleted the add-fixint branch December 12, 2018 06:04
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.

3 participants