diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-ir-sccp.cpp | 12 | ||||
| -rw-r--r-- | source/slang/slang-ir.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/slang-ir-sccp.cpp b/source/slang/slang-ir-sccp.cpp index fc3766e63..80cee8ecb 100644 --- a/source/slang/slang-ir-sccp.cpp +++ b/source/slang/slang-ir-sccp.cpp @@ -676,11 +676,23 @@ struct SCCPContext } LatticeVal evalLsh(IRType* type, LatticeVal v0, LatticeVal v1) { + IntInfo info = getIntTypeInfo(type); + if (info.isSigned == false) + { + return evalBinaryIntImpl( + type, v0, v1, [](IRUnsignedIntegerValue c0, IRUnsignedIntegerValue c1) { return c0 << c1; }); + } return evalBinaryIntImpl( type, v0, v1, [](IRIntegerValue c0, IRIntegerValue c1) { return c0 << c1; }); } LatticeVal evalRsh(IRType* type, LatticeVal v0, LatticeVal v1) { + IntInfo info = getIntTypeInfo(type); + if (info.isSigned == false) + { + return evalBinaryIntImpl( + type, v0, v1, [](IRUnsignedIntegerValue c0, IRUnsignedIntegerValue c1) { return c0 >> c1; }); + } return evalBinaryIntImpl( type, v0, v1, [](IRIntegerValue c0, IRIntegerValue c1) { return c0 >> c1; }); } diff --git a/source/slang/slang-ir.h b/source/slang/slang-ir.h index eb77127c8..36e145c01 100644 --- a/source/slang/slang-ir.h +++ b/source/slang/slang-ir.h @@ -1059,6 +1059,7 @@ void findAllInstsBreadthFirst(IRInst* inst, List<IRInst*>& outInsts); // Constant Instructions typedef int64_t IRIntegerValue; +typedef uint64_t IRUnsignedIntegerValue; typedef double IRFloatingPointValue; struct IRConstant : IRInst |
