353 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 Evaluate 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, B, nand(B, C)) for <4 x i32>14define <4 x i32> @ternary_A_B_nand_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {15; CHECK-LABEL: ternary_A_B_nand_BC_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, 22721; CHECK-NEXT: blr22entry:23 %and = and <4 x i32> %B, %C24 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation25 %res = select <4 x i1> %A, <4 x i32> %B, <4 x i32> %nand26 ret <4 x i32> %res27}28 29; Function to test ternary(A, B, nand(B, C)) for <2 x i64>30define <2 x i64> @ternary_A_B_nand_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {31; CHECK-LABEL: ternary_A_B_nand_BC_2x64:32; CHECK: # %bb.0: # %entry33; CHECK-NEXT: xxlxor v5, v5, v534; CHECK-NEXT: xxsplti32dx v5, 1, 6335; CHECK-NEXT: vsld v2, v2, v536; CHECK-NEXT: vsrad v2, v2, v537; CHECK-NEXT: xxeval v2, v2, v3, v4, 22738; CHECK-NEXT: blr39entry:40 %and = and <2 x i64> %B, %C41 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation42 %res = select <2 x i1> %A, <2 x i64> %B, <2 x i64> %nand43 ret <2 x i64> %res44}45 46; Function to test ternary(A, B, nand(B, C)) for <16 x i8>47define <16 x i8> @ternary_A_B_nand_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {48; CHECK-LABEL: ternary_A_B_nand_BC_16x8:49; CHECK: # %bb.0: # %entry50; CHECK-NEXT: xxspltib v5, 751; CHECK-NEXT: vslb v2, v2, v552; CHECK-NEXT: vsrab v2, v2, v553; CHECK-NEXT: xxeval v2, v2, v3, v4, 22754; CHECK-NEXT: blr55entry:56 %and = and <16 x i8> %B, %C57 %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 operation58 %res = select <16 x i1> %A, <16 x i8> %B, <16 x i8> %nand59 ret <16 x i8> %res60}61 62; Function to test ternary(A, B, nand(B, C)) for <8 x i16>63define <8 x i16> @ternary_A_B_nand_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {64; CHECK-LABEL: ternary_A_B_nand_BC_8x16:65; CHECK: # %bb.0: # %entry66; CHECK-NEXT: xxspltiw v5, 98305567; CHECK-NEXT: vslh v2, v2, v568; CHECK-NEXT: vsrah v2, v2, v569; CHECK-NEXT: xxeval v2, v2, v3, v4, 22770; CHECK-NEXT: blr71entry:72 %and = and <8 x i16> %B, %C73 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation74 %res = select <8 x i1> %A, <8 x i16> %B, <8 x i16> %nand75 ret <8 x i16> %res76}77 78; Function to test ternary(A, C, nand(B, C)) for <4 x i32>79define <4 x i32> @ternary_A_C_nand_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {80; CHECK-LABEL: ternary_A_C_nand_BC_4x32:81; CHECK: # %bb.0: # %entry82; CHECK-NEXT: xxleqv v5, v5, v583; CHECK-NEXT: vslw v2, v2, v584; CHECK-NEXT: vsraw v2, v2, v585; CHECK-NEXT: xxeval v2, v2, v3, v4, 22986; CHECK-NEXT: blr87entry:88 %and = and <4 x i32> %B, %C89 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation90 %res = select <4 x i1> %A, <4 x i32> %C, <4 x i32> %nand91 ret <4 x i32> %res92}93 94; Function to test ternary(A, C, nand(B, C)) for <2 x i64>95define <2 x i64> @ternary_A_C_nand_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {96; CHECK-LABEL: ternary_A_C_nand_BC_2x64:97; CHECK: # %bb.0: # %entry98; CHECK-NEXT: xxlxor v5, v5, v599; CHECK-NEXT: xxsplti32dx v5, 1, 63100; CHECK-NEXT: vsld v2, v2, v5101; CHECK-NEXT: vsrad v2, v2, v5102; CHECK-NEXT: xxeval v2, v2, v3, v4, 229103; CHECK-NEXT: blr104entry:105 %and = and <2 x i64> %B, %C106 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation107 %res = select <2 x i1> %A, <2 x i64> %C, <2 x i64> %nand108 ret <2 x i64> %res109}110 111; Function to test ternary(A, C, nand(B, C)) for <16 x i8>112define <16 x i8> @ternary_A_C_nand_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {113; CHECK-LABEL: ternary_A_C_nand_BC_16x8:114; CHECK: # %bb.0: # %entry115; CHECK-NEXT: xxspltib v5, 7116; CHECK-NEXT: vslb v2, v2, v5117; CHECK-NEXT: vsrab v2, v2, v5118; CHECK-NEXT: xxeval v2, v2, v3, v4, 229119; CHECK-NEXT: blr120entry:121 %and = and <16 x i8> %B, %C122 %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 operation123 %res = select <16 x i1> %A, <16 x i8> %C, <16 x i8> %nand124 ret <16 x i8> %res125}126 127; Function to test ternary(A, C, nand(B, C)) for <8 x i16>128define <8 x i16> @ternary_A_C_nand_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {129; CHECK-LABEL: ternary_A_C_nand_BC_8x16:130; CHECK: # %bb.0: # %entry131; CHECK-NEXT: xxspltiw v5, 983055132; CHECK-NEXT: vslh v2, v2, v5133; CHECK-NEXT: vsrah v2, v2, v5134; CHECK-NEXT: xxeval v2, v2, v3, v4, 229135; CHECK-NEXT: blr136entry:137 %and = and <8 x i16> %B, %C138 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation139 %res = select <8 x i1> %A, <8 x i16> %C, <8 x i16> %nand140 ret <8 x i16> %res141}142 143; Function to test ternary(A, xor(B, C), nand(B, C)) for <4 x i32>144define <4 x i32> @ternary_A_xor_BC_nand_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {145; CHECK-LABEL: ternary_A_xor_BC_nand_BC_4x32:146; CHECK: # %bb.0: # %entry147; CHECK-NEXT: xxleqv v5, v5, v5148; CHECK-NEXT: vslw v2, v2, v5149; CHECK-NEXT: vsraw v2, v2, v5150; CHECK-NEXT: xxeval v2, v2, v3, v4, 230151; CHECK-NEXT: blr152entry:153 %xor = xor <4 x i32> %B, %C154 %and = and <4 x i32> %B, %C155 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation156 %res = select <4 x i1> %A, <4 x i32> %xor, <4 x i32> %nand157 ret <4 x i32> %res158}159 160; Function to test ternary(A, xor(B, C), nand(B, C)) for <2 x i64>161define <2 x i64> @ternary_A_xor_BC_nand_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {162; CHECK-LABEL: ternary_A_xor_BC_nand_BC_2x64:163; CHECK: # %bb.0: # %entry164; CHECK-NEXT: xxlxor v5, v5, v5165; CHECK-NEXT: xxsplti32dx v5, 1, 63166; CHECK-NEXT: vsld v2, v2, v5167; CHECK-NEXT: vsrad v2, v2, v5168; CHECK-NEXT: xxeval v2, v2, v3, v4, 230169; CHECK-NEXT: blr170entry:171 %xor = xor <2 x i64> %B, %C172 %and = and <2 x i64> %B, %C173 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation174 %res = select <2 x i1> %A, <2 x i64> %xor, <2 x i64> %nand175 ret <2 x i64> %res176}177 178; Function to test ternary(A, xor(B, C), nand(B, C)) for <16 x i8>179define <16 x i8> @ternary_A_xor_BC_nand_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {180; CHECK-LABEL: ternary_A_xor_BC_nand_BC_16x8:181; CHECK: # %bb.0: # %entry182; CHECK-NEXT: xxspltib v5, 7183; CHECK-NEXT: vslb v2, v2, v5184; CHECK-NEXT: vsrab v2, v2, v5185; CHECK-NEXT: xxeval v2, v2, v3, v4, 230186; CHECK-NEXT: blr187entry:188 %xor = xor <16 x i8> %B, %C189 %and = and <16 x i8> %B, %C190 %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 operation191 %res = select <16 x i1> %A, <16 x i8> %xor, <16 x i8> %nand192 ret <16 x i8> %res193}194 195; Function to test ternary(A, xor(B, C), nand(B, C)) for <8 x i16>196define <8 x i16> @ternary_A_xor_BC_nand_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {197; CHECK-LABEL: ternary_A_xor_BC_nand_BC_8x16:198; CHECK: # %bb.0: # %entry199; CHECK-NEXT: xxspltiw v5, 983055200; CHECK-NEXT: vslh v2, v2, v5201; CHECK-NEXT: vsrah v2, v2, v5202; CHECK-NEXT: xxeval v2, v2, v3, v4, 230203; CHECK-NEXT: blr204entry:205 %xor = xor <8 x i16> %B, %C206 %and = and <8 x i16> %B, %C207 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation208 %res = select <8 x i1> %A, <8 x i16> %xor, <8 x i16> %nand209 ret <8 x i16> %res210}211 212; Function to test ternary(A, or(B, C), nand(B, C)) for <4 x i32>213define <4 x i32> @ternary_A_or_BC_nand_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {214; CHECK-LABEL: ternary_A_or_BC_nand_BC_4x32:215; CHECK: # %bb.0: # %entry216; CHECK-NEXT: xxleqv v5, v5, v5217; CHECK-NEXT: vslw v2, v2, v5218; CHECK-NEXT: vsraw v2, v2, v5219; CHECK-NEXT: xxeval v2, v2, v3, v4, 231220; CHECK-NEXT: blr221entry:222 %or = or <4 x i32> %B, %C223 %and = and <4 x i32> %B, %C224 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation225 %res = select <4 x i1> %A, <4 x i32> %or, <4 x i32> %nand226 ret <4 x i32> %res227}228 229; Function to test ternary(A, or(B, C), nand(B, C)) for <2 x i64>230define <2 x i64> @ternary_A_or_BC_nand_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {231; CHECK-LABEL: ternary_A_or_BC_nand_BC_2x64:232; CHECK: # %bb.0: # %entry233; CHECK-NEXT: xxlxor v5, v5, v5234; CHECK-NEXT: xxsplti32dx v5, 1, 63235; CHECK-NEXT: vsld v2, v2, v5236; CHECK-NEXT: vsrad v2, v2, v5237; CHECK-NEXT: xxeval v2, v2, v3, v4, 231238; CHECK-NEXT: blr239entry:240 %or = or <2 x i64> %B, %C241 %and = and <2 x i64> %B, %C242 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation243 %res = select <2 x i1> %A, <2 x i64> %or, <2 x i64> %nand244 ret <2 x i64> %res245}246 247; Function to test ternary(A, or(B, C), nand(B, C)) for <16 x i8>248define <16 x i8> @ternary_A_or_BC_nand_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {249; CHECK-LABEL: ternary_A_or_BC_nand_BC_16x8:250; CHECK: # %bb.0: # %entry251; CHECK-NEXT: xxspltib v5, 7252; CHECK-NEXT: vslb v2, v2, v5253; CHECK-NEXT: vsrab v2, v2, v5254; CHECK-NEXT: xxeval v2, v2, v3, v4, 231255; CHECK-NEXT: blr256entry:257 %or = or <16 x i8> %B, %C258 %and = and <16 x i8> %B, %C259 %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 operation260 %res = select <16 x i1> %A, <16 x i8> %or, <16 x i8> %nand261 ret <16 x i8> %res262}263 264; Function to test ternary(A, or(B, C), nand(B, C)) for <8 x i16>265define <8 x i16> @ternary_A_or_BC_nand_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {266; CHECK-LABEL: ternary_A_or_BC_nand_BC_8x16:267; CHECK: # %bb.0: # %entry268; CHECK-NEXT: xxspltiw v5, 983055269; CHECK-NEXT: vslh v2, v2, v5270; CHECK-NEXT: vsrah v2, v2, v5271; CHECK-NEXT: xxeval v2, v2, v3, v4, 231272; CHECK-NEXT: blr273entry:274 %or = or <8 x i16> %B, %C275 %and = and <8 x i16> %B, %C276 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation277 %res = select <8 x i1> %A, <8 x i16> %or, <8 x i16> %nand278 ret <8 x i16> %res279}280 281; Function to test ternary(A, eqv(B, C), nand(B, C)) for <4 x i32>282define <4 x i32> @ternary_A_eqv_BC_nand_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {283; CHECK-LABEL: ternary_A_eqv_BC_nand_BC_4x32:284; CHECK: # %bb.0: # %entry285; CHECK-NEXT: xxleqv v5, v5, v5286; CHECK-NEXT: vslw v2, v2, v5287; CHECK-NEXT: vsraw v2, v2, v5288; CHECK-NEXT: xxeval v2, v2, v3, v4, 233289; CHECK-NEXT: blr290entry:291 %xor = xor <4 x i32> %B, %C292 %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation293 %and = and <4 x i32> %B, %C294 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation295 %res = select <4 x i1> %A, <4 x i32> %eqv, <4 x i32> %nand296 ret <4 x i32> %res297}298 299; Function to test ternary(A, eqv(B, C), nand(B, C)) for <2 x i64>300define <2 x i64> @ternary_A_eqv_BC_nand_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {301; CHECK-LABEL: ternary_A_eqv_BC_nand_BC_2x64:302; CHECK: # %bb.0: # %entry303; CHECK-NEXT: xxlxor v5, v5, v5304; CHECK-NEXT: xxsplti32dx v5, 1, 63305; CHECK-NEXT: vsld v2, v2, v5306; CHECK-NEXT: vsrad v2, v2, v5307; CHECK-NEXT: xxeval v2, v2, v3, v4, 233308; CHECK-NEXT: blr309entry:310 %xor = xor <2 x i64> %B, %C311 %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation312 %and = and <2 x i64> %B, %C313 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation314 %res = select <2 x i1> %A, <2 x i64> %eqv, <2 x i64> %nand315 ret <2 x i64> %res316}317 318; Function to test ternary(A, eqv(B, C), nand(B, C)) for <16 x i8>319define <16 x i8> @ternary_A_eqv_BC_nand_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {320; CHECK-LABEL: ternary_A_eqv_BC_nand_BC_16x8:321; CHECK: # %bb.0: # %entry322; CHECK-NEXT: xxspltib v5, 7323; CHECK-NEXT: vslb v2, v2, v5324; CHECK-NEXT: vsrab v2, v2, v5325; CHECK-NEXT: xxeval v2, v2, v3, v4, 233326; CHECK-NEXT: blr327entry:328 %xor = xor <16 x i8> %B, %C329 %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 operation330 %and = and <16 x i8> %B, %C331 %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 operation332 %res = select <16 x i1> %A, <16 x i8> %eqv, <16 x i8> %nand333 ret <16 x i8> %res334}335 336; Function to test ternary(A, eqv(B, C), nand(B, C)) for <8 x i16>337define <8 x i16> @ternary_A_eqv_BC_nand_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {338; CHECK-LABEL: ternary_A_eqv_BC_nand_BC_8x16:339; CHECK: # %bb.0: # %entry340; CHECK-NEXT: xxspltiw v5, 983055341; CHECK-NEXT: vslh v2, v2, v5342; CHECK-NEXT: vsrah v2, v2, v5343; CHECK-NEXT: xxeval v2, v2, v3, v4, 233344; CHECK-NEXT: blr345entry:346 %xor = xor <8 x i16> %B, %C347 %eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector eqv operation348 %and = and <8 x i16> %B, %C349 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation350 %res = select <8 x i1> %A, <8 x i16> %eqv, <8 x i16> %nand351 ret <8 x i16> %res352}353