smallint aarch64 codegen trouble with -O2 option
## Summary <!-- Summarize the bug encountered concisely --> Basic test from testsuite `test/units/system/tincdec.pp` fails for aarch64 CPU target when `-O2` option (or higher) is used. ## System Information <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:** Any <!-- Windows, Linux (if possible, also name the distro), FreeBSD, Android, ... --> - **Processor architecture:** aarch64 <!-- x86, x86-64, ARM, AARCH64, AVR, RISC-V, PowerPC, ... --> - **Compiler version:** trunk 3.3.1 <!-- 3.2, 3.2.2, 3.3, trunk, beta, ... (if possible, give also the git hash) --> - **Device:** Any<!-- Computer, Tablet, Mobile, Amiga, Microcontroller, ... --> ## Steps to reproduce <!-- How one can reproduce the issue - this is very important! --> Recompile `test/units/system/tincdec.pp` with trunk aarch64 compiler and option `-O2` ## Example Project <!-- If possible, please create an example project that exhibits the problematic behavior, and link to it here in the bug report. --> ## What is the current bug behavior? <!-- What actually happens --> Test fails with run time error 2, which indicates a problem with 16-bit signed integers code. ## What is the expected (correct) behavior? <!-- What you should see instead --> The test should succeed. ``` https://www.freepascal.org/testsuite/cgi-bin/new-testsuite2.cgi?action=4&testfilename=test%2Funits%2Fsystem%2Ftincdec.pp&os=15&cpu=8&version=0&date=&submitter=&machine=gcc103&comment=%25-O3%25&limit=350&cond=&Category=3&failedonly=1&noskipped=1&listall=1 ```` seems to show that this test fails since Marc 20. 2022 ## Relevant logs and/or screenshots <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise. You can also use syntax highlighting for Pascal with: ```pascal the code``` For more information see https://docs.gitlab.com/ee/user/markdown.html --> It seems that the 16-bit value gets loaded into a 32-bit register, but the value is not correctly sign extended to 32-bit. ## Possible fixes <!-- If you can, link to the line of code that might be responsible for the problem --> Add instruction to do the sign extension to 32-bit.
issue