[PATCH] nvptx: Add support for PTX's cnot instruction.
Roger Sayle
roger@nextmovesoftware.com
Thu Jan 6 16:42:11 GMT 2022
Happy New Year for 2022. This is a simple patch, now that the
nvptx backend has transitioned to STORE_FLAG_VALUE=1, that adds
support for NVidia's cnot instruction, that implements C/C++
style logical negation.
Previously, the simple function:
int foo(int x) { return !x; }
on nvptx-none with -O2 would generate:
mov.u32 %r24, %ar0;
setp.eq.u32 %r28, %r24, 0;
selp.u32 %value, 1, 0, %r28;
with this patch, GCC now generates:
mov.u32 %r24, %ar0;
cnot.b32 %value, %r24;
This patch has been tested on nvptx-none hosted on x86_64-pc-linux-gnu
(including newlib) with a make and make -k check with no new failures.
Ok for mainline?
2022-01-06 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/nvptx/nvptx.md (*cnot<mode>2): New define_insn.
gcc/testsuite/ChangeLog
* gcc.target/nvptx/cnot-1.c: New test case.
Thanks in advance,
Roger
--
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchn.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20220106/2782d2b5/attachment-0001.txt>
More information about the Gcc-patches
mailing list