From 62ea823e64307e8fa1488439ac15249befbd213f Mon Sep 17 00:00:00 2001 From: Viktoria Maximova Date: Fri, 9 Aug 2024 12:03:58 +0200 Subject: [PATCH] [SPIR-V 1.4] Removed OpAtomicCompareExchangeWeak (#2665) Verified locally by changing the version from `65536` to `66560` in `test/transcoding/atomics.spt`. --- lib/SPIRV/libSPIRV/SPIRVInstruction.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/SPIRV/libSPIRV/SPIRVInstruction.h b/lib/SPIRV/libSPIRV/SPIRVInstruction.h index d75c0baef2..6e8afac215 100644 --- a/lib/SPIRV/libSPIRV/SPIRVInstruction.h +++ b/lib/SPIRV/libSPIRV/SPIRVInstruction.h @@ -2824,6 +2824,12 @@ class SPIRVAtomicInstBase : public SPIRVInstTemplateBase { for (auto RC : getRequiredCapability()) Module->addCapability(RC); } + + void validate() const override { + if (OpCode == OpAtomicCompareExchangeWeak) + assert(this->getModule()->getSPIRVVersion() < VersionNumber::SPIRV_1_4 && + "OpAtomicCompareExchangeWeak is removed starting from SPIR-V 1.4"); + } }; class SPIRVAtomicStoreInst : public SPIRVAtomicInstBase {