1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -instcombine %s | FileCheck %s 3 4define <2 x i8> @add_constant(i8 %x) { 5; CHECK-LABEL: @add_constant( 6; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 7; 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 0 11 %bo = add <2 x i8> %ins, <i8 42, i8 undef> 12 ret <2 x i8> %bo 13} 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> undef, i8 [[X:%.*]], i32 0 18; 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 0 22 %bo = add <2 x i8> %ins, <i8 42, i8 -42> 23 ret <2 x i8> %bo 24} 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> undef, i8 [[X:%.*]], i32 1 31; 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 1 35 %bo = sub nsw nuw <2 x i8> <i8 undef, i8 -42>, %ins 36 ret <2 x i8> %bo 37} 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> undef, i8 [[X:%.*]], i32 1 42; 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 1 46 %bo = sub nuw <2 x i8> <i8 42, i8 -42>, %ins 47 ret <2 x i8> %bo 48} 49 50define <2 x i8> @sub_constant_op1(i8 %x) { 51; CHECK-LABEL: @sub_constant_op1( 52; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 53; 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 0 57 %bo = sub nuw <2 x i8> %ins, <i8 42, i8 undef> 58 ret <2 x i8> %bo 59} 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> undef, i8 [[X:%.*]], i32 0 64; 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 0 68 %bo = sub nuw <2 x i8> %ins, <i8 42, i8 -42> 69 ret <2 x i8> %bo 70} 71 72define <3 x i8> @mul_constant(i8 %x) { 73; CHECK-LABEL: @mul_constant( 74; CHECK-NEXT: [[INS:%.*]] = insertelement <3 x i8> undef, i8 [[X:%.*]], i32 2 75; 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 2 79 %bo = mul <3 x i8> %ins, <i8 undef, i8 undef, i8 -42> 80 ret <3 x i8> %bo 81} 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> undef, i8 [[X:%.*]], i32 2 86; 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 2 90 %bo = mul <3 x i8> %ins, <i8 42, i8 undef, i8 -42> 91 ret <3 x i8> %bo 92} 93 94define <2 x i8> @shl_constant_op0(i8 %x) { 95; CHECK-LABEL: @shl_constant_op0( 96; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1 97; 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 1 101 %bo = shl <2 x i8> <i8 undef, i8 2>, %ins 102 ret <2 x i8> %bo 103} 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> undef, i8 [[X:%.*]], i32 1 108; 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 1 112 %bo = shl <2 x i8> <i8 5, i8 2>, %ins 113 ret <2 x i8> %bo 114} 115 116define <2 x i8> @shl_constant_op1(i8 %x) { 117; CHECK-LABEL: @shl_constant_op1( 118; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 119; 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 0 123 %bo = shl nuw <2 x i8> %ins, <i8 5, i8 undef> 124 ret <2 x i8> %bo 125} 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> undef, i8 [[X:%.*]], i32 0 130; 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 0 134 %bo = shl nuw <2 x i8> %ins, <i8 5, i8 2> 135 ret <2 x i8> %bo 136} 137 138define <2 x i8> @ashr_constant_op0(i8 %x) { 139; CHECK-LABEL: @ashr_constant_op0( 140; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1 141; 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 1 145 %bo = ashr exact <2 x i8> <i8 undef, i8 2>, %ins 146 ret <2 x i8> %bo 147} 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> undef, i8 [[X:%.*]], i32 1 152; CHECK-NEXT: [[BO:%.*]] = lshr <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 1 156 %bo = ashr exact <2 x i8> <i8 5, i8 2>, %ins 157 ret <2 x i8> %bo 158} 159 160define <2 x i8> @ashr_constant_op1(i8 %x) { 161; CHECK-LABEL: @ashr_constant_op1( 162; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 163; 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 0 167 %bo = ashr <2 x i8> %ins, <i8 5, i8 undef> 168 ret <2 x i8> %bo 169} 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> undef, i8 [[X:%.*]], i32 0 174; 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 0 178 %bo = ashr <2 x i8> %ins, <i8 5, i8 2> 179 ret <2 x i8> %bo 180} 181 182define <2 x i8> @lshr_constant_op0(i8 %x) { 183; CHECK-LABEL: @lshr_constant_op0( 184; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 185; 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 0 189 %bo = lshr <2 x i8> <i8 5, i8 undef>, %ins 190 ret <2 x i8> %bo 191} 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> undef, i8 [[X:%.*]], i32 0 196; 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 0 200 %bo = lshr <2 x i8> <i8 5, i8 2>, %ins 201 ret <2 x i8> %bo 202} 203 204define <2 x i8> @lshr_constant_op1(i8 %x) { 205; CHECK-LABEL: @lshr_constant_op1( 206; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1 207; 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 1 211 %bo = lshr exact <2 x i8> %ins, <i8 undef, i8 2> 212 ret <2 x i8> %bo 213} 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> undef, i8 [[X:%.*]], i32 1 218; 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 1 222 %bo = lshr exact <2 x i8> %ins, <i8 5, i8 2> 223 ret <2 x i8> %bo 224} 225 226define <2 x i8> @urem_constant_op0(i8 %x) { 227; CHECK-LABEL: @urem_constant_op0( 228; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 229; 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 0 233 %bo = urem <2 x i8> <i8 5, i8 undef>, %ins 234 ret <2 x i8> %bo 235} 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> undef, i8 [[X:%.*]], i32 0 240; 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 0 244 %bo = urem <2 x i8> <i8 5, i8 2>, %ins 245 ret <2 x i8> %bo 246} 247 248define <2 x i8> @urem_constant_op1(i8 %x) { 249; CHECK-LABEL: @urem_constant_op1( 250; CHECK-NEXT: ret <2 x i8> poison 251; 252 %ins = insertelement <2 x i8> undef, i8 %x, i32 1 253 %bo = urem <2 x i8> %ins, <i8 undef, i8 2> 254 ret <2 x i8> %bo 255} 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> undef, i8 [[X:%.*]], i32 1 260; 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 1 264 %bo = urem <2 x i8> %ins, <i8 5, i8 2> 265 ret <2 x i8> %bo 266} 267 268define <2 x i8> @srem_constant_op0(i8 %x) { 269; CHECK-LABEL: @srem_constant_op0( 270; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 271; 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 0 275 %bo = srem <2 x i8> <i8 5, i8 undef>, %ins 276 ret <2 x i8> %bo 277} 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> undef, i8 [[X:%.*]], i32 0 282; 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 0 286 %bo = srem <2 x i8> <i8 5, i8 2>, %ins 287 ret <2 x i8> %bo 288} 289 290define <2 x i8> @srem_constant_op1(i8 %x) { 291; CHECK-LABEL: @srem_constant_op1( 292; CHECK-NEXT: ret <2 x i8> poison 293; 294 %ins = insertelement <2 x i8> undef, i8 %x, i32 1 295 %bo = srem <2 x i8> %ins, <i8 undef, i8 2> 296 ret <2 x i8> %bo 297} 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> undef, i8 [[X:%.*]], i32 1 302; 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 1 306 %bo = srem <2 x i8> %ins, <i8 5, i8 2> 307 ret <2 x i8> %bo 308} 309 310define <2 x i8> @udiv_constant_op0(i8 %x) { 311; CHECK-LABEL: @udiv_constant_op0( 312; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 313; 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 0 317 %bo = udiv exact <2 x i8> <i8 5, i8 undef>, %ins 318 ret <2 x i8> %bo 319} 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> undef, i8 [[X:%.*]], i32 0 324; 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 0 328 %bo = udiv exact <2 x i8> <i8 5, i8 2>, %ins 329 ret <2 x i8> %bo 330} 331 332define <2 x i8> @udiv_constant_op1(i8 %x) { 333; CHECK-LABEL: @udiv_constant_op1( 334; CHECK-NEXT: ret <2 x i8> poison 335; 336 %ins = insertelement <2 x i8> undef, i8 %x, i32 1 337 %bo = udiv <2 x i8> %ins, <i8 undef, i8 2> 338 ret <2 x i8> %bo 339} 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> undef, i8 [[X:%.*]], i32 1 344; 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 1 348 %bo = udiv <2 x i8> %ins, <i8 5, i8 2> 349 ret <2 x i8> %bo 350} 351 352define <2 x i8> @sdiv_constant_op0(i8 %x) { 353; CHECK-LABEL: @sdiv_constant_op0( 354; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 355; 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 0 359 %bo = sdiv <2 x i8> <i8 5, i8 undef>, %ins 360 ret <2 x i8> %bo 361} 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> undef, i8 [[X:%.*]], i32 0 366; 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 0 370 %bo = sdiv <2 x i8> <i8 5, i8 2>, %ins 371 ret <2 x i8> %bo 372} 373 374define <2 x i8> @sdiv_constant_op1(i8 %x) { 375; CHECK-LABEL: @sdiv_constant_op1( 376; CHECK-NEXT: ret <2 x i8> poison 377; 378 %ins = insertelement <2 x i8> undef, i8 %x, i32 1 379 %bo = sdiv exact <2 x i8> %ins, <i8 undef, i8 2> 380 ret <2 x i8> %bo 381} 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> undef, i8 [[X:%.*]], i32 1 386; 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 1 390 %bo = sdiv exact <2 x i8> %ins, <i8 5, i8 2> 391 ret <2 x i8> %bo 392} 393 394define <2 x i8> @and_constant(i8 %x) { 395; CHECK-LABEL: @and_constant( 396; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 397; 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 0 401 %bo = and <2 x i8> %ins, <i8 42, i8 undef> 402 ret <2 x i8> %bo 403} 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> undef, i8 [[X:%.*]], i32 0 408; 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 0 412 %bo = and <2 x i8> %ins, <i8 42, i8 -42> 413 ret <2 x i8> %bo 414} 415 416define <2 x i8> @or_constant(i8 %x) { 417; CHECK-LABEL: @or_constant( 418; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1 419; 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 1 423 %bo = or <2 x i8> %ins, <i8 undef, i8 -42> 424 ret <2 x i8> %bo 425} 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> undef, i8 [[X:%.*]], i32 1 430; 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 1 434 %bo = or <2 x i8> %ins, <i8 42, i8 -42> 435 ret <2 x i8> %bo 436} 437 438define <2 x i8> @xor_constant(i8 %x) { 439; CHECK-LABEL: @xor_constant( 440; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 441; 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 0 445 %bo = xor <2 x i8> %ins, <i8 42, i8 undef> 446 ret <2 x i8> %bo 447} 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> undef, i8 [[X:%.*]], i32 0 452; 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 0 456 %bo = xor <2 x i8> %ins, <i8 42, i8 -42> 457 ret <2 x i8> %bo 458} 459 460define <2 x float> @fadd_constant(float %x) { 461; CHECK-LABEL: @fadd_constant( 462; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0 463; 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 0 467 %bo = fadd <2 x float> %ins, <float 42.0, float undef> 468 ret <2 x float> %bo 469} 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> undef, float [[X:%.*]], i32 1 474; 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 1 478 %bo = fadd <2 x float> %ins, <float 42.0, float -42.0> 479 ret <2 x float> %bo 480} 481 482define <2 x float> @fsub_constant_op0(float %x) { 483; CHECK-LABEL: @fsub_constant_op0( 484; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0 485; 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 0 489 %bo = fsub fast <2 x float> <float 42.0, float undef>, %ins 490 ret <2 x float> %bo 491} 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> undef, float [[X:%.*]], i32 1 496; 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 1 500 %bo = fsub nsz <2 x float> <float 42.0, float -42.0>, %ins 501 ret <2 x float> %bo 502} 503 504define <2 x float> @fsub_constant_op1(float %x) { 505; CHECK-LABEL: @fsub_constant_op1( 506; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1 507; 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 1 511 %bo = fsub <2 x float> %ins, <float undef, float 42.0> 512 ret <2 x float> %bo 513} 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> undef, float [[X:%.*]], i32 0 518; 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 0 522 %bo = fsub <2 x float> %ins, <float 42.0, float -42.0> 523 ret <2 x float> %bo 524} 525 526define <2 x float> @fmul_constant(float %x) { 527; CHECK-LABEL: @fmul_constant( 528; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0 529; 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 0 533 %bo = fmul reassoc <2 x float> %ins, <float 42.0, float undef> 534 ret <2 x float> %bo 535} 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> undef, float [[X:%.*]], i32 1 540; 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 1 544 %bo = fmul <2 x float> %ins, <float 42.0, float -42.0> 545 ret <2 x float> %bo 546} 547 548define <2 x float> @fdiv_constant_op0(float %x) { 549; CHECK-LABEL: @fdiv_constant_op0( 550; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1 551; 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 1 555 %bo = fdiv nnan <2 x float> <float undef, float 42.0>, %ins 556 ret <2 x float> %bo 557} 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> undef, float [[X:%.*]], i32 0 562; 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 0 566 %bo = fdiv ninf <2 x float> <float 42.0, float -42.0>, %ins 567 ret <2 x float> %bo 568} 569 570define <2 x float> @fdiv_constant_op1(float %x) { 571; CHECK-LABEL: @fdiv_constant_op1( 572; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0 573; 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 0 577 %bo = fdiv <2 x float> %ins, <float 42.0, float undef> 578 ret <2 x float> %bo 579} 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> undef, float [[X:%.*]], i32 0 584; 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 0 588 %bo = fdiv <2 x float> %ins, <float 42.0, float -42.0> 589 ret <2 x float> %bo 590} 591 592define <2 x float> @frem_constant_op0(float %x) { 593; CHECK-LABEL: @frem_constant_op0( 594; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 0 595; 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 0 599 %bo = frem fast <2 x float> <float 42.0, float undef>, %ins 600 ret <2 x float> %bo 601} 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> undef, float [[X:%.*]], i32 1 606; 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 1 610 %bo = frem <2 x float> <float 42.0, float -42.0>, %ins 611 ret <2 x float> %bo 612} 613 614define <2 x float> @frem_constant_op1(float %x) { 615; CHECK-LABEL: @frem_constant_op1( 616; CHECK-NEXT: [[INS:%.*]] = insertelement <2 x float> undef, float [[X:%.*]], i32 1 617; 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 1 621 %bo = frem ninf <2 x float> %ins, <float undef, float 42.0> 622 ret <2 x float> %bo 623} 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> undef, float [[X:%.*]], i32 0 628; 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 0 632 %bo = frem nnan <2 x float> %ins, <float 42.0, float -42.0> 633 ret <2 x float> %bo 634} 635 636