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 Machine Float support to K framework #36

Closed
sdasgup3 opened this issue Dec 10, 2017 · 1 comment
Closed

Add Machine Float support to K framework #36

sdasgup3 opened this issue Dec 10, 2017 · 1 comment

Comments

@sdasgup3
Copy link
Owner

Problem

For supporting AVX/SSE2 instructions, I should have the support for 128 xmm registers, where the 128 bits can be interpreted as any one of he following:

2 64 bit doubles or
4 32-bit floats or
1 128 bit int or
2 64 bit ints or
4 32 bit ints or
8 16 bit ints or
16 8-bit ints or

The plan is to use mi(128,I) for those registers and whenever I need to interpret it as floats (or double), I will extract each 32 (or 64) bit chunks and get the corresponding float (or double).

K-buitin Floats do not provide any hooks to convert a specific bit pattern into a single precision or double precision floating point value.

Requirement

We need the ability to do the conversion as shown in examples:

    Example 1:
    
    bit-vector: 32' 01000001 01000110 00000000 00000000 === MInt(32, 1095106560)
        convert to or from
    Float(single precision): 12.375f.
    
    Example 2:
    bit-vector: 64' 0b0100000000101000110000000000000000000000000000000000000000000000 === MInt(64, 4623156123728347136)
        convert to or from
    Float(single precision): 12.375d.
@sdasgup3 sdasgup3 self-assigned this Dec 10, 2017
@sdasgup3
Copy link
Owner Author

Added the pull request to K repository
runtimeverification/k#2383

Commit:

Provides two following two hooks:

1. float2mint(Float F, Int W): Converts a float point value F(single or double precision)  to a BitVector or MInt of bitwidth W.
2. mint2float(MInt MI, Int Precision, Int Exponent): Converts a Bitvector or MInt to an single or double precision float point value.

The hooks are tested extensively using corner cases.

Note

@sdasgup3 sdasgup3 added this to the Generate K Rules of register only instruction varinats milestone Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant