|
|
|
|
|
by aw1621107
80 days ago
|
|
> With expression templates you can translate one to the other, this is a static manipulation that does not depend on compiler level. How does that work on an implementation level? First thing that comes to mind is specialization, but I wouldn't be surprised if it were something else. > What does depend on the compiler is whether the incidental trivial function calls to operators gets optimized away or not. > Of course in many cases the optimization level does matter: if you are optimizing small vector operators to simd inlining will still be important. Perhaps this is the source of my confusion; my uses of expression templates so far have generally been "simpler" ones which rely on the optimizer to unravel things. I haven't been exposed much to the kind of matrix/BLAS-related scenarios you describe. |
|
The magic happens by specifically matching the pattern Expr<Expr<L, R, Mul>, R2, Add>; try to add a rule to optimize x+y*z as well.