summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-05-09 23:26:43 -0400
committerGitHub <noreply@github.com>2025-05-09 20:26:43 -0700
commit48203ea02250ba517f749a222092f091d9bef15e (patch)
tree75663fe17fcbae4a376d9cdbe31393de43171e7c /source/slang/slang-ir.cpp
parent5a6c2baadbc16fc2099a6951e389b9bd3cad08f6 (diff)
Fix SPIRV unsigned to signed widening casts (#7051)
* Fix unsigned to signed casts for SPIRV * Add test * Fix ICE crash
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index a99eddebb..98c0fa471 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -7811,6 +7811,37 @@ IROp getIntTypeOpFromInfo(const IntInfo info)
}
}
+IROp getOppositeSignIntTypeOp(IROp op)
+{
+ switch (op)
+ {
+ case kIROp_UInt8Type:
+ return kIROp_Int8Type;
+ case kIROp_UInt16Type:
+ return kIROp_Int16Type;
+ case kIROp_UIntType:
+ return kIROp_IntType;
+ case kIROp_UInt64Type:
+ return kIROp_Int64Type;
+ case kIROp_UIntPtrType:
+ return kIROp_IntPtrType;
+
+ case kIROp_Int8Type:
+ return kIROp_UInt8Type;
+ case kIROp_Int16Type:
+ return kIROp_UInt16Type;
+ case kIROp_IntType:
+ return kIROp_UIntType;
+ case kIROp_Int64Type:
+ return kIROp_UInt64Type;
+ case kIROp_IntPtrType:
+ return kIROp_UIntPtrType;
+
+ default:
+ SLANG_UNEXPECTED("Unhandled type passed to getOppositeSignIntTypeOp");
+ }
+}
+
FloatInfo getFloatingTypeInfo(const IRType* floatType)
{
switch (floatType->getOp())