aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorDimitar Dimitrov <dimitar@dinux.eu>2023-01-21 18:10:59 +0200
committerDimitar Dimitrov <dimitar@dinux.eu>2023-01-22 21:11:34 +0200
commitc517295940a23db8ca165dfd5d0edea4457eda49 (patch)
treeb6d5382d85b8ff98fa167d43ccecebafdd22b689 /gcc/fortran
parent011c0c29a2452e588f255673238460da4167c4c0 (diff)
downloadgcc-c517295940a23db8ca165dfd5d0edea4457eda49.zip
gcc-c517295940a23db8ca165dfd5d0edea4457eda49.tar.gz
gcc-c517295940a23db8ca165dfd5d0edea4457eda49.tar.bz2
pru: Fix CLZ expansion for QI and HI modes
The recent gcc.dg/tree-ssa/clz-char.c test case failed for PRU target, exposing a wrong code generation bug in the PRU backend. The "clz" pattern did not produce correct output for QI and HI input operand modes. SI mode is ok. The "clz" pattern is expanded to an LMBD instruction to get the left-most bit position having value "1". In turn, to get the correct "clz" value, that bit position must be subtracted from the MSB bit position of the input operand. The old behaviour of hard-coding 31 for MSB bit position is wrong. The LMBD instruction returns 32 if input operand is zero, irrespective of its register mode. This maps nicely for SI mode, where the "clz" pattern outputs -1. It also leads to peculiar (but valid!) output values from the "clz" pattern for QI and HI zero-valued inputs. gcc/ChangeLog: * config/pru/pru.h (CLZ_DEFINED_VALUE_AT_ZERO): Fix value for QI and HI input modes. * config/pru/pru.md (clz): Fix generated code for QI and HI input modes. gcc/testsuite/ChangeLog: * gcc.target/pru/clz-hi-2.c: New test. * gcc.target/pru/clz-hi.c: New test. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions