[PATCH] Model sqrtsd as a binary operation with one source operand tied to the destination (PR14221)
Michael Kuperstein
michael.m.kuperstein at intel.com
Sun Jan 11 06:44:23 PST 2015
Sorry I'm looking at this so late - missed the sqrtss version of it.
The problem I see with this is that it impacts correct code that doesn't want a destructive update, and can use the flexibility we currently have.
E.g, for this:
declare <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double>)
define void @sqrtsd(<2 x double> %a, double* %p0, double* %p1) nounwind uwtable ssp {
%res = tail call <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double> %a) nounwind
%new = extractelement <2 x double> %res, i32 0
store double %new, double* %p0
%orig = extractelement <2 x double> %a, i32 0
store double %orig, double* %p1
ret void
}
We now get:
movapd (%rcx), %xmm0
sqrtsd %xmm0, %xmm1
movlpd %xmm1, (%rdx)
movlpd %xmm0, (%r8)
And with the patch, we'll get:
movapd (%rcx), %xmm0
movapd %xmm0, %xmm1
sqrtsd %xmm1, %xmm1
movlpd %xmm1, (%rdx)
movlpd %xmm0, (%r8)
Do you think we can fix the correctness issue without introducing extra copies?
http://reviews.llvm.org/D6885
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list