llvm-project/clang/test/Driver/mprefer-vector-width.c
Craig Topper 9a724aa38f [Driver][CodeGen] Add -mprefer-vector-width driver option and attribute during CodeGen.
This adds a new command line option -mprefer-vector-width to specify a preferred vector width for the vectorizers. Valid values are 'none' and unsigned integers. The driver will check that it meets those constraints. Specific supported integers will be managed by the targets in the backend.

Clang will take the value and add it as a new function attribute during CodeGen.

This represents the alternate direction proposed by Sanjay in this RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118734.html

The syntax here matches gcc, though gcc treats it as an x86 specific command line argument. gcc only allows values of 128, 256, and 512. I'm not having clang check any values.

Differential Revision: https://reviews.llvm.org/D40230

llvm-svn: 320419
2017-12-11 21:09:19 +00:00

25 lines
1.0 KiB
C

////
//// Verify that valid options for the -mprefer-vector-width flag are passed through and invalid options cause an error.
////
//// If there are no options, convert to 'all'.
// RUN: %clang -### -S %s -mprefer-vector-width=none 2>&1 | FileCheck --check-prefix=WIDTHNONE %s
// WIDTHNONE: "-mprefer-vector-width=none"
//// Check options that cover all types.
// RUN: %clang -### -S %s -mprefer-vector-width=128 2>&1 | FileCheck --check-prefix=WIDTH128 %s
// WIDTH128: "-mprefer-vector-width=128"
//// Check invalid parameters.
// RUN: %clang -### -S %s -mprefer-vector-width=one 2>&1 | FileCheck --check-prefix=WIDTHONE %s
// WIDTHONE: invalid value 'one' in 'mprefer-vector-width='
// RUN: %clang -### -S %s -mprefer-vector-width=128.5 2>&1 | FileCheck --check-prefix=WIDTH128p5 %s
// WIDTH128p5: invalid value '128.5' in 'mprefer-vector-width='
// RUN: %clang -### -S %s -mprefer-vector-width=-128 2>&1 | FileCheck --check-prefix=WIDTHNEG128 %s
// WIDTHNEG128: invalid value '-128' in 'mprefer-vector-width='