brintos

brintos / llvm-project-archived public Read only

0
0
Text · 19.5 KiB · 3695874 Raw
491 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 selection 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), nor(B,C)) for <4 x i32>14define <4 x i32> @ternary_A_and_BC_nor_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {15; CHECK-LABEL: ternary_A_and_BC_nor_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, 12921; CHECK-NEXT:    blr22entry:23  %and = and <4 x i32> %B, %C24  %or = or <4 x i32> %B, %C25  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation26  %res = select <4 x i1> %A, <4 x i32> %and, <4 x i32> %nor27  ret <4 x i32> %res28}29 30; Function to test ternary(A, and(B, C), nor(B,C)) for <2 x i64>31define <2 x i64> @ternary_A_and_BC_nor_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {32; CHECK-LABEL: ternary_A_and_BC_nor_BC_2x64:33; CHECK:       # %bb.0: # %entry34; CHECK-NEXT:    xxlxor v5, v5, v535; CHECK-NEXT:    xxsplti32dx v5, 1, 6336; CHECK-NEXT:    vsld v2, v2, v537; CHECK-NEXT:    vsrad v2, v2, v538; CHECK-NEXT:    xxeval v2, v2, v3, v4, 12939; CHECK-NEXT:    blr40entry:41  %and = and <2 x i64> %B, %C42  %or = or <2 x i64> %B, %C43  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation44  %res = select <2 x i1> %A, <2 x i64> %and, <2 x i64> %nor45  ret <2 x i64> %res46}47 48; Function to test ternary(A, and(B, C), nor(B,C)) for <16 x i8>49define <16 x i8> @ternary_A_and_BC_nor_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {50; CHECK-LABEL: ternary_A_and_BC_nor_BC_16x8:51; CHECK:       # %bb.0: # %entry52; CHECK-NEXT:    xxspltib v5, 753; CHECK-NEXT:    vslb v2, v2, v554; CHECK-NEXT:    vsrab v2, v2, v555; CHECK-NEXT:    xxeval v2, v2, v3, v4, 12956; CHECK-NEXT:    blr57entry:58  %and = and <16 x i8> %B, %C59  %or = or <16 x i8> %B, %C60  %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 operation61  %res = select <16 x i1> %A, <16 x i8> %and, <16 x i8> %nor62  ret <16 x i8> %res63}64 65; Function to test ternary(A, and(B, C), nor(B,C)) for <8 x i16>66define <8 x i16> @ternary_A_and_BC_nor_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {67; CHECK-LABEL: ternary_A_and_BC_nor_BC_8x16:68; CHECK:       # %bb.0: # %entry69; CHECK-NEXT:    xxspltiw v5, 98305570; CHECK-NEXT:    vslh v2, v2, v571; CHECK-NEXT:    vsrah v2, v2, v572; CHECK-NEXT:    xxeval v2, v2, v3, v4, 12973; CHECK-NEXT:    blr74entry:75  %and = and <8 x i16> %B, %C76  %or = or <8 x i16> %B, %C77  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation78  %res = select <8 x i1> %A, <8 x i16> %and, <8 x i16> %nor79  ret <8 x i16> %res80}81 82; Function to test ternary(A, B, nor(B,C)) for <4 x i32>83define <4 x i32> @ternary_A_B_nor_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {84; CHECK-LABEL: ternary_A_B_nor_BC_4x32:85; CHECK:       # %bb.0: # %entry86; CHECK-NEXT:    xxleqv v5, v5, v587; CHECK-NEXT:    vslw v2, v2, v588; CHECK-NEXT:    vsraw v2, v2, v589; CHECK-NEXT:    xxeval v2, v2, v3, v4, 13190; CHECK-NEXT:    blr91entry:92  %or = or <4 x i32> %B, %C93  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation94  %res = select <4 x i1> %A, <4 x i32> %B, <4 x i32> %nor95  ret <4 x i32> %res96}97 98; Function to test ternary(A, B, nor(B,C)) for <2 x i64>99define <2 x i64> @ternary_A_B_nor_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {100; CHECK-LABEL: ternary_A_B_nor_BC_2x64:101; CHECK:       # %bb.0: # %entry102; CHECK-NEXT:    xxlxor v5, v5, v5103; CHECK-NEXT:    xxsplti32dx v5, 1, 63104; CHECK-NEXT:    vsld v2, v2, v5105; CHECK-NEXT:    vsrad v2, v2, v5106; CHECK-NEXT:    xxeval v2, v2, v3, v4, 131107; CHECK-NEXT:    blr108entry:109  %or = or <2 x i64> %B, %C110  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation111  %res = select <2 x i1> %A, <2 x i64> %B, <2 x i64> %nor112  ret <2 x i64> %res113}114 115; Function to test ternary(A, B, nor(B,C)) for <16 x i8>116define <16 x i8> @ternary_A_B_nor_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {117; CHECK-LABEL: ternary_A_B_nor_BC_16x8:118; CHECK:       # %bb.0: # %entry119; CHECK-NEXT:    xxspltib v5, 7120; CHECK-NEXT:    vslb v2, v2, v5121; CHECK-NEXT:    vsrab v2, v2, v5122; CHECK-NEXT:    xxeval v2, v2, v3, v4, 131123; CHECK-NEXT:    blr124entry:125  %or = or <16 x i8> %B, %C126  %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 operation127  %res = select <16 x i1> %A, <16 x i8> %B, <16 x i8> %nor128  ret <16 x i8> %res129}130 131; Function to test ternary(A, B, nor(B,C)) for <8 x i16>132define <8 x i16> @ternary_A_B_nor_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {133; CHECK-LABEL: ternary_A_B_nor_BC_8x16:134; CHECK:       # %bb.0: # %entry135; CHECK-NEXT:    xxspltiw v5, 983055136; CHECK-NEXT:    vslh v2, v2, v5137; CHECK-NEXT:    vsrah v2, v2, v5138; CHECK-NEXT:    xxeval v2, v2, v3, v4, 131139; CHECK-NEXT:    blr140entry:141  %or = or <8 x i16> %B, %C142  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation143  %res = select <8 x i1> %A, <8 x i16> %B, <8 x i16> %nor144  ret <8 x i16> %res145}146 147; Function to test ternary(A, C, nor(B,C)) for <4 x i32>148define <4 x i32> @ternary_A_C_nor_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {149; CHECK-LABEL: ternary_A_C_nor_BC_4x32:150; CHECK:       # %bb.0: # %entry151; CHECK-NEXT:    xxleqv v5, v5, v5152; CHECK-NEXT:    vslw v2, v2, v5153; CHECK-NEXT:    vsraw v2, v2, v5154; CHECK-NEXT:    xxeval v2, v2, v3, v4, 133155; CHECK-NEXT:    blr156entry:157  %or = or <4 x i32> %B, %C158  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation159  %res = select <4 x i1> %A, <4 x i32> %C, <4 x i32> %nor160  ret <4 x i32> %res161}162 163; Function to test ternary(A, C, nor(B,C)) for <2 x i64>164define <2 x i64> @ternary_A_C_nor_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {165; CHECK-LABEL: ternary_A_C_nor_BC_2x64:166; CHECK:       # %bb.0: # %entry167; CHECK-NEXT:    xxlxor v5, v5, v5168; CHECK-NEXT:    xxsplti32dx v5, 1, 63169; CHECK-NEXT:    vsld v2, v2, v5170; CHECK-NEXT:    vsrad v2, v2, v5171; CHECK-NEXT:    xxeval v2, v2, v3, v4, 133172; CHECK-NEXT:    blr173entry:174  %or = or <2 x i64> %B, %C175  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation176  %res = select <2 x i1> %A, <2 x i64> %C, <2 x i64> %nor177  ret <2 x i64> %res178}179 180; Function to test ternary(A, C, nor(B,C)) for <16 x i8>181define <16 x i8> @ternary_A_C_nor_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {182; CHECK-LABEL: ternary_A_C_nor_BC_16x8:183; CHECK:       # %bb.0: # %entry184; CHECK-NEXT:    xxspltib v5, 7185; CHECK-NEXT:    vslb v2, v2, v5186; CHECK-NEXT:    vsrab v2, v2, v5187; CHECK-NEXT:    xxeval v2, v2, v3, v4, 133188; CHECK-NEXT:    blr189entry:190  %or = or <16 x i8> %B, %C191  %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 operation192  %res = select <16 x i1> %A, <16 x i8> %C, <16 x i8> %nor193  ret <16 x i8> %res194}195 196; Function to test ternary(A, C, nor(B,C)) for <8 x i16>197define <8 x i16> @ternary_A_C_nor_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {198; CHECK-LABEL: ternary_A_C_nor_BC_8x16:199; CHECK:       # %bb.0: # %entry200; CHECK-NEXT:    xxspltiw v5, 983055201; CHECK-NEXT:    vslh v2, v2, v5202; CHECK-NEXT:    vsrah v2, v2, v5203; CHECK-NEXT:    xxeval v2, v2, v3, v4, 133204; CHECK-NEXT:    blr205entry:206  %or = or <8 x i16> %B, %C207  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation208  %res = select <8 x i1> %A, <8 x i16> %C, <8 x i16> %nor209  ret <8 x i16> %res210}211 212; Function to test ternary(A, xor(B,C), nor(B,C)) for <4 x i32>213define <4 x i32> @ternary_A_xor_BC_nor_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {214; CHECK-LABEL: ternary_A_xor_BC_nor_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, 134220; CHECK-NEXT:    blr221entry:222  %xor = xor <4 x i32> %B, %C223  %or = or <4 x i32> %B, %C224  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation225  %res = select <4 x i1> %A, <4 x i32> %xor, <4 x i32> %nor226  ret <4 x i32> %res227}228 229; Function to test ternary(A, xor(B,C), nor(B,C)) for <2 x i64>230define <2 x i64> @ternary_A_xor_BC_nor_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {231; CHECK-LABEL: ternary_A_xor_BC_nor_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, 134238; CHECK-NEXT:    blr239entry:240  %xor = xor <2 x i64> %B, %C241  %or = or <2 x i64> %B, %C242  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation243  %res = select <2 x i1> %A, <2 x i64> %xor, <2 x i64> %nor244  ret <2 x i64> %res245}246 247; Function to test ternary(A, xor(B,C), nor(B,C)) for <16 x i8>248define <16 x i8> @ternary_A_xor_BC_nor_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {249; CHECK-LABEL: ternary_A_xor_BC_nor_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, 134255; CHECK-NEXT:    blr256entry:257  %xor = xor <16 x i8> %B, %C258  %or = or <16 x i8> %B, %C259  %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 operation260  %res = select <16 x i1> %A, <16 x i8> %xor, <16 x i8> %nor261  ret <16 x i8> %res262}263 264; Function to test ternary(A, xor(B,C), nor(B,C)) for <8 x i16>265define <8 x i16> @ternary_A_xor_BC_nor_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {266; CHECK-LABEL: ternary_A_xor_BC_nor_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, 134272; CHECK-NEXT:    blr273entry:274  %xor = xor <8 x i16> %B, %C275  %or = or <8 x i16> %B, %C276  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation277  %res = select <8 x i1> %A, <8 x i16> %xor, <8 x i16> %nor278  ret <8 x i16> %res279}280 281; Function to test ternary(A, not(C), nor(B,C)) for <4 x i32>282define <4 x i32> @ternary_A_not_C_nor_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {283; CHECK-LABEL: ternary_A_not_C_nor_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, 138289; CHECK-NEXT:    blr290entry:291  %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector not operation292  %or = or <4 x i32> %B, %C293  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation294  %res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %nor295  ret <4 x i32> %res296}297 298; Function to test ternary(A, not(C), nor(B,C)) for <2 x i64>299define <2 x i64> @ternary_A_not_C_nor_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {300; CHECK-LABEL: ternary_A_not_C_nor_BC_2x64:301; CHECK:       # %bb.0: # %entry302; CHECK-NEXT:    xxlxor v5, v5, v5303; CHECK-NEXT:    xxsplti32dx v5, 1, 63304; CHECK-NEXT:    vsld v2, v2, v5305; CHECK-NEXT:    vsrad v2, v2, v5306; CHECK-NEXT:    xxeval v2, v2, v3, v4, 138307; CHECK-NEXT:    blr308entry:309  %not = xor <2 x i64> %C, <i64 -1, i64 -1>  ; Vector not operation310  %or = or <2 x i64> %B, %C311  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation312  %res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %nor313  ret <2 x i64> %res314}315 316; Function to test ternary(A, not(C), nor(B,C)) for <16 x i8>317define <16 x i8> @ternary_A_not_C_nor_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {318; CHECK-LABEL: ternary_A_not_C_nor_BC_16x8:319; CHECK:       # %bb.0: # %entry320; CHECK-NEXT:    xxspltib v5, 7321; CHECK-NEXT:    vslb v2, v2, v5322; CHECK-NEXT:    vsrab v2, v2, v5323; CHECK-NEXT:    xxeval v2, v2, v3, v4, 138324; CHECK-NEXT:    blr325entry:326  %not = xor <16 x i8> %C, <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 operation327  %or = or <16 x i8> %B, %C328  %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 operation329  %res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %nor330  ret <16 x i8> %res331}332 333; Function to test ternary(A, not(C), nor(B,C)) for <8 x i16>334define <8 x i16> @ternary_A_not_C_nor_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {335; CHECK-LABEL: ternary_A_not_C_nor_BC_8x16:336; CHECK:       # %bb.0: # %entry337; CHECK-NEXT:    xxspltiw v5, 983055338; CHECK-NEXT:    vslh v2, v2, v5339; CHECK-NEXT:    vsrah v2, v2, v5340; CHECK-NEXT:    xxeval v2, v2, v3, v4, 138341; CHECK-NEXT:    blr342entry:343  %not = xor <8 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector not operation344  %or = or <8 x i16> %B, %C345  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation346  %res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %nor347  ret <8 x i16> %res348}349 350; Function to test ternary(A, not(B), nor(B,C)) for <4 x i32>351define <4 x i32> @ternary_A_not_B_nor_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {352; CHECK-LABEL: ternary_A_not_B_nor_BC_4x32:353; CHECK:       # %bb.0: # %entry354; CHECK-NEXT:    xxleqv v5, v5, v5355; CHECK-NEXT:    vslw v2, v2, v5356; CHECK-NEXT:    vsraw v2, v2, v5357; CHECK-NEXT:    xxeval v2, v2, v3, v4, 140358; CHECK-NEXT:    blr359entry:360  %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector not operation361  %or = or <4 x i32> %B, %C362  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation363  %res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %nor364  ret <4 x i32> %res365}366 367; Function to test ternary(A, not(B), nor(B,C)) for <2 x i64>368define <2 x i64> @ternary_A_not_B_nor_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {369; CHECK-LABEL: ternary_A_not_B_nor_BC_2x64:370; CHECK:       # %bb.0: # %entry371; CHECK-NEXT:    xxlxor v5, v5, v5372; CHECK-NEXT:    xxsplti32dx v5, 1, 63373; CHECK-NEXT:    vsld v2, v2, v5374; CHECK-NEXT:    vsrad v2, v2, v5375; CHECK-NEXT:    xxeval v2, v2, v3, v4, 140376; CHECK-NEXT:    blr377entry:378  %not = xor <2 x i64> %B, <i64 -1, i64 -1>  ; Vector not operation379  %or = or <2 x i64> %B, %C380  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation381  %res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %nor382  ret <2 x i64> %res383}384 385; Function to test ternary(A, not(B), nor(B,C)) for <16 x i8>386define <16 x i8> @ternary_A_not_B_nor_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {387; CHECK-LABEL: ternary_A_not_B_nor_BC_16x8:388; CHECK:       # %bb.0: # %entry389; CHECK-NEXT:    xxspltib v5, 7390; CHECK-NEXT:    vslb v2, v2, v5391; CHECK-NEXT:    vsrab v2, v2, v5392; CHECK-NEXT:    xxeval v2, v2, v3, v4, 140393; CHECK-NEXT:    blr394entry:395  %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 operation396  %or = or <16 x i8> %B, %C397  %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 operation398  %res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %nor399  ret <16 x i8> %res400}401 402; Function to test ternary(A, not(B), nor(B,C)) for <8 x i16>403define <8 x i16> @ternary_A_not_B_nor_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {404; CHECK-LABEL: ternary_A_not_B_nor_BC_8x16:405; CHECK:       # %bb.0: # %entry406; CHECK-NEXT:    xxspltiw v5, 983055407; CHECK-NEXT:    vslh v2, v2, v5408; CHECK-NEXT:    vsrah v2, v2, v5409; CHECK-NEXT:    xxeval v2, v2, v3, v4, 140410; CHECK-NEXT:    blr411entry:412  %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector not operation413  %or = or <8 x i16> %B, %C414  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation415  %res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %nor416  ret <8 x i16> %res417}418 419; Function to test ternary(A, nand(B,C), nor(B,C)) for <4 x i32>420define <4 x i32> @ternary_A_nand_BC_nor_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {421; CHECK-LABEL: ternary_A_nand_BC_nor_BC_4x32:422; CHECK:       # %bb.0: # %entry423; CHECK-NEXT:    xxleqv v5, v5, v5424; CHECK-NEXT:    vslw v2, v2, v5425; CHECK-NEXT:    vsraw v2, v2, v5426; CHECK-NEXT:    xxeval v2, v2, v3, v4, 142427; CHECK-NEXT:    blr428entry:429  %and = and <4 x i32> %B, %C430  %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector nand operation431  %or = or <4 x i32> %B, %C432  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation433  %res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %nor434  ret <4 x i32> %res435}436 437; Function to test ternary(A, nand(B,C), nor(B,C)) for <2 x i64>438define <2 x i64> @ternary_A_nand_BC_nor_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {439; CHECK-LABEL: ternary_A_nand_BC_nor_BC_2x64:440; CHECK:       # %bb.0: # %entry441; CHECK-NEXT:    xxlxor v5, v5, v5442; CHECK-NEXT:    xxsplti32dx v5, 1, 63443; CHECK-NEXT:    vsld v2, v2, v5444; CHECK-NEXT:    vsrad v2, v2, v5445; CHECK-NEXT:    xxeval v2, v2, v3, v4, 142446; CHECK-NEXT:    blr447entry:448  %and = and <2 x i64> %B, %C449  %nand = xor <2 x i64> %and, <i64 -1, i64 -1>  ; Vector nand operation450  %or = or <2 x i64> %B, %C451  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation452  %res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %nor453  ret <2 x i64> %res454}455 456; Function to test ternary(A, nand(B,C), nor(B,C)) for <16 x i8>457define <16 x i8> @ternary_A_nand_BC_nor_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {458; CHECK-LABEL: ternary_A_nand_BC_nor_BC_16x8:459; CHECK:       # %bb.0: # %entry460; CHECK-NEXT:    xxspltib v5, 7461; CHECK-NEXT:    vslb v2, v2, v5462; CHECK-NEXT:    vsrab v2, v2, v5463; CHECK-NEXT:    xxeval v2, v2, v3, v4, 142464; CHECK-NEXT:    blr465entry:466  %and = and <16 x i8> %B, %C467  %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 operation468  %or = or <16 x i8> %B, %C469  %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 operation470  %res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %nor471  ret <16 x i8> %res472}473 474; Function to test ternary(A, nand(B,C), nor(B,C)) for <8 x i16>475define <8 x i16> @ternary_A_nand_BC_nor_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {476; CHECK-LABEL: ternary_A_nand_BC_nor_BC_8x16:477; CHECK:       # %bb.0: # %entry478; CHECK-NEXT:    xxspltiw v5, 983055479; CHECK-NEXT:    vslh v2, v2, v5480; CHECK-NEXT:    vsrah v2, v2, v5481; CHECK-NEXT:    xxeval v2, v2, v3, v4, 142482; CHECK-NEXT:    blr483entry:484  %and = and <8 x i16> %B, %C485  %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector nand operation486  %or = or <8 x i16> %B, %C487  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation488  %res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %nor489  ret <8 x i16> %res490}491