gnupru icon indicating copy to clipboard operation
gnupru copied to clipboard

Define Carry bit in GCC PRU port

Open dinuxbg opened this issue 5 years ago • 3 comments

  1. Experiment to check the semantics of PRU Carry bit: Is it the same for add/sub, is it set/cleared by adc/subc instructions.
  2. Define it in GCC PRU port and replace the hardcoded adddi/subdi patterns with carry-based ones.

dinuxbg avatar Aug 23 '18 04:08 dinuxbg

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)

dinuxbg avatar May 06 '19 20:05 dinuxbg

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.

dinuxbg avatar Oct 21 '19 18:10 dinuxbg

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.

dinuxbg avatar Mar 12 '20 19:03 dinuxbg