Go to file
QingShan Zhang 11de0e71b0 [DAGCombine] Match a pattern where a wide type scalar value is stored by several narrow stores
This opportunity is found from spec 2017 557.xz_r. And it is used by the sha encrypt/decrypt. See sha-2/sha512.c

static void store64(u64 x, unsigned char* y)
{
    for(int i = 0; i != 8; ++i)
        y[i] = (x >> ((7-i) * 8)) & 255;
}

static u64 load64(const unsigned char* y)
{
    u64 res = 0;
    for(int i = 0; i != 8; ++i)
        res |= (u64)(y[i]) << ((7-i) * 8);
    return res;
}
The load64 has been implemented by https://reviews.llvm.org/D26149
This patch is trying to implement the store pattern.

Match a pattern where a wide type scalar value is stored by several narrow
stores. Fold it into a single store or a BSWAP and a store if the targets
supports it.

Assuming little endian target:
i8 *p = ...
i32 val = ...
p[0] = (val >> 0) & 0xFF;
p[1] = (val >> 8) & 0xFF;
p[2] = (val >> 16) & 0xFF;
p[3] = (val >> 24) & 0xFF;

>
*((i32)p) = val;

i8 *p = ...
i32 val = ...
p[0] = (val >> 24) & 0xFF;
p[1] = (val >> 16) & 0xFF;
p[2] = (val >> 8) & 0xFF;
p[3] = (val >> 0) & 0xFF;

>
*((i32)p) = BSWAP(val);

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

llvm-svn: 362472
2019-06-04 08:53:53 +00:00
clang Add a release note entry for the change made in r362034. 2019-06-03 23:48:14 +00:00
clang-tools-extra [clangd] Fix a crash when clang-tidy is disabled 2019-06-04 07:19:11 +00:00
compiler-rt [builtins] Use libtool for builtins when building for Apple platform 2019-06-04 02:38:15 +00:00
debuginfo-tests Add cdb test for inline line tables 2019-06-03 18:24:55 +00:00
libclc travis: Add LLVM-8 build 2019-03-27 21:28:31 +00:00
libcxx We had a _LIBCPP_ASSERT commented out because gcc 4.9 didn't like it. We (LLVM) now require GCC 5.1, so that's not a problem any more. Re-enable the assertion. Fixes PR#36863 2019-06-04 02:07:11 +00:00
libcxxabi [libcxx] Use libtool when merging archives on Apple platforms 2019-06-02 01:14:31 +00:00
libunwind [Docs] Modernize references to macOS 2019-05-30 16:46:22 +00:00
lld ELF: Introduce a separate bit for tracking whether an output section has ever had an input section added to it. NFCI. 2019-06-03 20:14:25 +00:00
lldb [Target] Generalize some behavior in Target::SymbolsDidLoad 2019-06-03 23:12:11 +00:00
llgo IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
llvm [DAGCombine] Match a pattern where a wide type scalar value is stored by several narrow stores 2019-06-04 08:53:53 +00:00
openmp Fixed build warning with -DLIBOMP_USE_HWLOC=1 2019-06-03 14:21:59 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly [ScopBuilder] Move verifyInvariantLoads function from ScopInfo. NFC. 2019-05-31 19:40:20 +00:00
pstl A test commit from Mikhail Dvorskiy (blank line, to pstl/trunk) according 'Obtaining Commit Access' rules (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access) 2019-06-03 08:23:30 +00:00
.arcconfig Update monorepo .arcconfig with new project callsign. 2019-01-31 14:34:59 +00:00
.clang-format Add .clang-tidy and .clang-format files to the toplevel of the 2019-01-29 16:43:16 +00:00
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitignore Add a reduced copy of the llvm .gitignore 2019-04-09 00:52:49 +00:00
README.md

README.md

The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.