CORE-V bitmanip extract failures with -O1
Created by: jeremybennett
This is a stripped down version of a new test program. Attached the pre-processed source and generated assembly code. Compiled with
riscv32-corev-elf-gcc -B/home/jeremy/gittrees/dolphin/build/gcc-stage2/gcc/ /home/jeremy/gittrees/dolphin/gcc/gcc/testsuite/gcc.target/riscv/cv-bitmanip-exec.c -fdiagnostics-plain-output -O1 -march=rv32i_xcvbitmanip -mabi=ilp32 -save-temps -ffat-lto-objects -fno-ident -ffunction-sections -fdata-sections -static -Wl,-gc-sections -specs=nano.specs -lm -Wl,-T/home/jeremy/gittrees/dolphin/toolchain/embecosm-link.ld -save-temps -ggdb -o ./cv-bitmanip-exec.exe
When executed on FPGA, it fails through abort ()
(gdb) bt
#0 0x0000045c in abort ()
#1 0x00000448 in validate (v=<optimised out>, good=<optimised out>)
at /home/jeremy/gittrees/dolphin/gcc/gcc/testsuite/gcc.target/riscv/cv-helpers.h:12
#2 main ()
at /home/jeremy/gittrees/dolphin/gcc/gcc/testsuite/gcc.target/riscv/cv-bitmanip-exec.c:95
(gdb)
We note that while there should be 2 instances each of extract
, extractr
, extractu
and extractur
in the generated output, only 2 instances of extractr
appear.
This only happens with -O1
. At higher or lower optimization levels it all behaves correctly, with the correct number of generated extract instructions.