-
- Downloads
[to-be-committed][v3][RISC-V] Handle bit manipulation of SImode values
Last patch in this round of bitmanip work... At least I think I'm going to pause here and switch gears to other projects that need attentionThis patch introduces the ability to generate bitmanip instructions for rv64 when operating on SI objects when we know something about the range of the bit position (due to masking of the position). I've got note that the (7-pos % 8) bit position form was discovered by RAU in 500.perl. I took that and expanded it to the simple (pos & mask) form as well as covering bset, binv and bclr. As far as the implementation is concerned.... This turns the recently added define_splits into define_insn_and_split constructs. This allows combine to "see" enough RTL to realize a sign extension is unnecessary. Otherwise we get undesirable sign extensions for the new testcases. Second it adds new patterns for the logical operations. Two patterns for IOR/XOR and two patterns for AND. I think a key concept to keep in mind is that once we determine a Zbs operation is safe to perform on a SI value, we can rewrite the RTL in 64bit form. If we were ever to try and use range information at expand time for this stuff (and we probably should investigate that), that's the path I'd suggest. This is notably cleaner than my original implementation which actually kept the more complex RTL form through final and emitted 2/3 instructions (mask the bit position, then the bset/bclr/binv). Tested in my tester, but waiting for pre-commit CI to report back before taking further action. gcc/ * config/riscv/bitmanip.md (bset splitters): Turn into define_and_splits. Don't depend on combine splitting the "andn with constant" form. (bset, binv, bclr with masked bit position): New patterns. gcc/testsuite * gcc.target/riscv/binv-for-simode-1.c: New test. * gcc.target/riscv/bset-for-simode-1.c: New test. * gcc.target/riscv/bclr-for-simode-1.c: New test.
Showing
- gcc/config/riscv/bitmanip.md 119 additions, 16 deletionsgcc/config/riscv/bitmanip.md
- gcc/testsuite/gcc.target/riscv/bclr-for-simode-1.c 25 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/bclr-for-simode-1.c
- gcc/testsuite/gcc.target/riscv/binv-for-simode-1.c 24 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/binv-for-simode-1.c
- gcc/testsuite/gcc.target/riscv/bset-for-simode-1.c 24 additions, 0 deletionsgcc/testsuite/gcc.target/riscv/bset-for-simode-1.c
Please register or sign in to comment