Scalar minus Array operation is implemented suboptimal
@chhtz
Submitted by Christoph HertzbergAssigned to Nobody
Link to original bugzilla bug (#684)
Version: 3.2
Description
Currently expressions like
void foo(Array2d &a, const double s) {
a = s - a;
}
lead to this inefficient code (only excerpt shown, comments added):
movapd .LC0, %xmm0 #.LC0 is a {-0.0, -0.0}
xorpd (%eax), %xmm0 # negate elements of a
movddup 8(%esp), %xmm1 # load s
addpd %xmm1, %xmm0 # add s + (-a)
movapd %xmm0, (%eax) # store result
This could be implemented more efficiently using the subpd instruction:
movddup 8(%esp), %xmm0 # load s
subpd (eax), %xmm0 # subtract s - a
movapd %xmm0, (%eax) # store result
Blocking
Edited by Eigen Bugzilla