1. A method, in a data processing system, for performing a scalar operation, comprising: identifying the scalar operation in source code; generating an expression tree for the scalar operation, wherein the expression tree has leaf nodes corresponding to scalar operands of the scalar operation; determining an alignment of the scalar operands in respective registers that store the scalar operands; and generating executable code for the scalar operation based on the expression tree and the alignment of the scalar operands, wherein generating the executable code for the scalar operation includes inserting shift instructions into the executable code based on the alignment of the scalar operands.