Skip to content

Commit b3e8ec8

Browse files
authored
Revert "Cherry-pick of "Add SPIR-V 1.4 checks"" (#7103)
Reverts #6899 It causes regressions of ESIMD tests on Windows
1 parent 70ee3d5 commit b3e8ec8

File tree

12 files changed

+136
-165
lines changed

12 files changed

+136
-165
lines changed

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,12 +1418,9 @@ LLVMToSPIRVBase::getLoopControl(const BranchInst *Branch,
14181418
// PartialCount must not be used with the DontUnroll bit
14191419
else if (S == "llvm.loop.unroll.count" &&
14201420
!(LoopControl & LoopControlDontUnrollMask)) {
1421-
if (BM->isAllowedToUseVersion(VersionNumber::SPIRV_1_4)) {
1422-
BM->setMinSPIRVVersion(VersionNumber::SPIRV_1_4);
1423-
size_t I = getMDOperandAsInt(Node, 1);
1424-
ParametersToSort.emplace_back(spv::LoopControlPartialCountMask, I);
1425-
LoopControl |= spv::LoopControlPartialCountMask;
1426-
}
1421+
size_t I = getMDOperandAsInt(Node, 1);
1422+
ParametersToSort.emplace_back(spv::LoopControlPartialCountMask, I);
1423+
LoopControl |= spv::LoopControlPartialCountMask;
14271424
} else if (S == "llvm.loop.ivdep.enable")
14281425
LoopControl |= spv::LoopControlDependencyInfiniteMask;
14291426
else if (S == "llvm.loop.ivdep.safelen") {
@@ -2484,10 +2481,10 @@ bool LLVMToSPIRVBase::transDecoration(Value *V, SPIRVValue *BV) {
24842481

24852482
if (auto BVO = dyn_cast_or_null<OverflowingBinaryOperator>(V)) {
24862483
if (BVO->hasNoSignedWrap()) {
2487-
BV->setNoIntegerDecorationWrap<DecorationNoSignedWrap>(true);
2484+
BV->setNoSignedWrap(true);
24882485
}
24892486
if (BVO->hasNoUnsignedWrap()) {
2490-
BV->setNoIntegerDecorationWrap<DecorationNoUnsignedWrap>(true);
2487+
BV->setNoUnsignedWrap(true);
24912488
}
24922489
}
24932490

@@ -4613,34 +4610,43 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46134610
}
46144611
} break;
46154612
case spv::ExecutionModeNoGlobalOffsetINTEL: {
4616-
if (!BM->isAllowedToUseExtension(
4617-
ExtensionID::SPV_INTEL_kernel_attributes))
4618-
break;
4619-
BF->addExecutionMode(BM->add(
4620-
new SPIRVExecutionMode(BF, static_cast<ExecutionMode>(EMode))));
4621-
BM->addExtension(ExtensionID::SPV_INTEL_kernel_attributes);
4622-
BM->addCapability(CapabilityKernelAttributesINTEL);
4613+
if (BM->isAllowedToUseExtension(
4614+
ExtensionID::SPV_INTEL_kernel_attributes)) {
4615+
BF->addExecutionMode(BM->add(
4616+
new SPIRVExecutionMode(BF, static_cast<ExecutionMode>(EMode))));
4617+
BM->addExtension(ExtensionID::SPV_INTEL_kernel_attributes);
4618+
BM->addCapability(CapabilityKernelAttributesINTEL);
4619+
}
46234620
} break;
46244621
case spv::ExecutionModeVecTypeHint:
46254622
case spv::ExecutionModeSubgroupSize:
4626-
case spv::ExecutionModeSubgroupsPerWorkgroup:
4627-
AddSingleArgExecutionMode(static_cast<ExecutionMode>(EMode));
4628-
break;
4623+
case spv::ExecutionModeSubgroupsPerWorkgroup: {
4624+
unsigned X;
4625+
N.get(X);
4626+
BF->addExecutionMode(BM->add(
4627+
new SPIRVExecutionMode(BF, static_cast<ExecutionMode>(EMode), X)));
4628+
} break;
46294629
case spv::ExecutionModeNumSIMDWorkitemsINTEL:
46304630
case spv::ExecutionModeSchedulerTargetFmaxMhzINTEL:
46314631
case spv::ExecutionModeMaxWorkDimINTEL:
46324632
case spv::internal::ExecutionModeStreamingInterfaceINTEL: {
4633-
if (!BM->isAllowedToUseExtension(
4634-
ExtensionID::SPV_INTEL_kernel_attributes))
4635-
break;
4636-
AddSingleArgExecutionMode(static_cast<ExecutionMode>(EMode));
4637-
BM->addExtension(ExtensionID::SPV_INTEL_kernel_attributes);
4638-
BM->addCapability(CapabilityFPGAKernelAttributesINTEL);
4633+
if (BM->isAllowedToUseExtension(
4634+
ExtensionID::SPV_INTEL_kernel_attributes)) {
4635+
unsigned X;
4636+
N.get(X);
4637+
BF->addExecutionMode(BM->add(new SPIRVExecutionMode(
4638+
BF, static_cast<ExecutionMode>(EMode), X)));
4639+
BM->addExtension(ExtensionID::SPV_INTEL_kernel_attributes);
4640+
BM->addCapability(CapabilityFPGAKernelAttributesINTEL);
4641+
}
46394642
} break;
46404643
case spv::ExecutionModeSharedLocalMemorySizeINTEL: {
46414644
if (!BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_vector_compute))
46424645
break;
4643-
AddSingleArgExecutionMode(static_cast<ExecutionMode>(EMode));
4646+
unsigned SLMSize;
4647+
N.get(SLMSize);
4648+
BF->addExecutionMode(BM->add(new SPIRVExecutionMode(
4649+
BF, static_cast<ExecutionMode>(EMode), SLMSize)));
46444650
} break;
46454651
case spv::ExecutionModeNamedBarrierCountINTEL: {
46464652
if (!BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_vector_compute))
@@ -4658,14 +4664,12 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46584664
case spv::ExecutionModeSignedZeroInfNanPreserve:
46594665
case spv::ExecutionModeRoundingModeRTE:
46604666
case spv::ExecutionModeRoundingModeRTZ: {
4661-
if (BM->isAllowedToUseVersion(VersionNumber::SPIRV_1_4)) {
4662-
BM->setMinSPIRVVersion(VersionNumber::SPIRV_1_4);
4663-
AddSingleArgExecutionMode(static_cast<ExecutionMode>(EMode));
4664-
} else if (BM->isAllowedToUseExtension(
4665-
ExtensionID::SPV_KHR_float_controls)) {
4666-
BM->addExtension(ExtensionID::SPV_KHR_float_controls);
4667-
AddSingleArgExecutionMode(static_cast<ExecutionMode>(EMode));
4668-
}
4667+
if (!BM->isAllowedToUseExtension(ExtensionID::SPV_KHR_float_controls))
4668+
break;
4669+
unsigned TargetWidth;
4670+
N.get(TargetWidth);
4671+
BF->addExecutionMode(BM->add(new SPIRVExecutionMode(
4672+
BF, static_cast<ExecutionMode>(EMode), TargetWidth)));
46694673
} break;
46704674
case spv::ExecutionModeRoundingModeRTPINTEL:
46714675
case spv::ExecutionModeRoundingModeRTNINTEL:
@@ -4674,7 +4678,10 @@ bool LLVMToSPIRVBase::transExecutionMode() {
46744678
if (!BM->isAllowedToUseExtension(
46754679
ExtensionID::SPV_INTEL_float_controls2))
46764680
break;
4677-
AddSingleArgExecutionMode(static_cast<ExecutionMode>(EMode));
4681+
unsigned TargetWidth;
4682+
N.get(TargetWidth);
4683+
BF->addExecutionMode(BM->add(new SPIRVExecutionMode(
4684+
BF, static_cast<ExecutionMode>(EMode), TargetWidth)));
46784685
} break;
46794686
case spv::internal::ExecutionModeFastCompositeKernelINTEL: {
46804687
if (BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_fast_composite))

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVDecorate.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ class SPIRVDecorateGeneric : public SPIRVAnnotationGeneric {
9494

9595
case DecorationMaxByteOffset:
9696
return static_cast<SPIRVWord>(VersionNumber::SPIRV_1_1);
97-
case DecorationUserSemantic:
98-
return static_cast<SPIRVWord>(VersionNumber::SPIRV_1_4);
9997

10098
default:
10199
return static_cast<SPIRVWord>(VersionNumber::SPIRV_1_0);
@@ -129,6 +127,9 @@ class SPIRVDecorate : public SPIRVDecorateGeneric {
129127

130128
llvm::Optional<ExtensionID> getRequiredExtension() const override {
131129
switch (static_cast<size_t>(Dec)) {
130+
case DecorationNoSignedWrap:
131+
case DecorationNoUnsignedWrap:
132+
return ExtensionID::SPV_KHR_no_integer_wrap_decoration;
132133
case DecorationRegisterINTEL:
133134
case DecorationMemoryINTEL:
134135
case DecorationNumbanksINTEL:

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVEntry.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,12 @@ class SPIRVCapability : public SPIRVEntryNoId<OpCapability> {
843843

844844
llvm::Optional<ExtensionID> getRequiredExtension() const override {
845845
switch (static_cast<unsigned>(Kind)) {
846+
case CapabilityDenormPreserve:
847+
case CapabilityDenormFlushToZero:
848+
case CapabilitySignedZeroInfNanPreserve:
849+
case CapabilityRoundingModeRTE:
850+
case CapabilityRoundingModeRTZ:
851+
return ExtensionID::SPV_KHR_float_controls;
846852
case CapabilityRoundToInfinityINTEL:
847853
case CapabilityFloatingPointModeINTEL:
848854
case CapabilityFunctionFloatControlINTEL:

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVValue.cpp

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,45 @@ bool SPIRVValue::hasNoSignedWrap() const {
7575
return hasDecorate(DecorationNoSignedWrap);
7676
}
7777

78+
void SPIRVValue::setNoSignedWrap(bool HasNoSignedWrap) {
79+
if (!HasNoSignedWrap) {
80+
eraseDecorate(DecorationNoSignedWrap);
81+
}
82+
if (Module->isAllowedToUseExtension(
83+
ExtensionID::SPV_KHR_no_integer_wrap_decoration)) {
84+
// NoSignedWrap decoration is available only if it is allowed to use SPIR-V
85+
// 1.4 or if SPV_KHR_no_integer_wrap_decoration extension is allowed
86+
// FIXME: update this 'if' to include check for SPIR-V 1.4 once translator
87+
// support this version
88+
addDecorate(new SPIRVDecorate(DecorationNoSignedWrap, this));
89+
SPIRVDBG(spvdbgs() << "Set nsw for obj " << Id << "\n")
90+
} else {
91+
SPIRVDBG(spvdbgs() << "Skip setting nsw for obj " << Id << "\n")
92+
}
93+
}
94+
7895
bool SPIRVValue::hasNoUnsignedWrap() const {
7996
return hasDecorate(DecorationNoUnsignedWrap);
8097
}
8198

99+
void SPIRVValue::setNoUnsignedWrap(bool HasNoUnsignedWrap) {
100+
if (!HasNoUnsignedWrap) {
101+
eraseDecorate(DecorationNoUnsignedWrap);
102+
return;
103+
}
104+
if (Module->isAllowedToUseExtension(
105+
ExtensionID::SPV_KHR_no_integer_wrap_decoration)) {
106+
// NoUnsignedWrap decoration is available only if it is allowed to use
107+
// SPIR-V 1.4 or if SPV_KHR_no_integer_wrap_decoration extension is allowed
108+
// FIXME: update this 'if' to include check for SPIR-V 1.4 once translator
109+
// support this version
110+
addDecorate(new SPIRVDecorate(DecorationNoUnsignedWrap, this));
111+
SPIRVDBG(spvdbgs() << "Set nuw for obj " << Id << "\n")
112+
} else {
113+
SPIRVDBG(spvdbgs() << "Skip setting nuw for obj " << Id << "\n")
114+
}
115+
}
116+
82117
void SPIRVValue::setFPFastMathMode(SPIRVWord M) {
83118
if (M == 0) {
84119
eraseDecorate(DecorationFPFastMathMode);
@@ -89,39 +124,6 @@ void SPIRVValue::setFPFastMathMode(SPIRVWord M) {
89124
<< "\n")
90125
}
91126

92-
template <spv::Decoration NoIntegerWrapDecoration>
93-
void SPIRVValue::setNoIntegerDecorationWrap(bool HasNoIntegerWrap) {
94-
if (!HasNoIntegerWrap) {
95-
eraseDecorate(NoIntegerWrapDecoration);
96-
return;
97-
}
98-
// NoSignedWrap and NoUnsignedWrap decorations are available only if it is
99-
// allowed to use SPIR-V 1.4 or if SPV_KHR_no_integer_wrap_decoration
100-
// extension is enabled
101-
#ifdef _SPIRVDBG
102-
const std::string InstStr =
103-
NoIntegerWrapDecoration == DecorationNoSignedWrap ? "nsw" : "nuw";
104-
#endif // _SPIRVDBG
105-
if (Module->isAllowedToUseVersion(VersionNumber::SPIRV_1_4)) {
106-
Module->setMinSPIRVVersion(VersionNumber::SPIRV_1_4);
107-
addDecorate(new SPIRVDecorate(NoIntegerWrapDecoration, this));
108-
SPIRVDBG(spvdbgs() << "Set " << InstStr << " for obj " << Id << "\n")
109-
} else if (Module->isAllowedToUseExtension(
110-
ExtensionID::SPV_KHR_no_integer_wrap_decoration)) {
111-
Module->addExtension(ExtensionID::SPV_KHR_no_integer_wrap_decoration);
112-
addDecorate(new SPIRVDecorate(NoIntegerWrapDecoration, this));
113-
SPIRVDBG(spvdbgs() << "Set " << InstStr << " for obj " << Id << "\n")
114-
} else {
115-
SPIRVDBG(spvdbgs() << "Skip setting " << InstStr << " for obj " << Id
116-
<< "\n")
117-
}
118-
}
119-
120-
template void
121-
SPIRVValue::setNoIntegerDecorationWrap<DecorationNoSignedWrap>(bool);
122-
template void
123-
SPIRVValue::setNoIntegerDecorationWrap<DecorationNoUnsignedWrap>(bool);
124-
125127
template <spv::Op OC>
126128
void SPIRVConstantBase<OC>::setWords(const uint64_t *TheValue) {
127129
assert(TheValue && "Nullptr value");

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVValue.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ class SPIRVValue : public SPIRVEntry {
9898

9999
void setAlignment(SPIRVWord);
100100
void setVolatile(bool IsVolatile);
101-
102-
template <spv::Decoration NoIntegerWrapDecoration>
103-
void setNoIntegerDecorationWrap(bool HasNoIntegerWrap);
104-
101+
void setNoSignedWrap(bool HasNoSignedWrap);
102+
void setNoUnsignedWrap(bool HasNoUnsignedWrap);
105103
void setFPFastMathMode(SPIRVWord FPFastMathMode);
106104

107105
void validate() const override {

llvm-spirv/test/exec_mode_float_control_khr.ll

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
; RUN: llvm-as %s -o %t.bc
2-
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-max-version=1.1 --spirv-ext=+SPV_KHR_float_controls
2+
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_KHR_float_controls
33
; RUN: llvm-spirv %t.spv -o %t.spt --to-text
4-
; RUN: FileCheck %s --input-file %t.spt -check-prefixes=SPV,SPVEXT
5-
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-max-version=1.4
6-
; RUN: llvm-spirv %t.spv -o %t.spt --to-text
7-
; RUN: FileCheck %s --input-file %t.spt -check-prefixes=SPV,SPV14
8-
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-max-version=1.1
9-
; RUN: llvm-spirv %t.spv -o %t.spt --to-text
10-
; RUN: FileCheck %s --input-file %t.spt -check-prefix=SPV-NEGATIVE
4+
; RUN: FileCheck %s --input-file %t.spt -check-prefix=SPV
115

126
; ModuleID = 'float_control.bc'
137
source_filename = "float_control.cpp"
@@ -50,10 +44,6 @@ entry:
5044
!spirv.EntryPoint = !{}
5145
!spirv.ExecutionMode = !{!15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29}
5246

53-
; SPVEXT-DAG: Extension "SPV_KHR_float_controls"
54-
; SPV14-NOT: Extension "SPV_KHR_float_controls"
55-
; SPV-NEGATIVE-NOT: Extension "SPV_KHR_float_controls"
56-
5747
; SPV-DAG: EntryPoint {{[0-9]+}} [[KERNEL0:[0-9]+]] "k_float_controls_0"
5848
; SPV-DAG: EntryPoint {{[0-9]+}} [[KERNEL1:[0-9]+]] "k_float_controls_1"
5949
; SPV-DAG: EntryPoint {{[0-9]+}} [[KERNEL2:[0-9]+]] "k_float_controls_2"

llvm-spirv/test/transcoding/LoopUnroll.ll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@
4242
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
4343
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
4444
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefixes=CHECK-LLVM
45-
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-max-version=1.1
46-
; RUN: llvm-spirv -to-text %t.spv -o %t.spt
47-
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV-NEGATIVE
48-
49-
; Check SPIR-V versions in a format magic number + version
50-
; CHECK-SPIRV: 119734787 66560
51-
; CHECK-SPIRV-NEGATIVE: 119734787 65536
5245

5346
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
5447
target triple = "spir64"
@@ -122,7 +115,6 @@ while.cond: ; preds = %if.end, %if.then, %
122115
; Per SPIRV spec p3.23 "Unroll" loop control = 0x1
123116
; CHECK-SPIRV: LoopMerge [[#MERGEBLOCK:]] [[#CONTINUE:]] 256 8
124117
; CHECK-SPIRV: BranchConditional [[#]] [[#]] [[#MERGEBLOCK]]
125-
; CHECK-SPIRV-NEGATIVE-NOT: LoopMerge {{.*}} 256
126118
br i1 %cmp, label %while.body, label %while.end
127119

128120
while.body: ; preds = %while.cond

llvm-spirv/test/transcoding/NoSignedUnsignedWrap.ll

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88
; Positive tests:
99
;
1010
; RUN: llvm-as %s -o %t.bc
11-
; RUN: llvm-spirv %t.bc --spirv-max-version=1.1 --spirv-ext=+SPV_KHR_no_integer_wrap_decoration -spirv-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-EXT
12-
; RUN: llvm-spirv %t.bc --spirv-max-version=1.1 --spirv-ext=+SPV_KHR_no_integer_wrap_decoration -o %t.spv
11+
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_KHR_no_integer_wrap_decoration -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
12+
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_KHR_no_integer_wrap_decoration -o %t.spv
1313
; RUN: spirv-val %t.spv
14-
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv --spirv-max-version=1.1 --spirv-ext=+SPV_KHR_no_integer_wrap_decoration -o %t.rev.bc
15-
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
16-
; RUN: llvm-spirv %t.bc --spirv-max-version=1.4 -spirv-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-NOEXT
17-
; RUN: llvm-spirv %t.bc --spirv-max-version=1.4 -o %t.spv
18-
; RUN: spirv-val %t.spv
19-
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv --spirv-max-version=1.4 -o %t.rev.bc
14+
; RUN: llvm-spirv -r %t.spv --spirv-ext=+SPV_KHR_no_integer_wrap_decoration -o %t.rev.bc
2015
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
2116
;
2217
; During consumption, any SPIR-V extension must be accepted by default
@@ -26,29 +21,29 @@
2621
;
2722
; Negative tests:
2823
;
29-
; Check that translator is able to skip nsw/nuw attributes if extension is
30-
; disabled implicitly or explicitly and if max SPIR-V version is lower then 1.4
24+
; Check that translator is able to reject SPIR-V if extension is disallowed
3125
;
32-
; RUN: llvm-spirv %t.bc --spirv-max-version=1.1 -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV-NEGATIVE
33-
; RUN: llvm-spirv --spirv-max-version=1.1 %t.bc -o %t.spv
34-
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
35-
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-NEGATIVE
26+
; RUN: not llvm-spirv -r %t.spv --spirv-ext=-SPV_KHR_no_integer_wrap_decoration -o - 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-SPIRV
3627
;
37-
; RUN: llvm-spirv %t.bc --spirv-max-version=1.1 --spirv-ext=-SPV_KHR_no_integer_wrap_decoration -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV-NEGATIVE
38-
; RUN: llvm-spirv %t.bc --spirv-max-version=1.1 --spirv-ext=-SPV_KHR_no_integer_wrap_decoration -o %t.spv
39-
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
40-
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-NEGATIVE
28+
; Check that translator is able to skip nsw/nuw attributes if extension is disabled implicitly or explicitly
29+
;
30+
; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV-NOEXT
31+
; RUN: llvm-spirv %t.bc -o %t.spv
32+
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
33+
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-NOEXT
34+
;
35+
; RUN: llvm-spirv %t.bc --spirv-ext=-SPV_KHR_no_integer_wrap_decoration -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV-NOEXT
36+
; RUN: llvm-spirv %t.bc --spirv-ext=-SPV_KHR_no_integer_wrap_decoration -o %t.spv
37+
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
38+
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-NOEXT
4139

42-
; Check SPIR-V versions in a format magic number + version
43-
; CHECK-SPIRV-EXT: 119734787 65536
44-
; CHECK-SPIRV-EXT: Extension "SPV_KHR_no_integer_wrap_decoration"
45-
; CHECK-SPIRV-NOEXT: 119734787 66560
40+
; CHECK-SPIRV: Extension "SPV_KHR_no_integer_wrap_decoration"
4641
; CHECK-SPIRV-DAG: Decorate {{[0-9]+}} NoSignedWrap
4742
; CHECK-SPIRV-DAG: Decorate {{[0-9]+}} NoUnsignedWrap
4843
;
49-
; CHECK-SPIRV-NEGATIVE-NOT: Extension "SPV_KHR_no_integer_wrap_decoration"
50-
; CHECK-SPIRV-NEGATIVE-NOT: Decorate {{[0-9]+}} NoSignedWrap
51-
; CHECK-SPIRV-NEGATIVE-NOT: Decorate {{[0-9]+}} NoUnsignedWrap
44+
; CHECK-SPIRV-NOEXT-NOT: Extension "SPV_KHR_no_integer_wrap_decoration"
45+
; CHECK-SPIRV-NOEXT-NOT: Decorate {{[0-9]+}} NoSignedWrap
46+
; CHECK-SPIRV-NOEXT-NOT: Decorate {{[0-9]+}} NoUnsignedWrap
5247
;
5348
; CHECK-INVALID-SPIRV: input SPIR-V module uses extension 'SPV_KHR_no_integer_wrap_decoration' which were disabled
5449

@@ -60,7 +55,7 @@ define spir_func i32 @square(i16 zeroext %a) local_unnamed_addr #0 {
6055
entry:
6156
%conv = zext i16 %a to i32
6257
; CHECK-LLVM: mul nuw nsw
63-
; CHECK-LLVM-NEGATIVE: mul i32
58+
; CHECK-LLVM-NOEXT: mul i32
6459
%mul = mul nuw nsw i32 %conv, %conv
6560
ret i32 %mul
6661
}

0 commit comments

Comments
 (0)