brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 991d86a Raw
66 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; Example input for update_test_checks (taken from test/Transforms/InstSimplify/add.ll)3; RUN: opt < %s -passes=instsimplify -S | FileCheck %s4 5define i32 @common_sub_operand(i32 %X, i32 %Y) {6; CHECK-LABEL: define i32 @common_sub_operand7; CHECK-SAME: (i32 [[X:%.*]], i32 [[Y:%.*]]) {8; CHECK-NEXT:    ret i32 [[X]]9;10  %Z = sub i32 %X, %Y11  %Q = add i32 %Z, %Y12  ret i32 %Q13}14 15define i32 @negated_operand(i32 %x) {16; CHECK-LABEL: define i32 @negated_operand17; CHECK-SAME: (i32 [[X:%.*]]) {18; CHECK-NEXT:    ret i32 019;20  %negx = sub i32 0, %x21  %r = add i32 %negx, %x22  ret i32 %r23}24 25define <2 x i32> @negated_operand_commute_vec(<2 x i32> %x) {26; CHECK-LABEL: define <2 x i32> @negated_operand_commute_vec27; CHECK-SAME: (<2 x i32> [[X:%.*]]) {28; CHECK-NEXT:    ret <2 x i32> zeroinitializer29;30  %negx = sub <2 x i32> zeroinitializer, %x31  %r = add <2 x i32> %x, %negx32  ret <2 x i32> %r33}34 35define i8 @knownnegation(i8 %x, i8 %y) {36; CHECK-LABEL: define i8 @knownnegation37; CHECK-SAME: (i8 [[X:%.*]], i8 [[Y:%.*]]) {38; CHECK-NEXT:    ret i8 039;40  %xy = sub i8 %x, %y41  %yx = sub i8 %y, %x42  %r = add i8 %xy, %yx43  ret i8 %r44}45 46define <2 x i8> @knownnegation_commute_vec(<2 x i8> %x, <2 x i8> %y) {47; CHECK-LABEL: define <2 x i8> @knownnegation_commute_vec48; CHECK-SAME: (<2 x i8> [[X:%.*]], <2 x i8> [[Y:%.*]]) {49; CHECK-NEXT:    ret <2 x i8> zeroinitializer50;51  %xy = sub <2 x i8> %x, %y52  %yx = sub <2 x i8> %y, %x53  %r = add <2 x i8> %yx, %xy54  ret <2 x i8> %r55}56 57define i32 @nameless_value(i32 %X) {58; CHECK-LABEL: define i32 @nameless_value59; CHECK-SAME: (i32 [[X:%.*]]) {60; CHECK-NEXT:    [[TMP1:%.*]] = sub i32 42, [[X]]61; CHECK-NEXT:    ret i32 [[TMP1]]62;63  %1 = sub i32 42, %X64  ret i32 %165}66