1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mattr=+sve -force-streaming-compatible < %s | FileCheck %s 3; RUN: llc -mattr=+sme -force-streaming < %s | FileCheck %s 4; RUN: llc -force-streaming-compatible < %s | FileCheck %s --check-prefix=NONEON-NOSVE 5 6target triple = "aarch64-unknown-linux-gnu" 7 8define <2 x half> @select_v2f16(<2 x half> %op1, <2 x half> %op2, i1 %mask) { 9; CHECK-LABEL: select_v2f16: 10; CHECK: // %bb.0: 11; CHECK-NEXT: mov z2.h, w0 12; CHECK-NEXT: ptrue p0.h 13; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0 14; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1 15; CHECK-NEXT: and z2.h, z2.h, #0x1 16; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0 17; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h 18; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0 19; CHECK-NEXT: ret 20; 21; NONEON-NOSVE-LABEL: select_v2f16: 22; NONEON-NOSVE: // %bb.0: 23; NONEON-NOSVE-NEXT: sub sp, sp, #32 24; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32 25; NONEON-NOSVE-NEXT: stp d0, d1, [sp, #8] 26; NONEON-NOSVE-NEXT: tst w0, #0x1 27; NONEON-NOSVE-NEXT: ldr h0, [sp, #22] 28; NONEON-NOSVE-NEXT: ldr h1, [sp, #14] 29; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 30; NONEON-NOSVE-NEXT: ldr h1, [sp, #12] 31; NONEON-NOSVE-NEXT: str h0, [sp, #30] 32; NONEON-NOSVE-NEXT: ldr h0, [sp, #20] 33; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 34; NONEON-NOSVE-NEXT: ldr h1, [sp, #10] 35; NONEON-NOSVE-NEXT: str h0, [sp, #28] 36; NONEON-NOSVE-NEXT: ldr h0, [sp, #18] 37; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 38; NONEON-NOSVE-NEXT: ldr h1, [sp, #8] 39; NONEON-NOSVE-NEXT: str h0, [sp, #26] 40; NONEON-NOSVE-NEXT: ldr h0, [sp, #16] 41; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 42; NONEON-NOSVE-NEXT: str h0, [sp, #24] 43; NONEON-NOSVE-NEXT: ldr d0, [sp, #24] 44; NONEON-NOSVE-NEXT: add sp, sp, #32 45; NONEON-NOSVE-NEXT: ret 46 %sel = select i1 %mask, <2 x half> %op1, <2 x half> %op2 47 ret <2 x half> %sel 48} 49 50define <4 x half> @select_v4f16(<4 x half> %op1, <4 x half> %op2, i1 %mask) { 51; CHECK-LABEL: select_v4f16: 52; CHECK: // %bb.0: 53; CHECK-NEXT: mov z2.h, w0 54; CHECK-NEXT: ptrue p0.h 55; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0 56; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1 57; CHECK-NEXT: and z2.h, z2.h, #0x1 58; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0 59; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h 60; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0 61; CHECK-NEXT: ret 62; 63; NONEON-NOSVE-LABEL: select_v4f16: 64; NONEON-NOSVE: // %bb.0: 65; NONEON-NOSVE-NEXT: sub sp, sp, #32 66; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32 67; NONEON-NOSVE-NEXT: stp d0, d1, [sp, #8] 68; NONEON-NOSVE-NEXT: tst w0, #0x1 69; NONEON-NOSVE-NEXT: ldr h0, [sp, #22] 70; NONEON-NOSVE-NEXT: ldr h1, [sp, #14] 71; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 72; NONEON-NOSVE-NEXT: ldr h1, [sp, #12] 73; NONEON-NOSVE-NEXT: str h0, [sp, #30] 74; NONEON-NOSVE-NEXT: ldr h0, [sp, #20] 75; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 76; NONEON-NOSVE-NEXT: ldr h1, [sp, #10] 77; NONEON-NOSVE-NEXT: str h0, [sp, #28] 78; NONEON-NOSVE-NEXT: ldr h0, [sp, #18] 79; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 80; NONEON-NOSVE-NEXT: ldr h1, [sp, #8] 81; NONEON-NOSVE-NEXT: str h0, [sp, #26] 82; NONEON-NOSVE-NEXT: ldr h0, [sp, #16] 83; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 84; NONEON-NOSVE-NEXT: str h0, [sp, #24] 85; NONEON-NOSVE-NEXT: ldr d0, [sp, #24] 86; NONEON-NOSVE-NEXT: add sp, sp, #32 87; NONEON-NOSVE-NEXT: ret 88 %sel = select i1 %mask, <4 x half> %op1, <4 x half> %op2 89 ret <4 x half> %sel 90} 91 92define <8 x half> @select_v8f16(<8 x half> %op1, <8 x half> %op2, i1 %mask) { 93; CHECK-LABEL: select_v8f16: 94; CHECK: // %bb.0: 95; CHECK-NEXT: mov z2.h, w0 96; CHECK-NEXT: ptrue p0.h 97; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0 98; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1 99; CHECK-NEXT: and z2.h, z2.h, #0x1 100; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0 101; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h 102; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0 103; CHECK-NEXT: ret 104; 105; NONEON-NOSVE-LABEL: select_v8f16: 106; NONEON-NOSVE: // %bb.0: 107; NONEON-NOSVE-NEXT: stp q0, q1, [sp, #-48]! 108; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 48 109; NONEON-NOSVE-NEXT: ldr h0, [sp, #30] 110; NONEON-NOSVE-NEXT: ldr h1, [sp, #14] 111; NONEON-NOSVE-NEXT: tst w0, #0x1 112; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 113; NONEON-NOSVE-NEXT: ldr h1, [sp, #12] 114; NONEON-NOSVE-NEXT: str h0, [sp, #46] 115; NONEON-NOSVE-NEXT: ldr h0, [sp, #28] 116; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 117; NONEON-NOSVE-NEXT: ldr h1, [sp, #10] 118; NONEON-NOSVE-NEXT: str h0, [sp, #44] 119; NONEON-NOSVE-NEXT: ldr h0, [sp, #26] 120; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 121; NONEON-NOSVE-NEXT: ldr h1, [sp, #8] 122; NONEON-NOSVE-NEXT: str h0, [sp, #42] 123; NONEON-NOSVE-NEXT: ldr h0, [sp, #24] 124; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 125; NONEON-NOSVE-NEXT: ldr h1, [sp, #6] 126; NONEON-NOSVE-NEXT: str h0, [sp, #40] 127; NONEON-NOSVE-NEXT: ldr h0, [sp, #22] 128; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 129; NONEON-NOSVE-NEXT: ldr h1, [sp, #4] 130; NONEON-NOSVE-NEXT: str h0, [sp, #38] 131; NONEON-NOSVE-NEXT: ldr h0, [sp, #20] 132; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 133; NONEON-NOSVE-NEXT: ldr h1, [sp, #2] 134; NONEON-NOSVE-NEXT: str h0, [sp, #36] 135; NONEON-NOSVE-NEXT: ldr h0, [sp, #18] 136; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 137; NONEON-NOSVE-NEXT: ldr h1, [sp] 138; NONEON-NOSVE-NEXT: str h0, [sp, #34] 139; NONEON-NOSVE-NEXT: ldr h0, [sp, #16] 140; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 141; NONEON-NOSVE-NEXT: str h0, [sp, #32] 142; NONEON-NOSVE-NEXT: ldr q0, [sp, #32] 143; NONEON-NOSVE-NEXT: add sp, sp, #48 144; NONEON-NOSVE-NEXT: ret 145 %sel = select i1 %mask, <8 x half> %op1, <8 x half> %op2 146 ret <8 x half> %sel 147} 148 149define void @select_v16f16(ptr %a, ptr %b, i1 %mask) { 150; CHECK-LABEL: select_v16f16: 151; CHECK: // %bb.0: 152; CHECK-NEXT: mov z0.h, w2 153; CHECK-NEXT: ptrue p0.h 154; CHECK-NEXT: and z0.h, z0.h, #0x1 155; CHECK-NEXT: cmpne p0.h, p0/z, z0.h, #0 156; CHECK-NEXT: ldr q0, [x0] 157; CHECK-NEXT: ldr q1, [x0, #16] 158; CHECK-NEXT: ldr q2, [x1] 159; CHECK-NEXT: ldr q3, [x1, #16] 160; CHECK-NEXT: sel z0.h, p0, z0.h, z2.h 161; CHECK-NEXT: sel z1.h, p0, z1.h, z3.h 162; CHECK-NEXT: stp q0, q1, [x0] 163; CHECK-NEXT: ret 164; 165; NONEON-NOSVE-LABEL: select_v16f16: 166; NONEON-NOSVE: // %bb.0: 167; NONEON-NOSVE-NEXT: sub sp, sp, #96 168; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 96 169; NONEON-NOSVE-NEXT: ldr q0, [x0] 170; NONEON-NOSVE-NEXT: ldr q1, [x0, #16] 171; NONEON-NOSVE-NEXT: tst w2, #0x1 172; NONEON-NOSVE-NEXT: ldr q2, [x1] 173; NONEON-NOSVE-NEXT: ldr q3, [x1, #16] 174; NONEON-NOSVE-NEXT: str q0, [sp] 175; NONEON-NOSVE-NEXT: stp q1, q3, [sp, #16] 176; NONEON-NOSVE-NEXT: ldr h0, [sp, #30] 177; NONEON-NOSVE-NEXT: ldr h1, [sp, #46] 178; NONEON-NOSVE-NEXT: str q2, [sp, #48] 179; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 180; NONEON-NOSVE-NEXT: ldr h1, [sp, #44] 181; NONEON-NOSVE-NEXT: str h0, [sp, #78] 182; NONEON-NOSVE-NEXT: ldr h0, [sp, #28] 183; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 184; NONEON-NOSVE-NEXT: ldr h1, [sp, #42] 185; NONEON-NOSVE-NEXT: str h0, [sp, #76] 186; NONEON-NOSVE-NEXT: ldr h0, [sp, #26] 187; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 188; NONEON-NOSVE-NEXT: ldr h1, [sp, #40] 189; NONEON-NOSVE-NEXT: str h0, [sp, #74] 190; NONEON-NOSVE-NEXT: ldr h0, [sp, #24] 191; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 192; NONEON-NOSVE-NEXT: ldr h1, [sp, #38] 193; NONEON-NOSVE-NEXT: str h0, [sp, #72] 194; NONEON-NOSVE-NEXT: ldr h0, [sp, #22] 195; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 196; NONEON-NOSVE-NEXT: ldr h1, [sp, #36] 197; NONEON-NOSVE-NEXT: str h0, [sp, #70] 198; NONEON-NOSVE-NEXT: ldr h0, [sp, #20] 199; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 200; NONEON-NOSVE-NEXT: ldr h1, [sp, #34] 201; NONEON-NOSVE-NEXT: str h0, [sp, #68] 202; NONEON-NOSVE-NEXT: ldr h0, [sp, #18] 203; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 204; NONEON-NOSVE-NEXT: ldr h1, [sp, #32] 205; NONEON-NOSVE-NEXT: str h0, [sp, #66] 206; NONEON-NOSVE-NEXT: ldr h0, [sp, #16] 207; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 208; NONEON-NOSVE-NEXT: ldr h1, [sp, #62] 209; NONEON-NOSVE-NEXT: str h0, [sp, #64] 210; NONEON-NOSVE-NEXT: ldr h0, [sp, #14] 211; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 212; NONEON-NOSVE-NEXT: ldr h1, [sp, #60] 213; NONEON-NOSVE-NEXT: str h0, [sp, #94] 214; NONEON-NOSVE-NEXT: ldr h0, [sp, #12] 215; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 216; NONEON-NOSVE-NEXT: ldr h1, [sp, #58] 217; NONEON-NOSVE-NEXT: str h0, [sp, #92] 218; NONEON-NOSVE-NEXT: ldr h0, [sp, #10] 219; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 220; NONEON-NOSVE-NEXT: ldr h1, [sp, #56] 221; NONEON-NOSVE-NEXT: str h0, [sp, #90] 222; NONEON-NOSVE-NEXT: ldr h0, [sp, #8] 223; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 224; NONEON-NOSVE-NEXT: ldr h1, [sp, #54] 225; NONEON-NOSVE-NEXT: str h0, [sp, #88] 226; NONEON-NOSVE-NEXT: ldr h0, [sp, #6] 227; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 228; NONEON-NOSVE-NEXT: ldr h1, [sp, #52] 229; NONEON-NOSVE-NEXT: str h0, [sp, #86] 230; NONEON-NOSVE-NEXT: ldr h0, [sp, #4] 231; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 232; NONEON-NOSVE-NEXT: ldr h1, [sp, #50] 233; NONEON-NOSVE-NEXT: str h0, [sp, #84] 234; NONEON-NOSVE-NEXT: ldr h0, [sp, #2] 235; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 236; NONEON-NOSVE-NEXT: ldr h1, [sp, #48] 237; NONEON-NOSVE-NEXT: str h0, [sp, #82] 238; NONEON-NOSVE-NEXT: ldr h0, [sp] 239; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 240; NONEON-NOSVE-NEXT: str h0, [sp, #80] 241; NONEON-NOSVE-NEXT: ldp q1, q0, [sp, #64] 242; NONEON-NOSVE-NEXT: stp q0, q1, [x0] 243; NONEON-NOSVE-NEXT: add sp, sp, #96 244; NONEON-NOSVE-NEXT: ret 245 %op1 = load volatile <16 x half>, ptr %a 246 %op2 = load volatile <16 x half>, ptr %b 247 %sel = select i1 %mask, <16 x half> %op1, <16 x half> %op2 248 store <16 x half> %sel, ptr %a 249 ret void 250} 251 252define <2 x float> @select_v2f32(<2 x float> %op1, <2 x float> %op2, i1 %mask) { 253; CHECK-LABEL: select_v2f32: 254; CHECK: // %bb.0: 255; CHECK-NEXT: and w8, w0, #0x1 256; CHECK-NEXT: ptrue p0.s 257; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0 258; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1 259; CHECK-NEXT: mov z2.s, w8 260; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0 261; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s 262; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0 263; CHECK-NEXT: ret 264; 265; NONEON-NOSVE-LABEL: select_v2f32: 266; NONEON-NOSVE: // %bb.0: 267; NONEON-NOSVE-NEXT: sub sp, sp, #32 268; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32 269; NONEON-NOSVE-NEXT: stp d0, d1, [sp, #8] 270; NONEON-NOSVE-NEXT: tst w0, #0x1 271; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #8] 272; NONEON-NOSVE-NEXT: ldr s0, [sp, #20] 273; NONEON-NOSVE-NEXT: fcsel s3, s2, s0, ne 274; NONEON-NOSVE-NEXT: ldr s0, [sp, #16] 275; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 276; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #24] 277; NONEON-NOSVE-NEXT: ldr d0, [sp, #24] 278; NONEON-NOSVE-NEXT: add sp, sp, #32 279; NONEON-NOSVE-NEXT: ret 280 %sel = select i1 %mask, <2 x float> %op1, <2 x float> %op2 281 ret <2 x float> %sel 282} 283 284define <4 x float> @select_v4f32(<4 x float> %op1, <4 x float> %op2, i1 %mask) { 285; CHECK-LABEL: select_v4f32: 286; CHECK: // %bb.0: 287; CHECK-NEXT: and w8, w0, #0x1 288; CHECK-NEXT: ptrue p0.s 289; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0 290; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1 291; CHECK-NEXT: mov z2.s, w8 292; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0 293; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s 294; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0 295; CHECK-NEXT: ret 296; 297; NONEON-NOSVE-LABEL: select_v4f32: 298; NONEON-NOSVE: // %bb.0: 299; NONEON-NOSVE-NEXT: stp q0, q1, [sp, #-48]! 300; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 48 301; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #8] 302; NONEON-NOSVE-NEXT: tst w0, #0x1 303; NONEON-NOSVE-NEXT: ldr s0, [sp, #28] 304; NONEON-NOSVE-NEXT: fcsel s3, s2, s0, ne 305; NONEON-NOSVE-NEXT: ldr s0, [sp, #24] 306; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 307; NONEON-NOSVE-NEXT: ldp s1, s2, [sp] 308; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #40] 309; NONEON-NOSVE-NEXT: ldr s0, [sp, #20] 310; NONEON-NOSVE-NEXT: fcsel s3, s2, s0, ne 311; NONEON-NOSVE-NEXT: ldr s0, [sp, #16] 312; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne 313; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #32] 314; NONEON-NOSVE-NEXT: ldr q0, [sp, #32] 315; NONEON-NOSVE-NEXT: add sp, sp, #48 316; NONEON-NOSVE-NEXT: ret 317 %sel = select i1 %mask, <4 x float> %op1, <4 x float> %op2 318 ret <4 x float> %sel 319} 320 321define void @select_v8f32(ptr %a, ptr %b, i1 %mask) { 322; CHECK-LABEL: select_v8f32: 323; CHECK: // %bb.0: 324; CHECK-NEXT: and w8, w2, #0x1 325; CHECK-NEXT: ptrue p0.s 326; CHECK-NEXT: mov z0.s, w8 327; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0 328; CHECK-NEXT: ldr q0, [x0] 329; CHECK-NEXT: ldr q1, [x0, #16] 330; CHECK-NEXT: ldr q2, [x1] 331; CHECK-NEXT: ldr q3, [x1, #16] 332; CHECK-NEXT: sel z0.s, p0, z0.s, z2.s 333; CHECK-NEXT: sel z1.s, p0, z1.s, z3.s 334; CHECK-NEXT: stp q0, q1, [x0] 335; CHECK-NEXT: ret 336; 337; NONEON-NOSVE-LABEL: select_v8f32: 338; NONEON-NOSVE: // %bb.0: 339; NONEON-NOSVE-NEXT: sub sp, sp, #96 340; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 96 341; NONEON-NOSVE-NEXT: ldr q0, [x0] 342; NONEON-NOSVE-NEXT: ldr q1, [x0, #16] 343; NONEON-NOSVE-NEXT: tst w2, #0x1 344; NONEON-NOSVE-NEXT: ldr q2, [x1] 345; NONEON-NOSVE-NEXT: ldr q3, [x1, #16] 346; NONEON-NOSVE-NEXT: str q0, [sp] 347; NONEON-NOSVE-NEXT: stp q1, q3, [sp, #16] 348; NONEON-NOSVE-NEXT: str q2, [sp, #48] 349; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #40] 350; NONEON-NOSVE-NEXT: ldr s0, [sp, #28] 351; NONEON-NOSVE-NEXT: fcsel s3, s0, s2, ne 352; NONEON-NOSVE-NEXT: ldr s0, [sp, #24] 353; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 354; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #32] 355; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #72] 356; NONEON-NOSVE-NEXT: ldr s0, [sp, #20] 357; NONEON-NOSVE-NEXT: fcsel s3, s0, s2, ne 358; NONEON-NOSVE-NEXT: ldr s0, [sp, #16] 359; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 360; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #56] 361; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #64] 362; NONEON-NOSVE-NEXT: ldr s0, [sp, #12] 363; NONEON-NOSVE-NEXT: fcsel s3, s0, s2, ne 364; NONEON-NOSVE-NEXT: ldr s0, [sp, #8] 365; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 366; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #48] 367; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #88] 368; NONEON-NOSVE-NEXT: ldr s0, [sp, #4] 369; NONEON-NOSVE-NEXT: fcsel s3, s0, s2, ne 370; NONEON-NOSVE-NEXT: ldr s0, [sp] 371; NONEON-NOSVE-NEXT: fcsel s0, s0, s1, ne 372; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #80] 373; NONEON-NOSVE-NEXT: ldp q1, q0, [sp, #64] 374; NONEON-NOSVE-NEXT: stp q0, q1, [x0] 375; NONEON-NOSVE-NEXT: add sp, sp, #96 376; NONEON-NOSVE-NEXT: ret 377 %op1 = load volatile <8 x float>, ptr %a 378 %op2 = load volatile <8 x float>, ptr %b 379 %sel = select i1 %mask, <8 x float> %op1, <8 x float> %op2 380 store <8 x float> %sel, ptr %a 381 ret void 382} 383 384define <1 x double> @select_v1f64(<1 x double> %op1, <1 x double> %op2, i1 %mask) { 385; CHECK-LABEL: select_v1f64: 386; CHECK: // %bb.0: 387; CHECK-NEXT: tst w0, #0x1 388; CHECK-NEXT: fcsel d0, d0, d1, ne 389; CHECK-NEXT: ret 390; 391; NONEON-NOSVE-LABEL: select_v1f64: 392; NONEON-NOSVE: // %bb.0: 393; NONEON-NOSVE-NEXT: sub sp, sp, #16 394; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16 395; NONEON-NOSVE-NEXT: tst w0, #0x1 396; NONEON-NOSVE-NEXT: fcsel d0, d0, d1, ne 397; NONEON-NOSVE-NEXT: str d0, [sp, #8] 398; NONEON-NOSVE-NEXT: ldr d0, [sp, #8] 399; NONEON-NOSVE-NEXT: add sp, sp, #16 400; NONEON-NOSVE-NEXT: ret 401 %sel = select i1 %mask, <1 x double> %op1, <1 x double> %op2 402 ret <1 x double> %sel 403} 404 405define <2 x double> @select_v2f64(<2 x double> %op1, <2 x double> %op2, i1 %mask) { 406; CHECK-LABEL: select_v2f64: 407; CHECK: // %bb.0: 408; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 409; CHECK-NEXT: and x8, x0, #0x1 410; CHECK-NEXT: ptrue p0.d 411; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0 412; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1 413; CHECK-NEXT: mov z2.d, x8 414; CHECK-NEXT: cmpne p0.d, p0/z, z2.d, #0 415; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d 416; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0 417; CHECK-NEXT: ret 418; 419; NONEON-NOSVE-LABEL: select_v2f64: 420; NONEON-NOSVE: // %bb.0: 421; NONEON-NOSVE-NEXT: stp q0, q1, [sp, #-48]! 422; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 48 423; NONEON-NOSVE-NEXT: ldp d1, d2, [sp] 424; NONEON-NOSVE-NEXT: tst w0, #0x1 425; NONEON-NOSVE-NEXT: ldr d0, [sp, #24] 426; NONEON-NOSVE-NEXT: fcsel d3, d2, d0, ne 427; NONEON-NOSVE-NEXT: ldr d0, [sp, #16] 428; NONEON-NOSVE-NEXT: fcsel d0, d1, d0, ne 429; NONEON-NOSVE-NEXT: stp d0, d3, [sp, #32] 430; NONEON-NOSVE-NEXT: ldr q0, [sp, #32] 431; NONEON-NOSVE-NEXT: add sp, sp, #48 432; NONEON-NOSVE-NEXT: ret 433 %sel = select i1 %mask, <2 x double> %op1, <2 x double> %op2 434 ret <2 x double> %sel 435} 436 437define void @select_v4f64(ptr %a, ptr %b, i1 %mask) { 438; CHECK-LABEL: select_v4f64: 439; CHECK: // %bb.0: 440; CHECK-NEXT: // kill: def $w2 killed $w2 def $x2 441; CHECK-NEXT: and x8, x2, #0x1 442; CHECK-NEXT: ptrue p0.d 443; CHECK-NEXT: mov z0.d, x8 444; CHECK-NEXT: cmpne p0.d, p0/z, z0.d, #0 445; CHECK-NEXT: ldr q0, [x0] 446; CHECK-NEXT: ldr q1, [x0, #16] 447; CHECK-NEXT: ldr q2, [x1] 448; CHECK-NEXT: ldr q3, [x1, #16] 449; CHECK-NEXT: sel z0.d, p0, z0.d, z2.d 450; CHECK-NEXT: sel z1.d, p0, z1.d, z3.d 451; CHECK-NEXT: stp q0, q1, [x0] 452; CHECK-NEXT: ret 453; 454; NONEON-NOSVE-LABEL: select_v4f64: 455; NONEON-NOSVE: // %bb.0: 456; NONEON-NOSVE-NEXT: sub sp, sp, #96 457; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 96 458; NONEON-NOSVE-NEXT: ldr q0, [x0] 459; NONEON-NOSVE-NEXT: ldr q1, [x0, #16] 460; NONEON-NOSVE-NEXT: tst w2, #0x1 461; NONEON-NOSVE-NEXT: ldr q2, [x1] 462; NONEON-NOSVE-NEXT: ldr q3, [x1, #16] 463; NONEON-NOSVE-NEXT: str q0, [sp] 464; NONEON-NOSVE-NEXT: stp q1, q3, [sp, #16] 465; NONEON-NOSVE-NEXT: str q2, [sp, #48] 466; NONEON-NOSVE-NEXT: ldp d1, d2, [sp, #32] 467; NONEON-NOSVE-NEXT: ldr d0, [sp, #24] 468; NONEON-NOSVE-NEXT: fcsel d3, d0, d2, ne 469; NONEON-NOSVE-NEXT: ldr d0, [sp, #16] 470; NONEON-NOSVE-NEXT: fcsel d0, d0, d1, ne 471; NONEON-NOSVE-NEXT: ldp d1, d2, [sp, #48] 472; NONEON-NOSVE-NEXT: stp d0, d3, [sp, #64] 473; NONEON-NOSVE-NEXT: ldr d0, [sp, #8] 474; NONEON-NOSVE-NEXT: fcsel d3, d0, d2, ne 475; NONEON-NOSVE-NEXT: ldr d0, [sp] 476; NONEON-NOSVE-NEXT: fcsel d0, d0, d1, ne 477; NONEON-NOSVE-NEXT: stp d0, d3, [sp, #80] 478; NONEON-NOSVE-NEXT: ldp q1, q0, [sp, #64] 479; NONEON-NOSVE-NEXT: stp q0, q1, [x0] 480; NONEON-NOSVE-NEXT: add sp, sp, #96 481; NONEON-NOSVE-NEXT: ret 482 %op1 = load volatile <4 x double>, ptr %a 483 %op2 = load volatile <4 x double>, ptr %b 484 %sel = select i1 %mask, <4 x double> %op1, <4 x double> %op2 485 store <4 x double> %sel, ptr %a 486 ret void 487} 488