Add, I hope, patterns for fmsub, fnmadd, and fnmsub (also float versions).

This commit is contained in:
David Given 2016-10-31 22:36:54 +01:00
parent 44f0cea6ca
commit 941072e0d7

View file

@ -711,21 +711,41 @@ PATTERNS
FPU4R(DIVF.F, "fdivs") FPU4R(DIVF.F, "fdivs")
FPU8R(DIVF.D, "fdiv") FPU8R(DIVF.D, "fdiv")
out:(double)reg = ADDF.D(MULF.D(m1:(double)reg, m2:(double)reg), m3:(double)reg) #define FMALEFT(type, insn, add, mul) \
emit "fmadd %out, %m1, %m2, %m3" out:(type)reg = add(mul(m1:(double)reg, m2:(double)reg), m3:(double)reg) \
cost 4; emit insn " %out, %m1, %m2, %m3" \
cost 4; \
out:(double)reg = ADDF.D(m3:(double)reg, MULF.D(m1:(double)reg, m2:(double)reg)) #define FMARIGHT(type, insn, add, mul) \
emit "fmadd %out, %m1, %m2, %m3" out:(type)reg = add(m3:(double)reg, mul(m1:(double)reg, m2:(double)reg)) \
cost 4; emit insn " %out, %m1, %m2, %m3" \
cost 4; \
out:(float)reg = ADDF.F(MULF.D(m1:(float)reg, m2:(float)reg), m3:(float)reg) FMALEFT( double, "fmadd", ADDF.D, MULF.D)
emit "fmadds %out, %m1, %m2, %m3" FMARIGHT(double, "fmadd", ADDF.D, MULF.D)
cost 4; FMALEFT( float, "fmadds", ADDF.F, MULF.F)
FMARIGHT(float, "fmadds", ADDF.F, MULF.F)
out:(float)reg = ADDF.F(m3:(float)reg, MULF.D(m1:(float)reg, m2:(float)reg)) FMALEFT( double, "fmsub", SUBF.D, MULF.D)
emit "fmadds %out, %m1, %m2, %m3" FMALEFT( float, "fmsubs", SUBF.F, MULF.F)
cost 4;
FMARIGHT(double, "fnmadd", SUBF.D, MULF.D)
FMARIGHT(float, "fnmadds", SUBF.D, MULF.D)
#define FMANEGLEFT(type, insn, neg, add, mul) \
out:(type)reg = neg(add(mul(m1:(double)reg, m2:(double)reg), m3:(double)reg)) \
emit insn " %out, %m1, %m2, %m3" \
cost 4; \
#define FMANEGRIGHT(type, insn, neg, add, mul) \
out:(type)reg = neg(add(m3:(double)reg, mul(m1:(double)reg, m2:(double)reg))) \
emit insn " %out, %m1, %m2, %m3" \
cost 4; \
FMANEGLEFT( double, "fnmsub", NEGF.D, ADDF.D, MULF.D)
FMANEGRIGHT(double, "fnmsub", NEGF.D, ADDF.D, MULF.D)
FMANEGLEFT( float, "fnmsub", NEGF.F, ADDF.F, MULF.F)
FMANEGRIGHT(float, "fnmsub", NEGF.F, ADDF.F, MULF.F)
out:(float)reg = NEGF.F(left:(float)reg) out:(float)reg = NEGF.F(left:(float)reg)
emit "fneg %out, %left" emit "fneg %out, %left"