brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.0 KiB · e1e17d3 Raw
221 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=instsimplify -S < %s | FileCheck %s3 4define i1 @sdiv_neg_neg_high_bits(i8 %x, i8 %y) {5; CHECK-LABEL: @sdiv_neg_neg_high_bits(6; CHECK-NEXT:    ret i1 false7;8  %num = or i8 %x, 1289  %denum = or i8 %y, 13110  %div = sdiv i8 %num, %denum11  %and = and i8 %div, 12812  %r = icmp eq i8 %and, 12813  ret i1 %r14}15 16define i1 @sdiv_pos_neg_high_bits(i8 %x, i8 %y) {17; CHECK-LABEL: @sdiv_pos_neg_high_bits(18; CHECK-NEXT:    ret i1 false19;20  %xx = and i8 %x, 12721  %num = or i8 %xx, 4922  %denum = or i8 %y, 24123  %div = sdiv i8 %num, %denum24  %and = and i8 %div, 12825  %r = icmp eq i8 %and, 026  ret i1 %r27}28 29define i1 @sdiv_pos_neg_high_bits_fail_maybez(i8 %x, i8 %y) {30; CHECK-LABEL: @sdiv_pos_neg_high_bits_fail_maybez(31; CHECK-NEXT:    [[XX:%.*]] = and i8 [[X:%.*]], 12732; CHECK-NEXT:    [[NUM:%.*]] = or i8 [[XX]], 4933; CHECK-NEXT:    [[DENUM:%.*]] = or i8 [[Y:%.*]], -6434; CHECK-NEXT:    [[DIV:%.*]] = sdiv i8 [[NUM]], [[DENUM]]35; CHECK-NEXT:    [[AND:%.*]] = and i8 [[DIV]], -12836; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[AND]], 037; CHECK-NEXT:    ret i1 [[R]]38;39  %xx = and i8 %x, 12740  %num = or i8 %xx, 4941  %denum = or i8 %y, 19242  %div = sdiv i8 %num, %denum43  %and = and i8 %div, 12844  %r = icmp eq i8 %and, 045  ret i1 %r46}47 48define i1 @sdiv_exact_pos_neg_high_bits(i8 %x, i8 %y) {49; CHECK-LABEL: @sdiv_exact_pos_neg_high_bits(50; CHECK-NEXT:    ret i1 false51;52  %xx = and i8 %x, 12753  %num = or i8 %xx, 4954  %denum = or i8 %y, 19255  %div = sdiv exact i8 %num, %denum56  %and = and i8 %div, 12857  %r = icmp eq i8 %and, 058  ret i1 %r59}60 61define i1 @sdiv_neg_pos_high_bits(i8 %x, i8 %y) {62; CHECK-LABEL: @sdiv_neg_pos_high_bits(63; CHECK-NEXT:    ret i1 false64;65  %xx = and i8 %x, 15966  %num = or i8 %xx, 12967  %yy = and i8 %y, 1568  %denum = or i8 %yy, 969  %div = sdiv i8 %num, %denum70  %and = and i8 %div, 12871  %r = icmp eq i8 %and, 072  ret i1 %r73}74 75define i1 @sdiv_neg_pos_high_bits_fail_maybez(i8 %x, i8 %y) {76; CHECK-LABEL: @sdiv_neg_pos_high_bits_fail_maybez(77; CHECK-NEXT:    [[NUM:%.*]] = or i8 [[X:%.*]], -12878; CHECK-NEXT:    [[YY:%.*]] = and i8 [[Y:%.*]], 1579; CHECK-NEXT:    [[DENUM:%.*]] = or i8 [[YY]], 980; CHECK-NEXT:    [[DIV:%.*]] = sdiv i8 [[NUM]], [[DENUM]]81; CHECK-NEXT:    [[AND:%.*]] = and i8 [[DIV]], -12882; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[AND]], 083; CHECK-NEXT:    ret i1 [[R]]84;85  %num = or i8 %x, 12886  %yy = and i8 %y, 1587  %denum = or i8 %yy, 988  %div = sdiv i8 %num, %denum89  %and = and i8 %div, 12890  %r = icmp eq i8 %and, 091  ret i1 %r92}93 94define i1 @sdiv_exact_odd_odd(i8 %x, i8 %y) {95; CHECK-LABEL: @sdiv_exact_odd_odd(96; CHECK-NEXT:    ret i1 false97;98  %num = or i8 %x, 199  %denum = or i8 %y, 1100  %div = sdiv exact i8 %num, %denum101  %and = and i8 %div, 1102  %r = icmp eq i8 %and, 0103  ret i1 %r104}105 106define i1 @sdiv_exact_even_odd(i8 %x, i8 %y) {107; CHECK-LABEL: @sdiv_exact_even_odd(108; CHECK-NEXT:    ret i1 false109;110  %num = and i8 %x, -2111  %denum = or i8 %y, 1112  %div = sdiv exact i8 %num, %denum113  %and = and i8 %div, 1114  %r = icmp eq i8 %and, 1115  ret i1 %r116}117 118define i1 @sdiv_exact_even_even_fail_unknown(i8 %x, i8 %y) {119; CHECK-LABEL: @sdiv_exact_even_even_fail_unknown(120; CHECK-NEXT:    [[NUM:%.*]] = and i8 [[X:%.*]], -2121; CHECK-NEXT:    [[DENUM:%.*]] = and i8 [[Y:%.*]], -2122; CHECK-NEXT:    [[DIV:%.*]] = sdiv exact i8 [[NUM]], [[DENUM]]123; CHECK-NEXT:    [[AND:%.*]] = and i8 [[DIV]], 1124; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[AND]], 1125; CHECK-NEXT:    ret i1 [[R]]126;127  %num = and i8 %x, -2128  %denum = and i8 %y, -2129  %div = sdiv exact i8 %num, %denum130  %and = and i8 %div, 1131  %r = icmp eq i8 %and, 1132  ret i1 %r133}134 135define i1 @sdiv_exact_even_even_fail_unknown2(i8 %x, i8 %y) {136; CHECK-LABEL: @sdiv_exact_even_even_fail_unknown2(137; CHECK-NEXT:    [[NUM:%.*]] = and i8 [[X:%.*]], -2138; CHECK-NEXT:    [[DENUM:%.*]] = and i8 [[Y:%.*]], -2139; CHECK-NEXT:    [[DIV:%.*]] = sdiv exact i8 [[NUM]], [[DENUM]]140; CHECK-NEXT:    [[AND:%.*]] = and i8 [[DIV]], 1141; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[AND]], 0142; CHECK-NEXT:    ret i1 [[R]]143;144  %num = and i8 %x, -2145  %denum = and i8 %y, -2146  %div = sdiv exact i8 %num, %denum147  %and = and i8 %div, 1148  %r = icmp eq i8 %and, 0149  ret i1 %r150}151 152define i1 @udiv_high_bits(i8 %x, i8 %y) {153; CHECK-LABEL: @udiv_high_bits(154; CHECK-NEXT:    ret i1 false155;156  %num = and i8 %x, 129157  %denum = or i8 %y, 31158  %div = udiv i8 %num, %denum159  %and = and i8 %div, 8160  %r = icmp eq i8 %and, 8161  ret i1 %r162}163 164define i1 @udiv_exact_odd_odd(i8 %x, i8 %y) {165; CHECK-LABEL: @udiv_exact_odd_odd(166; CHECK-NEXT:    ret i1 false167;168  %num = or i8 %x, 1169  %denum = or i8 %y, 1170  %div = udiv exact i8 %num, %denum171  %and = and i8 %div, 1172  %r = icmp eq i8 %and, 0173  ret i1 %r174}175 176define i1 @udiv_exact_even_odd(i8 %x, i8 %y) {177; CHECK-LABEL: @udiv_exact_even_odd(178; CHECK-NEXT:    ret i1 false179;180  %num = and i8 %x, -2181  %denum = or i8 %y, 1182  %div = udiv exact i8 %num, %denum183  %and = and i8 %div, 1184  %r = icmp eq i8 %and, 1185  ret i1 %r186}187 188define i1 @udiv_exact_even_even_fail_unknown(i8 %x, i8 %y) {189; CHECK-LABEL: @udiv_exact_even_even_fail_unknown(190; CHECK-NEXT:    [[NUM:%.*]] = and i8 [[X:%.*]], -2191; CHECK-NEXT:    [[DENUM:%.*]] = and i8 [[Y:%.*]], -2192; CHECK-NEXT:    [[DIV:%.*]] = udiv exact i8 [[NUM]], [[DENUM]]193; CHECK-NEXT:    [[AND:%.*]] = and i8 [[DIV]], 1194; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[AND]], 1195; CHECK-NEXT:    ret i1 [[R]]196;197  %num = and i8 %x, -2198  %denum = and i8 %y, -2199  %div = udiv exact i8 %num, %denum200  %and = and i8 %div, 1201  %r = icmp eq i8 %and, 1202  ret i1 %r203}204 205define i1 @udiv_exact_even_even_fail_unknown2(i8 %x, i8 %y) {206; CHECK-LABEL: @udiv_exact_even_even_fail_unknown2(207; CHECK-NEXT:    [[NUM:%.*]] = and i8 [[X:%.*]], -2208; CHECK-NEXT:    [[DENUM:%.*]] = and i8 [[Y:%.*]], -2209; CHECK-NEXT:    [[DIV:%.*]] = udiv exact i8 [[NUM]], [[DENUM]]210; CHECK-NEXT:    [[AND:%.*]] = and i8 [[DIV]], 1211; CHECK-NEXT:    [[R:%.*]] = icmp eq i8 [[AND]], 0212; CHECK-NEXT:    ret i1 [[R]]213;214  %num = and i8 %x, -2215  %denum = and i8 %y, -2216  %div = udiv exact i8 %num, %denum217  %and = and i8 %div, 1218  %r = icmp eq i8 %and, 0219  ret i1 %r220}221