[Committed] riscv: generate builtin macro for compilation with strict alignment:

Edwin Lu ewlu@rivosinc.com
Tue Aug 29 16:12:08 GMT 2023


On 8/29/2023 8:53 AM, Palmer Dabbelt wrote:
> On Tue, 29 Aug 2023 08:48:56 PDT (-0700), ewlu@rivosinc.com wrote:
>>
>> On 8/28/2023 3:40 PM, Jeff Law wrote:
>>>
>>>
>>> On 8/15/23 12:29, Edwin Lu wrote:
>>>> This patch is a modification of
>>>> https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610115.html
>>>> following the discussion on
>>>> https://github.com/riscv-non-isa/riscv-c-api-doc/issues/32
>>>>
>>>> Distinguish between explicit -mstrict-align and cpu tune param
>>>> for slow_unaligned_access=true/false.
>>>>
>>>> Tested for regressions using rv32/64 multilib with newlib/linux
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>>     * config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins):
>>>>       Generate __riscv_unaligned_avoid with value 1 or
>>>>               __riscv_unaligned_slow with value 1 or
>>>>               __riscv_unaligned_fast with value 1
>>>>     * config/riscv/riscv.cc (riscv_option_override):
>>>>      Define riscv_user_wants_strict_align. Set
>>>>      riscv_user_wants_strict_align to TARGET_STRICT_ALIGN
>>>>     * config/riscv/riscv.h: Declare riscv_user_wants_strict_align
>>>>
>>>> gcc/testsuite/ChangeLog:
>>>>
>>>>     * gcc.target/riscv/attribute-1.c: Check for
>>>>      __riscv_unaligned_slow or __riscv_unaligned_fast
>>>>     * gcc.target/riscv/attribute-4.c: Check for
>>>>      __riscv_unaligned_avoid
>>>>     * gcc.target/riscv/attribute-5.c: Check for
>>>>      __riscv_unaligned_slow or __riscv_unaligned_fast
>>>>     * gcc.target/riscv/predef-align-1.c: New test.
>>>>     * gcc.target/riscv/predef-align-2.c: New test.
>>>>     * gcc.target/riscv/predef-align-3.c: New test.
>>>>     * gcc.target/riscv/predef-align-4.c: New test.
>>>>     * gcc.target/riscv/predef-align-5.c: New test.
>>>>     * gcc.target/riscv/predef-align-6.c: New test.
>>> OK.  Though I'm pretty sure the commit hooks are going to complain 
>>> about your ChangeLog :-)
>>>
>>> jeff
>>
>> I did need to do some ChangeLog formatting but was able to commit it 
>> in the end :)
>
> There's a gcc-commit-mklog git hook script in contrib/ that should do 
> most of the formatting for you.

I did use it but the long broken up descriptions were the main issue 
since it changed the tabs to spaces on the newlines. Will need to make 
sure to not expand tabs for future commits

Edwin



More information about the Gcc-patches mailing list