mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 22: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
101 lines
2.9 KiB
LLVM
101 lines
2.9 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+mmx,+sse2 | FileCheck %s
|
|
; There are no MMX operations here, so we use XMM or i64.
|
|
|
|
; CHECK: ti8
|
|
define void @ti8(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to <8 x i8>
|
|
%tmp2 = bitcast double %b to <8 x i8>
|
|
%tmp3 = add <8 x i8> %tmp1, %tmp2
|
|
; CHECK: paddb
|
|
store <8 x i8> %tmp3, <8 x i8>* null
|
|
ret void
|
|
}
|
|
|
|
; CHECK: ti16
|
|
define void @ti16(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to <4 x i16>
|
|
%tmp2 = bitcast double %b to <4 x i16>
|
|
%tmp3 = add <4 x i16> %tmp1, %tmp2
|
|
; CHECK: paddw
|
|
store <4 x i16> %tmp3, <4 x i16>* null
|
|
ret void
|
|
}
|
|
|
|
; CHECK: ti32
|
|
define void @ti32(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to <2 x i32>
|
|
%tmp2 = bitcast double %b to <2 x i32>
|
|
%tmp3 = add <2 x i32> %tmp1, %tmp2
|
|
; CHECK: paddd
|
|
store <2 x i32> %tmp3, <2 x i32>* null
|
|
ret void
|
|
}
|
|
|
|
; CHECK: ti64
|
|
define void @ti64(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to <1 x i64>
|
|
%tmp2 = bitcast double %b to <1 x i64>
|
|
%tmp3 = add <1 x i64> %tmp1, %tmp2
|
|
; CHECK: addq
|
|
store <1 x i64> %tmp3, <1 x i64>* null
|
|
ret void
|
|
}
|
|
|
|
; MMX intrinsics calls get us MMX instructions.
|
|
; CHECK: ti8a
|
|
define void @ti8a(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp2 = bitcast double %b to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp3 = tail call x86_mmx @llvm.x86.mmx.padd.b(x86_mmx %tmp1, x86_mmx %tmp2)
|
|
store x86_mmx %tmp3, x86_mmx* null
|
|
ret void
|
|
}
|
|
|
|
; CHECK: ti16a
|
|
define void @ti16a(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp2 = bitcast double %b to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp3 = tail call x86_mmx @llvm.x86.mmx.padd.w(x86_mmx %tmp1, x86_mmx %tmp2)
|
|
store x86_mmx %tmp3, x86_mmx* null
|
|
ret void
|
|
}
|
|
|
|
; CHECK: ti32a
|
|
define void @ti32a(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp2 = bitcast double %b to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp3 = tail call x86_mmx @llvm.x86.mmx.padd.d(x86_mmx %tmp1, x86_mmx %tmp2)
|
|
store x86_mmx %tmp3, x86_mmx* null
|
|
ret void
|
|
}
|
|
|
|
; CHECK: ti64a
|
|
define void @ti64a(double %a, double %b) nounwind {
|
|
entry:
|
|
%tmp1 = bitcast double %a to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp2 = bitcast double %b to x86_mmx
|
|
; CHECK: movdq2q
|
|
%tmp3 = tail call x86_mmx @llvm.x86.mmx.padd.q(x86_mmx %tmp1, x86_mmx %tmp2)
|
|
store x86_mmx %tmp3, x86_mmx* null
|
|
ret void
|
|
}
|
|
|
|
declare x86_mmx @llvm.x86.mmx.padd.b(x86_mmx, x86_mmx)
|
|
declare x86_mmx @llvm.x86.mmx.padd.w(x86_mmx, x86_mmx)
|
|
declare x86_mmx @llvm.x86.mmx.padd.d(x86_mmx, x86_mmx)
|
|
declare x86_mmx @llvm.x86.mmx.padd.q(x86_mmx, x86_mmx)
|