brintos

brintos / llvm-project-archived public Read only

0
0
Text · 769 B · 45564cd Raw
29 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4define i32 @foo(i32 %x, i32 %y) {5; CHECK-LABEL: @foo(6; CHECK-NEXT:    [[RES:%.*]] = mul i32 [[X:%.*]], [[Y:%.*]]7; CHECK-NEXT:    ret i32 [[RES]]8;9  %add = add nsw i32 %y, %x10  %mul = mul nsw i32 %add, %y11  %square = mul nsw i32 %y, %y12  %res = sub i32 %mul, %square13  ret i32 %res14}15 16define i1 @bar(i64 %x, i64 %y) {17; CHECK-LABEL: @bar(18; CHECK-NEXT:    [[Y1:%.*]] = xor i64 [[X:%.*]], -119; CHECK-NEXT:    [[B:%.*]] = and i64 [[Y:%.*]], [[Y1]]20; CHECK-NEXT:    [[R:%.*]] = icmp eq i64 [[B]], 021; CHECK-NEXT:    ret i1 [[R]]22;23  %a = and i64 %y, %x24  %not = xor i64 %a, -125  %b = and i64 %y, %not26  %r = icmp eq i64 %b, 027  ret i1 %r28}29