]> gcc.gnu.org Git - gcc.git/commit
frontend: Add novector C pragma
authorTamar Christina <tamar.christina@arm.com>
Fri, 4 Aug 2023 12:51:16 +0000 (13:51 +0100)
committerTamar Christina <tamar.christina@arm.com>
Fri, 4 Aug 2023 12:51:16 +0000 (13:51 +0100)
commit6fb5da03107f48e0b76f123933edcc07bae7e0aa
tree8b026baee20f920eac7655bbdf012ec416074abe
parent73b98860767ac03aa31ad4ca8b73f40484bd7562
frontend: Add novector C pragma

FORTRAN currently has a pragma NOVECTOR for indicating that vectorization should
not be applied to a particular loop.

ICC/ICX also has such a pragma for C and C++ called #pragma novector.

As part of this patch series I need a way to easily turn off vectorization of
particular loops, particularly for testsuite reasons.

This patch proposes a #pragma GCC novector that does the same for C
as gfortan does for FORTRAN and what ICX/ICX does for C.

I added only some basic tests here, but the next patch in the series uses this
in the testsuite in about ~800 tests.

gcc/c-family/ChangeLog:

* c-pragma.h (enum pragma_kind): Add PRAGMA_NOVECTOR.
* c-pragma.cc (init_pragma): Use it.

gcc/c/ChangeLog:

* c-parser.cc (c_parser_while_statement, c_parser_do_statement,
c_parser_for_statement, c_parser_statement_after_labels,
c_parse_pragma_novector, c_parser_pragma): Wire through novector and
default to false.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-novector-pragma.c: New test.
gcc/c-family/c-pragma.cc
gcc/c-family/c-pragma.h
gcc/c/c-parser.cc
gcc/testsuite/gcc.dg/vect/vect-novector-pragma.c [new file with mode: 0644]
This page took 0.068614 seconds and 5 git commands to generate.