brintos

brintos / llvm-project-archived public Read only

0
0
Text · 40.1 KiB · 57184ea Raw
1148 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=instcombine -S | FileCheck %s3 4define half @test_ui_ui_i8_add(i8 noundef %x_in, i8 noundef %y_in) {5; CHECK-LABEL: @test_ui_ui_i8_add(6; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 1277; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], 1278; CHECK-NEXT:    [[TMP1:%.*]] = add nuw i8 [[X]], [[Y]]9; CHECK-NEXT:    [[R:%.*]] = uitofp i8 [[TMP1]] to half10; CHECK-NEXT:    ret half [[R]]11;12  %x = and i8 %x_in, 12713  %y = and i8 %y_in, 12714  %xf = uitofp i8 %x to half15  %yf = uitofp i8 %y to half16  %r = fadd half %xf, %yf17  ret half %r18}19 20define half @test_ui_ui_i8_add_fail_overflow(i8 noundef %x_in, i8 noundef %y_in) {21; CHECK-LABEL: @test_ui_ui_i8_add_fail_overflow(22; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 12723; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], -12724; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half25; CHECK-NEXT:    [[YF:%.*]] = uitofp i8 [[Y]] to half26; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], [[YF]]27; CHECK-NEXT:    ret half [[R]]28;29  %x = and i8 %x_in, 12730  %y = and i8 %y_in, 12931  %xf = uitofp i8 %x to half32  %yf = uitofp i8 %y to half33  %r = fadd half %xf, %yf34  ret half %r35}36 37define half @test_ui_ui_i8_add_C(i8 noundef %x_in) {38; CHECK-LABEL: @test_ui_ui_i8_add_C(39; CHECK-NEXT:    [[TMP1:%.*]] = or i8 [[X_IN:%.*]], -12840; CHECK-NEXT:    [[R:%.*]] = uitofp i8 [[TMP1]] to half41; CHECK-NEXT:    ret half [[R]]42;43  %x = and i8 %x_in, 12744  %xf = uitofp i8 %x to half45  %r = fadd half %xf, 128.046  ret half %r47}48 49define half @test_ui_ui_i8_add_C_fail_no_repr(i8 noundef %x_in) {50; CHECK-LABEL: @test_ui_ui_i8_add_C_fail_no_repr(51; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 12752; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half53; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], 0xH57F854; CHECK-NEXT:    ret half [[R]]55;56  %x = and i8 %x_in, 12757  %xf = uitofp i8 %x to half58  %r = fadd half %xf, 127.559  ret half %r60}61 62define half @test_ui_ui_i8_add_C_fail_overflow(i8 noundef %x_in) {63; CHECK-LABEL: @test_ui_ui_i8_add_C_fail_overflow(64; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 12765; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half66; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], 0xH580867; CHECK-NEXT:    ret half [[R]]68;69  %x = and i8 %x_in, 12770  %xf = uitofp i8 %x to half71  %r = fadd half %xf, 129.072  ret half %r73}74 75define half @test_si_si_i8_add(i8 noundef %x_in, i8 noundef %y_in) {76; CHECK-LABEL: @test_si_si_i8_add(77; CHECK-NEXT:    [[X:%.*]] = or i8 [[X_IN:%.*]], -6478; CHECK-NEXT:    [[Y:%.*]] = or i8 [[Y_IN:%.*]], -6479; CHECK-NEXT:    [[TMP1:%.*]] = add nsw i8 [[X]], [[Y]]80; CHECK-NEXT:    [[R:%.*]] = sitofp i8 [[TMP1]] to half81; CHECK-NEXT:    ret half [[R]]82;83  %x = or i8 %x_in, -6484  %y = or i8 %y_in, -6485  %xf = sitofp i8 %x to half86  %yf = sitofp i8 %y to half87  %r = fadd half %xf, %yf88  ret half %r89}90 91define half @test_si_si_i8_add_fail_overflow(i8 noundef %x_in, i8 noundef %y_in) {92; CHECK-LABEL: @test_si_si_i8_add_fail_overflow(93; CHECK-NEXT:    [[X:%.*]] = or i8 [[X_IN:%.*]], -6494; CHECK-NEXT:    [[Y:%.*]] = or i8 [[Y_IN:%.*]], -6595; CHECK-NEXT:    [[XF:%.*]] = sitofp i8 [[X]] to half96; CHECK-NEXT:    [[YF:%.*]] = sitofp i8 [[Y]] to half97; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], [[YF]]98; CHECK-NEXT:    ret half [[R]]99;100  %x = or i8 %x_in, -64101  %y = or i8 %y_in, -65102  %xf = sitofp i8 %x to half103  %yf = sitofp i8 %y to half104  %r = fadd half %xf, %yf105  ret half %r106}107 108define half @test_ui_si_i8_add(i8 noundef %x_in, i8 noundef %y_in) {109; CHECK-LABEL: @test_ui_si_i8_add(110; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 63111; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], 63112; CHECK-NEXT:    [[TMP1:%.*]] = add nuw nsw i8 [[X]], [[Y]]113; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i8 [[TMP1]] to half114; CHECK-NEXT:    ret half [[R]]115;116  %x = and i8 %x_in, 63117  %y = and i8 %y_in, 63118  %xf = sitofp i8 %x to half119  %yf = uitofp i8 %y to half120  %r = fadd half %xf, %yf121  ret half %r122}123 124define half @test_ui_si_i8_add_overflow(i8 noundef %x_in, i8 noundef %y_in) {125; CHECK-LABEL: @test_ui_si_i8_add_overflow(126; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 63127; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], 65128; CHECK-NEXT:    [[TMP1:%.*]] = add nuw i8 [[X]], [[Y]]129; CHECK-NEXT:    [[R:%.*]] = uitofp i8 [[TMP1]] to half130; CHECK-NEXT:    ret half [[R]]131;132  %x = and i8 %x_in, 63133  %y = and i8 %y_in, 65134  %xf = sitofp i8 %x to half135  %yf = uitofp i8 %y to half136  %r = fadd half %xf, %yf137  ret half %r138}139 140define half @test_ui_ui_i8_sub_C(i8 noundef %x_in) {141; CHECK-LABEL: @test_ui_ui_i8_sub_C(142; CHECK-NEXT:    [[TMP1:%.*]] = and i8 [[X_IN:%.*]], 127143; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i8 [[TMP1]] to half144; CHECK-NEXT:    ret half [[R]]145;146  %x = or i8 %x_in, 128147  %xf = uitofp i8 %x to half148  %r = fsub half %xf, 128.0149  ret half %r150}151 152define half @test_ui_ui_i8_sub_C_fail_overflow(i8 noundef %x_in) {153; CHECK-LABEL: @test_ui_ui_i8_sub_C_fail_overflow(154; CHECK-NEXT:    [[TMP1:%.*]] = or i8 [[X_IN:%.*]], -128155; CHECK-NEXT:    [[R:%.*]] = sitofp i8 [[TMP1]] to half156; CHECK-NEXT:    ret half [[R]]157;158  %x = and i8 %x_in, 127159  %xf = uitofp i8 %x to half160  %r = fsub half %xf, 128.0161  ret half %r162}163 164define half @test_si_si_i8_sub(i8 noundef %x_in, i8 noundef %y_in) {165; CHECK-LABEL: @test_si_si_i8_sub(166; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 63167; CHECK-NEXT:    [[Y:%.*]] = or i8 [[Y_IN:%.*]], -64168; CHECK-NEXT:    [[TMP1:%.*]] = sub nsw i8 [[X]], [[Y]]169; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i8 [[TMP1]] to half170; CHECK-NEXT:    ret half [[R]]171;172  %x = and i8 %x_in, 63173  %y = or i8 %y_in, -64174  %xf = sitofp i8 %x to half175  %yf = sitofp i8 %y to half176  %r = fsub half %xf, %yf177  ret half %r178}179 180define half @test_si_si_i8_sub_fail_overflow(i8 noundef %x_in, i8 noundef %y_in) {181; CHECK-LABEL: @test_si_si_i8_sub_fail_overflow(182; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 63183; CHECK-NEXT:    [[Y:%.*]] = or i8 [[Y_IN:%.*]], -65184; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half185; CHECK-NEXT:    [[YF:%.*]] = sitofp i8 [[Y]] to half186; CHECK-NEXT:    [[R:%.*]] = fsub half [[XF]], [[YF]]187; CHECK-NEXT:    ret half [[R]]188;189  %x = and i8 %x_in, 63190  %y = or i8 %y_in, -65191  %xf = sitofp i8 %x to half192  %yf = sitofp i8 %y to half193  %r = fsub half %xf, %yf194  ret half %r195}196 197define half @test_si_si_i8_sub_C(i8 noundef %x_in) {198; CHECK-LABEL: @test_si_si_i8_sub_C(199; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 63200; CHECK-NEXT:    [[TMP1:%.*]] = or disjoint i8 [[X]], 64201; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i8 [[TMP1]] to half202; CHECK-NEXT:    ret half [[R]]203;204  %x = and i8 %x_in, 63205  %xf = sitofp i8 %x to half206  %r = fsub half %xf, -64.0207  ret half %r208}209 210define half @test_si_si_i8_sub_C_fail_overflow(i8 noundef %x_in) {211; CHECK-LABEL: @test_si_si_i8_sub_C_fail_overflow(212; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 65213; CHECK-NEXT:    [[TMP1:%.*]] = add nuw i8 [[X]], 64214; CHECK-NEXT:    [[R:%.*]] = uitofp i8 [[TMP1]] to half215; CHECK-NEXT:    ret half [[R]]216;217  %x = and i8 %x_in, 65218  %xf = sitofp i8 %x to half219  %r = fsub half %xf, -64.0220  ret half %r221}222 223define half @test_ui_si_i8_sub(i8 noundef %x_in, i8 noundef %y_in) {224; CHECK-LABEL: @test_ui_si_i8_sub(225; CHECK-NEXT:    [[X:%.*]] = or i8 [[X_IN:%.*]], 64226; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], 63227; CHECK-NEXT:    [[TMP1:%.*]] = sub nuw nsw i8 [[X]], [[Y]]228; CHECK-NEXT:    [[R:%.*]] = sitofp i8 [[TMP1]] to half229; CHECK-NEXT:    ret half [[R]]230;231  %x = or i8 %x_in, 64232  %y = and i8 %y_in, 63233  %xf = sitofp i8 %x to half234  %yf = uitofp i8 %y to half235  %r = fsub half %xf, %yf236  ret half %r237}238 239define half @test_ui_si_i8_sub_fail_maybe_sign(i8 noundef %x_in, i8 noundef %y_in) {240; CHECK-LABEL: @test_ui_si_i8_sub_fail_maybe_sign(241; CHECK-NEXT:    [[X:%.*]] = or i8 [[X_IN:%.*]], 64242; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], 63243; CHECK-NEXT:    [[TMP1:%.*]] = sub nuw nsw i8 [[X]], [[Y]]244; CHECK-NEXT:    [[R:%.*]] = uitofp i8 [[TMP1]] to half245; CHECK-NEXT:    ret half [[R]]246;247  %x = or i8 %x_in, 64248  %y = and i8 %y_in, 63249  %xf = uitofp i8 %x to half250  %yf = sitofp i8 %y to half251  %r = fsub half %xf, %yf252  ret half %r253}254 255define half @test_ui_ui_i8_mul(i8 noundef %x_in, i8 noundef %y_in) {256; CHECK-LABEL: @test_ui_ui_i8_mul(257; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 15258; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], 15259; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw i8 [[X]], [[Y]]260; CHECK-NEXT:    [[R:%.*]] = uitofp i8 [[TMP1]] to half261; CHECK-NEXT:    ret half [[R]]262;263  %x = and i8 %x_in, 15264  %y = and i8 %y_in, 15265  %xf = uitofp i8 %x to half266  %yf = uitofp i8 %y to half267  %r = fmul half %xf, %yf268  ret half %r269}270 271define half @test_ui_ui_i8_mul_C(i8 noundef %x_in) {272; CHECK-LABEL: @test_ui_ui_i8_mul_C(273; CHECK-NEXT:    [[X:%.*]] = shl i8 [[X_IN:%.*]], 4274; CHECK-NEXT:    [[R:%.*]] = uitofp i8 [[X]] to half275; CHECK-NEXT:    ret half [[R]]276;277  %x = and i8 %x_in, 15278  %xf = uitofp i8 %x to half279  %r = fmul half %xf, 16.0280  ret half %r281}282 283define half @test_ui_ui_i8_mul_C_fail_overlow(i8 noundef %x_in) {284; CHECK-LABEL: @test_ui_ui_i8_mul_C_fail_overlow(285; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 14286; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half287; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], 0xH4CC0288; CHECK-NEXT:    ret half [[R]]289;290  %x = and i8 %x_in, 14291  %xf = uitofp i8 %x to half292  %r = fmul half %xf, 19.0293  ret half %r294}295 296define half @test_si_si_i8_mul(i8 noundef %x_in, i8 noundef %y_in) {297; CHECK-LABEL: @test_si_si_i8_mul(298; CHECK-NEXT:    [[XX:%.*]] = and i8 [[X_IN:%.*]], 6299; CHECK-NEXT:    [[X:%.*]] = or disjoint i8 [[XX]], 1300; CHECK-NEXT:    [[Y:%.*]] = or i8 [[Y_IN:%.*]], -8301; CHECK-NEXT:    [[TMP1:%.*]] = mul nsw i8 [[X]], [[Y]]302; CHECK-NEXT:    [[R:%.*]] = sitofp i8 [[TMP1]] to half303; CHECK-NEXT:    ret half [[R]]304;305  %xx = and i8 %x_in, 6306  %x = add nsw nuw i8 %xx, 1307  %y = or i8 %y_in, -8308  %xf = sitofp i8 %x to half309  %yf = sitofp i8 %y to half310  %r = fmul half %xf, %yf311  ret half %r312}313 314define half @test_si_si_i8_mul_fail_maybe_zero(i8 noundef %x_in, i8 noundef %y_in) {315; CHECK-LABEL: @test_si_si_i8_mul_fail_maybe_zero(316; CHECK-NEXT:    [[X:%.*]] = and i8 [[X_IN:%.*]], 7317; CHECK-NEXT:    [[Y:%.*]] = or i8 [[Y_IN:%.*]], -8318; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half319; CHECK-NEXT:    [[YF:%.*]] = sitofp i8 [[Y]] to half320; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], [[YF]]321; CHECK-NEXT:    ret half [[R]]322;323  %x = and i8 %x_in, 7324  %y = or i8 %y_in, -8325  %xf = sitofp i8 %x to half326  %yf = sitofp i8 %y to half327  %r = fmul half %xf, %yf328  ret half %r329}330 331define half @test_si_si_i8_mul_C_fail_no_repr(i8 noundef %x_in) {332; CHECK-LABEL: @test_si_si_i8_mul_C_fail_no_repr(333; CHECK-NEXT:    [[XX:%.*]] = and i8 [[X_IN:%.*]], 6334; CHECK-NEXT:    [[X:%.*]] = or disjoint i8 [[XX]], 1335; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half336; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], 0xHC780337; CHECK-NEXT:    ret half [[R]]338;339  %xx = and i8 %x_in, 6340  %x = add nsw nuw i8 %xx, 1341  %xf = sitofp i8 %x to half342  %r = fmul half %xf, -7.5343  ret half %r344}345 346define half @test_si_si_i8_mul_C_fail_overflow(i8 noundef %x_in) {347; CHECK-LABEL: @test_si_si_i8_mul_C_fail_overflow(348; CHECK-NEXT:    [[XX:%.*]] = and i8 [[X_IN:%.*]], 6349; CHECK-NEXT:    [[X:%.*]] = or disjoint i8 [[XX]], 1350; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half351; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], 0xHCCC0352; CHECK-NEXT:    ret half [[R]]353;354  %xx = and i8 %x_in, 6355  %x = add nsw nuw i8 %xx, 1356  %xf = sitofp i8 %x to half357  %r = fmul half %xf, -19.0358  ret half %r359}360 361define half @test_ui_si_i8_mul(i8 noundef %x_in, i8 noundef %y_in) {362; CHECK-LABEL: @test_ui_si_i8_mul(363; CHECK-NEXT:    [[XX:%.*]] = and i8 [[X_IN:%.*]], 6364; CHECK-NEXT:    [[X:%.*]] = or disjoint i8 [[XX]], 1365; CHECK-NEXT:    [[YY:%.*]] = and i8 [[Y_IN:%.*]], 7366; CHECK-NEXT:    [[Y:%.*]] = add nuw nsw i8 [[YY]], 1367; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw nsw i8 [[X]], [[Y]]368; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i8 [[TMP1]] to half369; CHECK-NEXT:    ret half [[R]]370;371  %xx = and i8 %x_in, 6372  %x = add i8 %xx, 1373  %yy = and i8 %y_in, 7374  %y = add i8 %yy, 1375  %xf = sitofp i8 %x to half376  %yf = uitofp i8 %y to half377  %r = fmul half %xf, %yf378  ret half %r379}380 381define half @test_ui_si_i8_mul_fail_maybe_zero(i8 noundef %x_in, i8 noundef %y_in) {382; CHECK-LABEL: @test_ui_si_i8_mul_fail_maybe_zero(383; CHECK-NEXT:    [[XX:%.*]] = and i8 [[X_IN:%.*]], 7384; CHECK-NEXT:    [[X:%.*]] = add nuw nsw i8 [[XX]], 1385; CHECK-NEXT:    [[Y:%.*]] = and i8 [[Y_IN:%.*]], 7386; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw nsw i8 [[X]], [[Y]]387; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i8 [[TMP1]] to half388; CHECK-NEXT:    ret half [[R]]389;390  %xx = and i8 %x_in, 7391  %x = add i8 %xx, 1392  %y = and i8 %y_in, 7393  %xf = sitofp i8 %x to half394  %yf = uitofp i8 %y to half395  %r = fmul half %xf, %yf396  ret half %r397}398 399define half @test_ui_si_i8_mul_fail_signed(i8 noundef %x_in, i8 noundef %y_in) {400; CHECK-LABEL: @test_ui_si_i8_mul_fail_signed(401; CHECK-NEXT:    [[XX:%.*]] = and i8 [[X_IN:%.*]], 7402; CHECK-NEXT:    [[X:%.*]] = add nuw nsw i8 [[XX]], 1403; CHECK-NEXT:    [[Y:%.*]] = or i8 [[Y_IN:%.*]], -4404; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i8 [[X]] to half405; CHECK-NEXT:    [[YF:%.*]] = uitofp i8 [[Y]] to half406; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], [[YF]]407; CHECK-NEXT:    ret half [[R]]408;409  %xx = and i8 %x_in, 7410  %x = add i8 %xx, 1411  %y = or i8 %y_in, -4412  %xf = sitofp i8 %x to half413  %yf = uitofp i8 %y to half414  %r = fmul half %xf, %yf415  ret half %r416}417 418define half @test_ui_ui_i16_add(i16 noundef %x_in, i16 noundef %y_in) {419; CHECK-LABEL: @test_ui_ui_i16_add(420; CHECK-NEXT:    [[X:%.*]] = and i16 [[X_IN:%.*]], 2047421; CHECK-NEXT:    [[Y:%.*]] = and i16 [[Y_IN:%.*]], 2047422; CHECK-NEXT:    [[TMP1:%.*]] = add nuw nsw i16 [[X]], [[Y]]423; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i16 [[TMP1]] to half424; CHECK-NEXT:    ret half [[R]]425;426  %x = and i16 %x_in, 2047427  %y = and i16 %y_in, 2047428  %xf = uitofp i16 %x to half429  %yf = uitofp i16 %y to half430  %r = fadd half %xf, %yf431  ret half %r432}433 434define half @test_ui_ui_i16_add_fail_not_promotable(i16 noundef %x_in, i16 noundef %y_in) {435; CHECK-LABEL: @test_ui_ui_i16_add_fail_not_promotable(436; CHECK-NEXT:    [[X:%.*]] = and i16 [[X_IN:%.*]], 2049437; CHECK-NEXT:    [[Y:%.*]] = and i16 [[Y_IN:%.*]], 2047438; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i16 [[X]] to half439; CHECK-NEXT:    [[YF:%.*]] = uitofp nneg i16 [[Y]] to half440; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], [[YF]]441; CHECK-NEXT:    ret half [[R]]442;443  %x = and i16 %x_in, 2049444  %y = and i16 %y_in, 2047445  %xf = uitofp i16 %x to half446  %yf = uitofp i16 %y to half447  %r = fadd half %xf, %yf448  ret half %r449}450 451define half @test_ui_ui_i16_add_C(i16 noundef %x_in) {452; CHECK-LABEL: @test_ui_ui_i16_add_C(453; CHECK-NEXT:    [[TMP1:%.*]] = or i16 [[X_IN:%.*]], -2048454; CHECK-NEXT:    [[R:%.*]] = uitofp i16 [[TMP1]] to half455; CHECK-NEXT:    ret half [[R]]456;457  %x = and i16 %x_in, 2047458  %xf = uitofp i16 %x to half459  %r = fadd half %xf, 63488.0460  ret half %r461}462 463define half @test_ui_ui_i16_add_C_fail_overflow(i16 noundef %x_in) {464; CHECK-LABEL: @test_ui_ui_i16_add_C_fail_overflow(465; CHECK-NEXT:    [[X:%.*]] = and i16 [[X_IN:%.*]], 2047466; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i16 [[X]] to half467; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], 0xH7BD0468; CHECK-NEXT:    ret half [[R]]469;470  %x = and i16 %x_in, 2047471  %xf = uitofp i16 %x to half472  %r = fadd half %xf, 64000.0473  ret half %r474}475 476define half @test_si_si_i16_add(i16 noundef %x_in, i16 noundef %y_in) {477; CHECK-LABEL: @test_si_si_i16_add(478; CHECK-NEXT:    [[X:%.*]] = or i16 [[X_IN:%.*]], -2048479; CHECK-NEXT:    [[Y:%.*]] = or i16 [[Y_IN:%.*]], -2048480; CHECK-NEXT:    [[TMP1:%.*]] = add nsw i16 [[X]], [[Y]]481; CHECK-NEXT:    [[R:%.*]] = sitofp i16 [[TMP1]] to half482; CHECK-NEXT:    ret half [[R]]483;484  %x = or i16 %x_in, -2048485  %y = or i16 %y_in, -2048486  %xf = sitofp i16 %x to half487  %yf = sitofp i16 %y to half488  %r = fadd half %xf, %yf489  ret half %r490}491 492define half @test_si_si_i16_add_fail_no_promotion(i16 noundef %x_in, i16 noundef %y_in) {493; CHECK-LABEL: @test_si_si_i16_add_fail_no_promotion(494; CHECK-NEXT:    [[XX:%.*]] = or i16 [[X_IN:%.*]], -2048495; CHECK-NEXT:    [[X:%.*]] = add nsw i16 [[XX]], -1496; CHECK-NEXT:    [[Y:%.*]] = or i16 [[Y_IN:%.*]], -2048497; CHECK-NEXT:    [[XF:%.*]] = sitofp i16 [[X]] to half498; CHECK-NEXT:    [[YF:%.*]] = sitofp i16 [[Y]] to half499; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], [[YF]]500; CHECK-NEXT:    ret half [[R]]501;502  %xx = or i16 %x_in, -2048503  %x = sub i16 %xx, 1504  %y = or i16 %y_in, -2048505  %xf = sitofp i16 %x to half506  %yf = sitofp i16 %y to half507  %r = fadd half %xf, %yf508  ret half %r509}510 511define half @test_si_si_i16_add_C_overflow(i16 noundef %x_in) {512; CHECK-LABEL: @test_si_si_i16_add_C_overflow(513; CHECK-NEXT:    [[X:%.*]] = or i16 [[X_IN:%.*]], -2048514; CHECK-NEXT:    [[XF:%.*]] = sitofp i16 [[X]] to half515; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], 0xH7840516; CHECK-NEXT:    ret half [[R]]517;518  %x = or i16 %x_in, -2048519  %xf = sitofp i16 %x to half520  %r = fadd half %xf, 0xH7840521  ret half %r522}523 524define half @test_si_si_i16_sub(i16 noundef %x_in, i16 noundef %y_in) {525; CHECK-LABEL: @test_si_si_i16_sub(526; CHECK-NEXT:    [[X:%.*]] = or i16 [[X_IN:%.*]], -2048527; CHECK-NEXT:    [[Y:%.*]] = and i16 [[Y_IN:%.*]], 2047528; CHECK-NEXT:    [[TMP1:%.*]] = sub nuw nsw i16 [[X]], [[Y]]529; CHECK-NEXT:    [[R:%.*]] = sitofp i16 [[TMP1]] to half530; CHECK-NEXT:    ret half [[R]]531;532  %x = or i16 %x_in, -2048533  %y = and i16 %y_in, 2047534  %xf = sitofp i16 %x to half535  %yf = sitofp i16 %y to half536  %r = fsub half %xf, %yf537  ret half %r538}539 540define half @test_si_si_i16_sub_fail_no_promotion(i16 noundef %x_in, i16 noundef %y_in) {541; CHECK-LABEL: @test_si_si_i16_sub_fail_no_promotion(542; CHECK-NEXT:    [[X:%.*]] = and i16 [[X_IN:%.*]], 2047543; CHECK-NEXT:    [[Y:%.*]] = or i16 [[Y_IN:%.*]], -2049544; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i16 [[X]] to half545; CHECK-NEXT:    [[YF:%.*]] = sitofp i16 [[Y]] to half546; CHECK-NEXT:    [[R:%.*]] = fsub half [[XF]], [[YF]]547; CHECK-NEXT:    ret half [[R]]548;549  %x = and i16 %x_in, 2047550  %y = or i16 %y_in, -2049551  %xf = sitofp i16 %x to half552  %yf = sitofp i16 %y to half553  %r = fsub half %xf, %yf554  ret half %r555}556 557define half @test_ui_si_i16_sub(i16 noundef %x_in, i16 noundef %y_in) {558; CHECK-LABEL: @test_ui_si_i16_sub(559; CHECK-NEXT:    [[X:%.*]] = and i16 [[X_IN:%.*]], 2047560; CHECK-NEXT:    [[Y:%.*]] = and i16 [[Y_IN:%.*]], 2047561; CHECK-NEXT:    [[TMP1:%.*]] = sub nsw i16 [[X]], [[Y]]562; CHECK-NEXT:    [[R:%.*]] = sitofp i16 [[TMP1]] to half563; CHECK-NEXT:    ret half [[R]]564;565  %x = and i16 %x_in, 2047566  %y = and i16 %y_in, 2047567  %xf = uitofp i16 %x to half568  %yf = sitofp i16 %y to half569  %r = fsub half %xf, %yf570  ret half %r571}572 573define half @test_ui_si_i16_sub_fail_maybe_signed(i16 noundef %x_in, i16 noundef %y_in) {574; CHECK-LABEL: @test_ui_si_i16_sub_fail_maybe_signed(575; CHECK-NEXT:    [[X:%.*]] = or i16 [[X_IN:%.*]], -2048576; CHECK-NEXT:    [[Y:%.*]] = and i16 [[Y_IN:%.*]], 2047577; CHECK-NEXT:    [[XF:%.*]] = uitofp i16 [[X]] to half578; CHECK-NEXT:    [[YF:%.*]] = uitofp nneg i16 [[Y]] to half579; CHECK-NEXT:    [[R:%.*]] = fsub half [[XF]], [[YF]]580; CHECK-NEXT:    ret half [[R]]581;582  %x = or i16 %x_in, -2048583  %y = and i16 %y_in, 2047584  %xf = uitofp i16 %x to half585  %yf = sitofp i16 %y to half586  %r = fsub half %xf, %yf587  ret half %r588}589 590define half @test_ui_ui_i16_mul(i16 noundef %x_in, i16 noundef %y_in) {591; CHECK-LABEL: @test_ui_ui_i16_mul(592; CHECK-NEXT:    [[X:%.*]] = and i16 [[X_IN:%.*]], 255593; CHECK-NEXT:    [[Y:%.*]] = and i16 [[Y_IN:%.*]], 255594; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw i16 [[X]], [[Y]]595; CHECK-NEXT:    [[R:%.*]] = uitofp i16 [[TMP1]] to half596; CHECK-NEXT:    ret half [[R]]597;598  %x = and i16 %x_in, 255599  %y = and i16 %y_in, 255600  %xf = uitofp i16 %x to half601  %yf = uitofp i16 %y to half602  %r = fmul half %xf, %yf603  ret half %r604}605 606define half @test_ui_ui_i16_mul_fail_no_promotion(i16 noundef %x_in, i16 noundef %y_in) {607; CHECK-LABEL: @test_ui_ui_i16_mul_fail_no_promotion(608; CHECK-NEXT:    [[X:%.*]] = and i16 [[X_IN:%.*]], 4095609; CHECK-NEXT:    [[Y:%.*]] = and i16 [[Y_IN:%.*]], 3610; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i16 [[X]] to half611; CHECK-NEXT:    [[YF:%.*]] = uitofp nneg i16 [[Y]] to half612; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], [[YF]]613; CHECK-NEXT:    ret half [[R]]614;615  %x = and i16 %x_in, 4095616  %y = and i16 %y_in, 3617  %xf = uitofp i16 %x to half618  %yf = uitofp i16 %y to half619  %r = fmul half %xf, %yf620  ret half %r621}622 623define half @test_si_si_i16_mul(i16 noundef %x_in, i16 noundef %y_in) {624; CHECK-LABEL: @test_si_si_i16_mul(625; CHECK-NEXT:    [[XX:%.*]] = and i16 [[X_IN:%.*]], 126626; CHECK-NEXT:    [[X:%.*]] = or disjoint i16 [[XX]], 1627; CHECK-NEXT:    [[Y:%.*]] = or i16 [[Y_IN:%.*]], -255628; CHECK-NEXT:    [[TMP1:%.*]] = mul nsw i16 [[X]], [[Y]]629; CHECK-NEXT:    [[R:%.*]] = sitofp i16 [[TMP1]] to half630; CHECK-NEXT:    ret half [[R]]631;632  %xx = and i16 %x_in, 126633  %x = add nsw nuw i16 %xx, 1634  %y = or i16 %y_in, -255635  %xf = sitofp i16 %x to half636  %yf = sitofp i16 %y to half637  %r = fmul half %xf, %yf638  ret half %r639}640 641define half @test_si_si_i16_mul_fail_overflow(i16 noundef %x_in, i16 noundef %y_in) {642; CHECK-LABEL: @test_si_si_i16_mul_fail_overflow(643; CHECK-NEXT:    [[XX:%.*]] = and i16 [[X_IN:%.*]], 126644; CHECK-NEXT:    [[X:%.*]] = or disjoint i16 [[XX]], 1645; CHECK-NEXT:    [[Y:%.*]] = or i16 [[Y_IN:%.*]], -257646; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i16 [[X]] to half647; CHECK-NEXT:    [[YF:%.*]] = sitofp i16 [[Y]] to half648; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], [[YF]]649; CHECK-NEXT:    ret half [[R]]650;651  %xx = and i16 %x_in, 126652  %x = add nsw nuw i16 %xx, 1653  %y = or i16 %y_in, -257654  %xf = sitofp i16 %x to half655  %yf = sitofp i16 %y to half656  %r = fmul half %xf, %yf657  ret half %r658}659 660define half @test_si_si_i16_mul_C_fail_overflow(i16 noundef %x_in) {661; CHECK-LABEL: @test_si_si_i16_mul_C_fail_overflow(662; CHECK-NEXT:    [[X:%.*]] = or i16 [[X_IN:%.*]], -129663; CHECK-NEXT:    [[XF:%.*]] = sitofp i16 [[X]] to half664; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], 0xH5800665; CHECK-NEXT:    ret half [[R]]666;667  %x = or i16 %x_in, -129668  %xf = sitofp i16 %x to half669  %r = fmul half %xf, 128.0670  ret half %r671}672 673define half @test_si_si_i16_mul_C_fail_no_promotion(i16 noundef %x_in) {674; CHECK-LABEL: @test_si_si_i16_mul_C_fail_no_promotion(675; CHECK-NEXT:    [[X:%.*]] = or i16 [[X_IN:%.*]], -4097676; CHECK-NEXT:    [[XF:%.*]] = sitofp i16 [[X]] to half677; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], 0xH4500678; CHECK-NEXT:    ret half [[R]]679;680  %x = or i16 %x_in, -4097681  %xf = sitofp i16 %x to half682  %r = fmul half %xf, 5.0683  ret half %r684}685 686define half @test_ui_si_i16_mul(i16 noundef %x_in, i16 noundef %y_in) {687; CHECK-LABEL: @test_ui_si_i16_mul(688; CHECK-NEXT:    [[XX:%.*]] = and i16 [[X_IN:%.*]], 126689; CHECK-NEXT:    [[X:%.*]] = or disjoint i16 [[XX]], 1690; CHECK-NEXT:    [[YY:%.*]] = and i16 [[Y_IN:%.*]], 126691; CHECK-NEXT:    [[Y:%.*]] = or disjoint i16 [[YY]], 1692; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw nsw i16 [[X]], [[Y]]693; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i16 [[TMP1]] to half694; CHECK-NEXT:    ret half [[R]]695;696  %xx = and i16 %x_in, 126697  %x = add i16 %xx, 1698  %yy = and i16 %y_in, 126699  %y = add i16 %yy, 1700  %xf = sitofp i16 %x to half701  %yf = uitofp i16 %y to half702  %r = fmul half %xf, %yf703  ret half %r704}705 706define half @test_ui_ui_i12_add(i12 noundef %x_in, i12 noundef %y_in) {707; CHECK-LABEL: @test_ui_ui_i12_add(708; CHECK-NEXT:    [[X:%.*]] = and i12 [[X_IN:%.*]], 2047709; CHECK-NEXT:    [[Y:%.*]] = and i12 [[Y_IN:%.*]], 2047710; CHECK-NEXT:    [[TMP1:%.*]] = add nuw i12 [[X]], [[Y]]711; CHECK-NEXT:    [[R:%.*]] = uitofp i12 [[TMP1]] to half712; CHECK-NEXT:    ret half [[R]]713;714  %x = and i12 %x_in, 2047715  %y = and i12 %y_in, 2047716  %xf = uitofp i12 %x to half717  %yf = uitofp i12 %y to half718  %r = fadd half %xf, %yf719  ret half %r720}721 722define half @test_ui_ui_i12_add_fail_overflow(i12 noundef %x_in, i12 noundef %y_in) {723; CHECK-LABEL: @test_ui_ui_i12_add_fail_overflow(724; CHECK-NEXT:    [[X:%.*]] = and i12 [[X_IN:%.*]], 2047725; CHECK-NEXT:    [[Y:%.*]] = and i12 [[Y_IN:%.*]], -2047726; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i12 [[X]] to half727; CHECK-NEXT:    [[YF:%.*]] = uitofp i12 [[Y]] to half728; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], [[YF]]729; CHECK-NEXT:    ret half [[R]]730;731  %x = and i12 %x_in, 2047732  %y = and i12 %y_in, 2049733  %xf = uitofp i12 %x to half734  %yf = uitofp i12 %y to half735  %r = fadd half %xf, %yf736  ret half %r737}738 739 740define half @test_si_si_i12_add(i12 noundef %x_in, i12 noundef %y_in) {741; CHECK-LABEL: @test_si_si_i12_add(742; CHECK-NEXT:    [[X:%.*]] = or i12 [[X_IN:%.*]], -1024743; CHECK-NEXT:    [[Y:%.*]] = or i12 [[Y_IN:%.*]], -1024744; CHECK-NEXT:    [[TMP1:%.*]] = add nsw i12 [[X]], [[Y]]745; CHECK-NEXT:    [[R:%.*]] = sitofp i12 [[TMP1]] to half746; CHECK-NEXT:    ret half [[R]]747;748  %x = or i12 %x_in, -1024749  %y = or i12 %y_in, -1024750  %xf = sitofp i12 %x to half751  %yf = sitofp i12 %y to half752  %r = fadd half %xf, %yf753  ret half %r754}755 756define half @test_si_si_i12_add_fail_overflow(i12 noundef %x_in, i12 noundef %y_in) {757; CHECK-LABEL: @test_si_si_i12_add_fail_overflow(758; CHECK-NEXT:    [[X:%.*]] = or i12 [[X_IN:%.*]], -1025759; CHECK-NEXT:    [[Y:%.*]] = or i12 [[Y_IN:%.*]], -1025760; CHECK-NEXT:    [[XF:%.*]] = sitofp i12 [[X]] to half761; CHECK-NEXT:    [[YF:%.*]] = sitofp i12 [[Y]] to half762; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], [[YF]]763; CHECK-NEXT:    ret half [[R]]764;765  %x = or i12 %x_in, -1025766  %y = or i12 %y_in, -1025767  %xf = sitofp i12 %x to half768  %yf = sitofp i12 %y to half769  %r = fadd half %xf, %yf770  ret half %r771}772 773define half @test_si_si_i12_add_C_fail_overflow(i12 noundef %x_in) {774; CHECK-LABEL: @test_si_si_i12_add_C_fail_overflow(775; CHECK-NEXT:    [[X:%.*]] = or i12 [[X_IN:%.*]], -2048776; CHECK-NEXT:    [[XF:%.*]] = sitofp i12 [[X]] to half777; CHECK-NEXT:    [[R:%.*]] = fadd half [[XF]], 0xHBC00778; CHECK-NEXT:    ret half [[R]]779;780  %x = or i12 %x_in, -2048781  %xf = sitofp i12 %x to half782  %r = fadd half %xf, -1.0783  ret half %r784}785 786define half @test_ui_ui_i12_sub(i12 noundef %x_in, i12 noundef %y_in) {787; CHECK-LABEL: @test_ui_ui_i12_sub(788; CHECK-NEXT:    [[X:%.*]] = and i12 [[X_IN:%.*]], 1023789; CHECK-NEXT:    [[Y:%.*]] = and i12 [[Y_IN:%.*]], 1023790; CHECK-NEXT:    [[TMP1:%.*]] = sub nsw i12 [[X]], [[Y]]791; CHECK-NEXT:    [[R:%.*]] = sitofp i12 [[TMP1]] to half792; CHECK-NEXT:    ret half [[R]]793;794  %x = and i12 %x_in, 1023795  %y = and i12 %y_in, 1023796  %xf = uitofp i12 %x to half797  %yf = uitofp i12 %y to half798  %r = fsub half %xf, %yf799  ret half %r800}801 802define half @test_ui_ui_i12_sub_fail_overflow(i12 noundef %x_in, i12 noundef %y_in) {803; CHECK-LABEL: @test_ui_ui_i12_sub_fail_overflow(804; CHECK-NEXT:    [[X:%.*]] = and i12 [[X_IN:%.*]], 1023805; CHECK-NEXT:    [[Y:%.*]] = and i12 [[Y_IN:%.*]], 2047806; CHECK-NEXT:    [[TMP1:%.*]] = sub nsw i12 [[X]], [[Y]]807; CHECK-NEXT:    [[R:%.*]] = sitofp i12 [[TMP1]] to half808; CHECK-NEXT:    ret half [[R]]809;810  %x = and i12 %x_in, 1023811  %y = and i12 %y_in, 2047812  %xf = uitofp i12 %x to half813  %yf = uitofp i12 %y to half814  %r = fsub half %xf, %yf815  ret half %r816}817 818 819define half @test_si_si_i12_sub(i12 noundef %x_in, i12 noundef %y_in) {820; CHECK-LABEL: @test_si_si_i12_sub(821; CHECK-NEXT:    [[X:%.*]] = and i12 [[X_IN:%.*]], 1023822; CHECK-NEXT:    [[Y:%.*]] = or i12 [[Y_IN:%.*]], -1024823; CHECK-NEXT:    [[TMP1:%.*]] = sub nsw i12 [[X]], [[Y]]824; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i12 [[TMP1]] to half825; CHECK-NEXT:    ret half [[R]]826;827  %x = and i12 %x_in, 1023828  %y = or i12 %y_in, -1024829  %xf = sitofp i12 %x to half830  %yf = sitofp i12 %y to half831  %r = fsub half %xf, %yf832  ret half %r833}834 835define half @test_si_si_i12_sub_fail_overflow(i12 noundef %x, i12 noundef %y) {836; CHECK-LABEL: @test_si_si_i12_sub_fail_overflow(837; CHECK-NEXT:    [[XF:%.*]] = sitofp i12 [[X:%.*]] to half838; CHECK-NEXT:    [[YF:%.*]] = sitofp i12 [[Y:%.*]] to half839; CHECK-NEXT:    [[R:%.*]] = fsub half [[XF]], [[YF]]840; CHECK-NEXT:    ret half [[R]]841;842  %xf = sitofp i12 %x to half843  %yf = sitofp i12 %y to half844  %r = fsub half %xf, %yf845  ret half %r846}847 848define half @test_ui_ui_i12_mul(i12 noundef %x_in, i12 noundef %y_in) {849; CHECK-LABEL: @test_ui_ui_i12_mul(850; CHECK-NEXT:    [[X:%.*]] = and i12 [[X_IN:%.*]], 31851; CHECK-NEXT:    [[Y:%.*]] = and i12 [[Y_IN:%.*]], 63852; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw nsw i12 [[X]], [[Y]]853; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i12 [[TMP1]] to half854; CHECK-NEXT:    ret half [[R]]855;856  %x = and i12 %x_in, 31857  %y = and i12 %y_in, 63858  %xf = uitofp i12 %x to half859  %yf = uitofp i12 %y to half860  %r = fmul half %xf, %yf861  ret half %r862}863 864define half @test_ui_ui_i12_mul_fail_overflow(i12 noundef %x_in, i12 noundef %y_in) {865; CHECK-LABEL: @test_ui_ui_i12_mul_fail_overflow(866; CHECK-NEXT:    [[XX:%.*]] = and i12 [[X_IN:%.*]], 31867; CHECK-NEXT:    [[X:%.*]] = add nuw nsw i12 [[XX]], 1868; CHECK-NEXT:    [[Y:%.*]] = and i12 [[Y_IN:%.*]], 63869; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw i12 [[X]], [[Y]]870; CHECK-NEXT:    [[R:%.*]] = uitofp i12 [[TMP1]] to half871; CHECK-NEXT:    ret half [[R]]872;873  %xx = and i12 %x_in, 31874  %x = add i12 %xx, 1875  %y = and i12 %y_in, 63876  %xf = uitofp i12 %x to half877  %yf = uitofp i12 %y to half878  %r = fmul half %xf, %yf879  ret half %r880}881 882define half @test_ui_ui_i12_mul_C(i12 noundef %x_in) {883; CHECK-LABEL: @test_ui_ui_i12_mul_C(884; CHECK-NEXT:    [[X:%.*]] = shl i12 [[X_IN:%.*]], 6885; CHECK-NEXT:    [[TMP1:%.*]] = and i12 [[X]], 1984886; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i12 [[TMP1]] to half887; CHECK-NEXT:    ret half [[R]]888;889  %x = and i12 %x_in, 31890  %xf = uitofp i12 %x to half891  %r = fmul half %xf, 64.0892  ret half %r893}894 895define half @test_si_si_i12_mul(i12 noundef %x_in, i12 noundef %y_in) {896; CHECK-LABEL: @test_si_si_i12_mul(897; CHECK-NEXT:    [[XX:%.*]] = and i12 [[X_IN:%.*]], 30898; CHECK-NEXT:    [[X:%.*]] = or disjoint i12 [[XX]], 1899; CHECK-NEXT:    [[Y:%.*]] = or i12 [[Y_IN:%.*]], -64900; CHECK-NEXT:    [[TMP1:%.*]] = mul nsw i12 [[X]], [[Y]]901; CHECK-NEXT:    [[R:%.*]] = sitofp i12 [[TMP1]] to half902; CHECK-NEXT:    ret half [[R]]903;904  %xx = and i12 %x_in, 30905  %x = add nsw nuw i12 %xx, 1906  %y = or i12 %y_in, -64907  %xf = sitofp i12 %x to half908  %yf = sitofp i12 %y to half909  %r = fmul half %xf, %yf910  ret half %r911}912 913define half @test_si_si_i12_mul_fail_overflow(i12 noundef %x_in, i12 noundef %y_in) {914; CHECK-LABEL: @test_si_si_i12_mul_fail_overflow(915; CHECK-NEXT:    [[XX:%.*]] = and i12 [[X_IN:%.*]], 30916; CHECK-NEXT:    [[X:%.*]] = or disjoint i12 [[XX]], 1917; CHECK-NEXT:    [[Y:%.*]] = or i12 [[Y_IN:%.*]], -128918; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i12 [[X]] to half919; CHECK-NEXT:    [[YF:%.*]] = sitofp i12 [[Y]] to half920; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], [[YF]]921; CHECK-NEXT:    ret half [[R]]922;923  %xx = and i12 %x_in, 30924  %x = add nsw nuw i12 %xx, 1925  %y = or i12 %y_in, -128926  %xf = sitofp i12 %x to half927  %yf = sitofp i12 %y to half928  %r = fmul half %xf, %yf929  ret half %r930}931 932define half @test_si_si_i12_mul_fail_maybe_non_zero(i12 noundef %x_in, i12 noundef %y_in) {933; CHECK-LABEL: @test_si_si_i12_mul_fail_maybe_non_zero(934; CHECK-NEXT:    [[X:%.*]] = and i12 [[X_IN:%.*]], 30935; CHECK-NEXT:    [[Y:%.*]] = or i12 [[Y_IN:%.*]], -128936; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg i12 [[X]] to half937; CHECK-NEXT:    [[YF:%.*]] = sitofp i12 [[Y]] to half938; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], [[YF]]939; CHECK-NEXT:    ret half [[R]]940;941  %x = and i12 %x_in, 30942  %y = or i12 %y_in, -128943  %xf = sitofp i12 %x to half944  %yf = sitofp i12 %y to half945  %r = fmul half %xf, %yf946  ret half %r947}948 949define half @test_si_si_i12_mul_C(i12 noundef %x_in) {950; CHECK-LABEL: @test_si_si_i12_mul_C(951; CHECK-NEXT:    [[X:%.*]] = or i12 [[X_IN:%.*]], -64952; CHECK-NEXT:    [[TMP1:%.*]] = mul nsw i12 [[X]], -16953; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i12 [[TMP1]] to half954; CHECK-NEXT:    ret half [[R]]955;956  %x = or i12 %x_in, -64957  %xf = sitofp i12 %x to half958  %r = fmul half %xf, -16.0959  ret half %r960}961 962define half @test_si_si_i12_mul_C_fail_overflow(i12 noundef %x_in) {963; CHECK-LABEL: @test_si_si_i12_mul_C_fail_overflow(964; CHECK-NEXT:    [[X:%.*]] = or i12 [[X_IN:%.*]], -64965; CHECK-NEXT:    [[XF:%.*]] = sitofp i12 [[X]] to half966; CHECK-NEXT:    [[R:%.*]] = fmul half [[XF]], 0xHD400967; CHECK-NEXT:    ret half [[R]]968;969  %x = or i12 %x_in, -64970  %xf = sitofp i12 %x to half971  %r = fmul half %xf, -64.0972  ret half %r973}974 975define half @test_ui_si_i12_mul_nsw(i12 noundef %x_in, i12 noundef %y_in) {976; CHECK-LABEL: @test_ui_si_i12_mul_nsw(977; CHECK-NEXT:    [[XX:%.*]] = and i12 [[X_IN:%.*]], 31978; CHECK-NEXT:    [[X:%.*]] = add nuw nsw i12 [[XX]], 1979; CHECK-NEXT:    [[YY:%.*]] = and i12 [[Y_IN:%.*]], 30980; CHECK-NEXT:    [[Y:%.*]] = or disjoint i12 [[YY]], 1981; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw nsw i12 [[X]], [[Y]]982; CHECK-NEXT:    [[R:%.*]] = uitofp nneg i12 [[TMP1]] to half983; CHECK-NEXT:    ret half [[R]]984;985  %xx = and i12 %x_in, 31986  %x = add i12 %xx, 1987  %yy = and i12 %y_in, 30988  %y = add i12 %yy, 1989  %xf = uitofp i12 %x to half990  %yf = sitofp i12 %y to half991  %r = fmul half %xf, %yf992  ret half %r993}994 995define float @test_ui_add_with_signed_constant(i32 %shr.i) {996; CHECK-LABEL: @test_ui_add_with_signed_constant(997; CHECK-NEXT:    [[AND_I:%.*]] = and i32 [[SHR_I:%.*]], 32767998; CHECK-NEXT:    [[TMP1:%.*]] = add nsw i32 [[AND_I]], -16383999; CHECK-NEXT:    [[ADD:%.*]] = sitofp i32 [[TMP1]] to float1000; CHECK-NEXT:    ret float [[ADD]]1001;1002  %and.i = and i32 %shr.i, 327671003  %sub = uitofp i32 %and.i to float1004  %add = fadd float %sub, -16383.01005  ret float %add1006}1007 1008 1009;; Reduced form of bug noticed due to #825551010define float @missed_nonzero_check_on_constant_for_si_fmul(i1 %c, i1 %.b, ptr %g_2345) {1011; CHECK-LABEL: @missed_nonzero_check_on_constant_for_si_fmul(1012; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 532641013; CHECK-NEXT:    [[CONV_I:%.*]] = trunc nuw i32 [[SEL]] to i161014; CHECK-NEXT:    [[CONV1_I:%.*]] = sitofp i16 [[CONV_I]] to float1015; CHECK-NEXT:    [[MUL3_I_I:%.*]] = call float @llvm.copysign.f32(float 0.000000e+00, float [[CONV1_I]])1016; CHECK-NEXT:    store i32 [[SEL]], ptr [[G_2345:%.*]], align 41017; CHECK-NEXT:    ret float [[MUL3_I_I]]1018;1019  %sel = select i1 %c, i32 65529, i32 532641020  %conv.i = trunc i32 %sel to i161021  %conv1.i = sitofp i16 %conv.i to float1022  %mul3.i.i = fmul float %conv1.i, 0.000000e+001023  store i32 %sel, ptr %g_2345, align 41024  ret float %mul3.i.i1025}1026 1027define <2 x float> @missed_nonzero_check_on_constant_for_si_fmul_vec(i1 %c, i1 %.b, ptr %g_2345) {1028; CHECK-LABEL: @missed_nonzero_check_on_constant_for_si_fmul_vec(1029; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 532641030; CHECK-NEXT:    [[CONV_I_S:%.*]] = trunc nuw i32 [[SEL]] to i161031; CHECK-NEXT:    [[CONV_I_V:%.*]] = insertelement <2 x i16> poison, i16 [[CONV_I_S]], i64 01032; CHECK-NEXT:    [[CONV_I:%.*]] = shufflevector <2 x i16> [[CONV_I_V]], <2 x i16> poison, <2 x i32> zeroinitializer1033; CHECK-NEXT:    [[CONV1_I:%.*]] = sitofp <2 x i16> [[CONV_I]] to <2 x float>1034; CHECK-NEXT:    [[MUL3_I_I:%.*]] = call <2 x float> @llvm.copysign.v2f32(<2 x float> zeroinitializer, <2 x float> [[CONV1_I]])1035; CHECK-NEXT:    store i32 [[SEL]], ptr [[G_2345:%.*]], align 41036; CHECK-NEXT:    ret <2 x float> [[MUL3_I_I]]1037;1038  %sel = select i1 %c, i32 65529, i32 532641039  %conv.i.s = trunc i32 %sel to i161040  %conv.i.v = insertelement <2 x i16> poison, i16 %conv.i.s, i64 01041  %conv.i = insertelement <2 x i16> %conv.i.v, i16 %conv.i.s, i64 11042  %conv1.i = sitofp <2 x i16> %conv.i to <2 x float>1043  %mul3.i.i = fmul <2 x float> %conv1.i, zeroinitializer1044  store i32 %sel, ptr %g_2345, align 41045  ret <2 x float> %mul3.i.i1046}1047 1048define float @negzero_check_on_constant_for_si_fmul(i1 %c, i1 %.b, ptr %g_2345) {1049; CHECK-LABEL: @negzero_check_on_constant_for_si_fmul(1050; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 532641051; CHECK-NEXT:    [[CONV_I:%.*]] = trunc nuw i32 [[SEL]] to i161052; CHECK-NEXT:    [[CONV1_I:%.*]] = sitofp i16 [[CONV_I]] to float1053; CHECK-NEXT:    [[TMP1:%.*]] = fneg float [[CONV1_I]]1054; CHECK-NEXT:    [[MUL3_I_I:%.*]] = call float @llvm.copysign.f32(float 0.000000e+00, float [[TMP1]])1055; CHECK-NEXT:    store i32 [[SEL]], ptr [[G_2345:%.*]], align 41056; CHECK-NEXT:    ret float [[MUL3_I_I]]1057;1058  %sel = select i1 %c, i32 65529, i32 532641059  %conv.i = trunc i32 %sel to i161060  %conv1.i = sitofp i16 %conv.i to float1061  %mul3.i.i = fmul float %conv1.i, -0.000000e+001062  store i32 %sel, ptr %g_2345, align 41063  ret float %mul3.i.i1064}1065 1066; Don't perform the fold on vector operations, as the integer op may be1067; much more expensive than the float op in that case.1068define <2 x half> @test_ui_ui_i8_mul_vec(<2 x i8> noundef %x_in, <2 x i8> noundef %y_in) {1069; CHECK-LABEL: @test_ui_ui_i8_mul_vec(1070; CHECK-NEXT:    [[X:%.*]] = and <2 x i8> [[X_IN:%.*]], splat (i8 15)1071; CHECK-NEXT:    [[Y:%.*]] = and <2 x i8> [[Y_IN:%.*]], splat (i8 15)1072; CHECK-NEXT:    [[XF:%.*]] = uitofp nneg <2 x i8> [[X]] to <2 x half>1073; CHECK-NEXT:    [[YF:%.*]] = uitofp nneg <2 x i8> [[Y]] to <2 x half>1074; CHECK-NEXT:    [[R:%.*]] = fmul <2 x half> [[XF]], [[YF]]1075; CHECK-NEXT:    ret <2 x half> [[R]]1076;1077  %x = and <2 x i8> %x_in, splat (i8 15)1078  %y = and <2 x i8> %y_in, splat (i8 15)1079  %xf = uitofp <2 x i8> %x to <2 x half>1080  %yf = uitofp <2 x i8> %y to <2 x half>1081  %r = fmul <2 x half> %xf, %yf1082  ret <2 x half> %r1083}1084 1085define <2 x float> @nonzero_check_on_constant_for_si_fmul_vec_w_poison(i1 %c, i1 %.b, ptr %g_2345) {1086; CHECK-LABEL: @nonzero_check_on_constant_for_si_fmul_vec_w_poison(1087; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 532641088; CHECK-NEXT:    [[CONV_I_S:%.*]] = trunc nuw i32 [[SEL]] to i161089; CHECK-NEXT:    [[CONV_I_V:%.*]] = insertelement <2 x i16> poison, i16 [[CONV_I_S]], i64 01090; CHECK-NEXT:    [[CONV_I:%.*]] = shufflevector <2 x i16> [[CONV_I_V]], <2 x i16> poison, <2 x i32> zeroinitializer1091; CHECK-NEXT:    [[CONV1_I:%.*]] = sitofp <2 x i16> [[CONV_I]] to <2 x float>1092; CHECK-NEXT:    [[MUL3_I_I:%.*]] = call <2 x float> @llvm.copysign.v2f32(<2 x float> <float poison, float 0.000000e+00>, <2 x float> [[CONV1_I]])1093; CHECK-NEXT:    store i32 [[SEL]], ptr [[G_2345:%.*]], align 41094; CHECK-NEXT:    ret <2 x float> [[MUL3_I_I]]1095;1096  %sel = select i1 %c, i32 65529, i32 532641097  %conv.i.s = trunc i32 %sel to i161098  %conv.i.v = insertelement <2 x i16> poison, i16 %conv.i.s, i64 01099  %conv.i = insertelement <2 x i16> %conv.i.v, i16 %conv.i.s, i64 11100  %conv1.i = sitofp <2 x i16> %conv.i to <2 x float>1101  %mul3.i.i = fmul <2 x float> %conv1.i, <float poison, float 0.000000e+00>1102  store i32 %sel, ptr %g_2345, align 41103  ret <2 x float> %mul3.i.i1104}1105 1106define <2 x float> @nonzero_check_on_constant_for_si_fmul_nz_vec_w_poison(i1 %c, i1 %.b, ptr %g_2345) {1107; CHECK-LABEL: @nonzero_check_on_constant_for_si_fmul_nz_vec_w_poison(1108; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 532641109; CHECK-NEXT:    [[CONV_I_S:%.*]] = trunc nuw i32 [[SEL]] to i161110; CHECK-NEXT:    [[CONV_I_V:%.*]] = insertelement <2 x i16> poison, i16 [[CONV_I_S]], i64 01111; CHECK-NEXT:    [[CONV_I:%.*]] = shufflevector <2 x i16> [[CONV_I_V]], <2 x i16> poison, <2 x i32> zeroinitializer1112; CHECK-NEXT:    [[MUL3_I_I:%.*]] = sitofp <2 x i16> [[CONV_I]] to <2 x float>1113; CHECK-NEXT:    [[MUL3_I_I1:%.*]] = fmul <2 x float> [[MUL3_I_I]], <float poison, float 1.000000e+00>1114; CHECK-NEXT:    store i32 [[SEL]], ptr [[G_2345:%.*]], align 41115; CHECK-NEXT:    ret <2 x float> [[MUL3_I_I1]]1116;1117  %sel = select i1 %c, i32 65529, i32 532641118  %conv.i.s = trunc i32 %sel to i161119  %conv.i.v = insertelement <2 x i16> poison, i16 %conv.i.s, i64 01120  %conv.i = insertelement <2 x i16> %conv.i.v, i16 %conv.i.s, i64 11121  %conv1.i = sitofp <2 x i16> %conv.i to <2 x float>1122  %mul3.i.i = fmul <2 x float> %conv1.i, <float poison, float 1.000000e+00>1123  store i32 %sel, ptr %g_2345, align 41124  ret <2 x float> %mul3.i.i1125}1126 1127define <2 x float> @nonzero_check_on_constant_for_si_fmul_negz_vec_w_poison(i1 %c, i1 %.b, ptr %g_2345) {1128; CHECK-LABEL: @nonzero_check_on_constant_for_si_fmul_negz_vec_w_poison(1129; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 532641130; CHECK-NEXT:    [[CONV_I_S:%.*]] = trunc nuw i32 [[SEL]] to i161131; CHECK-NEXT:    [[CONV_I_V:%.*]] = insertelement <2 x i16> poison, i16 [[CONV_I_S]], i64 01132; CHECK-NEXT:    [[CONV_I:%.*]] = shufflevector <2 x i16> [[CONV_I_V]], <2 x i16> poison, <2 x i32> zeroinitializer1133; CHECK-NEXT:    [[CONV1_I:%.*]] = sitofp <2 x i16> [[CONV_I]] to <2 x float>1134; CHECK-NEXT:    [[TMP1:%.*]] = fneg <2 x float> [[CONV1_I]]1135; CHECK-NEXT:    [[MUL3_I_I:%.*]] = call <2 x float> @llvm.copysign.v2f32(<2 x float> <float poison, float -0.000000e+00>, <2 x float> [[TMP1]])1136; CHECK-NEXT:    store i32 [[SEL]], ptr [[G_2345:%.*]], align 41137; CHECK-NEXT:    ret <2 x float> [[MUL3_I_I]]1138;1139  %sel = select i1 %c, i32 65529, i32 532641140  %conv.i.s = trunc i32 %sel to i161141  %conv.i.v = insertelement <2 x i16> poison, i16 %conv.i.s, i64 01142  %conv.i = insertelement <2 x i16> %conv.i.v, i16 %conv.i.s, i64 11143  %conv1.i = sitofp <2 x i16> %conv.i to <2 x float>1144  %mul3.i.i = fmul <2 x float> %conv1.i, <float poison, float -0.000000e+00>1145  store i32 %sel, ptr %g_2345, align 41146  ret <2 x float> %mul3.i.i1147}1148