aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer/infinite-recursion.cc
diff options
context:
space:
mode:
authorJeff Law <jlaw@ventanamicro.com>2024-05-31 21:45:01 -0600
committerJeff Law <jlaw@ventanamicro.com>2024-05-31 21:45:01 -0600
commitc0ded050cd29cc73f78cb4ab23674c7bc024969e (patch)
treee456c8932be9a2cc223cc0d96d98d79ce2a90046 /gcc/analyzer/infinite-recursion.cc
parent85f15ea65a97686ad39af0c14b7dd9a9372e3a19 (diff)
downloadgcc-c0ded050cd29cc73f78cb4ab23674c7bc024969e.zip
gcc-c0ded050cd29cc73f78cb4ab23674c7bc024969e.tar.gz
gcc-c0ded050cd29cc73f78cb4ab23674c7bc024969e.tar.bz2
[to-be-committed] [RISC-V] Use Zbkb for general 64 bit constants when profitable
Basically this adds the ability to generate two independent constants during synthesis, then bring them together with a pack instruction. Thus we never need to go out to the constant pool when zbkb is enabled. The worst sequence we ever generate is lui+addi+lui+addi+pack Obviously if either half can be synthesized with just a lui or just an addi, then we'll DTRT automagically. So for example: unsigned long foo_0xf857f2def857f2de(void) { return 0x1425000028000000; } The high and low halves are just a lui. So the final synthesis is: > li a5,671088640 # 15 [c=4 l=4] *movdi_64bit/1 > li a0,337969152 # 16 [c=4 l=4] *movdi_64bit/1 > pack a0,a5,a0 # 17 [c=12 l=4] riscv_xpack_di_si_2 On the implementation side, I think the bits I've put in here likely can be used to handle the repeating constant case for !zbkb. I think it likely could be used to help capture cases where the upper half can be derived from the lower half (say by turning a bit on or off, shifting or something similar). The key in both of these cases is we need a temporary register holding an intermediate value. Ventana's internal tester enables zbkb, but I don't think any of the other testers currently exercise zbkb. We'll probably want to change that at some point, but I don't think it's super-critical yet. While I can envision a few more cases where we could improve constant synthesis, No immediate plans to work in this space, but if someone is interested, some thoughts are recorded here: > https://wiki.riseproject.dev/display/HOME/CT_00_031+--+Additional+Constant+Synthesis+Improvements gcc/ * config/riscv/riscv.cc (riscv_integer_op): Add new field. (riscv_build_integer_1): Initialize the new field. (riscv_built_integer): Recognize more cases where Zbkb's pack instruction is profitable. (riscv_move_integer): Loop over all the codes. If requested, save the current constant into a temporary. Generate pack for more cases using the saved constant. gcc/testsuite * gcc.target/riscv/synthesis-10.c: New test.
Diffstat (limited to 'gcc/analyzer/infinite-recursion.cc')
0 files changed, 0 insertions, 0 deletions