276 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, and(B, C), not(B)) for <4 x i32>14define <4 x i32> @ternary_A_and_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {15; CHECK-LABEL: ternary_A_and_BC_not_B_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, 19321; CHECK-NEXT: blr22entry:23 %and = and <4 x i32> %B, %C24 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation25 %res = select <4 x i1> %A, <4 x i32> %and, <4 x i32> %not26 ret <4 x i32> %res27}28 29; Function to test ternary(A, and(B, C), not(B)) for <2 x i64>30define <2 x i64> @ternary_A_and_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {31; CHECK-LABEL: ternary_A_and_BC_not_B_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, 19338; CHECK-NEXT: blr39entry:40 %and = and <2 x i64> %B, %C41 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation42 %res = select <2 x i1> %A, <2 x i64> %and, <2 x i64> %not43 ret <2 x i64> %res44}45 46; Function to test ternary(A, and(B, C), not(B)) for <16 x i8>47define <16 x i8> @ternary_A_and_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {48; CHECK-LABEL: ternary_A_and_BC_not_B_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, 19354; CHECK-NEXT: blr55entry:56 %and = and <16 x i8> %B, %C57 %not = xor <16 x i8> %B, <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 not operation58 %res = select <16 x i1> %A, <16 x i8> %and, <16 x i8> %not59 ret <16 x i8> %res60}61 62; Function to test ternary(A, and(B, C), not(B)) for <8 x i16>63define <8 x i16> @ternary_A_and_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {64; CHECK-LABEL: ternary_A_and_BC_not_B_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, 19370; CHECK-NEXT: blr71entry:72 %and = and <8 x i16> %B, %C73 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation74 %res = select <8 x i1> %A, <8 x i16> %and, <8 x i16> %not75 ret <8 x i16> %res76}77 78; Function to test ternary(A, xor(B, C), not(B)) for <4 x i32>79define <4 x i32> @ternary_A_xor_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {80; CHECK-LABEL: ternary_A_xor_BC_not_B_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, 19886; CHECK-NEXT: blr87entry:88 %xor = xor <4 x i32> %B, %C89 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation90 %res = select <4 x i1> %A, <4 x i32> %xor, <4 x i32> %not91 ret <4 x i32> %res92}93 94; Function to test ternary(A, xor(B, C), not(B)) for <2 x i64>95define <2 x i64> @ternary_A_xor_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {96; CHECK-LABEL: ternary_A_xor_BC_not_B_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, 198103; CHECK-NEXT: blr104entry:105 %xor = xor <2 x i64> %B, %C106 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation107 %res = select <2 x i1> %A, <2 x i64> %xor, <2 x i64> %not108 ret <2 x i64> %res109}110 111; Function to test ternary(A, xor(B, C), not(B)) for <16 x i8>112define <16 x i8> @ternary_A_xor_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {113; CHECK-LABEL: ternary_A_xor_BC_not_B_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, 198119; CHECK-NEXT: blr120entry:121 %xor = xor <16 x i8> %B, %C122 %not = xor <16 x i8> %B, <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 not operation123 %res = select <16 x i1> %A, <16 x i8> %xor, <16 x i8> %not124 ret <16 x i8> %res125}126 127; Function to test ternary(A, xor(B, C), not(B)) for <8 x i16>128define <8 x i16> @ternary_A_xor_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {129; CHECK-LABEL: ternary_A_xor_BC_not_B_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, 198135; CHECK-NEXT: blr136entry:137 %xor = xor <8 x i16> %B, %C138 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation139 %res = select <8 x i1> %A, <8 x i16> %xor, <8 x i16> %not140 ret <8 x i16> %res141}142 143; Function to test ternary(A, or(B, C), not(B)) for <4 x i32>144define <4 x i32> @ternary_A_or_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {145; CHECK-LABEL: ternary_A_or_BC_not_B_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, 199151; CHECK-NEXT: blr152entry:153 %or = or <4 x i32> %B, %C154 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation155 %res = select <4 x i1> %A, <4 x i32> %or, <4 x i32> %not156 ret <4 x i32> %res157}158 159; Function to test ternary(A, or(B, C), not(B)) for <2 x i64>160define <2 x i64> @ternary_A_or_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {161; CHECK-LABEL: ternary_A_or_BC_not_B_2x64:162; CHECK: # %bb.0: # %entry163; CHECK-NEXT: xxlxor v5, v5, v5164; CHECK-NEXT: xxsplti32dx v5, 1, 63165; CHECK-NEXT: vsld v2, v2, v5166; CHECK-NEXT: vsrad v2, v2, v5167; CHECK-NEXT: xxeval v2, v2, v3, v4, 199168; CHECK-NEXT: blr169entry:170 %or = or <2 x i64> %B, %C171 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation172 %res = select <2 x i1> %A, <2 x i64> %or, <2 x i64> %not173 ret <2 x i64> %res174}175 176; Function to test ternary(A, or(B, C), not(B)) for <16 x i8>177define <16 x i8> @ternary_A_or_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {178; CHECK-LABEL: ternary_A_or_BC_not_B_16x8:179; CHECK: # %bb.0: # %entry180; CHECK-NEXT: xxspltib v5, 7181; CHECK-NEXT: vslb v2, v2, v5182; CHECK-NEXT: vsrab v2, v2, v5183; CHECK-NEXT: xxeval v2, v2, v3, v4, 199184; CHECK-NEXT: blr185entry:186 %or = or <16 x i8> %B, %C187 %not = xor <16 x i8> %B, <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 not operation188 %res = select <16 x i1> %A, <16 x i8> %or, <16 x i8> %not189 ret <16 x i8> %res190}191 192; Function to test ternary(A, or(B, C), not(B)) for <8 x i16>193define <8 x i16> @ternary_A_or_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {194; CHECK-LABEL: ternary_A_or_BC_not_B_8x16:195; CHECK: # %bb.0: # %entry196; CHECK-NEXT: xxspltiw v5, 983055197; CHECK-NEXT: vslh v2, v2, v5198; CHECK-NEXT: vsrah v2, v2, v5199; CHECK-NEXT: xxeval v2, v2, v3, v4, 199200; CHECK-NEXT: blr201entry:202 %or = or <8 x i16> %B, %C203 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation204 %res = select <8 x i1> %A, <8 x i16> %or, <8 x i16> %not205 ret <8 x i16> %res206}207 208; Function to test ternary(A, nand(B, C), not(B)) for <4 x i32>209define <4 x i32> @ternary_A_nand_BC_not_B_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {210; CHECK-LABEL: ternary_A_nand_BC_not_B_4x32:211; CHECK: # %bb.0: # %entry212; CHECK-NEXT: xxleqv v5, v5, v5213; CHECK-NEXT: vslw v2, v2, v5214; CHECK-NEXT: vsraw v2, v2, v5215; CHECK-NEXT: xxeval v2, v2, v3, v4, 206216; CHECK-NEXT: blr217entry:218 %and = and <4 x i32> %B, %C219 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation220 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation221 %res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %not222 ret <4 x i32> %res223}224 225; Function to test ternary(A, nand(B, C), not(B)) for <2 x i64>226define <2 x i64> @ternary_A_nand_BC_not_B_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {227; CHECK-LABEL: ternary_A_nand_BC_not_B_2x64:228; CHECK: # %bb.0: # %entry229; CHECK-NEXT: xxlxor v5, v5, v5230; CHECK-NEXT: xxsplti32dx v5, 1, 63231; CHECK-NEXT: vsld v2, v2, v5232; CHECK-NEXT: vsrad v2, v2, v5233; CHECK-NEXT: xxeval v2, v2, v3, v4, 206234; CHECK-NEXT: blr235entry:236 %and = and <2 x i64> %B, %C237 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation238 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation239 %res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %not240 ret <2 x i64> %res241}242 243; Function to test ternary(A, nand(B, C), not(B)) for <16 x i8>244define <16 x i8> @ternary_A_nand_BC_not_B_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {245; CHECK-LABEL: ternary_A_nand_BC_not_B_16x8:246; CHECK: # %bb.0: # %entry247; CHECK-NEXT: xxspltib v5, 7248; CHECK-NEXT: vslb v2, v2, v5249; CHECK-NEXT: vsrab v2, v2, v5250; CHECK-NEXT: xxeval v2, v2, v3, v4, 206251; CHECK-NEXT: blr252entry:253 %and = and <16 x i8> %B, %C254 %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 operation255 %not = xor <16 x i8> %B, <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 not operation256 %res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %not257 ret <16 x i8> %res258}259 260; Function to test ternary(A, nand(B, C), not(B)) for <8 x i16>261define <8 x i16> @ternary_A_nand_BC_not_B_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {262; CHECK-LABEL: ternary_A_nand_BC_not_B_8x16:263; CHECK: # %bb.0: # %entry264; CHECK-NEXT: xxspltiw v5, 983055265; CHECK-NEXT: vslh v2, v2, v5266; CHECK-NEXT: vsrah v2, v2, v5267; CHECK-NEXT: xxeval v2, v2, v3, v4, 206268; CHECK-NEXT: blr269entry:270 %and = and <8 x i16> %B, %C271 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation272 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation273 %res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %not274 ret <8 x i16> %res275}276