[llvm] [SPIR-V] Support extension toggling and enabling all (PR #85503)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 16 00:48:17 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-spir-v
Author: Michal Paszkowski (michalpaszkowski)
<details>
<summary>Changes</summary>
This patch enhances spirv-extensions CLI option with the ability to enable all extensions through `--spirv-extensions=all` and to toggle individual extensions using `--spirv-extensions=+extension1,-extension2` or `--spirv-extensions=all,-extension`.
---
Patch is 52.86 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/85503.diff
52 Files Affected:
- (modified) llvm/lib/Target/SPIRV/CMakeLists.txt (+1)
- (added) llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp (+94)
- (added) llvm/lib/Target/SPIRV/SPIRVCommandLine.h (+37)
- (modified) llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp (+5-76)
- (modified) llvm/test/CodeGen/SPIRV/LinkOnceODR.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/LinkOnceODRFun.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/assume.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/exec_mode_float_control_khr.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/expect.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_double.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_float.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_half.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_min_max/atomicrmw_fminfmax_double.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_min_max/atomicrmw_fminfmax_float.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_min_max/atomicrmw_fminfmax_half.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_arbitrary_precision_integers.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_bfloat16_conversion/bfloat16-conv-negative1.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_bfloat16_conversion/bfloat16-conv-negative2.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_bfloat16_conversion/bfloat16-conv-negative3.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_bfloat16_conversion/bfloat16-conv-negative4.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_bfloat16_conversion/bfloat16-conv.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_function_pointers/fp_const.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_function_pointers/fp_two_calls.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_optnone.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_subgroups/cl_intel_sub_groups.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_usm_storage_classes/intel-usm-addrspaces.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_variable_length_array/vararr.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_variable_length_array/vararr_spec_const.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_bit_instructions.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_no_integer_wrap_decoration.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_subgroup_rotate/subgroup-rotate.ll (+2-2)
- (modified) llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_uniform_group_instructions/uniform-group-instructions.ll (+1-1)
- (added) llvm/test/CodeGen/SPIRV/extensions/enable-all-extensions-but-one.ll (+9)
- (added) llvm/test/CodeGen/SPIRV/extensions/enable-all-extensions.ll (+7)
- (added) llvm/test/CodeGen/SPIRV/extensions/invalid-extension-list-format.ll (+6)
- (added) llvm/test/CodeGen/SPIRV/extensions/unknown-extension-name.ll (+6)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/add.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/and.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/fadd.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/fmax.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/fmaximum.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/fmin.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/fminimum.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/fmul.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/mul.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/or.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/smax.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/smin.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/umax.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/umin.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/llvm-intrinsics/llvm-vector-reduce/xor.ll (+1-1)
- (modified) llvm/test/CodeGen/SPIRV/transcoding/NoSignedUnsignedWrap.ll (+1-1)
``````````diff
diff --git a/llvm/lib/Target/SPIRV/CMakeLists.txt b/llvm/lib/Target/SPIRV/CMakeLists.txt
index afc26dda4c68bd..7001ac382f41ca 100644
--- a/llvm/lib/Target/SPIRV/CMakeLists.txt
+++ b/llvm/lib/Target/SPIRV/CMakeLists.txt
@@ -17,6 +17,7 @@ add_llvm_target(SPIRVCodeGen
SPIRVAsmPrinter.cpp
SPIRVBuiltins.cpp
SPIRVCallLowering.cpp
+ SPIRVCommandLine.cpp
SPIRVDuplicatesTracker.cpp
SPIRVEmitIntrinsics.cpp
SPIRVGlobalRegistry.cpp
diff --git a/llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp b/llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp
new file mode 100644
index 00000000000000..9f2fe16659f777
--- /dev/null
+++ b/llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp
@@ -0,0 +1,94 @@
+//===--- SPIRVCommandLine.cpp ---- Command Line Options ---------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains definitions of classes and functions needed for
+// processing, parsing, and using CLI options for the SPIR-V backend.
+//
+//===----------------------------------------------------------------------===//
+
+#include "SPIRVCommandLine.h"
+#include "llvm/ADT/StringRef.h"
+#include <map>
+#include <sstream>
+#include <string>
+
+#define DEBUG_TYPE "spirv-commandline"
+
+using namespace llvm;
+
+const std::map<std::string, SPIRV::Extension::Extension> ExtensionMap = {
+ {"SPV_EXT_shader_atomic_float_add",
+ SPIRV::Extension::Extension::SPV_EXT_shader_atomic_float_add},
+ {"SPV_EXT_shader_atomic_float16_add",
+ SPIRV::Extension::Extension::SPV_EXT_shader_atomic_float16_add},
+ {"SPV_EXT_shader_atomic_float_min_max",
+ SPIRV::Extension::Extension::SPV_EXT_shader_atomic_float_min_max},
+ {"SPV_INTEL_arbitrary_precision_integers",
+ SPIRV::Extension::Extension::SPV_INTEL_arbitrary_precision_integers},
+ {"SPV_INTEL_optnone", SPIRV::Extension::Extension::SPV_INTEL_optnone},
+ {"SPV_INTEL_usm_storage_classes",
+ SPIRV::Extension::Extension::SPV_INTEL_usm_storage_classes},
+ {"SPV_INTEL_subgroups", SPIRV::Extension::Extension::SPV_INTEL_subgroups},
+ {"SPV_KHR_uniform_group_instructions",
+ SPIRV::Extension::Extension::SPV_KHR_uniform_group_instructions},
+ {"SPV_KHR_no_integer_wrap_decoration",
+ SPIRV::Extension::Extension::SPV_KHR_no_integer_wrap_decoration},
+ {"SPV_KHR_float_controls",
+ SPIRV::Extension::Extension::SPV_KHR_float_controls},
+ {"SPV_KHR_expect_assume",
+ SPIRV::Extension::Extension::SPV_KHR_expect_assume},
+ {"SPV_KHR_bit_instructions",
+ SPIRV::Extension::Extension::SPV_KHR_bit_instructions},
+ {"SPV_KHR_linkonce_odr", SPIRV::Extension::Extension::SPV_KHR_linkonce_odr},
+ {"SPV_INTEL_bfloat16_conversion",
+ SPIRV::Extension::Extension::SPV_INTEL_bfloat16_conversion},
+ {"SPV_KHR_subgroup_rotate",
+ SPIRV::Extension::Extension::SPV_KHR_subgroup_rotate},
+ {"SPV_INTEL_variable_length_array",
+ SPIRV::Extension::Extension::SPV_INTEL_variable_length_array},
+ {"SPV_INTEL_function_pointers",
+ SPIRV::Extension::Extension::SPV_INTEL_function_pointers},
+};
+
+bool SPIRVExtensionsParser::parse(cl::Option &O, llvm::StringRef ArgName,
+ llvm::StringRef ArgValue,
+ std::set<SPIRV::Extension::Extension> &Val) {
+ llvm::SmallVector<llvm::StringRef, 10> Tokens;
+ ArgValue.split(Tokens, ",", -1, false);
+
+ std::set<SPIRV::Extension::Extension> EnabledExtensions;
+
+ for (const auto &Token : Tokens) {
+ if (Token == "all") {
+ for (const auto &[ExtensionName, ExtensionEnum] : ExtensionMap)
+ EnabledExtensions.insert(ExtensionEnum);
+
+ continue;
+ }
+
+ if (!Token.empty() && (Token.starts_with("+") || Token.starts_with("-"))) {
+ llvm::StringRef ExtensionName = Token.substr(1);
+ auto NameValuePair = ExtensionMap.find(ExtensionName.str());
+
+ if (NameValuePair == ExtensionMap.end())
+ return O.error("Unknown SPIR-V extension: " + Token.str());
+
+ if (Token.starts_with("+"))
+ EnabledExtensions.insert(NameValuePair->second);
+ else if (EnabledExtensions.count(NameValuePair->second))
+ EnabledExtensions.erase(NameValuePair->second);
+
+ continue;
+ }
+
+ return O.error("Invalid extension list format " + Token.str());
+ }
+
+ Val = std::move(EnabledExtensions);
+ return false;
+}
diff --git a/llvm/lib/Target/SPIRV/SPIRVCommandLine.h b/llvm/lib/Target/SPIRV/SPIRVCommandLine.h
new file mode 100644
index 00000000000000..52f2946e961476
--- /dev/null
+++ b/llvm/lib/Target/SPIRV/SPIRVCommandLine.h
@@ -0,0 +1,37 @@
+//===--- SPIRVCommandLine.h ---- Command Line Options -----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains classes and functions needed for processing, parsing, and
+// using CLI options for the SPIR-V backend.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H
+#define LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H
+
+#include "MCTargetDesc/SPIRVBaseInfo.h"
+#include "llvm/Support/CommandLine.h"
+#include <set>
+
+namespace llvm {
+
+struct SPIRVExtensionsParser
+ : public cl::parser<std::set<SPIRV::Extension::Extension>> {
+public:
+ SPIRVExtensionsParser(cl::Option &O)
+ : cl::parser<std::set<SPIRV::Extension::Extension>>(O) {}
+
+ /// Parses SPIR-V extension name from a CLI arguments.
+ ///
+ /// \return Returns true on error.
+ bool parse(cl::Option &O, StringRef ArgName, StringRef ArgValue,
+ std::set<SPIRV::Extension::Extension> &Val);
+};
+
+} // namespace llvm
+#endif // LLVM_LIB_TARGET_SPIRV_COMMANDLINE_H
diff --git a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
index 38caa7c8ea0a7f..ec736d038f7983 100644
--- a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
@@ -13,6 +13,7 @@
#include "SPIRVSubtarget.h"
#include "SPIRV.h"
#include "SPIRVGlobalRegistry.h"
+#include "SPIRVCommandLine.h"
#include "SPIRVLegalizerInfo.h"
#include "SPIRVRegisterBankInfo.h"
#include "SPIRVTargetMachine.h"
@@ -27,80 +28,9 @@ using namespace llvm;
#define GET_SUBTARGETINFO_CTOR
#include "SPIRVGenSubtargetInfo.inc"
-cl::list<SPIRV::Extension::Extension> Extensions(
- "spirv-extensions", cl::desc("SPIR-V extensions"), cl::ZeroOrMore,
- cl::Hidden,
- cl::values(
- clEnumValN(SPIRV::Extension::SPV_EXT_shader_atomic_float_add,
- "SPV_EXT_shader_atomic_float_add",
- "Adds atomic add instruction on floating-point numbers."),
- clEnumValN(
- SPIRV::Extension::SPV_EXT_shader_atomic_float16_add,
- "SPV_EXT_shader_atomic_float16_add",
- "Extends the SPV_EXT_shader_atomic_float_add extension to support "
- "atomically adding to 16-bit floating-point numbers in memory."),
- clEnumValN(
- SPIRV::Extension::SPV_EXT_shader_atomic_float_min_max,
- "SPV_EXT_shader_atomic_float_min_max",
- "Adds atomic min and max instruction on floating-point numbers."),
- clEnumValN(SPIRV::Extension::SPV_INTEL_arbitrary_precision_integers,
- "SPV_INTEL_arbitrary_precision_integers",
- "Allows generating arbitrary width integer types."),
- clEnumValN(SPIRV::Extension::SPV_INTEL_optnone, "SPV_INTEL_optnone",
- "Adds OptNoneINTEL value for Function Control mask that "
- "indicates a request to not optimize the function."),
- clEnumValN(SPIRV::Extension::SPV_INTEL_usm_storage_classes,
- "SPV_INTEL_usm_storage_classes",
- "Introduces two new storage classes that are sub classes of "
- "the CrossWorkgroup storage class "
- "that provides additional information that can enable "
- "optimization."),
- clEnumValN(SPIRV::Extension::SPV_INTEL_subgroups, "SPV_INTEL_subgroups",
- "Allows work items in a subgroup to share data without the "
- "use of local memory and work group barriers, and to "
- "utilize specialized hardware to load and store blocks of "
- "data from images or buffers."),
- clEnumValN(SPIRV::Extension::SPV_KHR_uniform_group_instructions,
- "SPV_KHR_uniform_group_instructions",
- "Allows support for additional group operations within "
- "uniform control flow."),
- clEnumValN(SPIRV::Extension::SPV_KHR_no_integer_wrap_decoration,
- "SPV_KHR_no_integer_wrap_decoration",
- "Adds decorations to indicate that a given instruction does "
- "not cause integer wrapping."),
- clEnumValN(
- SPIRV::Extension::SPV_KHR_float_controls, "SPV_KHR_float_controls",
- "Provides new execution modes to control floating-point "
- "computations by overriding an implementation’s default behavior "
- "for rounding modes, denormals, signed zero, and infinities."),
- clEnumValN(SPIRV::Extension::SPV_KHR_expect_assume,
- "SPV_KHR_expect_assume",
- "Provides additional information to a compiler, similar to "
- "the llvm.assume and llvm.expect intrinsics."),
- clEnumValN(SPIRV::Extension::SPV_KHR_bit_instructions,
- "SPV_KHR_bit_instructions",
- "This enables bit instructions to be used by SPIR-V modules "
- "without requiring the Shader capability."),
- clEnumValN(
- SPIRV::Extension::SPV_KHR_linkonce_odr, "SPV_KHR_linkonce_odr",
- "Allows to use the LinkOnceODR linkage type that is to let "
- "a function or global variable to be merged with other functions "
- "or global variables of the same name when linkage occurs."),
- clEnumValN(SPIRV::Extension::SPV_INTEL_bfloat16_conversion,
- "SPV_INTEL_bfloat16_conversion",
- "Adds instructions to convert between single-precision "
- "32-bit floating-point values and 16-bit bfloat16 values."),
- clEnumValN(SPIRV::Extension::SPV_KHR_subgroup_rotate,
- "SPV_KHR_subgroup_rotate",
- "Adds a new instruction that enables rotating values across "
- "invocations within a subgroup."),
- clEnumValN(SPIRV::Extension::SPV_INTEL_variable_length_array,
- "SPV_INTEL_variable_length_array",
- "Allows to allocate local arrays whose number of elements "
- "is unknown at compile time."),
- clEnumValN(SPIRV::Extension::SPV_INTEL_function_pointers,
- "SPV_INTEL_function_pointers",
- "Allows translation of function pointers.")));
+cl::opt<std::set<SPIRV::Extension::Extension>, false, SPIRVExtensionsParser>
+ Extensions("spirv-extensions",
+ cl::desc("Specify list of enabled SPIR-V extensions"));
// Compare version numbers, but allow 0 to mean unspecified.
static bool isAtLeastVer(uint32_t Target, uint32_t VerToCompareTo) {
@@ -166,8 +96,7 @@ void SPIRVSubtarget::initAvailableExtensions() {
if (!isOpenCLEnv())
return;
- for (auto Extension : Extensions)
- AvailableExtensions.insert(Extension);
+ AvailableExtensions.insert(Extensions.begin(), Extensions.end());
}
// TODO: use command line args for this rather than just defaults.
diff --git a/llvm/test/CodeGen/SPIRV/LinkOnceODR.ll b/llvm/test/CodeGen/SPIRV/LinkOnceODR.ll
index 3dfdeac7adaa5e..384df9f138fa40 100644
--- a/llvm/test/CodeGen/SPIRV/LinkOnceODR.ll
+++ b/llvm/test/CodeGen/SPIRV/LinkOnceODR.ll
@@ -1,5 +1,5 @@
-; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_KHR_linkonce_odr %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV-EXT
-; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_KHR_linkonce_odr %s -o - -filetype=obj | spirv-val %}
+; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_KHR_linkonce_odr %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV-EXT
+; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_KHR_linkonce_odr %s -o - -filetype=obj | spirv-val %}
; CHECK-SPIRV-EXT: Capability Linkage
; CHECK-SPIRV-EXT: Extension "SPV_KHR_linkonce_odr"
diff --git a/llvm/test/CodeGen/SPIRV/LinkOnceODRFun.ll b/llvm/test/CodeGen/SPIRV/LinkOnceODRFun.ll
index 7505c3fc277e9e..35418b38cfaf18 100644
--- a/llvm/test/CodeGen/SPIRV/LinkOnceODRFun.ll
+++ b/llvm/test/CodeGen/SPIRV/LinkOnceODRFun.ll
@@ -1,5 +1,5 @@
-; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_KHR_linkonce_odr %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV-EXT
-; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_KHR_linkonce_odr %s -o - -filetype=obj | spirv-val %}
+; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_KHR_linkonce_odr %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV-EXT
+; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_KHR_linkonce_odr %s -o - -filetype=obj | spirv-val %}
; CHECK-SPIRV-EXT: Capability Linkage
; CHECK-SPIRV-EXT: Extension "SPV_KHR_linkonce_odr"
diff --git a/llvm/test/CodeGen/SPIRV/assume.ll b/llvm/test/CodeGen/SPIRV/assume.ll
index 6099955e4afb4e..dcd6afcda225a3 100644
--- a/llvm/test/CodeGen/SPIRV/assume.ll
+++ b/llvm/test/CodeGen/SPIRV/assume.ll
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=EXT,CHECK %s
-; RUN: llc -mtriple=spirv64-unknown-unknown --spirv-extensions=SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=EXT,CHECK %s
+; RUN: llc -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=EXT,CHECK %s
+; RUN: llc -mtriple=spirv64-unknown-unknown --spirv-extensions=+SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=EXT,CHECK %s
; RUN: llc -mtriple=spirv32-unknown-unknown < %s | FileCheck --check-prefixes=NOEXT,CHECK %s
; RUN: llc -mtriple=spirv64-unknown-unknown < %s | FileCheck --check-prefixes=NOEXT,CHECK %s
diff --git a/llvm/test/CodeGen/SPIRV/exec_mode_float_control_khr.ll b/llvm/test/CodeGen/SPIRV/exec_mode_float_control_khr.ll
index 473794a1ac978d..7eed1d0bac379e 100644
--- a/llvm/test/CodeGen/SPIRV/exec_mode_float_control_khr.ll
+++ b/llvm/test/CodeGen/SPIRV/exec_mode_float_control_khr.ll
@@ -1,5 +1,5 @@
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefixes=SPV
-; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s --mattr=+spirv1.3 --spirv-extensions=SPV_KHR_float_controls -o - | FileCheck %s --check-prefixes=SPVEXT
+; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s --mattr=+spirv1.3 --spirv-extensions=+SPV_KHR_float_controls -o - | FileCheck %s --check-prefixes=SPVEXT
define dso_local dllexport spir_kernel void @k_float_controls_0(i32 %ibuf, i32 %obuf) local_unnamed_addr {
entry:
diff --git a/llvm/test/CodeGen/SPIRV/expect.ll b/llvm/test/CodeGen/SPIRV/expect.ll
index 51555cd155523d..5c8013d0a058ae 100644
--- a/llvm/test/CodeGen/SPIRV/expect.ll
+++ b/llvm/test/CodeGen/SPIRV/expect.ll
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=CHECK,EXT %s
-; RUN: llc -mtriple=spirv64-unknown-unknown --spirv-extensions=SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=CHECK,EXT %s
+; RUN: llc -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=CHECK,EXT %s
+; RUN: llc -mtriple=spirv64-unknown-unknown --spirv-extensions=+SPV_KHR_expect_assume < %s | FileCheck --check-prefixes=CHECK,EXT %s
; RUN: llc -mtriple=spirv32-unknown-unknown < %s | FileCheck --check-prefixes=CHECK,NOEXT %s
; RUN: llc -mtriple=spirv64-unknown-unknown < %s | FileCheck --check-prefixes=CHECK,NOEXT %s
diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_double.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_double.ll
index 1bfa556affceca..3a9e4f3bd61de7 100644
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_double.ll
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_double.ll
@@ -1,6 +1,6 @@
; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_EXT_shader_atomic_float_add %s -o - | FileCheck %s
+; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_EXT_shader_atomic_float_add %s -o - | FileCheck %s
; CHECK-ERROR: LLVM ERROR: The atomic float instruction requires the following SPIR-V extension: SPV_EXT_shader_atomic_float_add
diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_float.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_float.ll
index 627b59fee1a632..58b00b48e3e0a7 100644
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_float.ll
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_float.ll
@@ -1,6 +1,6 @@
; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_EXT_shader_atomic_float_add %s -o - | FileCheck %s
+; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_EXT_shader_atomic_float_add %s -o - | FileCheck %s
; CHECK-ERROR: LLVM ERROR: The atomic float instruction requires the following SPIR-V extension: SPV_EXT_shader_atomic_float_add
diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_half.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_half.ll
index fffda4bd112823..6fff025923738d 100644
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_half.ll
+++ b/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_add/atomicrmw_faddfsub_half.ll
@@ -1,7 +1,7 @@
; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR1
-; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_EXT_shader_atomic_float_add %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR2
+; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_EXT_shader_atomic_float_add %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR2
-; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=SPV_EXT_shader_atomic_float_add --spirv-extensions=SPV_EXT_shader_atomic_float16_add %s -o - | FileCheck %s
+; RUN: llc -O0 -mtriple=spirv32-unknown-unknown --spirv-extensions=+SPV_EXT_shader_atomic_float_add,+SPV_EXT_shader_atomic_float16_add %s -o - | FileCheck %s
; CHECK-ERROR1: LLVM ERROR: The atomic float instruction requires the following SPIR-V extension: SPV_EXT_shader_atomic_float_add
; CHECK-ERROR2: LLVM ERROR: The atomic float instruction requires the following SPIR-V extension: SPV_EXT_shader_atomic_float16_add
diff --git a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_min_max/atomicrmw_fminfmax_double.ll b/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_min_max/atomicrmw_fminfmax_double.ll
index 3c6fa276cb76a3..740928eba82cae 100644
--- a/llvm/test/CodeGen/SPIRV/extensions/SPV_EXT_shader_atomic_float_min_max/atomicrmw_fminfmax_double.ll...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/85503
More information about the llvm-commits
mailing list