Permalink
Browse files

Fix real+imaginary and imaginary+real for xmm regs

  • Loading branch information...
1 parent ad06898 commit 35b0984a5d9eddc9a95b580de4bf3109e9f15d27 @yebblies committed Feb 26, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/backend/cgxmm.c
View
@@ -89,6 +89,19 @@ code *orthxmm(elem *e, regm_t *pretregs)
regm_t rretregs = XMMREGS & ~retregs;
code *cr = scodelem(e2, &rretregs, retregs, TRUE); // eval right leaf
+ // float + ifloat is not actually addition
+ if ((e->Eoper == OPadd || e->Eoper == OPmin) &&
+ ((tyreal(e1->Ety) && tyimaginary(e2->Ety)) ||
+ (tyreal(e2->Ety) && tyimaginary(e1->Ety))))
+ {
+ assert(e->Eoper == OPadd);
+ retregs |= rretregs;
+ c = cat(c, cr);
+ if (retregs != *pretregs)
+ c = cat(c, fixresult(e,retregs,pretregs));
+ return c;
+ }
+
unsigned op = xmmoperator(e1->Ety, e->Eoper);
unsigned rreg = findreg(rretregs);

0 comments on commit 35b0984

Please sign in to comment.