mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
d24d326705
which have successfully round-tripped through the combine phase, and use this to ensure all operands to DAG nodes are visited by the combiner, even if they are only added during the combine phase. This is critical to have the combiner reach nodes that are *introduced* during combining. Previously these would sometimes be visited and sometimes not be visited based on whether they happened to end up on the worklist or not. Now we always run them through the combiner. This fixes quite a few bad codegen test cases lurking in the suite while also being more principled. Among these, the TLS codegeneration is particularly exciting for programs that have this in the critical path like TSan-instrumented binaries (although I think they engineer to use a different TLS that is faster anyways). I've tried to check for compile-time regressions here by running llc over a merged (but not LTO-ed) clang bitcode file and observed at most a 3% slowdown in llc. Given that this is essentially a worst case (none of opt or clang are running at this phase) I think this is tolerable. The actual LTO case should be even less costly, and the cost in normal compilation should be negligible. With this combining logic, it is possible to re-legalize as we combine which is necessary to implement PSHUFB formation on x86 as a post-legalize DAG combine (my ultimate goal). Differential Revision: http://reviews.llvm.org/D4638 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213898 91177308-0d34-0410-b5e6-96231b3b80d8
80 lines
1.6 KiB
LLVM
80 lines
1.6 KiB
LLVM
; RUN: llc < %s -march=x86-64 -mcpu=corei7 -mattr=+sse4.1 | FileCheck %s
|
|
|
|
;CHECK-LABEL: load_2_i8:
|
|
; A single 16-bit load
|
|
;CHECK: pmovzxbq
|
|
;CHECK: paddq
|
|
;CHECK: pshufb
|
|
; A single 16-bit store
|
|
;CHECK: movw
|
|
;CHECK: ret
|
|
|
|
define void @load_2_i8(<2 x i8>* %A) {
|
|
%T = load <2 x i8>* %A
|
|
%G = add <2 x i8> %T, <i8 9, i8 7>
|
|
store <2 x i8> %G, <2 x i8>* %A
|
|
ret void
|
|
}
|
|
|
|
;CHECK-LABEL: load_2_i16:
|
|
; Read 32-bits
|
|
;CHECK: pmovzxwq
|
|
;CHECK: paddq
|
|
;CHECK: pshufb
|
|
;CHECK: movd
|
|
;CHECK: ret
|
|
define void @load_2_i16(<2 x i16>* %A) {
|
|
%T = load <2 x i16>* %A
|
|
%G = add <2 x i16> %T, <i16 9, i16 7>
|
|
store <2 x i16> %G, <2 x i16>* %A
|
|
ret void
|
|
}
|
|
|
|
;CHECK-LABEL: load_2_i32:
|
|
;CHECK: pmovzxdq
|
|
;CHECK: paddd
|
|
;CHECK: pshufd
|
|
;CHECK: ret
|
|
define void @load_2_i32(<2 x i32>* %A) {
|
|
%T = load <2 x i32>* %A
|
|
%G = add <2 x i32> %T, <i32 9, i32 7>
|
|
store <2 x i32> %G, <2 x i32>* %A
|
|
ret void
|
|
}
|
|
|
|
;CHECK-LABEL: load_4_i8:
|
|
;CHECK: pmovzxbd
|
|
;CHECK: paddd
|
|
;CHECK: pshufb
|
|
;CHECK: ret
|
|
define void @load_4_i8(<4 x i8>* %A) {
|
|
%T = load <4 x i8>* %A
|
|
%G = add <4 x i8> %T, <i8 1, i8 4, i8 9, i8 7>
|
|
store <4 x i8> %G, <4 x i8>* %A
|
|
ret void
|
|
}
|
|
|
|
;CHECK-LABEL: load_4_i16:
|
|
;CHECK: pmovzxwd
|
|
;CHECK: paddw
|
|
;CHECK: pshufb
|
|
;CHECK: ret
|
|
define void @load_4_i16(<4 x i16>* %A) {
|
|
%T = load <4 x i16>* %A
|
|
%G = add <4 x i16> %T, <i16 1, i16 4, i16 9, i16 7>
|
|
store <4 x i16> %G, <4 x i16>* %A
|
|
ret void
|
|
}
|
|
|
|
;CHECK-LABEL: load_8_i8:
|
|
;CHECK: pmovzxbw
|
|
;CHECK: paddb
|
|
;CHECK: pshufb
|
|
;CHECK: ret
|
|
define void @load_8_i8(<8 x i8>* %A) {
|
|
%T = load <8 x i8>* %A
|
|
%G = add <8 x i8> %T, %T
|
|
store <8 x i8> %G, <8 x i8>* %A
|
|
ret void
|
|
}
|