blob: 8fbf1b9d4bc50eab53765e462a2d49a0e4dd8686 [file] [log] [blame]
Chris Lattnerc714f262006-03-14 06:54:32 +00001; There should be exactly one shift and one add left.
Chad Rosier5ea14e02014-06-11 18:28:45 +00002; RUN: opt < %s -reassociate -instcombine -S | FileCheck %s
Chris Lattnerc714f262006-03-14 06:54:32 +00003
Chad Rosier5ea14e02014-06-11 18:28:45 +00004define i32 @test1(i32 %X, i32 %Y) {
5; CHECK-LABEL: test1
6; CHECK-NEXT: %tmp = add i32 %Y, %X
7; CHECK-NEXT: %tmp1 = shl i32 %tmp, 1
8; CHECK-NEXT: ret i32 %tmp1
9
10 %tmp.2 = shl i32 %X, 1
11 %tmp.6 = shl i32 %Y, 1
12 %tmp.4 = add i32 %tmp.6, %tmp.2
13 ret i32 %tmp.4
Chris Lattnerc714f262006-03-14 06:54:32 +000014}