diff options
author | Lars Knoll <[email protected]> | 2014-02-07 22:29:13 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-02-22 13:48:45 +0100 |
commit | 346382c36c2ac114ce3fab41545f5a8386838264 (patch) | |
tree | 74020bc610982250ea874d3427e619f318769d67 /src/qml/compiler/qv4ssa.cpp | |
parent | 61c682b410707ca610e92d4f6934e01f6233a6a8 (diff) |
Mask rhs of shift operations in the IR for constants
Saves an instruction for shifts with contants
Change-Id: Ia12355d2fe2b9f80631056cda5edd79b45189e99
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 3177f7304c..dcee3ea4cd 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -3388,6 +3388,18 @@ void optimizeSSA(Function *function, DefUsesCalculator &defUses, DominatorTree & continue; } } + if (rightConst) { // mask right hand side of shift operations + switch (binop->op) { + case OpLShift: + case OpRShift: + case OpURShift: + rightConst->value = QV4::Primitive::toInt32(rightConst->value) & 0x1f; + rightConst->type = SInt32Type; + break; + default: + break; + } + } // TODO: More constant binary expression evaluation // TODO: If the result of the move is only used in one single cjump, then |