599 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mattr=+sve -force-streaming-compatible < %s | FileCheck %s3; RUN: llc -mattr=+sme -force-streaming < %s | FileCheck %s4; RUN: llc -force-streaming-compatible < %s | FileCheck %s --check-prefix=NONEON-NOSVE5 6target triple = "aarch64-unknown-linux-gnu"7 8define <2 x half> @select_v2f16(<2 x half> %op1, <2 x half> %op2, <2 x i1> %mask) {9; CHECK-LABEL: select_v2f16:10; CHECK: // %bb.0:11; CHECK-NEXT: // kill: def $d2 killed $d2 def $z212; CHECK-NEXT: mov z3.s, z2.s[1]13; CHECK-NEXT: ptrue p0.h14; CHECK-NEXT: // kill: def $d0 killed $d0 def $z015; CHECK-NEXT: // kill: def $d1 killed $d1 def $z116; CHECK-NEXT: zip1 z2.h, z2.h, z3.h17; CHECK-NEXT: lsl z2.h, z2.h, #1518; CHECK-NEXT: asr z2.h, z2.h, #1519; CHECK-NEXT: and z2.h, z2.h, #0x120; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #021; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h22; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z023; CHECK-NEXT: ret24;25; NONEON-NOSVE-LABEL: select_v2f16:26; NONEON-NOSVE: // %bb.0:27; NONEON-NOSVE-NEXT: sub sp, sp, #3228; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 3229; NONEON-NOSVE-NEXT: stp d1, d2, [sp, #8]30; NONEON-NOSVE-NEXT: ldp w8, w9, [sp, #16]31; NONEON-NOSVE-NEXT: str d0, [sp]32; NONEON-NOSVE-NEXT: ldr h0, [sp, #10]33; NONEON-NOSVE-NEXT: ldr w10, [sp, #12]34; NONEON-NOSVE-NEXT: ldr h1, [sp, #2]35; NONEON-NOSVE-NEXT: sbfx w9, w9, #0, #136; NONEON-NOSVE-NEXT: sbfx w8, w8, #0, #137; NONEON-NOSVE-NEXT: str w10, [sp, #28]38; NONEON-NOSVE-NEXT: tst w9, #0xffff39; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne40; NONEON-NOSVE-NEXT: ldr h1, [sp]41; NONEON-NOSVE-NEXT: tst w8, #0xffff42; NONEON-NOSVE-NEXT: str h0, [sp, #26]43; NONEON-NOSVE-NEXT: ldr h0, [sp, #8]44; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne45; NONEON-NOSVE-NEXT: str h0, [sp, #24]46; NONEON-NOSVE-NEXT: ldr d0, [sp, #24]47; NONEON-NOSVE-NEXT: add sp, sp, #3248; NONEON-NOSVE-NEXT: ret49 %sel = select <2 x i1> %mask, <2 x half> %op1, <2 x half> %op250 ret <2 x half> %sel51}52 53define <4 x half> @select_v4f16(<4 x half> %op1, <4 x half> %op2, <4 x i1> %mask) {54; CHECK-LABEL: select_v4f16:55; CHECK: // %bb.0:56; CHECK-NEXT: // kill: def $d2 killed $d2 def $z257; CHECK-NEXT: ptrue p0.h58; CHECK-NEXT: // kill: def $d0 killed $d0 def $z059; CHECK-NEXT: // kill: def $d1 killed $d1 def $z160; CHECK-NEXT: lsl z2.h, z2.h, #1561; CHECK-NEXT: asr z2.h, z2.h, #1562; CHECK-NEXT: and z2.h, z2.h, #0x163; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #064; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h65; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z066; CHECK-NEXT: ret67;68; NONEON-NOSVE-LABEL: select_v4f16:69; NONEON-NOSVE: // %bb.0:70; NONEON-NOSVE-NEXT: sub sp, sp, #3271; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 3272; NONEON-NOSVE-NEXT: stp d1, d2, [sp, #8]73; NONEON-NOSVE-NEXT: ldrh w9, [sp, #22]74; NONEON-NOSVE-NEXT: str d0, [sp]75; NONEON-NOSVE-NEXT: ldr h0, [sp, #14]76; NONEON-NOSVE-NEXT: ldr h1, [sp, #6]77; NONEON-NOSVE-NEXT: ldrh w11, [sp, #20]78; NONEON-NOSVE-NEXT: ldrh w10, [sp, #18]79; NONEON-NOSVE-NEXT: sbfx w9, w9, #0, #180; NONEON-NOSVE-NEXT: ldrh w8, [sp, #16]81; NONEON-NOSVE-NEXT: tst w9, #0xffff82; NONEON-NOSVE-NEXT: sbfx w9, w11, #0, #183; NONEON-NOSVE-NEXT: sbfx w8, w8, #0, #184; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne85; NONEON-NOSVE-NEXT: ldr h1, [sp, #4]86; NONEON-NOSVE-NEXT: tst w9, #0xffff87; NONEON-NOSVE-NEXT: sbfx w9, w10, #0, #188; NONEON-NOSVE-NEXT: str h0, [sp, #30]89; NONEON-NOSVE-NEXT: ldr h0, [sp, #12]90; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne91; NONEON-NOSVE-NEXT: ldr h1, [sp, #2]92; NONEON-NOSVE-NEXT: tst w9, #0xffff93; NONEON-NOSVE-NEXT: str h0, [sp, #28]94; NONEON-NOSVE-NEXT: ldr h0, [sp, #10]95; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne96; NONEON-NOSVE-NEXT: ldr h1, [sp]97; NONEON-NOSVE-NEXT: tst w8, #0xffff98; NONEON-NOSVE-NEXT: str h0, [sp, #26]99; NONEON-NOSVE-NEXT: ldr h0, [sp, #8]100; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne101; NONEON-NOSVE-NEXT: str h0, [sp, #24]102; NONEON-NOSVE-NEXT: ldr d0, [sp, #24]103; NONEON-NOSVE-NEXT: add sp, sp, #32104; NONEON-NOSVE-NEXT: ret105 %sel = select <4 x i1> %mask, <4 x half> %op1, <4 x half> %op2106 ret <4 x half> %sel107}108 109define <8 x half> @select_v8f16(<8 x half> %op1, <8 x half> %op2, <8 x i1> %mask) {110; CHECK-LABEL: select_v8f16:111; CHECK: // %bb.0:112; CHECK-NEXT: // kill: def $d2 killed $d2 def $z2113; CHECK-NEXT: ptrue p0.h114; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0115; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1116; CHECK-NEXT: uunpklo z2.h, z2.b117; CHECK-NEXT: lsl z2.h, z2.h, #15118; CHECK-NEXT: asr z2.h, z2.h, #15119; CHECK-NEXT: and z2.h, z2.h, #0x1120; CHECK-NEXT: cmpne p0.h, p0/z, z2.h, #0121; CHECK-NEXT: sel z0.h, p0, z0.h, z1.h122; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0123; CHECK-NEXT: ret124;125; NONEON-NOSVE-LABEL: select_v8f16:126; NONEON-NOSVE: // %bb.0:127; NONEON-NOSVE-NEXT: sub sp, sp, #64128; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 64129; NONEON-NOSVE-NEXT: str d2, [sp, #40]130; NONEON-NOSVE-NEXT: ldrb w13, [sp, #47]131; NONEON-NOSVE-NEXT: stp q0, q1, [sp]132; NONEON-NOSVE-NEXT: ldrb w15, [sp, #46]133; NONEON-NOSVE-NEXT: ldr h0, [sp, #30]134; NONEON-NOSVE-NEXT: ldr h1, [sp, #14]135; NONEON-NOSVE-NEXT: ldrb w14, [sp, #45]136; NONEON-NOSVE-NEXT: sbfx w13, w13, #0, #1137; NONEON-NOSVE-NEXT: ldrb w12, [sp, #44]138; NONEON-NOSVE-NEXT: ldrb w11, [sp, #43]139; NONEON-NOSVE-NEXT: ldrb w10, [sp, #42]140; NONEON-NOSVE-NEXT: ldrb w9, [sp, #41]141; NONEON-NOSVE-NEXT: ldrb w8, [sp, #40]142; NONEON-NOSVE-NEXT: tst w13, #0xffff143; NONEON-NOSVE-NEXT: sbfx w13, w15, #0, #1144; NONEON-NOSVE-NEXT: sbfx w12, w12, #0, #1145; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne146; NONEON-NOSVE-NEXT: ldr h1, [sp, #12]147; NONEON-NOSVE-NEXT: sbfx w11, w11, #0, #1148; NONEON-NOSVE-NEXT: tst w13, #0xffff149; NONEON-NOSVE-NEXT: sbfx w13, w14, #0, #1150; NONEON-NOSVE-NEXT: sbfx w10, w10, #0, #1151; NONEON-NOSVE-NEXT: sbfx w9, w9, #0, #1152; NONEON-NOSVE-NEXT: sbfx w8, w8, #0, #1153; NONEON-NOSVE-NEXT: str h0, [sp, #62]154; NONEON-NOSVE-NEXT: ldr h0, [sp, #28]155; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne156; NONEON-NOSVE-NEXT: ldr h1, [sp, #10]157; NONEON-NOSVE-NEXT: tst w13, #0xffff158; NONEON-NOSVE-NEXT: str h0, [sp, #60]159; NONEON-NOSVE-NEXT: ldr h0, [sp, #26]160; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne161; NONEON-NOSVE-NEXT: ldr h1, [sp, #8]162; NONEON-NOSVE-NEXT: tst w12, #0xffff163; NONEON-NOSVE-NEXT: str h0, [sp, #58]164; NONEON-NOSVE-NEXT: ldr h0, [sp, #24]165; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne166; NONEON-NOSVE-NEXT: ldr h1, [sp, #6]167; NONEON-NOSVE-NEXT: tst w11, #0xffff168; NONEON-NOSVE-NEXT: str h0, [sp, #56]169; NONEON-NOSVE-NEXT: ldr h0, [sp, #22]170; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne171; NONEON-NOSVE-NEXT: ldr h1, [sp, #4]172; NONEON-NOSVE-NEXT: tst w10, #0xffff173; NONEON-NOSVE-NEXT: str h0, [sp, #54]174; NONEON-NOSVE-NEXT: ldr h0, [sp, #20]175; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne176; NONEON-NOSVE-NEXT: ldr h1, [sp, #2]177; NONEON-NOSVE-NEXT: tst w9, #0xffff178; NONEON-NOSVE-NEXT: str h0, [sp, #52]179; NONEON-NOSVE-NEXT: ldr h0, [sp, #18]180; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne181; NONEON-NOSVE-NEXT: ldr h1, [sp]182; NONEON-NOSVE-NEXT: tst w8, #0xffff183; NONEON-NOSVE-NEXT: str h0, [sp, #50]184; NONEON-NOSVE-NEXT: ldr h0, [sp, #16]185; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne186; NONEON-NOSVE-NEXT: str h0, [sp, #48]187; NONEON-NOSVE-NEXT: ldr q0, [sp, #48]188; NONEON-NOSVE-NEXT: add sp, sp, #64189; NONEON-NOSVE-NEXT: ret190 %sel = select <8 x i1> %mask, <8 x half> %op1, <8 x half> %op2191 ret <8 x half> %sel192}193 194define void @select_v16f16(ptr %a, ptr %b) {195; CHECK-LABEL: select_v16f16:196; CHECK: // %bb.0:197; CHECK-NEXT: ldp q3, q0, [x1]198; CHECK-NEXT: ptrue p0.h, vl8199; CHECK-NEXT: ldp q2, q1, [x0]200; CHECK-NEXT: mov x8, #8 // =0x8201; CHECK-NEXT: fcmne p1.h, p0/z, z1.h, z0.h202; CHECK-NEXT: fcmne p0.h, p0/z, z2.h, z3.h203; CHECK-NEXT: st1h { z0.h }, p1, [x0, x8, lsl #1]204; CHECK-NEXT: st1h { z3.h }, p0, [x0]205; CHECK-NEXT: ret206;207; NONEON-NOSVE-LABEL: select_v16f16:208; NONEON-NOSVE: // %bb.0:209; NONEON-NOSVE-NEXT: ldp q0, q3, [x1]210; NONEON-NOSVE-NEXT: ldp q1, q2, [x0]211; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-96]!212; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 96213; NONEON-NOSVE-NEXT: ldr h0, [sp, #18]214; NONEON-NOSVE-NEXT: ldr h1, [sp, #2]215; NONEON-NOSVE-NEXT: stp q2, q3, [sp, #32]216; NONEON-NOSVE-NEXT: ldr h4, [sp, #20]217; NONEON-NOSVE-NEXT: ldr h5, [sp, #4]218; NONEON-NOSVE-NEXT: ldr h16, [sp, #22]219; NONEON-NOSVE-NEXT: fcvt s2, h0220; NONEON-NOSVE-NEXT: fcvt s3, h1221; NONEON-NOSVE-NEXT: ldr h17, [sp, #6]222; NONEON-NOSVE-NEXT: fcvt s6, h4223; NONEON-NOSVE-NEXT: fcvt s7, h5224; NONEON-NOSVE-NEXT: ldr h19, [sp, #8]225; NONEON-NOSVE-NEXT: fcvt s18, h17226; NONEON-NOSVE-NEXT: ldr h21, [sp, #10]227; NONEON-NOSVE-NEXT: ldr h22, [sp, #12]228; NONEON-NOSVE-NEXT: fcvt s20, h19229; NONEON-NOSVE-NEXT: ldr h24, [sp, #32]230; NONEON-NOSVE-NEXT: ldr h25, [sp, #34]231; NONEON-NOSVE-NEXT: fcmp s3, s2232; NONEON-NOSVE-NEXT: fcvt s2, h16233; NONEON-NOSVE-NEXT: ldr h3, [sp, #24]234; NONEON-NOSVE-NEXT: ldr h26, [sp, #36]235; NONEON-NOSVE-NEXT: ldr h27, [sp, #38]236; NONEON-NOSVE-NEXT: ldr h28, [sp, #42]237; NONEON-NOSVE-NEXT: ldr h29, [sp, #44]238; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, eq239; NONEON-NOSVE-NEXT: fcmp s7, s6240; NONEON-NOSVE-NEXT: fcvt s7, h3241; NONEON-NOSVE-NEXT: ldr h6, [sp, #26]242; NONEON-NOSVE-NEXT: fcsel s1, s5, s4, eq243; NONEON-NOSVE-NEXT: fcmp s18, s2244; NONEON-NOSVE-NEXT: fcvt s4, h6245; NONEON-NOSVE-NEXT: fcvt s18, h21246; NONEON-NOSVE-NEXT: ldr h5, [sp, #28]247; NONEON-NOSVE-NEXT: str h0, [sp, #66]248; NONEON-NOSVE-NEXT: fcsel s2, s17, s16, eq249; NONEON-NOSVE-NEXT: fcmp s20, s7250; NONEON-NOSVE-NEXT: fcvt s16, h5251; NONEON-NOSVE-NEXT: fcvt s17, h22252; NONEON-NOSVE-NEXT: ldr h7, [sp, #30]253; NONEON-NOSVE-NEXT: ldr h20, [sp, #14]254; NONEON-NOSVE-NEXT: str h1, [sp, #68]255; NONEON-NOSVE-NEXT: fcsel s3, s19, s3, eq256; NONEON-NOSVE-NEXT: fcmp s18, s4257; NONEON-NOSVE-NEXT: fcvt s19, h7258; NONEON-NOSVE-NEXT: fcvt s23, h20259; NONEON-NOSVE-NEXT: ldr h18, [sp, #48]260; NONEON-NOSVE-NEXT: str h2, [sp, #70]261; NONEON-NOSVE-NEXT: fcsel s4, s21, s6, eq262; NONEON-NOSVE-NEXT: fcmp s17, s16263; NONEON-NOSVE-NEXT: fcvt s17, h18264; NONEON-NOSVE-NEXT: fcvt s21, h24265; NONEON-NOSVE-NEXT: ldr h16, [sp, #50]266; NONEON-NOSVE-NEXT: str h3, [sp, #72]267; NONEON-NOSVE-NEXT: fcsel s5, s22, s5, eq268; NONEON-NOSVE-NEXT: fcmp s23, s19269; NONEON-NOSVE-NEXT: fcvt s22, h16270; NONEON-NOSVE-NEXT: fcvt s23, h25271; NONEON-NOSVE-NEXT: ldr h19, [sp, #52]272; NONEON-NOSVE-NEXT: str h4, [sp, #74]273; NONEON-NOSVE-NEXT: fcsel s6, s20, s7, eq274; NONEON-NOSVE-NEXT: fcmp s21, s17275; NONEON-NOSVE-NEXT: fcvt s20, h19276; NONEON-NOSVE-NEXT: fcvt s21, h26277; NONEON-NOSVE-NEXT: ldr h17, [sp, #54]278; NONEON-NOSVE-NEXT: str h5, [sp, #76]279; NONEON-NOSVE-NEXT: fcsel s7, s24, s18, eq280; NONEON-NOSVE-NEXT: fcmp s23, s22281; NONEON-NOSVE-NEXT: fcvt s22, h17282; NONEON-NOSVE-NEXT: fcvt s23, h27283; NONEON-NOSVE-NEXT: ldr h18, [sp, #56]284; NONEON-NOSVE-NEXT: ldr h24, [sp, #40]285; NONEON-NOSVE-NEXT: str h6, [sp, #78]286; NONEON-NOSVE-NEXT: fcsel s16, s25, s16, eq287; NONEON-NOSVE-NEXT: fcmp s21, s20288; NONEON-NOSVE-NEXT: fcvt s21, h18289; NONEON-NOSVE-NEXT: fcvt s25, h24290; NONEON-NOSVE-NEXT: ldr h20, [sp, #58]291; NONEON-NOSVE-NEXT: str h7, [sp, #80]292; NONEON-NOSVE-NEXT: fcsel s19, s26, s19, eq293; NONEON-NOSVE-NEXT: fcmp s23, s22294; NONEON-NOSVE-NEXT: fcvt s23, h20295; NONEON-NOSVE-NEXT: fcvt s26, h28296; NONEON-NOSVE-NEXT: ldr h22, [sp, #60]297; NONEON-NOSVE-NEXT: str h16, [sp, #82]298; NONEON-NOSVE-NEXT: fcsel s17, s27, s17, eq299; NONEON-NOSVE-NEXT: fcmp s25, s21300; NONEON-NOSVE-NEXT: fcvt s25, h22301; NONEON-NOSVE-NEXT: fcvt s27, h29302; NONEON-NOSVE-NEXT: ldr h21, [sp, #62]303; NONEON-NOSVE-NEXT: str h19, [sp, #84]304; NONEON-NOSVE-NEXT: fcsel s18, s24, s18, eq305; NONEON-NOSVE-NEXT: ldr h24, [sp, #46]306; NONEON-NOSVE-NEXT: fcmp s26, s23307; NONEON-NOSVE-NEXT: fcvt s23, h21308; NONEON-NOSVE-NEXT: str h17, [sp, #86]309; NONEON-NOSVE-NEXT: fcvt s26, h24310; NONEON-NOSVE-NEXT: fcsel s20, s28, s20, eq311; NONEON-NOSVE-NEXT: fcmp s27, s25312; NONEON-NOSVE-NEXT: ldr h25, [sp, #16]313; NONEON-NOSVE-NEXT: ldr h27, [sp]314; NONEON-NOSVE-NEXT: str h18, [sp, #88]315; NONEON-NOSVE-NEXT: fcvt s17, h25316; NONEON-NOSVE-NEXT: fcvt s18, h27317; NONEON-NOSVE-NEXT: fcsel s7, s29, s22, eq318; NONEON-NOSVE-NEXT: fcmp s26, s23319; NONEON-NOSVE-NEXT: str h20, [sp, #90]320; NONEON-NOSVE-NEXT: fcsel s16, s24, s21, eq321; NONEON-NOSVE-NEXT: str h7, [sp, #92]322; NONEON-NOSVE-NEXT: fcmp s18, s17323; NONEON-NOSVE-NEXT: str h16, [sp, #94]324; NONEON-NOSVE-NEXT: fcsel s2, s27, s25, eq325; NONEON-NOSVE-NEXT: str h2, [sp, #64]326; NONEON-NOSVE-NEXT: ldp q0, q1, [sp, #64]327; NONEON-NOSVE-NEXT: stp q0, q1, [x0]328; NONEON-NOSVE-NEXT: add sp, sp, #96329; NONEON-NOSVE-NEXT: ret330 %op1 = load <16 x half>, ptr %a331 %op2 = load <16 x half>, ptr %b332 %mask = fcmp oeq <16 x half> %op1, %op2333 %sel = select <16 x i1> %mask, <16 x half> %op1, <16 x half> %op2334 store <16 x half> %sel, ptr %a335 ret void336}337 338define <2 x float> @select_v2f32(<2 x float> %op1, <2 x float> %op2, <2 x i1> %mask) {339; CHECK-LABEL: select_v2f32:340; CHECK: // %bb.0:341; CHECK-NEXT: // kill: def $d2 killed $d2 def $z2342; CHECK-NEXT: ptrue p0.s343; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0344; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1345; CHECK-NEXT: lsl z2.s, z2.s, #31346; CHECK-NEXT: asr z2.s, z2.s, #31347; CHECK-NEXT: and z2.s, z2.s, #0x1348; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0349; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s350; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0351; CHECK-NEXT: ret352;353; NONEON-NOSVE-LABEL: select_v2f32:354; NONEON-NOSVE: // %bb.0:355; NONEON-NOSVE-NEXT: stp d2, d0, [sp, #-32]!356; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 32357; NONEON-NOSVE-NEXT: ldp w9, w8, [sp]358; NONEON-NOSVE-NEXT: str d1, [sp, #16]359; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #8]360; NONEON-NOSVE-NEXT: ldr s0, [sp, #20]361; NONEON-NOSVE-NEXT: sbfx w8, w8, #0, #1362; NONEON-NOSVE-NEXT: cmp w8, #0363; NONEON-NOSVE-NEXT: sbfx w8, w9, #0, #1364; NONEON-NOSVE-NEXT: fcsel s3, s2, s0, ne365; NONEON-NOSVE-NEXT: ldr s0, [sp, #16]366; NONEON-NOSVE-NEXT: cmp w8, #0367; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne368; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #24]369; NONEON-NOSVE-NEXT: ldr d0, [sp, #24]370; NONEON-NOSVE-NEXT: add sp, sp, #32371; NONEON-NOSVE-NEXT: ret372 %sel = select <2 x i1> %mask, <2 x float> %op1, <2 x float> %op2373 ret <2 x float> %sel374}375 376define <4 x float> @select_v4f32(<4 x float> %op1, <4 x float> %op2, <4 x i1> %mask) {377; CHECK-LABEL: select_v4f32:378; CHECK: // %bb.0:379; CHECK-NEXT: // kill: def $d2 killed $d2 def $z2380; CHECK-NEXT: ptrue p0.s381; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0382; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1383; CHECK-NEXT: uunpklo z2.s, z2.h384; CHECK-NEXT: lsl z2.s, z2.s, #31385; CHECK-NEXT: asr z2.s, z2.s, #31386; CHECK-NEXT: and z2.s, z2.s, #0x1387; CHECK-NEXT: cmpne p0.s, p0/z, z2.s, #0388; CHECK-NEXT: sel z0.s, p0, z0.s, z1.s389; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0390; CHECK-NEXT: ret391;392; NONEON-NOSVE-LABEL: select_v4f32:393; NONEON-NOSVE: // %bb.0:394; NONEON-NOSVE-NEXT: sub sp, sp, #64395; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 64396; NONEON-NOSVE-NEXT: str d2, [sp, #8]397; NONEON-NOSVE-NEXT: ldrh w9, [sp, #14]398; NONEON-NOSVE-NEXT: stp q0, q1, [sp, #16]399; NONEON-NOSVE-NEXT: ldrh w11, [sp, #12]400; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #24]401; NONEON-NOSVE-NEXT: ldr s0, [sp, #44]402; NONEON-NOSVE-NEXT: sbfx w9, w9, #0, #1403; NONEON-NOSVE-NEXT: ldrh w10, [sp, #10]404; NONEON-NOSVE-NEXT: ldrh w8, [sp, #8]405; NONEON-NOSVE-NEXT: cmp w9, #0406; NONEON-NOSVE-NEXT: sbfx w9, w11, #0, #1407; NONEON-NOSVE-NEXT: sbfx w8, w8, #0, #1408; NONEON-NOSVE-NEXT: fcsel s3, s2, s0, ne409; NONEON-NOSVE-NEXT: ldr s0, [sp, #40]410; NONEON-NOSVE-NEXT: cmp w9, #0411; NONEON-NOSVE-NEXT: sbfx w9, w10, #0, #1412; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne413; NONEON-NOSVE-NEXT: ldp s1, s2, [sp, #16]414; NONEON-NOSVE-NEXT: cmp w9, #0415; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #56]416; NONEON-NOSVE-NEXT: ldr s0, [sp, #36]417; NONEON-NOSVE-NEXT: fcsel s3, s2, s0, ne418; NONEON-NOSVE-NEXT: ldr s0, [sp, #32]419; NONEON-NOSVE-NEXT: cmp w8, #0420; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, ne421; NONEON-NOSVE-NEXT: stp s0, s3, [sp, #48]422; NONEON-NOSVE-NEXT: ldr q0, [sp, #48]423; NONEON-NOSVE-NEXT: add sp, sp, #64424; NONEON-NOSVE-NEXT: ret425 %sel = select <4 x i1> %mask, <4 x float> %op1, <4 x float> %op2426 ret <4 x float> %sel427}428 429define void @select_v8f32(ptr %a, ptr %b) {430; CHECK-LABEL: select_v8f32:431; CHECK: // %bb.0:432; CHECK-NEXT: ldp q3, q0, [x1]433; CHECK-NEXT: ptrue p0.s, vl4434; CHECK-NEXT: ldp q2, q1, [x0]435; CHECK-NEXT: mov x8, #4 // =0x4436; CHECK-NEXT: fcmne p1.s, p0/z, z1.s, z0.s437; CHECK-NEXT: fcmne p0.s, p0/z, z2.s, z3.s438; CHECK-NEXT: st1w { z0.s }, p1, [x0, x8, lsl #2]439; CHECK-NEXT: st1w { z3.s }, p0, [x0]440; CHECK-NEXT: ret441;442; NONEON-NOSVE-LABEL: select_v8f32:443; NONEON-NOSVE: // %bb.0:444; NONEON-NOSVE-NEXT: ldp q0, q3, [x1]445; NONEON-NOSVE-NEXT: ldp q1, q2, [x0]446; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-96]!447; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 96448; NONEON-NOSVE-NEXT: stp q2, q3, [sp, #32]449; NONEON-NOSVE-NEXT: ldp s0, s2, [sp, #20]450; NONEON-NOSVE-NEXT: ldp s1, s3, [sp, #4]451; NONEON-NOSVE-NEXT: ldr s4, [sp, #12]452; NONEON-NOSVE-NEXT: ldr s17, [sp]453; NONEON-NOSVE-NEXT: ldp s6, s7, [sp, #36]454; NONEON-NOSVE-NEXT: fcmp s1, s0455; NONEON-NOSVE-NEXT: fcsel s0, s1, s0, eq456; NONEON-NOSVE-NEXT: fcmp s3, s2457; NONEON-NOSVE-NEXT: ldp s1, s5, [sp, #28]458; NONEON-NOSVE-NEXT: fcsel s2, s3, s2, eq459; NONEON-NOSVE-NEXT: ldp s16, s3, [sp, #44]460; NONEON-NOSVE-NEXT: fcmp s4, s1461; NONEON-NOSVE-NEXT: fcsel s1, s4, s1, eq462; NONEON-NOSVE-NEXT: fcmp s5, s3463; NONEON-NOSVE-NEXT: ldr s4, [sp, #52]464; NONEON-NOSVE-NEXT: fcsel s3, s5, s3, eq465; NONEON-NOSVE-NEXT: fcmp s6, s4466; NONEON-NOSVE-NEXT: ldr s5, [sp, #56]467; NONEON-NOSVE-NEXT: stp s2, s1, [sp, #72]468; NONEON-NOSVE-NEXT: fcsel s4, s6, s4, eq469; NONEON-NOSVE-NEXT: fcmp s7, s5470; NONEON-NOSVE-NEXT: ldr s6, [sp, #60]471; NONEON-NOSVE-NEXT: fcsel s5, s7, s5, eq472; NONEON-NOSVE-NEXT: fcmp s16, s6473; NONEON-NOSVE-NEXT: ldr s7, [sp, #16]474; NONEON-NOSVE-NEXT: stp s3, s4, [sp, #80]475; NONEON-NOSVE-NEXT: fcsel s6, s16, s6, eq476; NONEON-NOSVE-NEXT: fcmp s17, s7477; NONEON-NOSVE-NEXT: fcsel s3, s17, s7, eq478; NONEON-NOSVE-NEXT: stp s5, s6, [sp, #88]479; NONEON-NOSVE-NEXT: stp s3, s0, [sp, #64]480; NONEON-NOSVE-NEXT: ldp q0, q1, [sp, #64]481; NONEON-NOSVE-NEXT: stp q0, q1, [x0]482; NONEON-NOSVE-NEXT: add sp, sp, #96483; NONEON-NOSVE-NEXT: ret484 %op1 = load <8 x float>, ptr %a485 %op2 = load <8 x float>, ptr %b486 %mask = fcmp oeq <8 x float> %op1, %op2487 %sel = select <8 x i1> %mask, <8 x float> %op1, <8 x float> %op2488 store <8 x float> %sel, ptr %a489 ret void490}491 492define <1 x double> @select_v1f64(<1 x double> %op1, <1 x double> %op2, <1 x i1> %mask) {493; CHECK-LABEL: select_v1f64:494; CHECK: // %bb.0:495; CHECK-NEXT: tst w0, #0x1496; CHECK-NEXT: fcsel d0, d0, d1, ne497; CHECK-NEXT: ret498;499; NONEON-NOSVE-LABEL: select_v1f64:500; NONEON-NOSVE: // %bb.0:501; NONEON-NOSVE-NEXT: sub sp, sp, #16502; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 16503; NONEON-NOSVE-NEXT: tst w0, #0x1504; NONEON-NOSVE-NEXT: fcsel d0, d0, d1, ne505; NONEON-NOSVE-NEXT: str d0, [sp, #8]506; NONEON-NOSVE-NEXT: ldr d0, [sp, #8]507; NONEON-NOSVE-NEXT: add sp, sp, #16508; NONEON-NOSVE-NEXT: ret509 %sel = select <1 x i1> %mask, <1 x double> %op1, <1 x double> %op2510 ret <1 x double> %sel511}512 513define <2 x double> @select_v2f64(<2 x double> %op1, <2 x double> %op2, <2 x i1> %mask) {514; CHECK-LABEL: select_v2f64:515; CHECK: // %bb.0:516; CHECK-NEXT: // kill: def $d2 killed $d2 def $z2517; CHECK-NEXT: ptrue p0.d518; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0519; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1520; CHECK-NEXT: uunpklo z2.d, z2.s521; CHECK-NEXT: lsl z2.d, z2.d, #63522; CHECK-NEXT: asr z2.d, z2.d, #63523; CHECK-NEXT: and z2.d, z2.d, #0x1524; CHECK-NEXT: cmpne p0.d, p0/z, z2.d, #0525; CHECK-NEXT: sel z0.d, p0, z0.d, z1.d526; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0527; CHECK-NEXT: ret528;529; NONEON-NOSVE-LABEL: select_v2f64:530; NONEON-NOSVE: // %bb.0:531; NONEON-NOSVE-NEXT: sub sp, sp, #64532; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 64533; NONEON-NOSVE-NEXT: str d2, [sp, #8]534; NONEON-NOSVE-NEXT: ldp w9, w8, [sp, #8]535; NONEON-NOSVE-NEXT: stp q0, q1, [sp, #16]536; NONEON-NOSVE-NEXT: ldp d1, d2, [sp, #16]537; NONEON-NOSVE-NEXT: ldr d0, [sp, #40]538; NONEON-NOSVE-NEXT: sbfx x8, x8, #0, #1539; NONEON-NOSVE-NEXT: cmp x8, #0540; NONEON-NOSVE-NEXT: sbfx x8, x9, #0, #1541; NONEON-NOSVE-NEXT: fcsel d3, d2, d0, ne542; NONEON-NOSVE-NEXT: ldr d0, [sp, #32]543; NONEON-NOSVE-NEXT: cmp x8, #0544; NONEON-NOSVE-NEXT: fcsel d0, d1, d0, ne545; NONEON-NOSVE-NEXT: stp d0, d3, [sp, #48]546; NONEON-NOSVE-NEXT: ldr q0, [sp, #48]547; NONEON-NOSVE-NEXT: add sp, sp, #64548; NONEON-NOSVE-NEXT: ret549 %sel = select <2 x i1> %mask, <2 x double> %op1, <2 x double> %op2550 ret <2 x double> %sel551}552 553define void @select_v4f64(ptr %a, ptr %b) {554; CHECK-LABEL: select_v4f64:555; CHECK: // %bb.0:556; CHECK-NEXT: ldp q3, q0, [x1]557; CHECK-NEXT: ptrue p0.d, vl2558; CHECK-NEXT: ldp q2, q1, [x0]559; CHECK-NEXT: mov x8, #2 // =0x2560; CHECK-NEXT: fcmne p1.d, p0/z, z1.d, z0.d561; CHECK-NEXT: fcmne p0.d, p0/z, z2.d, z3.d562; CHECK-NEXT: st1d { z0.d }, p1, [x0, x8, lsl #3]563; CHECK-NEXT: st1d { z3.d }, p0, [x0]564; CHECK-NEXT: ret565;566; NONEON-NOSVE-LABEL: select_v4f64:567; NONEON-NOSVE: // %bb.0:568; NONEON-NOSVE-NEXT: ldp q0, q3, [x1]569; NONEON-NOSVE-NEXT: ldp q1, q2, [x0]570; NONEON-NOSVE-NEXT: stp q1, q0, [sp, #-96]!571; NONEON-NOSVE-NEXT: .cfi_def_cfa_offset 96572; NONEON-NOSVE-NEXT: stp q2, q3, [sp, #32]573; NONEON-NOSVE-NEXT: ldp d5, d1, [sp]574; NONEON-NOSVE-NEXT: ldp d0, d3, [sp, #24]575; NONEON-NOSVE-NEXT: ldp d4, d2, [sp, #40]576; NONEON-NOSVE-NEXT: fcmp d1, d0577; NONEON-NOSVE-NEXT: fcsel d0, d1, d0, eq578; NONEON-NOSVE-NEXT: fcmp d3, d2579; NONEON-NOSVE-NEXT: ldr d1, [sp, #56]580; NONEON-NOSVE-NEXT: fcsel d2, d3, d2, eq581; NONEON-NOSVE-NEXT: fcmp d4, d1582; NONEON-NOSVE-NEXT: ldr d3, [sp, #16]583; NONEON-NOSVE-NEXT: fcsel d1, d4, d1, eq584; NONEON-NOSVE-NEXT: fcmp d5, d3585; NONEON-NOSVE-NEXT: fcsel d3, d5, d3, eq586; NONEON-NOSVE-NEXT: stp d2, d1, [sp, #80]587; NONEON-NOSVE-NEXT: stp d3, d0, [sp, #64]588; NONEON-NOSVE-NEXT: ldp q0, q1, [sp, #64]589; NONEON-NOSVE-NEXT: stp q0, q1, [x0]590; NONEON-NOSVE-NEXT: add sp, sp, #96591; NONEON-NOSVE-NEXT: ret592 %op1 = load <4 x double>, ptr %a593 %op2 = load <4 x double>, ptr %b594 %mask = fcmp oeq <4 x double> %op1, %op2595 %sel = select <4 x i1> %mask, <4 x double> %op1, <4 x double> %op2596 store <4 x double> %sel, ptr %a597 ret void598}599