Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

How to enable +zfinx in llvm 14? #13

Open
hughperkins opened this issue Apr 12, 2022 · 0 comments
Open

How to enable +zfinx in llvm 14? #13

hughperkins opened this issue Apr 12, 2022 · 0 comments

Comments

@hughperkins
Copy link

hughperkins commented Apr 12, 2022

I need to compile with +zfinx, so that float operations use int registers.

In llvm 14, it looks like this is available:

/usr/local/opt/llvm-14.0.0/bin/llc --march riscv32 -mattr=help 2>&1 | grep zfinx
  zfinx            - 'Zfinx' (Float in Integer).

However, if I try to compile LLVM IR to riscv source-code with it, It continues to use float registers.

In conjueciton with +f, it uses float variables:

$ llc-14 sum_floats-device.ll -o sum_floats-device.s --march=riscv32 -mattr=+m,+zfinx,+f 2>/dev/null && grep ft sum_floats-device.s
        flw     ft0, 0(a0)
        flw     ft1, -28(s0)
        fadd.s  ft0, ft1, ft0
        fsw     ft0, -28(s0)
        flw     ft0, -28(s0)
        fsw     ft0, 0(a0)

conversely, if I use without +f, the float add becomes software emulated:

$ llc-14 sum_floats-device.ll -o sum_floats-device.s --march=riscv32 -mattr=+m,+zfinx 2>/dev/null && grep '@plt' sum_floats-device.s
        call    __addsf3@plt

finally, using some flag that doesnt exist has the same effect as using zfinx, i.e. none, so I wonder if I'm passing in the right parameter?

$ llc-14 sum_floats-device.ll -o sum_floats-device.s --march=riscv32 -mattr=+m,+blahblah 2>/dev/null && grep '@plt' sum_floats-device.s
        call    __addsf3@plt

Thoughts on how I can enable zfinx in llvm 14?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant