| 1 |
// If there is no `-fspv-extension`, enable all extensions. |
| 2 |
// RUN: %clang_dxc -spirv -Tlib_6_7 -### %s 2>&1 | FileCheck %s -check-prefix=ALL |
| 3 |
// ALL: "-spirv-ext=all" |
| 4 |
|
| 5 |
// Convert the `-fspv-extension` into `spirv-ext`. |
| 6 |
// RUN: %clang_dxc -spirv -Tlib_6_7 -### %s -fspv-extension=SPV_TEST1 2>&1 | FileCheck %s -check-prefix=TEST1 |
| 7 |
// TEST1: "-spirv-ext=+SPV_TEST1" |
| 8 |
|
| 9 |
// Merge multiple extensions into a single `spirv-ext` option. |
| 10 |
// RUN: %clang_dxc -spirv -Tlib_6_7 -### %s -fspv-extension=SPV_TEST1 -fspv-extension=SPV_TEST2 2>&1 | FileCheck %s -check-prefix=TEST2 |
| 11 |
// TEST2: "-spirv-ext=+SPV_TEST1,+SPV_TEST2" |
| 12 |
|
| 13 |
// Merge KHR with other extensions. |
| 14 |
// RUN: %clang_dxc -spirv -Tlib_6_7 -### %s -fspv-extension=SPV_TEST1 -fspv-extension=KHR -fspv-extension=SPV_TEST2 2>&1 | FileCheck %s -check-prefix=TEST3 |
| 15 |
// TEST3: "-spirv-ext=+SPV_TEST1,KHR,+SPV_TEST2" |
| 16 |
|
| 17 |
// Merge KHR with other extensions. |
| 18 |
// RUN: %clang_dxc -spirv -Tlib_6_7 -### %s -fspv-extension=KHR -fspv-extension=SPV_TEST2 2>&1 | FileCheck %s -check-prefix=TEST4 |
| 19 |
// TEST4: "-spirv-ext=KHR,+SPV_TEST2" |
| 20 |
|
| 21 |
// Convert DXC to a list of SPV extensions. |
| 22 |
// RUN: %clang_dxc -spirv -Tlib_6_7 -### %s -fspv-extension=DXC 2>&1 | FileCheck %s -check-prefix=TEST5 |
| 23 |
// TEST5: "-spirv-ext={{(\+SPV_[a-zA-Z0-9_]+,?)+}}" |
| 24 |
|
| 25 |
// Check for the error message if the extension name is not properly formed. |
| 26 |
// RUN: not %clang_dxc -spirv -Tlib_6_7 -### %s -fspv-extension=KHR_BAD -fspv-extension=TEST1 -fspv-extension=SPV_GOOD -fspv-extension=TEST2 2>&1 | FileCheck %s -check-prefix=FAIL |
| 27 |
// FAIL: invalid value 'KHR_BAD' in '-fspv-extension' |
| 28 |
// FAIL: invalid value 'TEST1' in '-fspv-extension' |
| 29 |
// FAIL: invalid value 'TEST2' in '-fspv-extension' |
| 30 |
|
| 31 |
// If targeting DXIL, the `-spirv-ext` should not be passed to the backend. |
| 32 |
// RUN: %clang_dxc -Tlib_6_7 -### %s 2>&1 | FileCheck %s -check-prefix=DXIL |
| 33 |
// DXIL-NOT: spirv-ext |
| 34 |
|
| 35 |
// If targeting DXIL, the `-fspv-extension` option is meaningless, and there should be a warning. |
| 36 |
// RUN: %clang_dxc -Tlib_6_7 -### %s -fspv-extension=SPV_TEST 2>&1 | FileCheck %s -check-prefix=WARN |
| 37 |
// WARN: warning: argument unused during compilation: '-fspv-extension=SPV_TEST' |
| 38 |
// WARN-NOT: spirv-ext |