llvm-project/llvm/lib
Hiroshi Inoue 33486787cb [PowerPC] fix incorrect vectorization of abs() on POWER9
Vectorized loops with abs() returns incorrect results on POWER9. This patch fixes it.
For example the following code returns negative result if input values are negative though it sums up the absolute value of the inputs.

int vpx_satd_c(const int16_t *coeff, int length) {
  int satd = 0;
  for (int i = 0; i < length; ++i) satd += abs(coeff[i]);
  return satd;
}

This problem causes test failures for libvpx.
For vector absolute and vector absolute difference on POWER9, LLVM generates VABSDUW (Vector Absolute Difference Unsigned Word) instruction or variants.
Since these instructions are for unsigned integers, we need adjustment for signed integers.
For abs(sub(a, b)), we generate VABSDUW(a+0x80000000, b+0x80000000). Otherwise, abs(sub(-1, 0)) returns 0xFFFFFFFF(=-1) instead of 1. For abs(a), we generate VABSDUW(a+0x80000000, 0x80000000).

Differential Revision: https://reviews.llvm.org/D45522

llvm-svn: 330497
2018-04-21 09:32:17 +00:00
..
Analysis [BasicAA] Return MayAlias for the pointer plus variable offset to 2018-04-16 01:58:39 +00:00
AsmParser Add the ShadowCallStack attribute 2018-04-03 20:10:40 +00:00
BinaryFormat Fix build broken by r328090 2018-03-21 12:18:03 +00:00
Bitcode [IR] Upgrade comment token in objc retain release marker for asm call 2018-04-17 04:02:24 +00:00
CodeGen [AArch64] Don't crash trying to resolve __stack_chk_guard. 2018-04-21 00:07:46 +00:00
DebugInfo [LLD/PDB] Emit first section contribution for DBI Module Descriptor. 2018-04-20 18:00:46 +00:00
Demangle [demangler] Add a partial demangling API for LLDB. 2018-04-12 20:41:38 +00:00
ExecutionEngine [ORC] Fix an assertion condition from r329934. 2018-04-19 19:30:35 +00:00
FuzzMutate [llvm-opt-fuzzer] Add irce to the fuzzing options 2018-03-20 11:32:13 +00:00
Fuzzer
IR Lowering x86 adds/addus/subs/subus intrinsics (llvm part) 2018-04-19 12:13:30 +00:00
IRReader LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
LTO [LTO] Add stats-file option to LTO/Config.h. 2018-04-20 10:18:36 +00:00
LineEditor
Linker [ThinLTO] Recommit of import global variables 2018-03-12 10:30:50 +00:00
MC [WebAssembly] Enabled -triple=wasm32-unknown-unknown-wasm path using ELF directive parser. 2018-04-19 22:00:53 +00:00
Object [WebAssembly] Distinguish debug/symbol names in the Wasm structs. NFC 2018-04-20 17:07:24 +00:00
ObjectYAML [ObjectYAML] Add ability for DWARFYAML to calculate DIE lengths 2018-04-20 12:33:49 +00:00
Option [NFC] Replace iterators in PrintHelp with range-based for 2018-03-12 18:31:07 +00:00
Passes Re-land r329273: [Plugins] Add a slim plugin API to work together with the new PM 2018-04-05 15:04:13 +00:00
ProfileData [ProfileData] Change std::sort to llvm::sort in response to r327219 2018-04-13 19:46:36 +00:00
Support [X86] WaitPKG instructions 2018-04-20 18:42:47 +00:00
TableGen [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
Target [PowerPC] fix incorrect vectorization of abs() on POWER9 2018-04-21 09:32:17 +00:00
Testing [LLVMTestingSupport] Add explicit linkage to LLVMSupport 2018-04-08 06:49:17 +00:00
ToolDrivers [COFF] Keep the underscore on exported decorated stdcall functions in MSVC mode 2018-01-20 11:44:32 +00:00
Transforms [ObjCARC] Take BlockColors by const reference. NFC 2018-04-20 22:14:45 +00:00
WindowsManifest Convert line endings of lib/WindowsManifest/CMakeLists.txt to unix. 2018-04-07 04:28:08 +00:00
XRay [XRay] clarify error messages when parsing broken traces 2018-01-30 13:41:34 +00:00
CMakeLists.txt
LLVMBuild.txt