636 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=instcombine %s | FileCheck %s3 4define <2 x i8> @add_constant(i8 %x) {5; CHECK-LABEL: @add_constant(6; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 07; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 42, i8 undef>8; CHECK-NEXT: ret <2 x i8> [[BO]]9;10 %ins = insertelement <2 x i8> undef, i8 %x, i32 011 %bo = add <2 x i8> %ins, <i8 42, i8 undef>12 ret <2 x i8> %bo13}14 15define <2 x i8> @add_constant_not_undef_lane(i8 %x) {16; CHECK-LABEL: @add_constant_not_undef_lane(17; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 018; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 42, i8 -42>19; CHECK-NEXT: ret <2 x i8> [[BO]]20;21 %ins = insertelement <2 x i8> undef, i8 %x, i32 022 %bo = add <2 x i8> %ins, <i8 42, i8 -42>23 ret <2 x i8> %bo24}25 26; IR flags are not required, but they should propagate.27 28define <2 x i8> @sub_constant_op0(i8 %x) {29; CHECK-LABEL: @sub_constant_op0(30; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 131; CHECK-NEXT: [[BO:%.*]] = sub nuw nsw <2 x i8> <i8 undef, i8 -42>, [[INS]]32; CHECK-NEXT: ret <2 x i8> [[BO]]33;34 %ins = insertelement <2 x i8> undef, i8 %x, i32 135 %bo = sub nsw nuw <2 x i8> <i8 undef, i8 -42>, %ins36 ret <2 x i8> %bo37}38 39define <2 x i8> @sub_constant_op0_not_undef_lane(i8 %x) {40; CHECK-LABEL: @sub_constant_op0_not_undef_lane(41; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 142; CHECK-NEXT: [[BO:%.*]] = sub nuw <2 x i8> <i8 42, i8 -42>, [[INS]]43; CHECK-NEXT: ret <2 x i8> [[BO]]44;45 %ins = insertelement <2 x i8> undef, i8 %x, i32 146 %bo = sub nuw <2 x i8> <i8 42, i8 -42>, %ins47 ret <2 x i8> %bo48}49 50define <2 x i8> @sub_constant_op1(i8 %x) {51; CHECK-LABEL: @sub_constant_op1(52; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 053; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 -42, i8 undef>54; CHECK-NEXT: ret <2 x i8> [[BO]]55;56 %ins = insertelement <2 x i8> undef, i8 %x, i32 057 %bo = sub nuw <2 x i8> %ins, <i8 42, i8 undef>58 ret <2 x i8> %bo59}60 61define <2 x i8> @sub_constant_op1_not_undef_lane(i8 %x) {62; CHECK-LABEL: @sub_constant_op1_not_undef_lane(63; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 064; CHECK-NEXT: [[BO:%.*]] = add <2 x i8> [[INS]], <i8 -42, i8 42>65; CHECK-NEXT: ret <2 x i8> [[BO]]66;67 %ins = insertelement <2 x i8> undef, i8 %x, i32 068 %bo = sub nuw <2 x i8> %ins, <i8 42, i8 -42>69 ret <2 x i8> %bo70}71 72define <3 x i8> @mul_constant(i8 %x) {73; CHECK-LABEL: @mul_constant(74; CHECK-NEXT: [[INS:%.*]] = insertelement <3 x i8> <i8 undef, i8 undef, i8 poison>, i8 [[X:%.*]], i64 275; CHECK-NEXT: [[BO:%.*]] = mul <3 x i8> [[INS]], <i8 undef, i8 undef, i8 -42>76; CHECK-NEXT: ret <3 x i8> [[BO]]77;78 %ins = insertelement <3 x i8> undef, i8 %x, i32 279 %bo = mul <3 x i8> %ins, <i8 undef, i8 undef, i8 -42>80 ret <3 x i8> %bo81}82 83define <3 x i8> @mul_constant_not_undef_lane(i8 %x) {84; CHECK-LABEL: @mul_constant_not_undef_lane(85; CHECK-NEXT: [[INS:%.*]] = insertelement <3 x i8> <i8 undef, i8 undef, i8 poison>, i8 [[X:%.*]], i64 286; CHECK-NEXT: [[BO:%.*]] = mul <3 x i8> [[INS]], <i8 42, i8 undef, i8 -42>87; CHECK-NEXT: ret <3 x i8> [[BO]]88;89 %ins = insertelement <3 x i8> undef, i8 %x, i32 290 %bo = mul <3 x i8> %ins, <i8 42, i8 undef, i8 -42>91 ret <3 x i8> %bo92}93 94define <2 x i8> @shl_constant_op0(i8 %x) {95; CHECK-LABEL: @shl_constant_op0(96; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 197; CHECK-NEXT: [[BO:%.*]] = shl <2 x i8> <i8 undef, i8 2>, [[INS]]98; CHECK-NEXT: ret <2 x i8> [[BO]]99;100 %ins = insertelement <2 x i8> undef, i8 %x, i32 1101 %bo = shl <2 x i8> <i8 undef, i8 2>, %ins102 ret <2 x i8> %bo103}104 105define <2 x i8> @shl_constant_op0_not_undef_lane(i8 %x) {106; CHECK-LABEL: @shl_constant_op0_not_undef_lane(107; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1108; CHECK-NEXT: [[BO:%.*]] = shl <2 x i8> <i8 5, i8 2>, [[INS]]109; CHECK-NEXT: ret <2 x i8> [[BO]]110;111 %ins = insertelement <2 x i8> undef, i8 %x, i32 1112 %bo = shl <2 x i8> <i8 5, i8 2>, %ins113 ret <2 x i8> %bo114}115 116define <2 x i8> @shl_constant_op1(i8 %x) {117; CHECK-LABEL: @shl_constant_op1(118; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0119; CHECK-NEXT: [[BO:%.*]] = shl nuw <2 x i8> [[INS]], <i8 5, i8 undef>120; CHECK-NEXT: ret <2 x i8> [[BO]]121;122 %ins = insertelement <2 x i8> undef, i8 %x, i32 0123 %bo = shl nuw <2 x i8> %ins, <i8 5, i8 undef>124 ret <2 x i8> %bo125}126 127define <2 x i8> @shl_constant_op1_not_undef_lane(i8 %x) {128; CHECK-LABEL: @shl_constant_op1_not_undef_lane(129; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0130; CHECK-NEXT: [[BO:%.*]] = shl nuw <2 x i8> [[INS]], <i8 5, i8 2>131; CHECK-NEXT: ret <2 x i8> [[BO]]132;133 %ins = insertelement <2 x i8> undef, i8 %x, i32 0134 %bo = shl nuw <2 x i8> %ins, <i8 5, i8 2>135 ret <2 x i8> %bo136}137 138define <2 x i8> @ashr_constant_op0(i8 %x) {139; CHECK-LABEL: @ashr_constant_op0(140; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1141; CHECK-NEXT: [[BO:%.*]] = ashr exact <2 x i8> <i8 undef, i8 2>, [[INS]]142; CHECK-NEXT: ret <2 x i8> [[BO]]143;144 %ins = insertelement <2 x i8> undef, i8 %x, i32 1145 %bo = ashr exact <2 x i8> <i8 undef, i8 2>, %ins146 ret <2 x i8> %bo147}148 149define <2 x i8> @ashr_constant_op0_not_undef_lane(i8 %x) {150; CHECK-LABEL: @ashr_constant_op0_not_undef_lane(151; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1152; CHECK-NEXT: [[BO:%.*]] = lshr exact <2 x i8> <i8 5, i8 2>, [[INS]]153; CHECK-NEXT: ret <2 x i8> [[BO]]154;155 %ins = insertelement <2 x i8> undef, i8 %x, i32 1156 %bo = ashr exact <2 x i8> <i8 5, i8 2>, %ins157 ret <2 x i8> %bo158}159 160define <2 x i8> @ashr_constant_op1(i8 %x) {161; CHECK-LABEL: @ashr_constant_op1(162; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0163; CHECK-NEXT: [[BO:%.*]] = ashr <2 x i8> [[INS]], <i8 5, i8 undef>164; CHECK-NEXT: ret <2 x i8> [[BO]]165;166 %ins = insertelement <2 x i8> undef, i8 %x, i32 0167 %bo = ashr <2 x i8> %ins, <i8 5, i8 undef>168 ret <2 x i8> %bo169}170 171define <2 x i8> @ashr_constant_op1_not_undef_lane(i8 %x) {172; CHECK-LABEL: @ashr_constant_op1_not_undef_lane(173; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0174; CHECK-NEXT: [[BO:%.*]] = ashr <2 x i8> [[INS]], <i8 5, i8 2>175; CHECK-NEXT: ret <2 x i8> [[BO]]176;177 %ins = insertelement <2 x i8> undef, i8 %x, i32 0178 %bo = ashr <2 x i8> %ins, <i8 5, i8 2>179 ret <2 x i8> %bo180}181 182define <2 x i8> @lshr_constant_op0(i8 %x) {183; CHECK-LABEL: @lshr_constant_op0(184; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0185; CHECK-NEXT: [[BO:%.*]] = lshr <2 x i8> <i8 5, i8 undef>, [[INS]]186; CHECK-NEXT: ret <2 x i8> [[BO]]187;188 %ins = insertelement <2 x i8> undef, i8 %x, i32 0189 %bo = lshr <2 x i8> <i8 5, i8 undef>, %ins190 ret <2 x i8> %bo191}192 193define <2 x i8> @lshr_constant_op0_not_undef_lane(i8 %x) {194; CHECK-LABEL: @lshr_constant_op0_not_undef_lane(195; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0196; CHECK-NEXT: [[BO:%.*]] = lshr <2 x i8> <i8 5, i8 2>, [[INS]]197; CHECK-NEXT: ret <2 x i8> [[BO]]198;199 %ins = insertelement <2 x i8> undef, i8 %x, i32 0200 %bo = lshr <2 x i8> <i8 5, i8 2>, %ins201 ret <2 x i8> %bo202}203 204define <2 x i8> @lshr_constant_op1(i8 %x) {205; CHECK-LABEL: @lshr_constant_op1(206; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1207; CHECK-NEXT: [[BO:%.*]] = lshr exact <2 x i8> [[INS]], <i8 undef, i8 2>208; CHECK-NEXT: ret <2 x i8> [[BO]]209;210 %ins = insertelement <2 x i8> undef, i8 %x, i32 1211 %bo = lshr exact <2 x i8> %ins, <i8 undef, i8 2>212 ret <2 x i8> %bo213}214 215define <2 x i8> @lshr_constant_op1_not_undef_lane(i8 %x) {216; CHECK-LABEL: @lshr_constant_op1_not_undef_lane(217; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1218; CHECK-NEXT: [[BO:%.*]] = lshr exact <2 x i8> [[INS]], <i8 5, i8 2>219; CHECK-NEXT: ret <2 x i8> [[BO]]220;221 %ins = insertelement <2 x i8> undef, i8 %x, i32 1222 %bo = lshr exact <2 x i8> %ins, <i8 5, i8 2>223 ret <2 x i8> %bo224}225 226define <2 x i8> @urem_constant_op0(i8 %x) {227; CHECK-LABEL: @urem_constant_op0(228; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0229; CHECK-NEXT: [[BO:%.*]] = urem <2 x i8> <i8 5, i8 undef>, [[INS]]230; CHECK-NEXT: ret <2 x i8> [[BO]]231;232 %ins = insertelement <2 x i8> undef, i8 %x, i32 0233 %bo = urem <2 x i8> <i8 5, i8 undef>, %ins234 ret <2 x i8> %bo235}236 237define <2 x i8> @urem_constant_op0_not_undef_lane(i8 %x) {238; CHECK-LABEL: @urem_constant_op0_not_undef_lane(239; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0240; CHECK-NEXT: [[BO:%.*]] = urem <2 x i8> <i8 5, i8 2>, [[INS]]241; CHECK-NEXT: ret <2 x i8> [[BO]]242;243 %ins = insertelement <2 x i8> undef, i8 %x, i32 0244 %bo = urem <2 x i8> <i8 5, i8 2>, %ins245 ret <2 x i8> %bo246}247 248define <2 x i8> @urem_constant_op1(i8 %x) {249; CHECK-LABEL: @urem_constant_op1(250; CHECK-NEXT: ret <2 x i8> poison251;252 %ins = insertelement <2 x i8> undef, i8 %x, i32 1253 %bo = urem <2 x i8> %ins, <i8 undef, i8 2>254 ret <2 x i8> %bo255}256 257define <2 x i8> @urem_constant_op1_not_undef_lane(i8 %x) {258; CHECK-LABEL: @urem_constant_op1_not_undef_lane(259; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1260; CHECK-NEXT: [[BO:%.*]] = urem <2 x i8> [[INS]], <i8 5, i8 2>261; CHECK-NEXT: ret <2 x i8> [[BO]]262;263 %ins = insertelement <2 x i8> undef, i8 %x, i32 1264 %bo = urem <2 x i8> %ins, <i8 5, i8 2>265 ret <2 x i8> %bo266}267 268define <2 x i8> @srem_constant_op0(i8 %x) {269; CHECK-LABEL: @srem_constant_op0(270; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0271; CHECK-NEXT: [[BO:%.*]] = srem <2 x i8> <i8 5, i8 undef>, [[INS]]272; CHECK-NEXT: ret <2 x i8> [[BO]]273;274 %ins = insertelement <2 x i8> undef, i8 %x, i32 0275 %bo = srem <2 x i8> <i8 5, i8 undef>, %ins276 ret <2 x i8> %bo277}278 279define <2 x i8> @srem_constant_op0_not_undef_lane(i8 %x) {280; CHECK-LABEL: @srem_constant_op0_not_undef_lane(281; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0282; CHECK-NEXT: [[BO:%.*]] = srem <2 x i8> <i8 5, i8 2>, [[INS]]283; CHECK-NEXT: ret <2 x i8> [[BO]]284;285 %ins = insertelement <2 x i8> undef, i8 %x, i32 0286 %bo = srem <2 x i8> <i8 5, i8 2>, %ins287 ret <2 x i8> %bo288}289 290define <2 x i8> @srem_constant_op1(i8 %x) {291; CHECK-LABEL: @srem_constant_op1(292; CHECK-NEXT: ret <2 x i8> poison293;294 %ins = insertelement <2 x i8> undef, i8 %x, i32 1295 %bo = srem <2 x i8> %ins, <i8 undef, i8 2>296 ret <2 x i8> %bo297}298 299define <2 x i8> @srem_constant_op1_not_undef_lane(i8 %x) {300; CHECK-LABEL: @srem_constant_op1_not_undef_lane(301; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1302; CHECK-NEXT: [[BO:%.*]] = srem <2 x i8> [[INS]], <i8 5, i8 2>303; CHECK-NEXT: ret <2 x i8> [[BO]]304;305 %ins = insertelement <2 x i8> undef, i8 %x, i32 1306 %bo = srem <2 x i8> %ins, <i8 5, i8 2>307 ret <2 x i8> %bo308}309 310define <2 x i8> @udiv_constant_op0(i8 %x) {311; CHECK-LABEL: @udiv_constant_op0(312; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0313; CHECK-NEXT: [[BO:%.*]] = udiv exact <2 x i8> <i8 5, i8 undef>, [[INS]]314; CHECK-NEXT: ret <2 x i8> [[BO]]315;316 %ins = insertelement <2 x i8> undef, i8 %x, i32 0317 %bo = udiv exact <2 x i8> <i8 5, i8 undef>, %ins318 ret <2 x i8> %bo319}320 321define <2 x i8> @udiv_constant_op0_not_undef_lane(i8 %x) {322; CHECK-LABEL: @udiv_constant_op0_not_undef_lane(323; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0324; CHECK-NEXT: [[BO:%.*]] = udiv exact <2 x i8> <i8 5, i8 2>, [[INS]]325; CHECK-NEXT: ret <2 x i8> [[BO]]326;327 %ins = insertelement <2 x i8> undef, i8 %x, i32 0328 %bo = udiv exact <2 x i8> <i8 5, i8 2>, %ins329 ret <2 x i8> %bo330}331 332define <2 x i8> @udiv_constant_op1(i8 %x) {333; CHECK-LABEL: @udiv_constant_op1(334; CHECK-NEXT: ret <2 x i8> poison335;336 %ins = insertelement <2 x i8> undef, i8 %x, i32 1337 %bo = udiv <2 x i8> %ins, <i8 undef, i8 2>338 ret <2 x i8> %bo339}340 341define <2 x i8> @udiv_constant_op1_not_undef_lane(i8 %x) {342; CHECK-LABEL: @udiv_constant_op1_not_undef_lane(343; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1344; CHECK-NEXT: [[BO:%.*]] = udiv <2 x i8> [[INS]], <i8 5, i8 2>345; CHECK-NEXT: ret <2 x i8> [[BO]]346;347 %ins = insertelement <2 x i8> undef, i8 %x, i32 1348 %bo = udiv <2 x i8> %ins, <i8 5, i8 2>349 ret <2 x i8> %bo350}351 352define <2 x i8> @sdiv_constant_op0(i8 %x) {353; CHECK-LABEL: @sdiv_constant_op0(354; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0355; CHECK-NEXT: [[BO:%.*]] = sdiv <2 x i8> <i8 5, i8 undef>, [[INS]]356; CHECK-NEXT: ret <2 x i8> [[BO]]357;358 %ins = insertelement <2 x i8> undef, i8 %x, i32 0359 %bo = sdiv <2 x i8> <i8 5, i8 undef>, %ins360 ret <2 x i8> %bo361}362 363define <2 x i8> @sdiv_constant_op0_not_undef_lane(i8 %x) {364; CHECK-LABEL: @sdiv_constant_op0_not_undef_lane(365; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0366; CHECK-NEXT: [[BO:%.*]] = sdiv <2 x i8> <i8 5, i8 2>, [[INS]]367; CHECK-NEXT: ret <2 x i8> [[BO]]368;369 %ins = insertelement <2 x i8> undef, i8 %x, i32 0370 %bo = sdiv <2 x i8> <i8 5, i8 2>, %ins371 ret <2 x i8> %bo372}373 374define <2 x i8> @sdiv_constant_op1(i8 %x) {375; CHECK-LABEL: @sdiv_constant_op1(376; CHECK-NEXT: ret <2 x i8> poison377;378 %ins = insertelement <2 x i8> undef, i8 %x, i32 1379 %bo = sdiv exact <2 x i8> %ins, <i8 undef, i8 2>380 ret <2 x i8> %bo381}382 383define <2 x i8> @sdiv_constant_op1_not_undef_lane(i8 %x) {384; CHECK-LABEL: @sdiv_constant_op1_not_undef_lane(385; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1386; CHECK-NEXT: [[BO:%.*]] = sdiv exact <2 x i8> [[INS]], <i8 5, i8 2>387; CHECK-NEXT: ret <2 x i8> [[BO]]388;389 %ins = insertelement <2 x i8> undef, i8 %x, i32 1390 %bo = sdiv exact <2 x i8> %ins, <i8 5, i8 2>391 ret <2 x i8> %bo392}393 394define <2 x i8> @and_constant(i8 %x) {395; CHECK-LABEL: @and_constant(396; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0397; CHECK-NEXT: [[BO:%.*]] = and <2 x i8> [[INS]], <i8 42, i8 undef>398; CHECK-NEXT: ret <2 x i8> [[BO]]399;400 %ins = insertelement <2 x i8> undef, i8 %x, i32 0401 %bo = and <2 x i8> %ins, <i8 42, i8 undef>402 ret <2 x i8> %bo403}404 405define <2 x i8> @and_constant_not_undef_lane(i8 %x) {406; CHECK-LABEL: @and_constant_not_undef_lane(407; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0408; CHECK-NEXT: [[BO:%.*]] = and <2 x i8> [[INS]], <i8 42, i8 -42>409; CHECK-NEXT: ret <2 x i8> [[BO]]410;411 %ins = insertelement <2 x i8> undef, i8 %x, i32 0412 %bo = and <2 x i8> %ins, <i8 42, i8 -42>413 ret <2 x i8> %bo414}415 416define <2 x i8> @or_constant(i8 %x) {417; CHECK-LABEL: @or_constant(418; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1419; CHECK-NEXT: [[BO:%.*]] = or <2 x i8> [[INS]], <i8 undef, i8 -42>420; CHECK-NEXT: ret <2 x i8> [[BO]]421;422 %ins = insertelement <2 x i8> undef, i8 %x, i32 1423 %bo = or <2 x i8> %ins, <i8 undef, i8 -42>424 ret <2 x i8> %bo425}426 427define <2 x i8> @or_constant_not_undef_lane(i8 %x) {428; CHECK-LABEL: @or_constant_not_undef_lane(429; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 undef, i8 poison>, i8 [[X:%.*]], i64 1430; CHECK-NEXT: [[BO:%.*]] = or <2 x i8> [[INS]], <i8 42, i8 -42>431; CHECK-NEXT: ret <2 x i8> [[BO]]432;433 %ins = insertelement <2 x i8> undef, i8 %x, i32 1434 %bo = or <2 x i8> %ins, <i8 42, i8 -42>435 ret <2 x i8> %bo436}437 438define <2 x i8> @xor_constant(i8 %x) {439; CHECK-LABEL: @xor_constant(440; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0441; CHECK-NEXT: [[BO:%.*]] = xor <2 x i8> [[INS]], <i8 42, i8 undef>442; CHECK-NEXT: ret <2 x i8> [[BO]]443;444 %ins = insertelement <2 x i8> undef, i8 %x, i32 0445 %bo = xor <2 x i8> %ins, <i8 42, i8 undef>446 ret <2 x i8> %bo447}448 449define <2 x i8> @xor_constant_not_undef_lane(i8 %x) {450; CHECK-LABEL: @xor_constant_not_undef_lane(451; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> <i8 poison, i8 undef>, i8 [[X:%.*]], i64 0452; CHECK-NEXT: [[BO:%.*]] = xor <2 x i8> [[INS]], <i8 42, i8 -42>453; CHECK-NEXT: ret <2 x i8> [[BO]]454;455 %ins = insertelement <2 x i8> undef, i8 %x, i32 0456 %bo = xor <2 x i8> %ins, <i8 42, i8 -42>457 ret <2 x i8> %bo458}459 460define <2 x float> @fadd_constant(float %x) {461; CHECK-LABEL: @fadd_constant(462; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0463; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float 4.200000e+01, float undef>464; CHECK-NEXT: ret <2 x float> [[BO]]465;466 %ins = insertelement <2 x float> undef, float %x, i32 0467 %bo = fadd <2 x float> %ins, <float 42.0, float undef>468 ret <2 x float> %bo469}470 471define <2 x float> @fadd_constant_not_undef_lane(float %x) {472; CHECK-LABEL: @fadd_constant_not_undef_lane(473; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float undef, float poison>, float [[X:%.*]], i64 1474; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>475; CHECK-NEXT: ret <2 x float> [[BO]]476;477 %ins = insertelement <2 x float> undef, float %x, i32 1478 %bo = fadd <2 x float> %ins, <float 42.0, float -42.0>479 ret <2 x float> %bo480}481 482define <2 x float> @fsub_constant_op0(float %x) {483; CHECK-LABEL: @fsub_constant_op0(484; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0485; CHECK-NEXT: [[BO:%.*]] = fsub fast <2 x float> <float 4.200000e+01, float undef>, [[INS]]486; CHECK-NEXT: ret <2 x float> [[BO]]487;488 %ins = insertelement <2 x float> undef, float %x, i32 0489 %bo = fsub fast <2 x float> <float 42.0, float undef>, %ins490 ret <2 x float> %bo491}492 493define <2 x float> @fsub_constant_op0_not_undef_lane(float %x) {494; CHECK-LABEL: @fsub_constant_op0_not_undef_lane(495; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float undef, float poison>, float [[X:%.*]], i64 1496; CHECK-NEXT: [[BO:%.*]] = fsub nsz <2 x float> <float 4.200000e+01, float -4.200000e+01>, [[INS]]497; CHECK-NEXT: ret <2 x float> [[BO]]498;499 %ins = insertelement <2 x float> undef, float %x, i32 1500 %bo = fsub nsz <2 x float> <float 42.0, float -42.0>, %ins501 ret <2 x float> %bo502}503 504define <2 x float> @fsub_constant_op1(float %x) {505; CHECK-LABEL: @fsub_constant_op1(506; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float undef, float poison>, float [[X:%.*]], i64 1507; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float undef, float -4.200000e+01>508; CHECK-NEXT: ret <2 x float> [[BO]]509;510 %ins = insertelement <2 x float> undef, float %x, i32 1511 %bo = fsub <2 x float> %ins, <float undef, float 42.0>512 ret <2 x float> %bo513}514 515define <2 x float> @fsub_constant_op1_not_undef_lane(float %x) {516; CHECK-LABEL: @fsub_constant_op1_not_undef_lane(517; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0518; CHECK-NEXT: [[BO:%.*]] = fadd <2 x float> [[INS]], <float -4.200000e+01, float 4.200000e+01>519; CHECK-NEXT: ret <2 x float> [[BO]]520;521 %ins = insertelement <2 x float> undef, float %x, i32 0522 %bo = fsub <2 x float> %ins, <float 42.0, float -42.0>523 ret <2 x float> %bo524}525 526define <2 x float> @fmul_constant(float %x) {527; CHECK-LABEL: @fmul_constant(528; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0529; CHECK-NEXT: [[BO:%.*]] = fmul reassoc <2 x float> [[INS]], <float 4.200000e+01, float undef>530; CHECK-NEXT: ret <2 x float> [[BO]]531;532 %ins = insertelement <2 x float> undef, float %x, i32 0533 %bo = fmul reassoc <2 x float> %ins, <float 42.0, float undef>534 ret <2 x float> %bo535}536 537define <2 x float> @fmul_constant_not_undef_lane(float %x) {538; CHECK-LABEL: @fmul_constant_not_undef_lane(539; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float undef, float poison>, float [[X:%.*]], i64 1540; CHECK-NEXT: [[BO:%.*]] = fmul <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>541; CHECK-NEXT: ret <2 x float> [[BO]]542;543 %ins = insertelement <2 x float> undef, float %x, i32 1544 %bo = fmul <2 x float> %ins, <float 42.0, float -42.0>545 ret <2 x float> %bo546}547 548define <2 x float> @fdiv_constant_op0(float %x) {549; CHECK-LABEL: @fdiv_constant_op0(550; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float undef, float poison>, float [[X:%.*]], i64 1551; CHECK-NEXT: [[BO:%.*]] = fdiv nnan <2 x float> <float undef, float 4.200000e+01>, [[INS]]552; CHECK-NEXT: ret <2 x float> [[BO]]553;554 %ins = insertelement <2 x float> undef, float %x, i32 1555 %bo = fdiv nnan <2 x float> <float undef, float 42.0>, %ins556 ret <2 x float> %bo557}558 559define <2 x float> @fdiv_constant_op0_not_undef_lane(float %x) {560; CHECK-LABEL: @fdiv_constant_op0_not_undef_lane(561; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0562; CHECK-NEXT: [[BO:%.*]] = fdiv ninf <2 x float> <float 4.200000e+01, float -4.200000e+01>, [[INS]]563; CHECK-NEXT: ret <2 x float> [[BO]]564;565 %ins = insertelement <2 x float> undef, float %x, i32 0566 %bo = fdiv ninf <2 x float> <float 42.0, float -42.0>, %ins567 ret <2 x float> %bo568}569 570define <2 x float> @fdiv_constant_op1(float %x) {571; CHECK-LABEL: @fdiv_constant_op1(572; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0573; CHECK-NEXT: [[BO:%.*]] = fdiv <2 x float> [[INS]], <float 4.200000e+01, float undef>574; CHECK-NEXT: ret <2 x float> [[BO]]575;576 %ins = insertelement <2 x float> undef, float %x, i32 0577 %bo = fdiv <2 x float> %ins, <float 42.0, float undef>578 ret <2 x float> %bo579}580 581define <2 x float> @fdiv_constant_op1_not_undef_lane(float %x) {582; CHECK-LABEL: @fdiv_constant_op1_not_undef_lane(583; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0584; CHECK-NEXT: [[BO:%.*]] = fdiv <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>585; CHECK-NEXT: ret <2 x float> [[BO]]586;587 %ins = insertelement <2 x float> undef, float %x, i32 0588 %bo = fdiv <2 x float> %ins, <float 42.0, float -42.0>589 ret <2 x float> %bo590}591 592define <2 x float> @frem_constant_op0(float %x) {593; CHECK-LABEL: @frem_constant_op0(594; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0595; CHECK-NEXT: [[BO:%.*]] = frem fast <2 x float> <float 4.200000e+01, float undef>, [[INS]]596; CHECK-NEXT: ret <2 x float> [[BO]]597;598 %ins = insertelement <2 x float> undef, float %x, i32 0599 %bo = frem fast <2 x float> <float 42.0, float undef>, %ins600 ret <2 x float> %bo601}602 603define <2 x float> @frem_constant_op0_not_undef_lane(float %x) {604; CHECK-LABEL: @frem_constant_op0_not_undef_lane(605; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float undef, float poison>, float [[X:%.*]], i64 1606; CHECK-NEXT: [[BO:%.*]] = frem <2 x float> <float 4.200000e+01, float -4.200000e+01>, [[INS]]607; CHECK-NEXT: ret <2 x float> [[BO]]608;609 %ins = insertelement <2 x float> undef, float %x, i32 1610 %bo = frem <2 x float> <float 42.0, float -42.0>, %ins611 ret <2 x float> %bo612}613 614define <2 x float> @frem_constant_op1(float %x) {615; CHECK-LABEL: @frem_constant_op1(616; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float undef, float poison>, float [[X:%.*]], i64 1617; CHECK-NEXT: [[BO:%.*]] = frem ninf <2 x float> [[INS]], <float undef, float 4.200000e+01>618; CHECK-NEXT: ret <2 x float> [[BO]]619;620 %ins = insertelement <2 x float> undef, float %x, i32 1621 %bo = frem ninf <2 x float> %ins, <float undef, float 42.0>622 ret <2 x float> %bo623}624 625define <2 x float> @frem_constant_op1_not_undef_lane(float %x) {626; CHECK-LABEL: @frem_constant_op1_not_undef_lane(627; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[X:%.*]], i64 0628; CHECK-NEXT: [[BO:%.*]] = frem nnan <2 x float> [[INS]], <float 4.200000e+01, float -4.200000e+01>629; CHECK-NEXT: ret <2 x float> [[BO]]630;631 %ins = insertelement <2 x float> undef, float %x, i32 0632 %bo = frem nnan <2 x float> %ins, <float 42.0, float -42.0>633 ret <2 x float> %bo634}635 636