summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/warning_operator_left_shift_overflow.slang
blob: 5c156a9b9d75b1b3ba61ad26e11b82aa461bd6b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target hlsl

RWStructuredBuffer<int> inputBuffer;
RWStructuredBuffer<int> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
    uint8_t u8 = uint8_t(inputBuffer[0]);

    uint result = (u8 << 0)
        + (u8 << 1)
        + (u8 << 2)
        + (u8 << 3)
        + (u8 << 4)
        + (u8 << 5)
        + (u8 << 6)
        + (u8 << 7)
        // CHECK-NOT: warning 41030:
        // CHECK: ([[#@LINE+1]]): warning 41030: {{.*}}uint8{{.*}}8
        + (u8 << 8)
        // CHECK: ([[#@LINE+1]]): warning 41030: {{.*}}uint8{{.*}}9
        + (u8 << 9)
        ;

    outputBuffer[0] = int(result);
}