abc767234318 opened issue #9508:
I constructed a clif file that contains the f16const instruction, and I got an error when I used the following command.
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib clif-util test test.clifThe error is:
ERROR cranelift_filetests::concurrent > FAIL: failed to parse test.clif FAIL test.clif: failed to parse test.clif Caused by: 16: Unknown opcode: 'f16const' 1 tests Error: 1 failureIn addition, I found a test file for the f16const instruction in the cranelift/filetests/filetests/isa/riscv64/f16const.clif.
cfallin commented on issue #9508:
Interesting -- it seems we should, since it's in a test and tests are passing on CI.
A few things to verify:
- Can you check that your version of
clif-utilis the latest, i.e. built from currentmain?- Can you check if you're able to run
clif-util testoncranelift/filetests/filetests/isa/riscv64/f16const.clif?- If things are still not working, can you share the full CLIF input file, exact version (commit) and command line you're running?
abc767234318 closed issue #9508:
I constructed a clif file that contains the f16const instruction, and I got an error when I used the following command.
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib clif-util test test.clifThe error is:
ERROR cranelift_filetests::concurrent > FAIL: failed to parse test.clif FAIL test.clif: failed to parse test.clif Caused by: 16: Unknown opcode: 'f16const' 1 tests Error: 1 failureIn addition, I found a test file for the f16const instruction in the cranelift/filetests/filetests/isa/riscv64/f16const.clif.
abc767234318 commented on issue #9508:
Interesting -- it seems we should, since it's in a test and tests are passing on CI.
A few things to verify:
- Can you check that your version of
clif-utilis the latest, i.e. built from currentmain?- Can you check if you're able to run
clif-util testoncranelift/filetests/filetests/isa/riscv64/f16const.clif?- If things are still not working, can you share the full CLIF input file, exact version (commit) and command line you're running?
It seems that my version of wasmtime is wrong, I will close this issue.
abc767234318 reopened issue #9508:
I constructed a clif file that contains the f16const instruction, and I got an error when I used the following command.
qemu-riscv64 -L /usr/riscv64-linux-gnu/ -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib clif-util test test.clifThe error is:
ERROR cranelift_filetests::concurrent > FAIL: failed to parse test.clif FAIL test.clif: failed to parse test.clif Caused by: 16: Unknown opcode: 'f16const' 1 tests Error: 1 failureIn addition, I found a test file for the f16const instruction in the cranelift/filetests/filetests/isa/riscv64/f16const.clif.
abc767234318 commented on issue #9508:
@cfallin Here is my CLIF input file.
output.zipHowever, I still can't run this file by using the following command line:
qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib riscv64gc-unknown-linux-gnu/debug/clif-util run -v output.clifThe error is :
output.clif: The target ISA specified in the file is not compatible with the host ISA 1 file Error: 1 failureAnd I try to run the f16const.clif, it also outputs the similar error:
qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/lib riscv64gc-unknown-linux-gnu/debug/clif-util run -v ../cranelift/filetests/filetests/isa/riscv64/f16const.clif ../cranelift/filetests/filetests/isa/riscv64/f16const.clif: The target ISA specified in the file is not compatible with the host ISA 1 file Error: 1 failureThe commit version of my wasmtime is:
~/wasmtime$ git rev-parse HEAD c255a853f47188f43fb004389581fccc74bfc362
bjorn3 commented on issue #9508:
You are probably missing
target riscv64at the top of the test file (didn't download your zip).
afonso360 commented on issue #9508:
FP16 on the RISC-V backend is only supported with the
Zfhextension. You need to add thehas_zfhflag to thetargetfield. (i.e.target riscv64 has_zfh)You also have to specify support for the
Zfhextension in qemu otherwise it likely won't run the test. There's a flag somewhere to do it, I don't know exactly what it is.
afonso360 edited a comment on issue #9508:
FP16 on the RISC-V backend is only supported with the
Zfhextension. You need to add thehas_zfhflag to thetargetfield. (i.e.target riscv64 has_zfh)You also have to specify support for the
Zfhextension in qemu otherwise it likely won't run the test. There's a flag somewhere to do it, I don't know exactly what it is.I should also note, there are some operations that we don't yet support for FP16.
bjorn3 commented on issue #9508:
FP16 on the RISC-V backend is only supported with the Zfh extension.
For cg_clif f16const and f16 arguments and return values will need to work unconditionally. Math on f16 can be lowered to libcalls just fine when
Zfhis not enabled however.
afonso360 commented on issue #9508:
I'm not entirely sure how it's currently implemented, but I think that should work. We already save and restore the entire registers, instead of just the used portion. I haven't tested that yet though.
afonso360 commented on issue #9508:
@abc767234318 I'm not entirely sure why the
clif-util runcommand doesn't work, but running the test withclif-util testdoes work on my machine.I also tried to run
clif-util compile --target riscv64 --set has_zfh output.clif, but that failed because we don't support f128 types.
abc767234318 commented on issue #9508:
@abc767234318 I'm not entirely sure why the
clif-util runcommand doesn't work, but running the test withclif-util testdoes work on my machine.I also tried to run
clif-util compile --target riscv64 --set has_zfh output.clif, but that failed because we don't support f128 types.Where can I find the set of IR instructions supported by each cpu architecture? I also found that x86 cpu don't seem to support the iconst.i128 instruction.
The line 13 is
v7 = iconst.i128 -2319861032952027390, but I get the following errorERROR cranelift_filetests::concurrent > FAIL: failed to parse file_tests/multi_func.clif FAIL file_tests/multi_func.clif: failed to parse file_tests/multi_func.clif Caused by: 13: expected one of the following type: i8, i16, i32 or i64 1 tests Error: 1 failure
bjorn3 commented on issue #9508:
iconst.i128is not allowed on any architecture afaik. You have to use twoiconst.i64+ aniconcatwith both halves to get ani128. Theiconstinstruction only accepts a 64bit immediate value.
cfallin commented on issue #9508:
To add a bit more: we don't support
iconst.i128because it would imply that the size of anInstructionDatais at least 128 bits (16 bytes) plus the opcode; whereas we try to keep the entireInstructionDatato 16 bytes for performance and memory-overhead reasons. The tradeoff is that the one instruction that has a huge immediate (iconst.i128) is not possible to encode directly.
Last updated: Dec 06 2025 at 06:05 UTC