• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -instcombine -S | FileCheck %s
2define i32 @foo(i32 %x, i32 %y) {
3; CHECK-LABEL: @foo(
4  %add = add nsw i32 %y, %x
5  %mul = mul nsw i32 %add, %y
6  %square = mul nsw i32 %y, %y
7  %res = sub i32 %mul, %square
8  ret i32 %res
9; CHECK-NEXT: mul i32 %x, %y
10; CHECK-NEXT: ret i32
11}
12
13define i1 @bar(i64 %x, i64 %y) {
14; CHECK-LABEL: @bar(
15  %a = and i64 %y, %x
16; CHECK: and
17; CHECK-NOT: and
18  %not = xor i64 %a, -1
19  %b = and i64 %y, %not
20  %r = icmp eq i64 %b, 0
21  ret i1 %r
22; CHECK: ret i1
23}
24