On 8/27/21 12:07 PM, Roger Sayle wrote:
> 
> This patch introduces some new define_insn rules to the nvptx backend,
> to perform sign-extension of a truncation (from and to the same mode),
> using a single cvt instruction.  As an example, the following function
> 
> int foo(int x) { return (char)x; }
> 
> with -O2 currently generates:
> 
>       mov.u32 %r24, %ar0;
>       mov.u32 %r26, %r24;
>       cvt.s32.s8      %value, %r26;
> 
> and with this patch, now generates:
> 
>       mov.u32 %r24, %ar0;
>       cvt.s32.s8      %value, %r24;
> 
> This patch has been tested on nvptx-none hosted by x86_64-pc-linux-gnu
> with a top-level "make" (including newlib) and a "make check" with no
> new regressions.  Ok for mainline?
> 

Hi Roger,

thanks for the patch and apologies for the delay.

I was not happy with negative-testing-only in the test-case, so I've
split it up into 6 separate tests.

The first one is not influenced by the patch, so I've committed that one
separately.

The other 5 I've committed together with the patch.

Thanks,
- Tom

> 
> 2021-08-27  Roger Sayle  <ro...@nextmovesoftware.com>
> 
> gcc/ChangeLog
>       * config/nvptx/nvptx.md (*extend_trunc_<mode>2_qi,
>       *extend_trunc_<mode>2_hi, *extend_trunc_di2_si): New insns.
>       Use cvt to perform sign-extension of truncation in one step.
> 
> gcc/testsuite/ChangeLog
>       * gcc.target/nvptx/exttrunc.c: New test case.
> 
> 
> Roger
> --
> 

Reply via email to