1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 define i32 @foo(i32 %x, i32 %y) {
6 ; CHECK-NEXT: [[RES:%.*]] = mul i32 [[X:%.*]], [[Y:%.*]]
7 ; CHECK-NEXT: ret i32 [[RES]]
9 %add = add nsw i32 %y, %x
10 %mul = mul nsw i32 %add, %y
11 %square = mul nsw i32 %y, %y
12 %res = sub i32 %mul, %square
16 define i1 @bar(i64 %x, i64 %y) {
18 ; CHECK-NEXT: [[Y1:%.*]] = xor i64 [[X:%.*]], -1
19 ; CHECK-NEXT: [[B:%.*]] = and i64 [[Y:%.*]], [[Y1]]
20 ; CHECK-NEXT: [[R:%.*]] = icmp eq i64 [[B]], 0
21 ; CHECK-NEXT: ret i1 [[R]]
26 %r = icmp eq i64 %b, 0