268 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; Test file to verify the emission of Vector Evaluation instructions when ternary operators are used.3 4; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc64le-unknown-unknown \5; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s6 7; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc-ibm-aix-xcoff \8; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s9 10; RUN: llc -verify-machineinstrs -mcpu=pwr10 -mtriple=powerpc64-ibm-aix-xcoff \11; RUN: -ppc-asm-full-reg-names --ppc-vsr-nums-as-vr < %s | FileCheck %s12 13; Function to test ternary(A, and(B, C), C) for <4 x i32>14define <4 x i32> @ternary_A_and_BC_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {15; CHECK-LABEL: ternary_A_and_BC_C_4x32:16; CHECK: # %bb.0: # %entry17; CHECK-NEXT: xxleqv v5, v5, v518; CHECK-NEXT: vslw v2, v2, v519; CHECK-NEXT: vsraw v2, v2, v520; CHECK-NEXT: xxeval v2, v2, v3, v4, 8121; CHECK-NEXT: blr22entry:23 %and = and <4 x i32> %B, %C24 %res = select <4 x i1> %A, <4 x i32> %and, <4 x i32> %C25 ret <4 x i32> %res26}27 28; Function to test ternary(A, and(B, C), C) for <2 x i64>29define <2 x i64> @ternary_A_and_BC_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {30; CHECK-LABEL: ternary_A_and_BC_C_2x64:31; CHECK: # %bb.0: # %entry32; CHECK-NEXT: xxlxor v5, v5, v533; CHECK-NEXT: xxsplti32dx v5, 1, 6334; CHECK-NEXT: vsld v2, v2, v535; CHECK-NEXT: vsrad v2, v2, v536; CHECK-NEXT: xxeval v2, v2, v3, v4, 8137; CHECK-NEXT: blr38entry:39 %and = and <2 x i64> %B, %C40 %res = select <2 x i1> %A, <2 x i64> %and, <2 x i64> %C41 ret <2 x i64> %res42}43 44; Function to test ternary(A, and(B, C), C) for <16 x i8>45define <16 x i8> @ternary_A_and_BC_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {46; CHECK-LABEL: ternary_A_and_BC_C_16x8:47; CHECK: # %bb.0: # %entry48; CHECK-NEXT: xxspltib v5, 749; CHECK-NEXT: vslb v2, v2, v550; CHECK-NEXT: vsrab v2, v2, v551; CHECK-NEXT: xxeval v2, v2, v3, v4, 8152; CHECK-NEXT: blr53entry:54 %and = and <16 x i8> %B, %C55 %res = select <16 x i1> %A, <16 x i8> %and, <16 x i8> %C56 ret <16 x i8> %res57}58 59; Function to test ternary(A, and(B, C), C) for <8 x i16>60define <8 x i16> @ternary_A_and_BC_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {61; CHECK-LABEL: ternary_A_and_BC_C_8x16:62; CHECK: # %bb.0: # %entry63; CHECK-NEXT: xxspltiw v5, 98305564; CHECK-NEXT: vslh v2, v2, v565; CHECK-NEXT: vsrah v2, v2, v566; CHECK-NEXT: xxeval v2, v2, v3, v4, 8167; CHECK-NEXT: blr68entry:69 %and = and <8 x i16> %B, %C70 %res = select <8 x i1> %A, <8 x i16> %and, <8 x i16> %C71 ret <8 x i16> %res72}73 74; Function to test ternary(A, nor(B, C), C) for <4 x i32>75define <4 x i32> @ternary_A_nor_BC_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {76; CHECK-LABEL: ternary_A_nor_BC_C_4x32:77; CHECK: # %bb.0: # %entry78; CHECK-NEXT: xxleqv v5, v5, v579; CHECK-NEXT: vslw v2, v2, v580; CHECK-NEXT: vsraw v2, v2, v581; CHECK-NEXT: xxeval v2, v2, v3, v4, 8882; CHECK-NEXT: blr83entry:84 %or = or <4 x i32> %B, %C85 %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector NOR operation86 %res = select <4 x i1> %A, <4 x i32> %nor, <4 x i32> %C87 ret <4 x i32> %res88}89 90; Function to test ternary(A, nor(B, C), C) for <2 x i64>91define <2 x i64> @ternary_A_nor_BC_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {92; CHECK-LABEL: ternary_A_nor_BC_C_2x64:93; CHECK: # %bb.0: # %entry94; CHECK-NEXT: xxlxor v5, v5, v595; CHECK-NEXT: xxsplti32dx v5, 1, 6396; CHECK-NEXT: vsld v2, v2, v597; CHECK-NEXT: vsrad v2, v2, v598; CHECK-NEXT: xxeval v2, v2, v3, v4, 8899; CHECK-NEXT: blr100entry:101 %or = or <2 x i64> %B, %C102 %nor = xor <2 x i64> %or, <i64 -1, i64 -1> ; Vector NOR operation103 %res = select <2 x i1> %A, <2 x i64> %nor, <2 x i64> %C104 ret <2 x i64> %res105}106 107; Function to test ternary(A, nor(B, C), C) for <16 x i8>108define <16 x i8> @ternary_A_nor_BC_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {109; CHECK-LABEL: ternary_A_nor_BC_C_16x8:110; CHECK: # %bb.0: # %entry111; CHECK-NEXT: xxspltib v5, 7112; CHECK-NEXT: vslb v2, v2, v5113; CHECK-NEXT: vsrab v2, v2, v5114; CHECK-NEXT: xxeval v2, v2, v3, v4, 88115; CHECK-NEXT: blr116entry:117 %or = or <16 x i8> %B, %C118 %nor = xor <16 x i8> %or, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector NOR operation119 %res = select <16 x i1> %A, <16 x i8> %nor, <16 x i8> %C120 ret <16 x i8> %res121}122 123; Function to test ternary(A, nor(B, C), C) for <8 x i16>124define <8 x i16> @ternary_A_nor_BC_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {125; CHECK-LABEL: ternary_A_nor_BC_C_8x16:126; CHECK: # %bb.0: # %entry127; CHECK-NEXT: xxspltiw v5, 983055128; CHECK-NEXT: vslh v2, v2, v5129; CHECK-NEXT: vsrah v2, v2, v5130; CHECK-NEXT: xxeval v2, v2, v3, v4, 88131; CHECK-NEXT: blr132entry:133 %or = or <8 x i16> %B, %C134 %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector NOR operation135 %res = select <8 x i1> %A, <8 x i16> %nor, <8 x i16> %C136 ret <8 x i16> %res137}138 139; Function to test ternary(A, eqv(B, C), C) for <4 x i32>140define <4 x i32> @ternary_A_eqv_BC_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {141; CHECK-LABEL: ternary_A_eqv_BC_C_4x32:142; CHECK: # %bb.0: # %entry143; CHECK-NEXT: xxleqv v5, v5, v5144; CHECK-NEXT: vslw v2, v2, v5145; CHECK-NEXT: vsraw v2, v2, v5146; CHECK-NEXT: xxeval v2, v2, v3, v4, 89147; CHECK-NEXT: blr148entry:149 %xor = xor <4 x i32> %B, %C150 %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation151 %res = select <4 x i1> %A, <4 x i32> %eqv, <4 x i32> %C152 ret <4 x i32> %res153}154 155; Function to test ternary(A, eqv(B, C), C) for <2 x i64>156define <2 x i64> @ternary_A_eqv_BC_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {157; CHECK-LABEL: ternary_A_eqv_BC_C_2x64:158; CHECK: # %bb.0: # %entry159; CHECK-NEXT: xxlxor v5, v5, v5160; CHECK-NEXT: xxsplti32dx v5, 1, 63161; CHECK-NEXT: vsld v2, v2, v5162; CHECK-NEXT: vsrad v2, v2, v5163; CHECK-NEXT: xxeval v2, v2, v3, v4, 89164; CHECK-NEXT: blr165entry:166 %xor = xor <2 x i64> %B, %C167 %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation168 %res = select <2 x i1> %A, <2 x i64> %eqv, <2 x i64> %C169 ret <2 x i64> %res170}171 172; Function to test ternary(A, eqv(B, C), C) for <16 x i8>173define <16 x i8> @ternary_A_eqv_BC_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {174; CHECK-LABEL: ternary_A_eqv_BC_C_16x8:175; CHECK: # %bb.0: # %entry176; CHECK-NEXT: xxspltib v5, 7177; CHECK-NEXT: vslb v2, v2, v5178; CHECK-NEXT: vsrab v2, v2, v5179; CHECK-NEXT: xxeval v2, v2, v3, v4, 89180; CHECK-NEXT: blr181entry:182 %xor = xor <16 x i8> %B, %C183 %eqv = xor <16 x i8> %xor, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector eqv operation184 %res = select <16 x i1> %A, <16 x i8> %eqv, <16 x i8> %C185 ret <16 x i8> %res186}187 188; Function to test ternary(A, eqv(B, C), C) for <8 x i16>189define <8 x i16> @ternary_A_eqv_BC_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {190; CHECK-LABEL: ternary_A_eqv_BC_C_8x16:191; CHECK: # %bb.0: # %entry192; CHECK-NEXT: xxspltiw v5, 983055193; CHECK-NEXT: vslh v2, v2, v5194; CHECK-NEXT: vsrah v2, v2, v5195; CHECK-NEXT: xxeval v2, v2, v3, v4, 89196; CHECK-NEXT: blr197entry:198 %xor = xor <8 x i16> %B, %C199 %eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector eqv operation200 %res = select <8 x i1> %A, <8 x i16> %eqv, <8 x i16> %C201 ret <8 x i16> %res202}203 204; Function to test ternary(A, nand(B, C), C) for <4 x i32>205define <4 x i32> @ternary_A_nand_BC_C_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {206; CHECK-LABEL: ternary_A_nand_BC_C_4x32:207; CHECK: # %bb.0: # %entry208; CHECK-NEXT: xxleqv v5, v5, v5209; CHECK-NEXT: vslw v2, v2, v5210; CHECK-NEXT: vsraw v2, v2, v5211; CHECK-NEXT: xxeval v2, v2, v3, v4, 94212; CHECK-NEXT: blr213entry:214 %and = and <4 x i32> %B, %C215 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation216 %res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %C217 ret <4 x i32> %res218}219 220; Function to test ternary(A, nand(B, C), C) for <2 x i64>221define <2 x i64> @ternary_A_nand_BC_C_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {222; CHECK-LABEL: ternary_A_nand_BC_C_2x64:223; CHECK: # %bb.0: # %entry224; CHECK-NEXT: xxlxor v5, v5, v5225; CHECK-NEXT: xxsplti32dx v5, 1, 63226; CHECK-NEXT: vsld v2, v2, v5227; CHECK-NEXT: vsrad v2, v2, v5228; CHECK-NEXT: xxeval v2, v2, v3, v4, 94229; CHECK-NEXT: blr230entry:231 %and = and <2 x i64> %B, %C232 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation233 %res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %C234 ret <2 x i64> %res235}236 237; Function to test ternary(A, nand(B, C), C) for <16 x i8>238define <16 x i8> @ternary_A_nand_BC_C_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {239; CHECK-LABEL: ternary_A_nand_BC_C_16x8:240; CHECK: # %bb.0: # %entry241; CHECK-NEXT: xxspltib v5, 7242; CHECK-NEXT: vslb v2, v2, v5243; CHECK-NEXT: vsrab v2, v2, v5244; CHECK-NEXT: xxeval v2, v2, v3, v4, 94245; CHECK-NEXT: blr246entry:247 %and = and <16 x i8> %B, %C248 %nand = xor <16 x i8> %and, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> ; Vector nand operation249 %res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %C250 ret <16 x i8> %res251}252 253; Function to test ternary(A, nand(B, C), C) for <8 x i16>254define <8 x i16> @ternary_A_nand_BC_C_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {255; CHECK-LABEL: ternary_A_nand_BC_C_8x16:256; CHECK: # %bb.0: # %entry257; CHECK-NEXT: xxspltiw v5, 983055258; CHECK-NEXT: vslh v2, v2, v5259; CHECK-NEXT: vsrah v2, v2, v5260; CHECK-NEXT: xxeval v2, v2, v3, v4, 94261; CHECK-NEXT: blr262entry:263 %and = and <8 x i16> %B, %C264 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation265 %res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %C266 ret <8 x i16> %res267}268