compiler.cfg.two-operand: sometimes we can eliminate a copy in the x = y <op> y case
parent
55acddef3f
commit
24a50c8006
|
@ -35,3 +35,18 @@ compiler.cfg.registers cpu.architecture namespaces tools.test ;
|
||||||
T{ ##sub-float f 1 2 3 }
|
T{ ##sub-float f 1 2 3 }
|
||||||
} (convert-two-operand)
|
} (convert-two-operand)
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
[
|
||||||
|
V{
|
||||||
|
T{ ##copy f 1 2 double-float-rep }
|
||||||
|
T{ ##mul-float f 1 1 1 }
|
||||||
|
}
|
||||||
|
] [
|
||||||
|
H{
|
||||||
|
{ 1 double-float-rep }
|
||||||
|
{ 2 double-float-rep }
|
||||||
|
} clone representations set
|
||||||
|
{
|
||||||
|
T{ ##mul-float f 1 2 2 }
|
||||||
|
} (convert-two-operand)
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -48,8 +48,10 @@ GENERIC: convert-two-operand* ( insn -- )
|
||||||
|
|
||||||
M: two-operand-insn convert-two-operand*
|
M: two-operand-insn convert-two-operand*
|
||||||
[ [ dst>> ] [ src1>> ] bi emit-copy ]
|
[ [ dst>> ] [ src1>> ] bi emit-copy ]
|
||||||
[ dup dst>> >>src1 , ]
|
[
|
||||||
bi ;
|
dup [ src1>> ] [ src2>> ] bi = [ dup dst>> >>src2 ] when
|
||||||
|
dup dst>> >>src1 ,
|
||||||
|
] bi ;
|
||||||
|
|
||||||
M: ##not convert-two-operand*
|
M: ##not convert-two-operand*
|
||||||
[ [ dst>> ] [ src>> ] bi emit-copy ]
|
[ [ dst>> ] [ src>> ] bi emit-copy ]
|
||||||
|
|
Loading…
Reference in New Issue