On 2023/08/29 6:12, Jeff Law wrote:
> 
> 
> On 8/9/23 00:11, Tsukasa OI via Gcc-patches wrote:
>> From: Tsukasa OI <research_tra...@irq.a4lg.com>
>>
>> The "pause" RISC-V hint instruction requires the 'Zihintpause' extension
>> (in the assembler).  However, GCC emits "pause" unconditionally, making
>> an assembler error while compiling code with __builtin_riscv_pause while
>> the 'Zihintpause' extension disabled.
>>
>> However, the "pause" instruction code (0x0100000f) is a HINT and emitting
>> its instruction code is safe in any environment.
>>
>> This commit implements handling for the 'Zihintpause' extension and emits
>> ".insn 0x0100000f" instead of "pause" only if the extension is disabled
>> (making the diagnostics better).
>>
>> gcc/ChangeLog:
>>
>>     * common/config/riscv/riscv-common.cc
>>     (riscv_ext_version_table): Implement the 'Zihintpause' extension,
>>     version 2.0.  (riscv_ext_flag_table) Add 'Zihintpause' handling.
>>     * config/riscv/riscv-builtins.cc: Remove availability predicate
>>     "always" and add "hint_pause" and "hint_pause_pseudo", corresponding
>>     the existence of the 'Zihintpause' extension.
>>     (riscv_builtins) Split builtin implementation depending on the
>>     existence of the 'Zihintpause' extension.
>>     * config/riscv/riscv-opts.h
>>     (MASK_ZIHINTPAUSE, TARGET_ZIHINTPAUSE): New.
>>     * config/riscv/riscv.md (riscv_pause): Make it only available when
>>     the 'Zihintpause' extension is enabled.  (riscv_pause_insn) New
>>     "pause" implementation when the 'Zihintpause' extension is disabled.
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * gcc.target/riscv/builtin_pause.c: Removed.
>>     * gcc.target/riscv/zihintpause.c:
>>     New test when the 'Zihintpause' extension is enabled.
>>     * gcc.target/riscv/zihintpause-noarch.c:
>>     New test when the 'Zihintpause' extension is disabled.
> So I cleaned this up a bit per the list discussion and pushed the final
> result.  Hopefully I didn't goof anything too badly ;-)  The net is we
> emit "pause" or a suitable .insn based on TARGET_ZIHINTPAUSE.
> 
> Jeff

Thanks!  I had having a problem to type words through the keyboard for a
while and I appreciate doing that instead of me (your modifications were
mostly "I would do so too" ones).

Also, it seems that I will no longer need to ask you to remove leading
"[PATCH xxx]" (not just the commit title is not my intention, I worried
that you have been doing something inefficient [other than "git am"]).

Tsukasa

Reply via email to