diff options
| -rw-r--r-- | source/slang/core.meta.slang | 2 | ||||
| -rw-r--r-- | tests/bugs/gh-5026.slang | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index 4e8529666..03dda0fe5 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -568,7 +568,7 @@ ${{{{ __intrinsic_op($(kIROp_Sub)) This sub(This other); __intrinsic_op($(kIROp_Mul)) This mul(This other); __intrinsic_op($(kIROp_Div)) This div(This other); - __intrinsic_op($(kIROp_FRem)) This mod(This other); + __intrinsic_op($(kIROp_IRem)) This mod(This other); __intrinsic_op($(kIROp_Neg)) This neg(); __intrinsic_op($(kIROp_Lsh)) This shl(int other); __intrinsic_op($(kIROp_Rsh)) This shr(int other); diff --git a/tests/bugs/gh-5026.slang b/tests/bugs/gh-5026.slang new file mode 100644 index 000000000..1080d1180 --- /dev/null +++ b/tests/bugs/gh-5026.slang @@ -0,0 +1,23 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type + +// CHECK: type: int32_t +// CHECK-NEXT: 0 +// CHECK-NEXT: 0 +// CHECK-NEXT: 0 +// CHECK-NEXT: 0 + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +T myMod<T : __BuiltinArithmeticType>(T x, T y) +{ + return x % y; +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int c = 1; + int d = 1; + outputBuffer[dispatchThreadID.x] = myMod(c,d); +}
\ No newline at end of file |
