summaryrefslogtreecommitdiff
path: root/source/slang/core.meta.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-05-14 18:01:31 -0700
committerGitHub <noreply@github.com>2024-05-14 18:01:31 -0700
commit4edc72e4dea47cf549b4e28940e3509a5ab61439 (patch)
tree10475236b4a0e1f8a7a0bafdaa05a09d26f9412f /source/slang/core.meta.slang
parentd76bed6c1b03e5d7ef19c947fdd5fcaf33b595f7 (diff)
Remove use of `G0` and `__target_intrinsic` in stdlib. (#4170)
* Remove use of `G0` and `__target_intrinsic` in stdlib. * Fix. * Fix calling intrinsic in global scope.
Diffstat (limited to 'source/slang/core.meta.slang')
-rw-r--r--source/slang/core.meta.slang19
1 files changed, 13 insertions, 6 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 63bc2571b..bf69eb9ad 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -2003,11 +2003,12 @@ int __SyntaxError()
/// For downstream compilers that allow sizeof/alignof/offsetof
/// Can't be called in the C/C++ style. Need to use __size_of<some_type>() as opposed to sizeof(some_type).
__generic<T>
-__target_intrinsic(cpp, "sizeof($G0)")
-__target_intrinsic(cuda, "sizeof($G0)")
[__readNone]
[require(cpp_cuda)]
-int __sizeOf();
+int __sizeOf()
+{
+ __intrinsic_asm "sizeof($[0])", T;
+}
__generic<T>
[__readNone]
@@ -2022,11 +2023,17 @@ int __sizeOf(T v)
}
__generic<T>
-__target_intrinsic(cuda, "SLANG_ALIGN_OF($G0)")
-__target_intrinsic(cpp, "SLANG_ALIGN_OF($G0)")
[__readNone]
[require(cpp_cuda)]
-int __alignOf();
+int __alignOf()
+{
+ __target_switch
+ {
+ case cuda :
+ case cpp :
+ __intrinsic_asm "SLANG_ALIGN_OF($[0])", T;
+ }
+}
__generic<T>
[__readNone]