17ec681f3Smrg/*
27ec681f3Smrg * Copyright © 2020 Valve Corporation
37ec681f3Smrg *
47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
57ec681f3Smrg * copy of this software and associated documentation files (the "Software"),
67ec681f3Smrg * to deal in the Software without restriction, including without limitation
77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the
97ec681f3Smrg * Software is furnished to do so, subject to the following conditions:
107ec681f3Smrg *
117ec681f3Smrg * The above copyright notice and this permission notice (including the next
127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the
137ec681f3Smrg * Software.
147ec681f3Smrg *
157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
187ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
197ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
207ec681f3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
217ec681f3Smrg * IN THE SOFTWARE.
227ec681f3Smrg */
237ec681f3Smrg#include "helpers.h"
247ec681f3Smrg
257ec681f3SmrgTEST_F(spirv_test, opload_volatile)
267ec681f3Smrg{
277ec681f3Smrg   /*
287ec681f3Smrg               OpCapability Shader
297ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
307ec681f3Smrg               OpMemoryModel Logical GLSL450
317ec681f3Smrg               OpEntryPoint GLCompute %4 "main"
327ec681f3Smrg               OpExecutionMode %4 LocalSize 1 1 1
337ec681f3Smrg               OpMemberDecorate %_struct_7 0 Offset 0
347ec681f3Smrg               OpDecorate %_struct_7 BufferBlock
357ec681f3Smrg               OpDecorate %9 DescriptorSet 0
367ec681f3Smrg               OpDecorate %9 Binding 0
377ec681f3Smrg       %void = OpTypeVoid
387ec681f3Smrg          %3 = OpTypeFunction %void
397ec681f3Smrg       %uint = OpTypeInt 32 0
407ec681f3Smrg  %_struct_7 = OpTypeStruct %uint
417ec681f3Smrg%_ptr_Uniform__struct_7 = OpTypePointer Uniform %_struct_7
427ec681f3Smrg          %9 = OpVariable %_ptr_Uniform__struct_7 Uniform
437ec681f3Smrg        %int = OpTypeInt 32 1
447ec681f3Smrg      %int_0 = OpConstant %int 0
457ec681f3Smrg%_ptr_Uniform_uint = OpTypePointer Uniform %uint
467ec681f3Smrg          %4 = OpFunction %void None %3
477ec681f3Smrg          %5 = OpLabel
487ec681f3Smrg         %13 = OpAccessChain %_ptr_Uniform_uint %9 %int_0
497ec681f3Smrg         %14 = OpLoad %uint %13 Volatile
507ec681f3Smrg               OpStore %13 %14
517ec681f3Smrg               OpReturn
527ec681f3Smrg               OpFunctionEnd
537ec681f3Smrg   */
547ec681f3Smrg   static const uint32_t words[] = {
557ec681f3Smrg      0x07230203, 0x00010300, 0x00070000, 0x0000000f, 0x00000000, 0x00020011,
567ec681f3Smrg      0x00000001, 0x0006000b, 0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e,
577ec681f3Smrg      0x00000000, 0x0003000e, 0x00000000, 0x00000001, 0x0005000f, 0x00000005,
587ec681f3Smrg      0x00000002, 0x6e69616d, 0x00000000, 0x00060010, 0x00000002, 0x00000011,
597ec681f3Smrg      0x00000001, 0x00000001, 0x00000001, 0x00050048, 0x00000003, 0x00000000,
607ec681f3Smrg      0x00000023, 0x00000000, 0x00030047, 0x00000003, 0x00000003, 0x00040047,
617ec681f3Smrg      0x00000004, 0x00000022, 0x00000000, 0x00040047, 0x00000004, 0x00000021,
627ec681f3Smrg      0x00000000, 0x00020013, 0x00000005, 0x00030021, 0x00000006, 0x00000005,
637ec681f3Smrg      0x00040015, 0x00000007, 0x00000020, 0x00000000, 0x0003001e, 0x00000003,
647ec681f3Smrg      0x00000007, 0x00040020, 0x00000008, 0x00000002, 0x00000003, 0x0004003b,
657ec681f3Smrg      0x00000008, 0x00000004, 0x00000002, 0x00040015, 0x00000009, 0x00000020,
667ec681f3Smrg      0x00000001, 0x0004002b, 0x00000009, 0x0000000a, 0x00000000, 0x00040020,
677ec681f3Smrg      0x0000000b, 0x00000002, 0x00000007, 0x00050036, 0x00000005, 0x00000002,
687ec681f3Smrg      0x00000000, 0x00000006, 0x000200f8, 0x0000000c, 0x00050041, 0x0000000b,
697ec681f3Smrg      0x0000000d, 0x00000004, 0x0000000a, 0x0005003d, 0x00000007, 0x0000000e,
707ec681f3Smrg      0x0000000d, 0x00000001, 0x0003003e, 0x0000000d, 0x0000000e, 0x000100fd,
717ec681f3Smrg      0x00010038,
727ec681f3Smrg   };
737ec681f3Smrg
747ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
757ec681f3Smrg
767ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_load_deref);
777ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
787ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
797ec681f3Smrg}
807ec681f3Smrg
817ec681f3SmrgTEST_F(spirv_test, opstore_volatile)
827ec681f3Smrg{
837ec681f3Smrg   /*
847ec681f3Smrg               OpCapability Shader
857ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
867ec681f3Smrg               OpMemoryModel Logical GLSL450
877ec681f3Smrg               OpEntryPoint GLCompute %4 "main"
887ec681f3Smrg               OpExecutionMode %4 LocalSize 1 1 1
897ec681f3Smrg               OpMemberDecorate %_struct_7 0 Offset 0
907ec681f3Smrg               OpDecorate %_struct_7 BufferBlock
917ec681f3Smrg               OpDecorate %9 DescriptorSet 0
927ec681f3Smrg               OpDecorate %9 Binding 0
937ec681f3Smrg       %void = OpTypeVoid
947ec681f3Smrg          %3 = OpTypeFunction %void
957ec681f3Smrg       %uint = OpTypeInt 32 0
967ec681f3Smrg  %_struct_7 = OpTypeStruct %uint
977ec681f3Smrg%_ptr_Uniform__struct_7 = OpTypePointer Uniform %_struct_7
987ec681f3Smrg          %9 = OpVariable %_ptr_Uniform__struct_7 Uniform
997ec681f3Smrg        %int = OpTypeInt 32 1
1007ec681f3Smrg      %int_0 = OpConstant %int 0
1017ec681f3Smrg%_ptr_Uniform_uint = OpTypePointer Uniform %uint
1027ec681f3Smrg          %4 = OpFunction %void None %3
1037ec681f3Smrg          %5 = OpLabel
1047ec681f3Smrg         %13 = OpAccessChain %_ptr_Uniform_uint %9 %int_0
1057ec681f3Smrg         %14 = OpLoad %uint %13
1067ec681f3Smrg               OpStore %13 %14 Volatile
1077ec681f3Smrg               OpReturn
1087ec681f3Smrg               OpFunctionEnd
1097ec681f3Smrg   */
1107ec681f3Smrg   static const uint32_t words[] = {
1117ec681f3Smrg      0x07230203, 0x00010300, 0x00070000, 0x0000000f, 0x00000000, 0x00020011,
1127ec681f3Smrg      0x00000001, 0x0006000b, 0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e,
1137ec681f3Smrg      0x00000000, 0x0003000e, 0x00000000, 0x00000001, 0x0005000f, 0x00000005,
1147ec681f3Smrg      0x00000002, 0x6e69616d, 0x00000000, 0x00060010, 0x00000002, 0x00000011,
1157ec681f3Smrg      0x00000001, 0x00000001, 0x00000001, 0x00050048, 0x00000003, 0x00000000,
1167ec681f3Smrg      0x00000023, 0x00000000, 0x00030047, 0x00000003, 0x00000003, 0x00040047,
1177ec681f3Smrg      0x00000004, 0x00000022, 0x00000000, 0x00040047, 0x00000004, 0x00000021,
1187ec681f3Smrg      0x00000000, 0x00020013, 0x00000005, 0x00030021, 0x00000006, 0x00000005,
1197ec681f3Smrg      0x00040015, 0x00000007, 0x00000020, 0x00000000, 0x0003001e, 0x00000003,
1207ec681f3Smrg      0x00000007, 0x00040020, 0x00000008, 0x00000002, 0x00000003, 0x0004003b,
1217ec681f3Smrg      0x00000008, 0x00000004, 0x00000002, 0x00040015, 0x00000009, 0x00000020,
1227ec681f3Smrg      0x00000001, 0x0004002b, 0x00000009, 0x0000000a, 0x00000000, 0x00040020,
1237ec681f3Smrg      0x0000000b, 0x00000002, 0x00000007, 0x00050036, 0x00000005, 0x00000002,
1247ec681f3Smrg      0x00000000, 0x00000006, 0x000200f8, 0x0000000c, 0x00050041, 0x0000000b,
1257ec681f3Smrg      0x0000000d, 0x00000004, 0x0000000a, 0x0004003d, 0x00000007, 0x0000000e,
1267ec681f3Smrg      0x0000000d, 0x0004003e, 0x0000000d, 0x0000000e, 0x00000001, 0x000100fd,
1277ec681f3Smrg      0x00010038,
1287ec681f3Smrg   };
1297ec681f3Smrg
1307ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
1317ec681f3Smrg
1327ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_store_deref);
1337ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
1347ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
1357ec681f3Smrg}
1367ec681f3Smrg
1377ec681f3SmrgTEST_F(spirv_test, opcopymemory_volatile_both)
1387ec681f3Smrg{
1397ec681f3Smrg   /*
1407ec681f3Smrg               OpCapability Shader
1417ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
1427ec681f3Smrg               OpMemoryModel Logical GLSL450
1437ec681f3Smrg               OpEntryPoint GLCompute %4 "main"
1447ec681f3Smrg               OpExecutionMode %4 LocalSize 1 1 1
1457ec681f3Smrg               OpMemberDecorate %_struct_7 0 Offset 0
1467ec681f3Smrg               OpDecorate %_struct_7 BufferBlock
1477ec681f3Smrg               OpDecorate %9 DescriptorSet 0
1487ec681f3Smrg               OpDecorate %9 Binding 0
1497ec681f3Smrg       %void = OpTypeVoid
1507ec681f3Smrg          %3 = OpTypeFunction %void
1517ec681f3Smrg       %uint = OpTypeInt 32 0
1527ec681f3Smrg  %_struct_7 = OpTypeStruct %uint
1537ec681f3Smrg%_ptr_Uniform__struct_7 = OpTypePointer Uniform %_struct_7
1547ec681f3Smrg          %9 = OpVariable %_ptr_Uniform__struct_7 Uniform
1557ec681f3Smrg        %int = OpTypeInt 32 1
1567ec681f3Smrg      %int_0 = OpConstant %int 0
1577ec681f3Smrg%_ptr_Uniform_uint = OpTypePointer Uniform %uint
1587ec681f3Smrg          %4 = OpFunction %void None %3
1597ec681f3Smrg          %5 = OpLabel
1607ec681f3Smrg         %13 = OpAccessChain %_ptr_Uniform_uint %9 %int_0
1617ec681f3Smrg               OpCopyMemory %13 %13 Volatile
1627ec681f3Smrg               OpReturn
1637ec681f3Smrg               OpFunctionEnd
1647ec681f3Smrg   */
1657ec681f3Smrg   static const uint32_t words[] = {
1667ec681f3Smrg      0x07230203, 0x00010300, 0x00070000, 0x0000000e, 0x00000000, 0x00020011,
1677ec681f3Smrg      0x00000001, 0x0006000b, 0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e,
1687ec681f3Smrg      0x00000000, 0x0003000e, 0x00000000, 0x00000001, 0x0005000f, 0x00000005,
1697ec681f3Smrg      0x00000002, 0x6e69616d, 0x00000000, 0x00060010, 0x00000002, 0x00000011,
1707ec681f3Smrg      0x00000001, 0x00000001, 0x00000001, 0x00050048, 0x00000003, 0x00000000,
1717ec681f3Smrg      0x00000023, 0x00000000, 0x00030047, 0x00000003, 0x00000003, 0x00040047,
1727ec681f3Smrg      0x00000004, 0x00000022, 0x00000000, 0x00040047, 0x00000004, 0x00000021,
1737ec681f3Smrg      0x00000000, 0x00020013, 0x00000005, 0x00030021, 0x00000006, 0x00000005,
1747ec681f3Smrg      0x00040015, 0x00000007, 0x00000020, 0x00000000, 0x0003001e, 0x00000003,
1757ec681f3Smrg      0x00000007, 0x00040020, 0x00000008, 0x00000002, 0x00000003, 0x0004003b,
1767ec681f3Smrg      0x00000008, 0x00000004, 0x00000002, 0x00040015, 0x00000009, 0x00000020,
1777ec681f3Smrg      0x00000001, 0x0004002b, 0x00000009, 0x0000000a, 0x00000000, 0x00040020,
1787ec681f3Smrg      0x0000000b, 0x00000002, 0x00000007, 0x00050036, 0x00000005, 0x00000002,
1797ec681f3Smrg      0x00000000, 0x00000006, 0x000200f8, 0x0000000c, 0x00050041, 0x0000000b,
1807ec681f3Smrg      0x0000000d, 0x00000004, 0x0000000a, 0x0004003f, 0x0000000d, 0x0000000d,
1817ec681f3Smrg      0x00000001, 0x000100fd, 0x00010038,
1827ec681f3Smrg   };
1837ec681f3Smrg
1847ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
1857ec681f3Smrg
1867ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_load_deref);
1877ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
1887ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
1897ec681f3Smrg
1907ec681f3Smrg   intrinsic = find_intrinsic(nir_intrinsic_store_deref);
1917ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
1927ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
1937ec681f3Smrg}
1947ec681f3Smrg
1957ec681f3SmrgTEST_F(spirv_test, opcopymemory_volatile_target)
1967ec681f3Smrg{
1977ec681f3Smrg   /*
1987ec681f3Smrg               OpCapability Shader
1997ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
2007ec681f3Smrg               OpMemoryModel Logical GLSL450
2017ec681f3Smrg               OpEntryPoint GLCompute %4 "main" %9
2027ec681f3Smrg               OpExecutionMode %4 LocalSize 1 1 1
2037ec681f3Smrg               OpMemberDecorate %_struct_7 0 Offset 0
2047ec681f3Smrg               OpDecorate %_struct_7 Block
2057ec681f3Smrg               OpDecorate %9 DescriptorSet 0
2067ec681f3Smrg               OpDecorate %9 Binding 0
2077ec681f3Smrg       %void = OpTypeVoid
2087ec681f3Smrg          %3 = OpTypeFunction %void
2097ec681f3Smrg       %uint = OpTypeInt 32 0
2107ec681f3Smrg  %_struct_7 = OpTypeStruct %uint
2117ec681f3Smrg%_ptr_StorageBuffer__struct_7 = OpTypePointer StorageBuffer %_struct_7
2127ec681f3Smrg          %9 = OpVariable %_ptr_StorageBuffer__struct_7 StorageBuffer
2137ec681f3Smrg        %int = OpTypeInt 32 1
2147ec681f3Smrg      %int_0 = OpConstant %int 0
2157ec681f3Smrg%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
2167ec681f3Smrg          %4 = OpFunction %void None %3
2177ec681f3Smrg          %5 = OpLabel
2187ec681f3Smrg         %13 = OpAccessChain %_ptr_StorageBuffer_uint %9 %int_0
2197ec681f3Smrg               OpCopyMemory %13 %13 Volatile None
2207ec681f3Smrg               OpReturn
2217ec681f3Smrg               OpFunctionEnd
2227ec681f3Smrg   */
2237ec681f3Smrg   static const uint32_t words[] = {
2247ec681f3Smrg      0x07230203, 0x00010500, 0x00070000, 0x0000000e, 0x00000000, 0x00020011,
2257ec681f3Smrg      0x00000001, 0x0006000b, 0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e,
2267ec681f3Smrg      0x00000000, 0x0003000e, 0x00000000, 0x00000001, 0x0006000f, 0x00000005,
2277ec681f3Smrg      0x00000002, 0x6e69616d, 0x00000000, 0x00000003, 0x00060010, 0x00000002,
2287ec681f3Smrg      0x00000011, 0x00000001, 0x00000001, 0x00000001, 0x00050048, 0x00000004,
2297ec681f3Smrg      0x00000000, 0x00000023, 0x00000000, 0x00030047, 0x00000004, 0x00000002,
2307ec681f3Smrg      0x00040047, 0x00000003, 0x00000022, 0x00000000, 0x00040047, 0x00000003,
2317ec681f3Smrg      0x00000021, 0x00000000, 0x00020013, 0x00000005, 0x00030021, 0x00000006,
2327ec681f3Smrg      0x00000005, 0x00040015, 0x00000007, 0x00000020, 0x00000000, 0x0003001e,
2337ec681f3Smrg      0x00000004, 0x00000007, 0x00040020, 0x00000008, 0x0000000c, 0x00000004,
2347ec681f3Smrg      0x0004003b, 0x00000008, 0x00000003, 0x0000000c, 0x00040015, 0x00000009,
2357ec681f3Smrg      0x00000020, 0x00000001, 0x0004002b, 0x00000009, 0x0000000a, 0x00000000,
2367ec681f3Smrg      0x00040020, 0x0000000b, 0x0000000c, 0x00000007, 0x00050036, 0x00000005,
2377ec681f3Smrg      0x00000002, 0x00000000, 0x00000006, 0x000200f8, 0x0000000c, 0x00050041,
2387ec681f3Smrg      0x0000000b, 0x0000000d, 0x00000003, 0x0000000a, 0x0005003f, 0x0000000d,
2397ec681f3Smrg      0x0000000d, 0x00000001, 0x00000000, 0x000100fd, 0x00010038,
2407ec681f3Smrg   };
2417ec681f3Smrg
2427ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
2437ec681f3Smrg
2447ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_load_deref);
2457ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
2467ec681f3Smrg   EXPECT_EQ(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
2477ec681f3Smrg
2487ec681f3Smrg   intrinsic = find_intrinsic(nir_intrinsic_store_deref);
2497ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
2507ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
2517ec681f3Smrg}
2527ec681f3Smrg
2537ec681f3SmrgTEST_F(spirv_test, opcopymemory_volatile_source)
2547ec681f3Smrg{
2557ec681f3Smrg   /*
2567ec681f3Smrg               OpCapability Shader
2577ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
2587ec681f3Smrg               OpMemoryModel Logical GLSL450
2597ec681f3Smrg               OpEntryPoint GLCompute %4 "main" %9
2607ec681f3Smrg               OpExecutionMode %4 LocalSize 1 1 1
2617ec681f3Smrg               OpMemberDecorate %_struct_7 0 Offset 0
2627ec681f3Smrg               OpDecorate %_struct_7 Block
2637ec681f3Smrg               OpDecorate %9 DescriptorSet 0
2647ec681f3Smrg               OpDecorate %9 Binding 0
2657ec681f3Smrg       %void = OpTypeVoid
2667ec681f3Smrg          %3 = OpTypeFunction %void
2677ec681f3Smrg       %uint = OpTypeInt 32 0
2687ec681f3Smrg  %_struct_7 = OpTypeStruct %uint
2697ec681f3Smrg%_ptr_StorageBuffer__struct_7 = OpTypePointer StorageBuffer %_struct_7
2707ec681f3Smrg          %9 = OpVariable %_ptr_StorageBuffer__struct_7 StorageBuffer
2717ec681f3Smrg        %int = OpTypeInt 32 1
2727ec681f3Smrg      %int_0 = OpConstant %int 0
2737ec681f3Smrg%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
2747ec681f3Smrg          %4 = OpFunction %void None %3
2757ec681f3Smrg          %5 = OpLabel
2767ec681f3Smrg         %13 = OpAccessChain %_ptr_StorageBuffer_uint %9 %int_0
2777ec681f3Smrg               OpCopyMemory %13 %13 None Volatile
2787ec681f3Smrg               OpReturn
2797ec681f3Smrg               OpFunctionEnd
2807ec681f3Smrg   */
2817ec681f3Smrg   static const uint32_t words[] = {
2827ec681f3Smrg      0x07230203, 0x00010500, 0x00070000, 0x0000000e, 0x00000000, 0x00020011,
2837ec681f3Smrg      0x00000001, 0x0006000b, 0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e,
2847ec681f3Smrg      0x00000000, 0x0003000e, 0x00000000, 0x00000001, 0x0006000f, 0x00000005,
2857ec681f3Smrg      0x00000002, 0x6e69616d, 0x00000000, 0x00000003, 0x00060010, 0x00000002,
2867ec681f3Smrg      0x00000011, 0x00000001, 0x00000001, 0x00000001, 0x00050048, 0x00000004,
2877ec681f3Smrg      0x00000000, 0x00000023, 0x00000000, 0x00030047, 0x00000004, 0x00000002,
2887ec681f3Smrg      0x00040047, 0x00000003, 0x00000022, 0x00000000, 0x00040047, 0x00000003,
2897ec681f3Smrg      0x00000021, 0x00000000, 0x00020013, 0x00000005, 0x00030021, 0x00000006,
2907ec681f3Smrg      0x00000005, 0x00040015, 0x00000007, 0x00000020, 0x00000000, 0x0003001e,
2917ec681f3Smrg      0x00000004, 0x00000007, 0x00040020, 0x00000008, 0x0000000c, 0x00000004,
2927ec681f3Smrg      0x0004003b, 0x00000008, 0x00000003, 0x0000000c, 0x00040015, 0x00000009,
2937ec681f3Smrg      0x00000020, 0x00000001, 0x0004002b, 0x00000009, 0x0000000a, 0x00000000,
2947ec681f3Smrg      0x00040020, 0x0000000b, 0x0000000c, 0x00000007, 0x00050036, 0x00000005,
2957ec681f3Smrg      0x00000002, 0x00000000, 0x00000006, 0x000200f8, 0x0000000c, 0x00050041,
2967ec681f3Smrg      0x0000000b, 0x0000000d, 0x00000003, 0x0000000a, 0x0005003f, 0x0000000d,
2977ec681f3Smrg      0x0000000d, 0x00000000, 0x00000001, 0x000100fd, 0x00010038,
2987ec681f3Smrg   };
2997ec681f3Smrg
3007ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
3017ec681f3Smrg
3027ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_load_deref);
3037ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
3047ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
3057ec681f3Smrg
3067ec681f3Smrg   intrinsic = find_intrinsic(nir_intrinsic_store_deref);
3077ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
3087ec681f3Smrg   EXPECT_EQ(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
3097ec681f3Smrg}
3107ec681f3Smrg
3117ec681f3SmrgTEST_F(spirv_test, opimageread_volatile)
3127ec681f3Smrg{
3137ec681f3Smrg   /*
3147ec681f3Smrg               OpCapability Shader
3157ec681f3Smrg               OpCapability VulkanMemoryModel
3167ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
3177ec681f3Smrg               OpMemoryModel Logical Vulkan
3187ec681f3Smrg               OpEntryPoint GLCompute %4 "main" %9
3197ec681f3Smrg               OpExecutionMode %4 LocalSize 1 1 1
3207ec681f3Smrg               OpDecorate %9 DescriptorSet 0
3217ec681f3Smrg               OpDecorate %9 Binding 1
3227ec681f3Smrg       %void = OpTypeVoid
3237ec681f3Smrg          %3 = OpTypeFunction %void
3247ec681f3Smrg       %uint = OpTypeInt 32 0
3257ec681f3Smrg          %7 = OpTypeImage %uint 2D 0 0 0 2 R32ui
3267ec681f3Smrg%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
3277ec681f3Smrg          %9 = OpVariable %_ptr_UniformConstant_7 UniformConstant
3287ec681f3Smrg        %int = OpTypeInt 32 1
3297ec681f3Smrg      %v2int = OpTypeVector %int 2
3307ec681f3Smrg      %int_0 = OpConstant %int 0
3317ec681f3Smrg         %14 = OpConstantComposite %v2int %int_0 %int_0
3327ec681f3Smrg     %v4uint = OpTypeVector %uint 4
3337ec681f3Smrg     %v3uint = OpTypeVector %uint 3
3347ec681f3Smrg     %uint_1 = OpConstant %uint 1
3357ec681f3Smrg          %4 = OpFunction %void None %3
3367ec681f3Smrg          %5 = OpLabel
3377ec681f3Smrg         %10 = OpLoad %7 %9
3387ec681f3Smrg         %15 = OpLoad %7 %9
3397ec681f3Smrg         %17 = OpImageRead %v4uint %15 %14 VolatileTexel
3407ec681f3Smrg               OpImageWrite %10 %14 %17
3417ec681f3Smrg               OpReturn
3427ec681f3Smrg               OpFunctionEnd
3437ec681f3Smrg   */
3447ec681f3Smrg   static const uint32_t words[] = {
3457ec681f3Smrg      0x07230203, 0x00010500, 0x00070000, 0x00000014, 0x00000000, 0x00020011,
3467ec681f3Smrg      0x00000001, 0x00020011, 0x000014e1, 0x0006000b, 0x00000001, 0x4c534c47,
3477ec681f3Smrg      0x6474732e, 0x3035342e, 0x00000000, 0x0003000e, 0x00000000, 0x00000003,
3487ec681f3Smrg      0x0006000f, 0x00000005, 0x00000002, 0x6e69616d, 0x00000000, 0x00000003,
3497ec681f3Smrg      0x00060010, 0x00000002, 0x00000011, 0x00000001, 0x00000001, 0x00000001,
3507ec681f3Smrg      0x00040047, 0x00000003, 0x00000022, 0x00000000, 0x00040047, 0x00000003,
3517ec681f3Smrg      0x00000021, 0x00000001, 0x00020013, 0x00000004, 0x00030021, 0x00000005,
3527ec681f3Smrg      0x00000004, 0x00040015, 0x00000006, 0x00000020, 0x00000000, 0x00090019,
3537ec681f3Smrg      0x00000007, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
3547ec681f3Smrg      0x00000002, 0x00000021, 0x00040020, 0x00000008, 0x00000000, 0x00000007,
3557ec681f3Smrg      0x0004003b, 0x00000008, 0x00000003, 0x00000000, 0x00040015, 0x00000009,
3567ec681f3Smrg      0x00000020, 0x00000001, 0x00040017, 0x0000000a, 0x00000009, 0x00000002,
3577ec681f3Smrg      0x0004002b, 0x00000009, 0x0000000b, 0x00000000, 0x0005002c, 0x0000000a,
3587ec681f3Smrg      0x0000000c, 0x0000000b, 0x0000000b, 0x00040017, 0x0000000d, 0x00000006,
3597ec681f3Smrg      0x00000004, 0x00040017, 0x0000000e, 0x00000006, 0x00000003, 0x0004002b,
3607ec681f3Smrg      0x00000006, 0x0000000f, 0x00000001, 0x00050036, 0x00000004, 0x00000002,
3617ec681f3Smrg      0x00000000, 0x00000005, 0x000200f8, 0x00000010, 0x0004003d, 0x00000007,
3627ec681f3Smrg      0x00000011, 0x00000003, 0x0004003d, 0x00000007, 0x00000012, 0x00000003,
3637ec681f3Smrg      0x00060062, 0x0000000d, 0x00000013, 0x00000012, 0x0000000c, 0x00000800,
3647ec681f3Smrg      0x00040063, 0x00000011, 0x0000000c, 0x00000013, 0x000100fd, 0x00010038,
3657ec681f3Smrg   };
3667ec681f3Smrg
3677ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
3687ec681f3Smrg
3697ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_image_deref_load, 0);
3707ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
3717ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
3727ec681f3Smrg}
3737ec681f3Smrg
3747ec681f3SmrgTEST_F(spirv_test, opimagewrite_volatile)
3757ec681f3Smrg{
3767ec681f3Smrg   /*
3777ec681f3Smrg               OpCapability Shader
3787ec681f3Smrg               OpCapability VulkanMemoryModel
3797ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
3807ec681f3Smrg               OpMemoryModel Logical Vulkan
3817ec681f3Smrg               OpEntryPoint GLCompute %4 "main" %9
3827ec681f3Smrg               OpExecutionMode %4 LocalSize 1 1 1
3837ec681f3Smrg               OpDecorate %9 DescriptorSet 0
3847ec681f3Smrg               OpDecorate %9 Binding 1
3857ec681f3Smrg       %void = OpTypeVoid
3867ec681f3Smrg          %3 = OpTypeFunction %void
3877ec681f3Smrg       %uint = OpTypeInt 32 0
3887ec681f3Smrg          %7 = OpTypeImage %uint 2D 0 0 0 2 R32ui
3897ec681f3Smrg%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
3907ec681f3Smrg          %9 = OpVariable %_ptr_UniformConstant_7 UniformConstant
3917ec681f3Smrg        %int = OpTypeInt 32 1
3927ec681f3Smrg      %v2int = OpTypeVector %int 2
3937ec681f3Smrg      %int_0 = OpConstant %int 0
3947ec681f3Smrg         %14 = OpConstantComposite %v2int %int_0 %int_0
3957ec681f3Smrg     %v4uint = OpTypeVector %uint 4
3967ec681f3Smrg     %v3uint = OpTypeVector %uint 3
3977ec681f3Smrg     %uint_1 = OpConstant %uint 1
3987ec681f3Smrg          %4 = OpFunction %void None %3
3997ec681f3Smrg          %5 = OpLabel
4007ec681f3Smrg         %10 = OpLoad %7 %9
4017ec681f3Smrg         %15 = OpLoad %7 %9
4027ec681f3Smrg         %17 = OpImageRead %v4uint %15 %14
4037ec681f3Smrg               OpImageWrite %10 %14 %17 VolatileTexel
4047ec681f3Smrg               OpReturn
4057ec681f3Smrg               OpFunctionEnd
4067ec681f3Smrg   */
4077ec681f3Smrg   static const uint32_t words[] = {
4087ec681f3Smrg      0x07230203, 0x00010500, 0x00070000, 0x00000014, 0x00000000, 0x00020011,
4097ec681f3Smrg      0x00000001, 0x00020011, 0x000014e1, 0x0006000b, 0x00000001, 0x4c534c47,
4107ec681f3Smrg      0x6474732e, 0x3035342e, 0x00000000, 0x0003000e, 0x00000000, 0x00000003,
4117ec681f3Smrg      0x0006000f, 0x00000005, 0x00000002, 0x6e69616d, 0x00000000, 0x00000003,
4127ec681f3Smrg      0x00060010, 0x00000002, 0x00000011, 0x00000001, 0x00000001, 0x00000001,
4137ec681f3Smrg      0x00040047, 0x00000003, 0x00000022, 0x00000000, 0x00040047, 0x00000003,
4147ec681f3Smrg      0x00000021, 0x00000001, 0x00020013, 0x00000004, 0x00030021, 0x00000005,
4157ec681f3Smrg      0x00000004, 0x00040015, 0x00000006, 0x00000020, 0x00000000, 0x00090019,
4167ec681f3Smrg      0x00000007, 0x00000006, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4177ec681f3Smrg      0x00000002, 0x00000021, 0x00040020, 0x00000008, 0x00000000, 0x00000007,
4187ec681f3Smrg      0x0004003b, 0x00000008, 0x00000003, 0x00000000, 0x00040015, 0x00000009,
4197ec681f3Smrg      0x00000020, 0x00000001, 0x00040017, 0x0000000a, 0x00000009, 0x00000002,
4207ec681f3Smrg      0x0004002b, 0x00000009, 0x0000000b, 0x00000000, 0x0005002c, 0x0000000a,
4217ec681f3Smrg      0x0000000c, 0x0000000b, 0x0000000b, 0x00040017, 0x0000000d, 0x00000006,
4227ec681f3Smrg      0x00000004, 0x00040017, 0x0000000e, 0x00000006, 0x00000003, 0x0004002b,
4237ec681f3Smrg      0x00000006, 0x0000000f, 0x00000001, 0x00050036, 0x00000004, 0x00000002,
4247ec681f3Smrg      0x00000000, 0x00000005, 0x000200f8, 0x00000010, 0x0004003d, 0x00000007,
4257ec681f3Smrg      0x00000011, 0x00000003, 0x0004003d, 0x00000007, 0x00000012, 0x00000003,
4267ec681f3Smrg      0x00050062, 0x0000000d, 0x00000013, 0x00000012, 0x0000000c, 0x00050063,
4277ec681f3Smrg      0x00000011, 0x0000000c, 0x00000013, 0x00000800, 0x000100fd, 0x00010038,
4287ec681f3Smrg   };
4297ec681f3Smrg
4307ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
4317ec681f3Smrg
4327ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_image_deref_store, 0);
4337ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
4347ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
4357ec681f3Smrg}
4367ec681f3Smrg
4377ec681f3SmrgTEST_F(spirv_test, opatomicload_image_volatile)
4387ec681f3Smrg{
4397ec681f3Smrg   /*
4407ec681f3Smrg               OpCapability Shader
4417ec681f3Smrg               OpCapability VulkanMemoryModel
4427ec681f3Smrg               OpCapability VulkanMemoryModelDeviceScope
4437ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
4447ec681f3Smrg               OpMemoryModel Logical Vulkan
4457ec681f3Smrg               OpEntryPoint GLCompute %2 "main" %3
4467ec681f3Smrg               OpExecutionMode %2 LocalSize 1 1 1
4477ec681f3Smrg               OpDecorate %3 DescriptorSet 0
4487ec681f3Smrg               OpDecorate %3 Binding 1
4497ec681f3Smrg       %void = OpTypeVoid
4507ec681f3Smrg          %7 = OpTypeFunction %void
4517ec681f3Smrg       %uint = OpTypeInt 32 0
4527ec681f3Smrg         %10 = OpTypeImage %uint 2D 0 0 0 2 R32ui
4537ec681f3Smrg%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10
4547ec681f3Smrg          %3 = OpVariable %_ptr_UniformConstant_10 UniformConstant
4557ec681f3Smrg        %int = OpTypeInt 32 1
4567ec681f3Smrg      %v2int = OpTypeVector %int 2
4577ec681f3Smrg      %int_0 = OpConstant %int 0
4587ec681f3Smrg         %15 = OpConstantComposite %v2int %int_0 %int_0
4597ec681f3Smrg      %int_1 = OpConstant %int 1
4607ec681f3Smrg     %uint_0 = OpConstant %uint 0
4617ec681f3Smrg%_ptr_Image_uint = OpTypePointer Image %uint
4627ec681f3Smrg     %uint_1 = OpConstant %uint 1
4637ec681f3Smrg  %uint_2048 = OpConstant %uint 2048
4647ec681f3Smrg %uint_34816 = OpConstant %uint 34816
4657ec681f3Smrg     %v3uint = OpTypeVector %uint 3
4667ec681f3Smrg          %2 = OpFunction %void None %7
4677ec681f3Smrg         %29 = OpLabel
4687ec681f3Smrg         %30 = OpImageTexelPointer %_ptr_Image_uint %3 %15 %uint_0
4697ec681f3Smrg         %31 = OpAtomicLoad %uint %30 %int_1 %uint_34816
4707ec681f3Smrg               OpAtomicStore %30 %int_1 %uint_2048 %31
4717ec681f3Smrg               OpReturn
4727ec681f3Smrg               OpFunctionEnd
4737ec681f3Smrg   */
4747ec681f3Smrg   static const uint32_t words[] = {
4757ec681f3Smrg      0x07230203, 0x00010500, 0x00070000, 0x00000017, 0x00000000, 0x00020011,
4767ec681f3Smrg      0x00000001, 0x00020011, 0x000014e1, 0x00020011, 0x000014e2, 0x0006000b,
4777ec681f3Smrg      0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, 0x00000000, 0x0003000e,
4787ec681f3Smrg      0x00000000, 0x00000003, 0x0006000f, 0x00000005, 0x00000002, 0x6e69616d,
4797ec681f3Smrg      0x00000000, 0x00000003, 0x00060010, 0x00000002, 0x00000011, 0x00000001,
4807ec681f3Smrg      0x00000001, 0x00000001, 0x00040047, 0x00000003, 0x00000022, 0x00000000,
4817ec681f3Smrg      0x00040047, 0x00000003, 0x00000021, 0x00000001, 0x00020013, 0x00000004,
4827ec681f3Smrg      0x00030021, 0x00000005, 0x00000004, 0x00040015, 0x00000006, 0x00000020,
4837ec681f3Smrg      0x00000000, 0x00090019, 0x00000007, 0x00000006, 0x00000001, 0x00000000,
4847ec681f3Smrg      0x00000000, 0x00000000, 0x00000002, 0x00000021, 0x00040020, 0x00000008,
4857ec681f3Smrg      0x00000000, 0x00000007, 0x0004003b, 0x00000008, 0x00000003, 0x00000000,
4867ec681f3Smrg      0x00040015, 0x00000009, 0x00000020, 0x00000001, 0x00040017, 0x0000000a,
4877ec681f3Smrg      0x00000009, 0x00000002, 0x0004002b, 0x00000009, 0x0000000b, 0x00000000,
4887ec681f3Smrg      0x0005002c, 0x0000000a, 0x0000000c, 0x0000000b, 0x0000000b, 0x0004002b,
4897ec681f3Smrg      0x00000009, 0x0000000d, 0x00000001, 0x0004002b, 0x00000006, 0x0000000e,
4907ec681f3Smrg      0x00000000, 0x00040020, 0x0000000f, 0x0000000b, 0x00000006, 0x0004002b,
4917ec681f3Smrg      0x00000006, 0x00000010, 0x00000001, 0x0004002b, 0x00000006, 0x00000011,
4927ec681f3Smrg      0x00000800, 0x0004002b, 0x00000006, 0x00000012, 0x00008800, 0x00040017,
4937ec681f3Smrg      0x00000013, 0x00000006, 0x00000003, 0x00050036, 0x00000004, 0x00000002,
4947ec681f3Smrg      0x00000000, 0x00000005, 0x000200f8, 0x00000014, 0x0006003c, 0x0000000f,
4957ec681f3Smrg      0x00000015, 0x00000003, 0x0000000c, 0x0000000e, 0x000600e3, 0x00000006,
4967ec681f3Smrg      0x00000016, 0x00000015, 0x0000000d, 0x00000012, 0x000500e4, 0x00000015,
4977ec681f3Smrg      0x0000000d, 0x00000011, 0x00000016, 0x000100fd, 0x00010038,
4987ec681f3Smrg   };
4997ec681f3Smrg
5007ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
5017ec681f3Smrg
5027ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_image_deref_load, 0);
5037ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
5047ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
5057ec681f3Smrg}
5067ec681f3Smrg
5077ec681f3SmrgTEST_F(spirv_test, opatomicstore_image_volatile)
5087ec681f3Smrg{
5097ec681f3Smrg   /*
5107ec681f3Smrg               OpCapability Shader
5117ec681f3Smrg               OpCapability VulkanMemoryModel
5127ec681f3Smrg               OpCapability VulkanMemoryModelDeviceScope
5137ec681f3Smrg          %1 = OpExtInstImport "GLSL.std.450"
5147ec681f3Smrg               OpMemoryModel Logical Vulkan
5157ec681f3Smrg               OpEntryPoint GLCompute %2 "main" %3
5167ec681f3Smrg               OpExecutionMode %2 LocalSize 1 1 1
5177ec681f3Smrg               OpDecorate %3 DescriptorSet 0
5187ec681f3Smrg               OpDecorate %3 Binding 1
5197ec681f3Smrg       %void = OpTypeVoid
5207ec681f3Smrg          %7 = OpTypeFunction %void
5217ec681f3Smrg       %uint = OpTypeInt 32 0
5227ec681f3Smrg         %10 = OpTypeImage %uint 2D 0 0 0 2 R32ui
5237ec681f3Smrg%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10
5247ec681f3Smrg          %3 = OpVariable %_ptr_UniformConstant_10 UniformConstant
5257ec681f3Smrg        %int = OpTypeInt 32 1
5267ec681f3Smrg      %v2int = OpTypeVector %int 2
5277ec681f3Smrg      %int_0 = OpConstant %int 0
5287ec681f3Smrg         %15 = OpConstantComposite %v2int %int_0 %int_0
5297ec681f3Smrg      %int_1 = OpConstant %int 1
5307ec681f3Smrg     %uint_0 = OpConstant %uint 0
5317ec681f3Smrg%_ptr_Image_uint = OpTypePointer Image %uint
5327ec681f3Smrg     %uint_1 = OpConstant %uint 1
5337ec681f3Smrg  %uint_2048 = OpConstant %uint 2048
5347ec681f3Smrg %uint_34816 = OpConstant %uint 34816
5357ec681f3Smrg     %v3uint = OpTypeVector %uint 3
5367ec681f3Smrg          %2 = OpFunction %void None %7
5377ec681f3Smrg         %29 = OpLabel
5387ec681f3Smrg         %30 = OpImageTexelPointer %_ptr_Image_uint %3 %15 %uint_0
5397ec681f3Smrg         %31 = OpAtomicLoad %uint %30 %int_1 %uint_2048
5407ec681f3Smrg               OpAtomicStore %30 %int_1 %uint_34816 %31
5417ec681f3Smrg               OpReturn
5427ec681f3Smrg               OpFunctionEnd
5437ec681f3Smrg   */
5447ec681f3Smrg   static const uint32_t words[] = {
5457ec681f3Smrg      0x07230203, 0x00010500, 0x00070000, 0x00000017, 0x00000000, 0x00020011,
5467ec681f3Smrg      0x00000001, 0x00020011, 0x000014e1, 0x00020011, 0x000014e2, 0x0006000b,
5477ec681f3Smrg      0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, 0x00000000, 0x0003000e,
5487ec681f3Smrg      0x00000000, 0x00000003, 0x0006000f, 0x00000005, 0x00000002, 0x6e69616d,
5497ec681f3Smrg      0x00000000, 0x00000003, 0x00060010, 0x00000002, 0x00000011, 0x00000001,
5507ec681f3Smrg      0x00000001, 0x00000001, 0x00040047, 0x00000003, 0x00000022, 0x00000000,
5517ec681f3Smrg      0x00040047, 0x00000003, 0x00000021, 0x00000001, 0x00020013, 0x00000004,
5527ec681f3Smrg      0x00030021, 0x00000005, 0x00000004, 0x00040015, 0x00000006, 0x00000020,
5537ec681f3Smrg      0x00000000, 0x00090019, 0x00000007, 0x00000006, 0x00000001, 0x00000000,
5547ec681f3Smrg      0x00000000, 0x00000000, 0x00000002, 0x00000021, 0x00040020, 0x00000008,
5557ec681f3Smrg      0x00000000, 0x00000007, 0x0004003b, 0x00000008, 0x00000003, 0x00000000,
5567ec681f3Smrg      0x00040015, 0x00000009, 0x00000020, 0x00000001, 0x00040017, 0x0000000a,
5577ec681f3Smrg      0x00000009, 0x00000002, 0x0004002b, 0x00000009, 0x0000000b, 0x00000000,
5587ec681f3Smrg      0x0005002c, 0x0000000a, 0x0000000c, 0x0000000b, 0x0000000b, 0x0004002b,
5597ec681f3Smrg      0x00000009, 0x0000000d, 0x00000001, 0x0004002b, 0x00000006, 0x0000000e,
5607ec681f3Smrg      0x00000000, 0x00040020, 0x0000000f, 0x0000000b, 0x00000006, 0x0004002b,
5617ec681f3Smrg      0x00000006, 0x00000010, 0x00000001, 0x0004002b, 0x00000006, 0x00000011,
5627ec681f3Smrg      0x00000800, 0x0004002b, 0x00000006, 0x00000012, 0x00008800, 0x00040017,
5637ec681f3Smrg      0x00000013, 0x00000006, 0x00000003, 0x00050036, 0x00000004, 0x00000002,
5647ec681f3Smrg      0x00000000, 0x00000005, 0x000200f8, 0x00000014, 0x0006003c, 0x0000000f,
5657ec681f3Smrg      0x00000015, 0x00000003, 0x0000000c, 0x0000000e, 0x000600e3, 0x00000006,
5667ec681f3Smrg      0x00000016, 0x00000015, 0x0000000d, 0x00000011, 0x000500e4, 0x00000015,
5677ec681f3Smrg      0x0000000d, 0x00000012, 0x00000016, 0x000100fd, 0x00010038,
5687ec681f3Smrg   };
5697ec681f3Smrg
5707ec681f3Smrg   get_nir(sizeof(words) / sizeof(words[0]), words);
5717ec681f3Smrg
5727ec681f3Smrg   nir_intrinsic_instr *intrinsic = find_intrinsic(nir_intrinsic_image_deref_store, 0);
5737ec681f3Smrg   ASSERT_NE(intrinsic, nullptr);
5747ec681f3Smrg   EXPECT_NE(nir_intrinsic_access(intrinsic) & ACCESS_VOLATILE, 0);
5757ec681f3Smrg}
576