SPIRV-Tools/source
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 Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
link linker: Recalculate interface variables (#4784) 2022-05-03 13:23:02 +00:00
lint spirv-lint: Add lint based on divergence analysis (#4488) 2021-08-27 14:43:23 -04:00
opt Support Narrow Types in BitCast Folding Rule (#4941) 2022-10-06 10:35:18 -04:00
reduce Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
util spirv-as: Avoid overflow when parsing exponents on hex floats (#4874) 2022-07-28 09:40:07 -04:00
val spirv-val: Add SPV_ARM_core_builtins validation (#4958) 2022-10-05 22:47:10 -04:00
wasm Add SPIR-V 1.6 support to wasm build (#4674) 2022-01-13 13:49:35 -05:00
assembly_grammar.cpp spirv-val: Add better error code for invalid operand (#4753) 2022-03-22 15:37:38 -04:00
assembly_grammar.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
binary.cpp Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
binary.h Fix endianness of string literals (#4622) 2021-12-08 12:01:26 -05:00
cfa.h Improve time to build dominators (#4916) 2022-09-02 16:27:10 +00:00
CMakeLists.txt spirv-val: Add initial SPV_EXT_mesh_shader validation (#4924) 2022-09-23 11:06:46 -04:00
common_debug_info.h spirv-opt: Switch from Vulkan.DebugInfo to Shader.DebugInfo (#4493) 2021-09-15 14:38:53 -04:00
diagnostic.cpp fix strncpy bound error (#4331) 2021-06-29 10:07:13 -04:00
diagnostic.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
disassemble.cpp Refactor the disassembler code for reuse (#4616) 2021-12-14 09:46:59 -05:00
disassemble.h Fix segfault in SpirvTools::Disassemble when printing (#4833) 2022-06-29 12:05:00 -04:00
enum_set.h Instrument: Debug Printf support (#3215) 2020-03-12 09:19:52 -04:00
enum_string_mapping.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
enum_string_mapping.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
ext_inst.cpp Vulkan 1.3 (#4686) 2022-01-25 10:36:08 -05:00
ext_inst.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
extensions.cpp Fix endianness of string literals (#4622) 2021-12-08 12:01:26 -05:00
extensions.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
instruction.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
latest_version_glsl_std_450_header.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
latest_version_opencl_std_header.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
latest_version_spirv_header.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
libspirv.cpp Fix segfault in SpirvTools::Disassemble when printing (#4833) 2022-06-29 12:05:00 -04:00
macro.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
name_mapper.cpp Fix endianness of string literals (#4622) 2021-12-08 12:01:26 -05:00
name_mapper.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
opcode.cpp Remove spvOpcodeTerminatesExecution (#4931) 2022-09-21 16:10:58 -04:00
opcode.h Remove spvOpcodeTerminatesExecution (#4931) 2022-09-21 16:10:58 -04:00
operand.cpp spirv-val: Add better error code for invalid operand (#4753) 2022-03-22 15:37:38 -04:00
operand.h Handle conflict between debug info and existing validation rule (#3104) 2020-01-23 17:04:30 -05:00
parsed_operand.cpp Introduce spirv-diff (#4611) 2022-02-02 10:33:18 -05:00
parsed_operand.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
pch_source.cpp Enable precompiled headers for spirv-tools(-shared) and some unit tests (#2026) 2018-11-06 09:26:23 -05:00
pch_source.h Enable precompiled headers for spirv-tools(-shared) and some unit tests (#2026) 2018-11-06 09:26:23 -05:00
print.cpp Support building on OpenBSD (#4912) 2022-09-02 19:30:09 +00:00
print.h Rewrite include guards (#1793) 2018-08-03 08:05:33 -04:00
software_version.cpp Add missing function parameters in libspirv.h 2018-04-03 10:10:43 -04:00
spirv_constant.h Fix Linker generator ID (#4601) 2021-10-29 10:32:41 -04:00
spirv_definition.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
spirv_endian.cpp Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00
spirv_endian.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
spirv_fuzzer_options.cpp spirv-fuzz: Add pass recommendations (#3757) 2020-09-18 15:51:35 +01:00
spirv_fuzzer_options.h spirv-fuzz: Add pass recommendations (#3757) 2020-09-18 15:51:35 +01:00
spirv_optimizer_options.cpp Add —preserve-bindings and —preserve-spec-constants (#2693) 2019-07-10 14:12:19 -04:00
spirv_optimizer_options.h Add —preserve-bindings and —preserve-spec-constants (#2693) 2019-07-10 14:12:19 -04:00
spirv_reducer_options.cpp spirv-reduce: Support reducing a specific function (#3774) 2020-09-11 06:29:43 +01:00
spirv_reducer_options.h spirv-reduce: Support reducing a specific function (#3774) 2020-09-11 06:29:43 +01:00
spirv_target_env.cpp Vulkan 1.3 (#4686) 2022-01-25 10:36:08 -05:00
spirv_target_env.h Fix various source comment (doxygen) typos (#4680) 2022-01-26 15:13:08 -05:00
spirv_validator_options.cpp spirv-val: Add an option to use friendly names or not (#4951) 2022-09-30 12:22:00 -04:00
spirv_validator_options.h spirv-val: Add an option to use friendly names or not (#4951) 2022-09-30 12:22:00 -04:00
table.cpp Vulkan 1.3 (#4686) 2022-01-25 10:36:08 -05:00
table.h Use last version (#2578) 2019-05-10 11:02:01 -04:00
text_handler.cpp spirv-as: Avoid recursion when skipping whitespace (#4866) 2022-07-26 10:56:04 -04:00
text_handler.h Remove source/message.h (#1838) 2018-08-14 15:41:21 -04:00
text.cpp spirv-as: Add opcode name when possible (#4757) 2022-03-28 14:46:39 +00:00
text.h Cleanup includes. (#1795) 2018-08-03 15:06:09 -04:00