SPIRV-Tools/test
gmitrano-unity 1cecf91701
Support Narrow Types in BitCast Folding Rule (#4941)
* Support Narrow Types in BitCast Folding Rule

This change adds support for narrow types in the BitCastScalarOrVector
folding rule. According to Section 2.2.1 of the SPIR-V spec, types that
are narrower than 32 bits are automatically either sign extended, or
zero extended depending on the type. With that guaranteed, we should
be able to use the first 32-bit word of any narrow type for the folding
logic without performing any special conversions.

In order to reduce code duplication, this change moves the
GetU32BitValue and GetU64BitValue functions from IntConstant to
ScalarConstant. Without this move, we would have needed an identical
version of GetU32BitValue on FloatConstant.

* Add Tests for 16-bit BitCast Folding

This change adds several new test cases to the
IntegerInstructionFoldingTest which trigger the 16-bit BitCast logic.
The logic for half types was also added to the integer case since we
can't easily validate half float types in C++ code. It's easier to
validate them as unsigned integers instead. Pllus this also allows us
to verify the SPIR-V constant sign extension logic too.

* Add 8-Bit Folding Test Cases

This change adds a couple more test cases to the integer instruction
folding test suite in order to ensure that the BitCast logic also
works correctly with the Int8 shader capability.
2022-10-06 10:35:18 -04:00
..
diff spirv-diff: Allow no SpecId (#4904) 2022-09-07 15:14:26 -04:00
fuzz Remove reference to protobuf internals from fuzzers (#4701) 2022-02-10 10:41:24 -05:00
fuzzers Fix opt fuzzer test harness (#4670) 2022-01-07 15:03:29 +00:00
link linker: Recalculate interface variables (#4784) 2022-05-03 13:23:02 +00:00
lint Add divergence analysis to linter (#4465) 2021-08-23 17:03:28 -04:00
opt Support Narrow Types in BitCast Folding Rule (#4941) 2022-10-06 10:35:18 -04:00
reduce Use structural reachability in CFG checks (#4849) 2022-07-06 17:43:32 -04:00
scripts Remove unneeded future imports (#2739) 2019-07-24 15:29:38 -04:00
tools Basic support for SPIR-V 1.6 (#4663) 2021-12-15 14:38:28 -05:00
util Revert "Optimize DefUseManager allocations (#4709)" (#4846) 2022-07-12 13:14:47 -06:00
val spirv-val: Add SPV_ARM_core_builtins validation (#4958) 2022-10-05 22:47:10 -04:00
wasm Add Wasm build (#3752) 2021-11-01 16:45:51 -04:00
assembly_context_test.cpp Add descriptor array scalar replacement (#2742) 2019-08-08 10:53:19 -04:00
assembly_format_test.cpp Assembler: Can't set an ID in instruction without result ID (#2852) 2019-09-11 13:15:25 -04:00
binary_destroy_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
binary_endianness_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
binary_header_get_test.cpp Basic support for SPIR-V 1.6 (#4663) 2021-12-15 14:38:28 -05:00
binary_parse_test.cpp Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
binary_strnlen_s_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
binary_to_text_test.cpp Fix segfault in SpirvTools::Disassemble when printing (#4833) 2022-06-29 12:05:00 -04:00
binary_to_text.literal_test.cpp Fix endianness of string literals (#4622) 2021-12-08 12:01:26 -05:00
c_interface_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
CMakeLists.txt Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
comment_test.cpp Add descriptor array scalar replacement (#2742) 2019-08-08 10:53:19 -04:00
cpp_interface_test.cpp spirv-val: Consistently quote ids in messages (#4950) 2022-09-29 10:03:49 +02:00
diagnostic_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
enum_set_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
enum_string_mapping_test.cpp Add validation for SPV_EXT_shader_atomic_float_min_max (#4105) 2021-03-24 08:49:21 -04:00
ext_inst.cldebug100_test.cpp Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
ext_inst.debuginfo_test.cpp Add descriptor array scalar replacement (#2742) 2019-08-08 10:53:19 -04:00
ext_inst.glsl_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
ext_inst.non_semantic_test.cpp Add support for SPV_KHR_non_semantic_info (#3110) 2019-12-18 18:10:29 -05:00
ext_inst.opencl_test.cpp Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
fix_word_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
generator_magic_number_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
hex_float_test.cpp spirv-as: Avoid overflow when parsing exponents on hex floats (#4874) 2022-07-28 09:40:07 -04:00
immediate_int_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
libspirv_macros_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
log_test.cpp Remove source/message.h (#1838) 2018-08-14 15:41:21 -04:00
name_mapper_test.cpp Add gl_BaseInstance to the name mapper. (#3462) 2020-06-26 11:54:35 -05:00
named_id_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
opcode_make_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
opcode_require_capabilities_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
opcode_split_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
opcode_table_get_test.cpp Favour 'integrity' over 'coherence' as a replacement for 'sanity'. (#3619) 2020-09-10 09:52:21 -04:00
operand_capabilities_test.cpp Implement tool changes for SPV_EXT_mesh_shader. (#4915) 2022-09-01 20:36:15 -04:00
operand_pattern_test.cpp Update test for parsing memory access masks (#4703) 2022-02-09 18:02:19 +00:00
operand_test.cpp Avoid operand type range checks (#3379) 2020-07-27 13:14:03 -04:00
operand-class-test-coverage.csv Fix operand class test coverage table. 2016-09-23 11:58:25 -04:00
parse_number_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
pch_test.cpp Enable precompiled headers for spirv-tools(-shared) and some unit tests (#2026) 2018-11-06 09:26:23 -05:00
pch_test.h Enable precompiled headers for spirv-tools(-shared) and some unit tests (#2026) 2018-11-06 09:26:23 -05:00
preserve_numeric_ids_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
software_version_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
string_utils_test.cpp Move utils/ to spvtools::utils 2018-07-06 16:47:46 -04:00
target_env_test.cpp Vulkan 1.3 (#4686) 2022-01-25 10:36:08 -05:00
test_fixture.h Fix endianness of string literals (#4622) 2021-12-08 12:01:26 -05:00
text_advance_test.cpp spirv-as: Avoid recursion when skipping whitespace (#4866) 2022-07-26 10:56:04 -04:00
text_destroy_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
text_literal_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
text_start_new_inst_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
text_to_binary_test.cpp Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
text_to_binary.annotation_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.barrier_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.composite_test.cpp Support SPIR-V 1.4 (#2550) 2019-05-07 12:27:18 -04:00
text_to_binary.constant_test.cpp Fix round trip tests that weren't instantiated (#3417) 2020-06-10 11:11:46 -04:00
text_to_binary.control_flow_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.debug_test.cpp Add descriptor array scalar replacement (#2742) 2019-08-08 10:53:19 -04:00
text_to_binary.device_side_enqueue_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.extension_test.cpp Add support for SPV_KHR_subgroup_rotate (#4786) 2022-05-05 08:58:05 -04:00
text_to_binary.function_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
text_to_binary.group_test.cpp Remove use of deprecated googletest macro (#2286) 2019-01-29 18:56:52 -05:00
text_to_binary.image_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.literal_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
text_to_binary.memory_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.misc_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
text_to_binary.mode_setting_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.pipe_storage_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.reserved_sampling_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
text_to_binary.subgroup_dispatch_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_to_binary.type_declaration_test.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text_word_get_test.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
timer_test.cpp Remove extra semis (#2717) 2019-07-08 15:07:36 -04:00
unit_spirv.cpp Fix round trip tests that weren't instantiated (#3417) 2020-06-10 11:11:46 -04:00
unit_spirv.h Remove WebGPU support (#4108) 2021-01-14 16:45:18 -05:00