diff options
| author | Yong He <yonghe@outlook.com> | 2022-09-15 14:22:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-15 14:22:59 -0700 |
| commit | a6032446c6bf7f64d1e201bf438a4c7605a3dbb4 (patch) | |
| tree | a95267c52155e13699ff9aab38ab68353d76939e /source/slang/slang-ir-sccp.cpp | |
| parent | 05f9aaf6a4ef246dcf89b00000a8e59e90c47662 (diff) | |
Language feature: pointer sized int types. (#2401)
* Language feature: pointer sized int types.
* Fix.
* small change to test.
* Fix stdlib.
* Fix.
* Fix.
* Add typedef for `size_t` in stdlib.
* Fix test.
* Add `intptr_t::size` constant.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-sccp.cpp')
| -rw-r--r-- | source/slang/slang-ir-sccp.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/slang/slang-ir-sccp.cpp b/source/slang/slang-ir-sccp.cpp index e724d0d88..0bee2565c 100644 --- a/source/slang/slang-ir-sccp.cpp +++ b/source/slang/slang-ir-sccp.cpp @@ -303,6 +303,8 @@ struct SCCPContext case kIROp_UInt16Type: case kIROp_UIntType: case kIROp_UInt64Type: + case kIROp_IntPtrType: + case kIROp_UIntPtrType: switch (irConstant->getOp()) { case kIROp_FloatLit: @@ -368,10 +370,12 @@ struct SCCPContext case kIROp_Int16Type: case kIROp_IntType: case kIROp_Int64Type: + case kIROp_IntPtrType: case kIROp_UInt8Type: case kIROp_UInt16Type: case kIROp_UIntType: case kIROp_UInt64Type: + case kIROp_UIntPtrType: resultVal = getBuilder()->getIntValue(type, (IRIntegerValue)0); break; @@ -413,6 +417,8 @@ struct SCCPContext case kIROp_UInt16Type: case kIROp_UIntType: case kIROp_UInt64Type: + case kIROp_IntPtrType: + case kIROp_UIntPtrType: case kIROp_BoolType: resultVal = getBuilder()->getIntValue(type, intFunc(c0->value.intVal, c1->value.intVal)); break; @@ -447,10 +453,12 @@ struct SCCPContext case kIROp_Int16Type: case kIROp_IntType: case kIROp_Int64Type: + case kIROp_IntPtrType: case kIROp_UInt8Type: case kIROp_UInt16Type: case kIROp_UIntType: case kIROp_UInt64Type: + case kIROp_UIntPtrType: case kIROp_BoolType: resultVal = getBuilder()->getIntValue(type, intFunc(c0->value.intVal, c1->value.intVal)); @@ -476,10 +484,12 @@ struct SCCPContext case kIROp_Int16Type: case kIROp_IntType: case kIROp_Int64Type: + case kIROp_IntPtrType: case kIROp_UInt8Type: case kIROp_UInt16Type: case kIROp_UIntType: case kIROp_UInt64Type: + case kIROp_UIntPtrType: case kIROp_BoolType: resultVal = getBuilder()->getIntValue(type, intFunc(c0->value.intVal)); @@ -511,10 +521,12 @@ struct SCCPContext case kIROp_Int16Type: case kIROp_IntType: case kIROp_Int64Type: + case kIROp_IntPtrType: case kIROp_UInt8Type: case kIROp_UInt16Type: case kIROp_UIntType: case kIROp_UInt64Type: + case kIROp_UIntPtrType: case kIROp_BoolType: resultVal = getBuilder()->getBoolValue(intFunc(c0->value.intVal, c1->value.intVal)); @@ -680,10 +692,12 @@ struct SCCPContext case kIROp_Int16Type: case kIROp_IntType: case kIROp_Int64Type: + case kIROp_IntPtrType: case kIROp_UInt8Type: case kIROp_UInt16Type: case kIROp_UIntType: case kIROp_UInt64Type: + case kIROp_UIntPtrType: resultVal = getBuilder()->getIntValue(type, -c0->value.intVal); break; case kIROp_FloatType: @@ -708,10 +722,18 @@ struct SCCPContext { case kIROp_Int64Type: case kIROp_UInt64Type: +#if SLANG_PTR_IS_64 + case kIROp_IntPtrType: + case kIROp_UIntPtrType: +#endif resultVal = getBuilder()->getIntValue(type, c0->value.intVal); break; case kIROp_IntType: case kIROp_UIntType: +#if SLANG_PTR_IS_32 + case kIROp_IntPtrType: + case kIROp_UIntPtrType: +#endif { float val = (float)c0->value.floatVal; uint32_t intVal = (uint32_t)FloatAsInt(val); |
