summaryrefslogtreecommitdiff
path: root/test/Transforms/Reassociate/mulfactor.ll
blob: 76db242128fe521dbd5e450282e9d3187c3a25be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep mul | wc -l | grep 2

; This should have exactly 2 multiplies when we're done.

int %f(int %a, int %b) {
        %tmp.2 = mul int %a, %a
        %tmp.5 = shl int %a, ubyte 1
        %tmp.6 = mul int %tmp.5, %b
        %tmp.10 = mul int %b, %b
        %tmp.7 = add int %tmp.6, %tmp.2
        %tmp.11 = add int %tmp.7, %tmp.10
        ret int %tmp.11
}