gnupru
gnupru copied to clipboard
Define Carry bit in GCC PRU port
- Experiment to check the semantics of PRU Carry bit: Is it the same for add/sub, is it set/cleared by adc/subc instructions.
- Define it in GCC PRU port and replace the hardcoded adddi/subdi patterns with carry-based ones.
A prototype definition yields a few regressions, including what appears to be an infinite loop in LRA. More investigation is needed.
PASS->FAIL: c-c++-common/torture/builtin-arith-overflow-9.c -O0 execution test PASS->FAIL: c-c++-common/torture/builtin-arith-overflow-p-10.c -O0 execution test PASS->FAIL: c-c++-common/torture/builtin-arith-overflow-p-3.c -O0 execution test PASS->FAIL: c-c++-common/torture/builtin-arith-overflow-p-9.c -O0 execution test PASS->FAIL: gcc.c-torture/compile/pr37669.c -O0 (test for excess errors) PASS->FAIL: gcc.c-torture/compile/pr54713-3.c -O0 (test for excess errors) PASS->FAIL: gcc.c-torture/execute/20041011-1.c -O0 execution test PASS->FAIL: gcc.c-torture/execute/920501-6.c -O0 execution test PASS->FAIL: gcc.c-torture/execute/bitfld-3.c -O0 execution test PASS->FAIL: gcc.c-torture/execute/multi-ix.c -O0 (test for excess errors) PASS->FAIL: gcc.dg/compat/struct-by-value-15 c_compat_x_tst.o-c_compat_y_tst.o execute PASS->FAIL: gcc.dg/torture/pr70083.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) PASS->FAIL: gcc.dg/torture/pr70083.c -O2 (test for excess errors) PASS->FAIL: gcc.dg/torture/pr70083.c -O3 -g (test for excess errors) PASS->FAIL: gcc.dg/torture/tls/tls-reload-1.c -O0 (test for excess errors)
Infinite IRA loop has been rootcaused. After CC clobber is defined for addsi3, IRA cannot emit a simple non-clobbering plus:SI insn. The internals manual specifies that addptr must be defined, and it must not clobber CC.
Now I have to find an instruction sequence to save/restore CC, and implement non-clobbering addptr.
Turns out that with CC defined the generated code is even worse. Reason is that lower-subreg.c phase cannot lower DImode to SImode because word_mode=QImode for PRU. I'm trying to fix that.
Won't do. Carry is broken in all PRU core revisions - see https://github.com/dinuxbg/gnupru/wiki/Carry