SQRTSS and similar scalar SSE insns are not accurately modelled
| Bugzilla Link | 14221 |
| Resolution | FIXED |
| Resolved on | Jun 18, 2015 18:35 |
| Version | trunk |
| OS | Linux |
| Blocks | llvm/llvm-bugzilla-archive#22206 |
| CC | @rotateright |
Extended Description
Scalar SSE instructions, such as SQRTSS, should be model as binary insns with the one input tied to the output and the other is the regular numeric input source. This's exactly the model of AVX variants.
mentioned in issue llvm/llvm-bugzilla-archive#23349
mentioned in issue llvm/llvm-bugzilla-archive#22206
mentioned in issue llvm/llvm-bugzilla-archive#21507
sqrtsd patch committed here: http://llvm.org/viewvc/llvm-project?view=revision&revision=227111
As noted in the review for this patch (http://reviews.llvm.org/D6885), by tying the source and dest regs, we've introduced a small SSE perf regression in the case where we need to use the original operand and the result.
sqrtss patch committed here: http://llvm.org/viewvc/llvm-project?view=revision&revision=224624
I'll work on the sqrtsd patch next unless someone gets to it before me.
For the record, we are producing wrong code without this patch.
It wasn't immediately obvious to me how this happens, but in the sqrt test case in the patch, we will generate this SSE code:
sqrtss %xmm0, %xmm1 <--- high elements of %xmm1 are undefined
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0 <--- this is ok; low element def'd by sqrtss
shufps $-27, %xmm1, %xmm1 ## xmm1 = xmm1[1,1,2,3]
cvtss2sd %xmm1, %xmm1 <--- oops: undef value
jmp _callee
Patch for sqrtss submitted for review: http://reviews.llvm.org/D6330
Fixed RSQRTss & RCPss in r167064. SQRTss and SQRTsd also needs to be fixed.
According to Manman, it's still incomplete. BE still needs more fixed.
This was fixed by 167064, no?