1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/test
Cong Hou 6fe6cafdd5 [X86][SSE] Detect AVG pattern during instruction combine for SSE2/AVX2/AVX512BW.
This patch detects the AVG pattern in vectorized code, which is simply
c = (a + b + 1) / 2, where a, b, and c have the same type which are vectors of
either unsigned i8 or unsigned i16. In the IR, i8/i16 will be promoted to
i32 before any arithmetic operations. The following IR shows such an example:

%1 = zext <N x i8> %a to <N x i32>
%2 = zext <N x i8> %b to <N x i32>
%3 = add nuw nsw <N x i32> %1, <i32 1 x N>
%4 = add nuw nsw <N x i32> %3, %2
%5 = lshr <N x i32> %N, <i32 1 x N>
%6 = trunc <N x i32> %5 to <N x i8>

and with this patch it will be converted to a X86ISD::AVG instruction.

The pattern recognition is done when combining instructions just before type
legalization during instruction selection. We do it here because after type
legalization, it is much more difficult to do pattern recognition based
on many instructions that are doing type conversions. Therefore, for
target-specific instructions (like X86ISD::AVG), we need to take care of type
legalization by ourselves. However, as X86ISD::AVG behaves similarly to
ISD::ADD, I am wondering if there is a way to legalize operands and result
types of X86ISD::AVG together with ISD::ADD. It seems that the current design
doesn't support this idea.

Tests are added for SSE2, AVX2, and AVX512BW and both i8 and i16 types of
variant vector sizes.


Differential revision: http://reviews.llvm.org/D14761

llvm-svn: 253952
2015-11-24 05:44:19 +00:00
..
Analysis Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
Assembler [IR] Add support for empty tokens 2015-11-11 21:57:16 +00:00
Bindings Disable Go bindings test with MSan, it has tons of linker errors 2015-11-19 00:05:20 +00:00
Bitcode Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
BugPoint [bugpoint] Add a named metadata (+their operands) reducer 2015-11-06 00:12:50 +00:00
CodeGen [X86][SSE] Detect AVG pattern during instruction combine for SSE2/AVX2/AVX512BW. 2015-11-24 05:44:19 +00:00
DebugInfo Removing specific target from the generic test 2015-11-19 12:24:47 +00:00
Examples
ExecutionEngine [RuntimeDyld] Don't allocate unnecessary stub buffer space 2015-11-23 21:47:51 +00:00
Feature [FunctionAttrs] Add handling for operand bundles 2015-11-07 01:56:00 +00:00
FileCheck
Instrumentation Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
Integer
JitListener DI: Reverse direction of subprogram -> function edge. 2015-11-05 22:03:56 +00:00
LibDriver
Linker Have a single way for creating unique value names. 2015-11-22 00:16:24 +00:00
LTO [LTO] Add options to llvm-lto to select output format and dump merged module 2015-11-20 00:13:05 +00:00
MC [mips] .ent and .end should also set the type and size of the symbol respectively. 2015-11-23 16:08:03 +00:00
Object Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
Other Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
SymbolRewriter
TableGen Revert r253923. 2015-11-23 22:19:57 +00:00
tools [PGO] Add --text option for llvm-profdata show|merge commands 2015-11-23 20:47:38 +00:00
Transforms SamplePGO - Add coverage tracking for samples. 2015-11-23 20:12:21 +00:00
Unit
Verifier Revert "Change memcpy/memset/memmove to have dest and source alignments." 2015-11-19 05:56:52 +00:00
YAMLParser
.clang-format
CMakeLists.txt sancov test suite 2015-11-12 19:34:21 +00:00
lit.cfg Disable Go bindings test with MSan, it has tons of linker errors 2015-11-19 00:05:20 +00:00
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh