I would argue that the low level work you are doing should be done in a macro or compiler.
http://www.graphics.stanford.edu/~hanrahan/talks/dsl/dsl1.pd...
http://www.graphics.stanford.edu/~hanrahan/talks/dsl/dsl2.pd...
Pat Hanrahan makes a compelling argument for using special purpose DSLs to construct efficient performant code that takes advantage of heterogeneous hardware.
See the Design of Terra, http://terralang.org/snapl-devito.pdf