diff options
| author | Wei Mi <wmi@google.com> | 2016-09-02 17:17:04 +0000 | 
|---|---|---|
| committer | Wei Mi <wmi@google.com> | 2016-09-02 17:17:04 +0000 | 
| commit | c54d1298f52c186cf91b92a7da8b40360478dee0 (patch) | |
| tree | a7b740df2b6a4d016918ccddcbc276ec71324a26 /llvm/test | |
| parent | 521f19f2498e867696b803eedfa4e87b53efea09 (diff) | |
| download | bcm5719-llvm-c54d1298f52c186cf91b92a7da8b40360478dee0.tar.gz bcm5719-llvm-c54d1298f52c186cf91b92a7da8b40360478dee0.zip | |
Split the store of a wide value merged from an int-fp pair into multiple stores.
For the store of a wide value merged from a pair of values, especially int-fp pair,
sometimes it is more efficent to split it into separate narrow stores, which can
remove the bitwise instructions or sink them to colder places.
Now the feature is only enabled on x86 target, and only store of int-fp pair is
splitted. It is possible that the application scope gets extended with perf evidence
support in the future.
Differential Revision: https://reviews.llvm.org/D22840
llvm-svn: 280505
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/split-store.ll | 62 | 
1 files changed, 62 insertions, 0 deletions
| diff --git a/llvm/test/Transforms/InstCombine/split-store.ll b/llvm/test/Transforms/InstCombine/split-store.ll new file mode 100644 index 00000000000..707690797b2 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/split-store.ll @@ -0,0 +1,62 @@ +; RUN: llc < %s | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK-LABEL: int32_float_pair +; CHECK: movss %xmm0, 4(%rsi) +; CHECK: movl %edi, (%rsi) +define void @int32_float_pair(i32 %tmp1, float %tmp2, i64* %ref.tmp) { +entry: +  %t0 = bitcast float %tmp2 to i32 +  %t1 = zext i32 %t0 to i64 +  %t2 = shl nuw i64 %t1, 32 +  %t3 = zext i32 %tmp1 to i64 +  %t4 = or i64 %t2, %t3 +  store i64 %t4, i64* %ref.tmp, align 8 +  ret void +} + +; CHECK-LABEL: float_int32_pair +; CHECK: movl %edi, 4(%rsi) +; CHECK: movss %xmm0, (%rsi) +define void @float_int32_pair(float %tmp1, i32 %tmp2, i64* %ref.tmp) { +entry: +  %t0 = bitcast float %tmp1 to i32 +  %t1 = zext i32 %tmp2 to i64 +  %t2 = shl nuw i64 %t1, 32 +  %t3 = zext i32 %t0 to i64 +  %t4 = or i64 %t2, %t3 +  store i64 %t4, i64* %ref.tmp, align 8 +  ret void +} + +; CHECK-LABEL: int16_float_pair +; CHECK: movss %xmm0, 4(%rsi) +; CHECK: movzwl	%di, %eax +; CHECK: movl %eax, (%rsi) +define void @int16_float_pair(i16 signext %tmp1, float %tmp2, i64* %ref.tmp) { +entry: +  %t0 = bitcast float %tmp2 to i32 +  %t1 = zext i32 %t0 to i64 +  %t2 = shl nuw i64 %t1, 32 +  %t3 = zext i16 %tmp1 to i64 +  %t4 = or i64 %t2, %t3 +  store i64 %t4, i64* %ref.tmp, align 8 +  ret void +} + +; CHECK-LABEL: int8_float_pair +; CHECK: movss %xmm0, 4(%rsi) +; CHECK: movzbl	%dil, %eax +; CHECK: movl %eax, (%rsi) +define void @int8_float_pair(i8 signext %tmp1, float %tmp2, i64* %ref.tmp) { +entry: +  %t0 = bitcast float %tmp2 to i32 +  %t1 = zext i32 %t0 to i64 +  %t2 = shl nuw i64 %t1, 32 +  %t3 = zext i8 %tmp1 to i64 +  %t4 = or i64 %t2, %t3 +  store i64 %t4, i64* %ref.tmp, align 8 +  ret void +} | 

