blob: 73af5e5304ee02b81d2931dfc6941b89f8649a84 [file] [log] [blame]
Chris Lattnerc714f262006-03-14 06:54:32 +00001; There should be exactly one shift and one add left.
Dan Gohmana0801592009-09-11 18:36:27 +00002; RUN: opt < %s -reassociate -instcombine -S > %t
Dan Gohmanf9dd1702007-08-15 13:36:28 +00003; RUN: grep shl %t | count 1
4; RUN: grep add %t | count 1
Chris Lattnerc714f262006-03-14 06:54:32 +00005
Tanya Lattner0ea4c8d2008-03-19 04:36:04 +00006define i32 @test(i32 %X, i32 %Y) {
7 %tmp.2 = shl i32 %X, 1 ; <i32> [#uses=1]
8 %tmp.6 = shl i32 %Y, 1 ; <i32> [#uses=1]
9 %tmp.4 = add i32 %tmp.6, %tmp.2 ; <i32> [#uses=1]
10 ret i32 %tmp.4
Chris Lattnerc714f262006-03-14 06:54:32 +000011}
12