blob: e9a52b41d879fb4880bc2a074979f422bc5acaa4 [file] [log] [blame]
Ben Clayton47dd3012023-04-26 18:27:53 +00001struct atomic_compare_exchange_result_u32 {
Antonio Maioranof99671b2022-06-23 13:14:54 +00002 uint old_value;
3 bool exchanged;
4};
5groupshared uint arg_0;
Ben Claytonc0af5c52022-06-02 14:36:10 +00006
Antonio Maioranof99671b2022-06-23 13:14:54 +00007void atomicCompareExchangeWeak_83580d() {
8 uint arg_1 = 1u;
9 uint arg_2 = 1u;
Ben Clayton47dd3012023-04-26 18:27:53 +000010 atomic_compare_exchange_result_u32 atomic_result = (atomic_compare_exchange_result_u32)0;
Antonio Maioranof99671b2022-06-23 13:14:54 +000011 uint atomic_compare_value = arg_1;
12 InterlockedCompareExchange(arg_0, atomic_compare_value, arg_2, atomic_result.old_value);
13 atomic_result.exchanged = atomic_result.old_value == atomic_compare_value;
Ben Clayton47dd3012023-04-26 18:27:53 +000014 atomic_compare_exchange_result_u32 res = atomic_result;
Ben Claytonc0af5c52022-06-02 14:36:10 +000015}
16
Antonio Maioranof99671b2022-06-23 13:14:54 +000017struct tint_symbol_1 {
18 uint local_invocation_index : SV_GroupIndex;
19};
20
21void compute_main_inner(uint local_invocation_index) {
22 {
23 uint atomic_result_1 = 0u;
24 InterlockedExchange(arg_0, 0u, atomic_result_1);
25 }
26 GroupMemoryBarrierWithGroupSync();
Ben Claytonc0af5c52022-06-02 14:36:10 +000027 atomicCompareExchangeWeak_83580d();
28}
29
Antonio Maioranof99671b2022-06-23 13:14:54 +000030[numthreads(1, 1, 1)]
31void compute_main(tint_symbol_1 tint_symbol) {
32 compute_main_inner(tint_symbol.local_invocation_index);
33 return;
34}