brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · 9fa55a6 Raw
146 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4declare void @use(i8)5 6define i8 @sub_not(i8 %x, i8 %y) {7; CHECK-LABEL: @sub_not(8; CHECK-NEXT:    [[TMP1:%.*]] = xor i8 [[X:%.*]], -19; CHECK-NEXT:    [[R:%.*]] = add i8 [[Y:%.*]], [[TMP1]]10; CHECK-NEXT:    ret i8 [[R]]11;12  %s = sub i8 %x, %y13  %r = xor i8 %s, -114  ret i8 %r15}16 17define i8 @sub_not_extra_use(i8 %x, i8 %y) {18; CHECK-LABEL: @sub_not_extra_use(19; CHECK-NEXT:    [[S:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]20; CHECK-NEXT:    [[R:%.*]] = xor i8 [[S]], -121; CHECK-NEXT:    call void @use(i8 [[S]])22; CHECK-NEXT:    ret i8 [[R]]23;24  %s = sub i8 %x, %y25  %r = xor i8 %s, -126  call void @use(i8 %s)27  ret i8 %r28}29 30define <2 x i8> @sub_not_vec(<2 x i8> %x, <2 x i8> %y) {31; CHECK-LABEL: @sub_not_vec(32; CHECK-NEXT:    [[TMP1:%.*]] = xor <2 x i8> [[X:%.*]], splat (i8 -1)33; CHECK-NEXT:    [[R:%.*]] = add <2 x i8> [[Y:%.*]], [[TMP1]]34; CHECK-NEXT:    ret <2 x i8> [[R]]35;36  %s = sub <2 x i8> %x, %y37  %r = xor <2 x i8> %s, <i8 -1, i8 poison>38  ret <2 x i8> %r39}40 41define i8 @dec_sub(i8 %x, i8 %y) {42; CHECK-LABEL: @dec_sub(43; CHECK-NEXT:    [[TMP1:%.*]] = xor i8 [[Y:%.*]], -144; CHECK-NEXT:    [[R:%.*]] = add i8 [[X:%.*]], [[TMP1]]45; CHECK-NEXT:    ret i8 [[R]]46;47  %s = sub i8 %x, %y48  %r = add i8 %s, -149  ret i8 %r50}51 52define i8 @dec_sub_extra_use(i8 %x, i8 %y) {53; CHECK-LABEL: @dec_sub_extra_use(54; CHECK-NEXT:    [[S:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]55; CHECK-NEXT:    [[R:%.*]] = add i8 [[S]], -156; CHECK-NEXT:    call void @use(i8 [[S]])57; CHECK-NEXT:    ret i8 [[R]]58;59  %s = sub i8 %x, %y60  %r = add i8 %s, -161  call void @use(i8 %s)62  ret i8 %r63}64 65define <2 x i8> @dec_sub_vec(<2 x i8> %x, <2 x i8> %y) {66; CHECK-LABEL: @dec_sub_vec(67; CHECK-NEXT:    [[TMP1:%.*]] = xor <2 x i8> [[Y:%.*]], splat (i8 -1)68; CHECK-NEXT:    [[R:%.*]] = add <2 x i8> [[X:%.*]], [[TMP1]]69; CHECK-NEXT:    ret <2 x i8> [[R]]70;71  %s = sub <2 x i8> %x, %y72  %r = add <2 x i8> %s, <i8 -1, i8 poison>73  ret <2 x i8> %r74}75 76define i8 @sub_inc(i8 %x, i8 %y) {77; CHECK-LABEL: @sub_inc(78; CHECK-NEXT:    [[S_NEG:%.*]] = xor i8 [[X:%.*]], -179; CHECK-NEXT:    [[R:%.*]] = add i8 [[Y:%.*]], [[S_NEG]]80; CHECK-NEXT:    ret i8 [[R]]81;82  %s = add i8 %x, 183  %r = sub i8 %y, %s84  ret i8 %r85}86 87define i8 @sub_inc_extra_use(i8 %x, i8 %y) {88; CHECK-LABEL: @sub_inc_extra_use(89; CHECK-NEXT:    [[S:%.*]] = add i8 [[X:%.*]], 190; CHECK-NEXT:    [[R:%.*]] = sub i8 [[Y:%.*]], [[S]]91; CHECK-NEXT:    call void @use(i8 [[S]])92; CHECK-NEXT:    ret i8 [[R]]93;94  %s = add i8 %x, 195  %r = sub i8 %y, %s96  call void @use(i8 %s)97  ret i8 %r98}99 100define <2 x i8> @sub_inc_vec(<2 x i8> %x, <2 x i8> %y) {101; CHECK-LABEL: @sub_inc_vec(102; CHECK-NEXT:    [[S_NEG:%.*]] = xor <2 x i8> [[X:%.*]], splat (i8 -1)103; CHECK-NEXT:    [[R:%.*]] = add <2 x i8> [[Y:%.*]], [[S_NEG]]104; CHECK-NEXT:    ret <2 x i8> [[R]]105;106  %s = add <2 x i8> %x, <i8 poison, i8 1>107  %r = sub <2 x i8> %y, %s108  ret <2 x i8> %r109}110 111define i8 @sub_dec(i8 %x, i8 %y) {112; CHECK-LABEL: @sub_dec(113; CHECK-NEXT:    [[TMP1:%.*]] = xor i8 [[Y:%.*]], -1114; CHECK-NEXT:    [[R:%.*]] = add i8 [[X:%.*]], [[TMP1]]115; CHECK-NEXT:    ret i8 [[R]]116;117  %s = add i8 %x, -1118  %r = sub i8 %s, %y119  ret i8 %r120}121 122define i8 @sub_dec_extra_use(i8 %x, i8 %y) {123; CHECK-LABEL: @sub_dec_extra_use(124; CHECK-NEXT:    [[S:%.*]] = add i8 [[X:%.*]], -1125; CHECK-NEXT:    [[R:%.*]] = sub i8 [[S]], [[Y:%.*]]126; CHECK-NEXT:    call void @use(i8 [[S]])127; CHECK-NEXT:    ret i8 [[R]]128;129  %s = add i8 %x, -1130  %r = sub i8 %s, %y131  call void @use(i8 %s)132  ret i8 %r133}134 135define <2 x i8> @sub_dec_vec(<2 x i8> %x, <2 x i8> %y) {136; CHECK-LABEL: @sub_dec_vec(137; CHECK-NEXT:    [[TMP1:%.*]] = xor <2 x i8> [[Y:%.*]], splat (i8 -1)138; CHECK-NEXT:    [[R:%.*]] = add <2 x i8> [[X:%.*]], [[TMP1]]139; CHECK-NEXT:    ret <2 x i8> [[R]]140;141  %s = add <2 x i8> %x, <i8 poison, i8 -1>142  %r = sub <2 x i8> %s, %y143  ret <2 x i8> %r144}145 146