467 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), or(B, C)) for <4 x i32>14define <4 x i32> @ternary_A_and_BC_or_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {15; CHECK-LABEL: ternary_A_and_BC_or_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, 11321; CHECK-NEXT: blr22entry:23 %and = and <4 x i32> %B, %C24 %or = or <4 x i32> %B, %C25 %res = select <4 x i1> %A, <4 x i32> %and, <4 x i32> %or26 ret <4 x i32> %res27}28 29; Function to test ternary(A, and(B, C), or(B, C)) for <2 x i64>30define <2 x i64> @ternary_A_and_BC_or_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {31; CHECK-LABEL: ternary_A_and_BC_or_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, 11338; CHECK-NEXT: blr39entry:40 %and = and <2 x i64> %B, %C41 %or = or <2 x i64> %B, %C42 %res = select <2 x i1> %A, <2 x i64> %and, <2 x i64> %or43 ret <2 x i64> %res44}45 46; Function to test ternary(A, and(B, C), or(B, C)) for <16 x i8>47define <16 x i8> @ternary_A_and_BC_or_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {48; CHECK-LABEL: ternary_A_and_BC_or_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, 11354; CHECK-NEXT: blr55entry:56 %and = and <16 x i8> %B, %C57 %or = or <16 x i8> %B, %C58 %res = select <16 x i1> %A, <16 x i8> %and, <16 x i8> %or59 ret <16 x i8> %res60}61 62; Function to test ternary(A, and(B, C), or(B, C)) for <8 x i16>63define <8 x i16> @ternary_A_and_BC_or_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {64; CHECK-LABEL: ternary_A_and_BC_or_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, 11370; CHECK-NEXT: blr71entry:72 %and = and <8 x i16> %B, %C73 %or = or <8 x i16> %B, %C74 %res = select <8 x i1> %A, <8 x i16> %and, <8 x i16> %or75 ret <8 x i16> %res76}77 78; Function to test ternary(A, B, or(B, C)) for <4 x i32>79define <4 x i32> @ternary_A_B_or_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {80; CHECK-LABEL: ternary_A_B_or_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, 11586; CHECK-NEXT: blr87entry:88 %or = or <4 x i32> %B, %C89 %res = select <4 x i1> %A, <4 x i32> %B, <4 x i32> %or90 ret <4 x i32> %res91}92 93; Function to test ternary(A, B, or(B, C)) for <2 x i64>94define <2 x i64> @ternary_A_B_or_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {95; CHECK-LABEL: ternary_A_B_or_BC_2x64:96; CHECK: # %bb.0: # %entry97; CHECK-NEXT: xxlxor v5, v5, v598; CHECK-NEXT: xxsplti32dx v5, 1, 6399; CHECK-NEXT: vsld v2, v2, v5100; CHECK-NEXT: vsrad v2, v2, v5101; CHECK-NEXT: xxeval v2, v2, v3, v4, 115102; CHECK-NEXT: blr103entry:104 %or = or <2 x i64> %B, %C105 %res = select <2 x i1> %A, <2 x i64> %B, <2 x i64> %or106 ret <2 x i64> %res107}108 109; Function to test ternary(A, B, or(B, C)) for <16 x i8>110define <16 x i8> @ternary_A_B_or_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {111; CHECK-LABEL: ternary_A_B_or_BC_16x8:112; CHECK: # %bb.0: # %entry113; CHECK-NEXT: xxspltib v5, 7114; CHECK-NEXT: vslb v2, v2, v5115; CHECK-NEXT: vsrab v2, v2, v5116; CHECK-NEXT: xxeval v2, v2, v3, v4, 115117; CHECK-NEXT: blr118entry:119 %or = or <16 x i8> %B, %C120 %res = select <16 x i1> %A, <16 x i8> %B, <16 x i8> %or121 ret <16 x i8> %res122}123 124; Function to test ternary(A, B, or(B, C)) for <8 x i16>125define <8 x i16> @ternary_A_B_or_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {126; CHECK-LABEL: ternary_A_B_or_BC_8x16:127; CHECK: # %bb.0: # %entry128; CHECK-NEXT: xxspltiw v5, 983055129; CHECK-NEXT: vslh v2, v2, v5130; CHECK-NEXT: vsrah v2, v2, v5131; CHECK-NEXT: xxeval v2, v2, v3, v4, 115132; CHECK-NEXT: blr133entry:134 %or = or <8 x i16> %B, %C135 %res = select <8 x i1> %A, <8 x i16> %B, <8 x i16> %or136 ret <8 x i16> %res137}138 139; Function to test ternary(A, C, or(B, C)) for <4 x i32>140define <4 x i32> @ternary_A_C_or_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {141; CHECK-LABEL: ternary_A_C_or_BC_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, 117147; CHECK-NEXT: blr148entry:149 %or = or <4 x i32> %B, %C150 %res = select <4 x i1> %A, <4 x i32> %C, <4 x i32> %or151 ret <4 x i32> %res152}153 154; Function to test ternary(A, C, or(B, C)) for <2 x i64>155define <2 x i64> @ternary_A_C_or_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {156; CHECK-LABEL: ternary_A_C_or_BC_2x64:157; CHECK: # %bb.0: # %entry158; CHECK-NEXT: xxlxor v5, v5, v5159; CHECK-NEXT: xxsplti32dx v5, 1, 63160; CHECK-NEXT: vsld v2, v2, v5161; CHECK-NEXT: vsrad v2, v2, v5162; CHECK-NEXT: xxeval v2, v2, v3, v4, 117163; CHECK-NEXT: blr164entry:165 %or = or <2 x i64> %B, %C166 %res = select <2 x i1> %A, <2 x i64> %C, <2 x i64> %or167 ret <2 x i64> %res168}169 170; Function to test ternary(A, C, or(B, C)) for <16 x i8>171define <16 x i8> @ternary_A_C_or_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {172; CHECK-LABEL: ternary_A_C_or_BC_16x8:173; CHECK: # %bb.0: # %entry174; CHECK-NEXT: xxspltib v5, 7175; CHECK-NEXT: vslb v2, v2, v5176; CHECK-NEXT: vsrab v2, v2, v5177; CHECK-NEXT: xxeval v2, v2, v3, v4, 117178; CHECK-NEXT: blr179entry:180 %or = or <16 x i8> %B, %C181 %res = select <16 x i1> %A, <16 x i8> %C, <16 x i8> %or182 ret <16 x i8> %res183}184 185; Function to test ternary(A, C, or(B, C)) for <8 x i16>186define <8 x i16> @ternary_A_C_or_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {187; CHECK-LABEL: ternary_A_C_or_BC_8x16:188; CHECK: # %bb.0: # %entry189; CHECK-NEXT: xxspltiw v5, 983055190; CHECK-NEXT: vslh v2, v2, v5191; CHECK-NEXT: vsrah v2, v2, v5192; CHECK-NEXT: xxeval v2, v2, v3, v4, 117193; CHECK-NEXT: blr194entry:195 %or = or <8 x i16> %B, %C196 %res = select <8 x i1> %A, <8 x i16> %C, <8 x i16> %or197 ret <8 x i16> %res198}199 200; Function to test ternary(A, eqv(B,C), or(B, C)) for <4 x i32>201define <4 x i32> @ternary_A_eqv_BC_or_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {202; CHECK-LABEL: ternary_A_eqv_BC_or_BC_4x32:203; CHECK: # %bb.0: # %entry204; CHECK-NEXT: xxleqv v5, v5, v5205; CHECK-NEXT: vslw v2, v2, v5206; CHECK-NEXT: vsraw v2, v2, v5207; CHECK-NEXT: xxeval v2, v2, v3, v4, 121208; CHECK-NEXT: blr209entry:210 %xor = xor <4 x i32> %B, %C211 %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector eqv operation212 %or = or <4 x i32> %B, %C213 %res = select <4 x i1> %A, <4 x i32> %eqv, <4 x i32> %or214 ret <4 x i32> %res215}216 217; Function to test ternary(A, eqv(B,C), or(B, C)) for <2 x i64>218define <2 x i64> @ternary_A_eqv_BC_or_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {219; CHECK-LABEL: ternary_A_eqv_BC_or_BC_2x64:220; CHECK: # %bb.0: # %entry221; CHECK-NEXT: xxlxor v5, v5, v5222; CHECK-NEXT: xxsplti32dx v5, 1, 63223; CHECK-NEXT: vsld v2, v2, v5224; CHECK-NEXT: vsrad v2, v2, v5225; CHECK-NEXT: xxeval v2, v2, v3, v4, 121226; CHECK-NEXT: blr227entry:228 %xor = xor <2 x i64> %B, %C229 %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1> ; Vector eqv operation230 %or = or <2 x i64> %B, %C231 %res = select <2 x i1> %A, <2 x i64> %eqv, <2 x i64> %or232 ret <2 x i64> %res233}234 235; Function to test ternary(A, eqv(B,C), or(B, C)) for <16 x i8>236define <16 x i8> @ternary_A_eqv_BC_or_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {237; CHECK-LABEL: ternary_A_eqv_BC_or_BC_16x8:238; CHECK: # %bb.0: # %entry239; CHECK-NEXT: xxspltib v5, 7240; CHECK-NEXT: vslb v2, v2, v5241; CHECK-NEXT: vsrab v2, v2, v5242; CHECK-NEXT: xxeval v2, v2, v3, v4, 121243; CHECK-NEXT: blr244entry:245 %xor = xor <16 x i8> %B, %C246 %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 operation247 %or = or <16 x i8> %B, %C248 %res = select <16 x i1> %A, <16 x i8> %eqv, <16 x i8> %or249 ret <16 x i8> %res250}251 252; Function to test ternary(A, eqv(B,C), or(B, C)) for <8 x i16>253define <8 x i16> @ternary_A_eqv_BC_or_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {254; CHECK-LABEL: ternary_A_eqv_BC_or_BC_8x16:255; CHECK: # %bb.0: # %entry256; CHECK-NEXT: xxspltiw v5, 983055257; CHECK-NEXT: vslh v2, v2, v5258; CHECK-NEXT: vsrah v2, v2, v5259; CHECK-NEXT: xxeval v2, v2, v3, v4, 121260; CHECK-NEXT: blr261entry:262 %xor = xor <8 x i16> %B, %C263 %eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector eqv operation264 %or = or <8 x i16> %B, %C265 %res = select <8 x i1> %A, <8 x i16> %eqv, <8 x i16> %or266 ret <8 x i16> %res267}268 269; Function to test ternary(A, not(C), or(B, C)) for <4 x i32>270define <4 x i32> @ternary_A_not_C_or_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {271; CHECK-LABEL: ternary_A_not_C_or_BC_4x32:272; CHECK: # %bb.0: # %entry273; CHECK-NEXT: xxleqv v5, v5, v5274; CHECK-NEXT: vslw v2, v2, v5275; CHECK-NEXT: vsraw v2, v2, v5276; CHECK-NEXT: xxeval v2, v2, v3, v4, 122277; CHECK-NEXT: blr278entry:279 %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation280 %or = or <4 x i32> %B, %C281 %res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %or282 ret <4 x i32> %res283}284 285; Function to test ternary(A, not(C), or(B, C)) for <2 x i64>286define <2 x i64> @ternary_A_not_C_or_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {287; CHECK-LABEL: ternary_A_not_C_or_BC_2x64:288; CHECK: # %bb.0: # %entry289; CHECK-NEXT: xxlxor v5, v5, v5290; CHECK-NEXT: xxsplti32dx v5, 1, 63291; CHECK-NEXT: vsld v2, v2, v5292; CHECK-NEXT: vsrad v2, v2, v5293; CHECK-NEXT: xxeval v2, v2, v3, v4, 122294; CHECK-NEXT: blr295entry:296 %not = xor <2 x i64> %C, <i64 -1, i64 -1> ; Vector not operation297 %or = or <2 x i64> %B, %C298 %res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %or299 ret <2 x i64> %res300}301 302; Function to test ternary(A, not(C), or(B, C)) for <16 x i8>303define <16 x i8> @ternary_A_not_C_or_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {304; CHECK-LABEL: ternary_A_not_C_or_BC_16x8:305; CHECK: # %bb.0: # %entry306; CHECK-NEXT: xxspltib v5, 7307; CHECK-NEXT: vslb v2, v2, v5308; CHECK-NEXT: vsrab v2, v2, v5309; CHECK-NEXT: xxeval v2, v2, v3, v4, 122310; CHECK-NEXT: blr311entry:312 %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 operation313 %or = or <16 x i8> %B, %C314 %res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %or315 ret <16 x i8> %res316}317 318; Function to test ternary(A, not(C), or(B, C)) for <8 x i16>319define <8 x i16> @ternary_A_not_C_or_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {320; CHECK-LABEL: ternary_A_not_C_or_BC_8x16:321; CHECK: # %bb.0: # %entry322; CHECK-NEXT: xxspltiw v5, 983055323; CHECK-NEXT: vslh v2, v2, v5324; CHECK-NEXT: vsrah v2, v2, v5325; CHECK-NEXT: xxeval v2, v2, v3, v4, 122326; CHECK-NEXT: blr327entry:328 %not = xor <8 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation329 %or = or <8 x i16> %B, %C330 %res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %or331 ret <8 x i16> %res332}333 334; Function to test ternary(A, not(B), or(B, C)) for <4 x i32>335define <4 x i32> @ternary_A_not_B_or_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {336; CHECK-LABEL: ternary_A_not_B_or_BC_4x32:337; CHECK: # %bb.0: # %entry338; CHECK-NEXT: xxleqv v5, v5, v5339; CHECK-NEXT: vslw v2, v2, v5340; CHECK-NEXT: vsraw v2, v2, v5341; CHECK-NEXT: xxeval v2, v2, v3, v4, 124342; CHECK-NEXT: blr343entry:344 %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector not operation345 %or = or <4 x i32> %B, %C346 %res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %or347 ret <4 x i32> %res348}349 350; Function to test ternary(A, not(B), or(B, C)) for <2 x i64>351define <2 x i64> @ternary_A_not_B_or_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {352; CHECK-LABEL: ternary_A_not_B_or_BC_2x64:353; CHECK: # %bb.0: # %entry354; CHECK-NEXT: xxlxor v5, v5, v5355; CHECK-NEXT: xxsplti32dx v5, 1, 63356; CHECK-NEXT: vsld v2, v2, v5357; CHECK-NEXT: vsrad v2, v2, v5358; CHECK-NEXT: xxeval v2, v2, v3, v4, 124359; CHECK-NEXT: blr360entry:361 %not = xor <2 x i64> %B, <i64 -1, i64 -1> ; Vector not operation362 %or = or <2 x i64> %B, %C363 %res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %or364 ret <2 x i64> %res365}366 367; Function to test ternary(A, not(B), or(B, C)) for <16 x i8>368define <16 x i8> @ternary_A_not_B_or_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {369; CHECK-LABEL: ternary_A_not_B_or_BC_16x8:370; CHECK: # %bb.0: # %entry371; CHECK-NEXT: xxspltib v5, 7372; CHECK-NEXT: vslb v2, v2, v5373; CHECK-NEXT: vsrab v2, v2, v5374; CHECK-NEXT: xxeval v2, v2, v3, v4, 124375; CHECK-NEXT: blr376entry:377 %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 operation378 %or = or <16 x i8> %B, %C379 %res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %or380 ret <16 x i8> %res381}382 383; Function to test ternary(A, not(B), or(B, C)) for <8 x i16>384define <8 x i16> @ternary_A_not_B_or_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {385; CHECK-LABEL: ternary_A_not_B_or_BC_8x16:386; CHECK: # %bb.0: # %entry387; CHECK-NEXT: xxspltiw v5, 983055388; CHECK-NEXT: vslh v2, v2, v5389; CHECK-NEXT: vsrah v2, v2, v5390; CHECK-NEXT: xxeval v2, v2, v3, v4, 124391; CHECK-NEXT: blr392entry:393 %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector not operation394 %or = or <8 x i16> %B, %C395 %res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %or396 ret <8 x i16> %res397}398 399; Function to test ternary(A, nand(B,C), or(B, C)) for <4 x i32>400define <4 x i32> @ternary_A_nand_BC_or_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {401; CHECK-LABEL: ternary_A_nand_BC_or_BC_4x32:402; CHECK: # %bb.0: # %entry403; CHECK-NEXT: xxleqv v5, v5, v5404; CHECK-NEXT: vslw v2, v2, v5405; CHECK-NEXT: vsraw v2, v2, v5406; CHECK-NEXT: xxeval v2, v2, v3, v4, 126407; CHECK-NEXT: blr408entry:409 %and = and <4 x i32> %B, %C410 %nand = xor <4 x i32> %and, <i32 -1, i32 -1, i32 -1, i32 -1> ; Vector nand operation411 %or = or <4 x i32> %B, %C412 %res = select <4 x i1> %A, <4 x i32> %nand, <4 x i32> %or413 ret <4 x i32> %res414}415 416; Function to test ternary(A, nand(B,C), or(B, C)) for <2 x i64>417define <2 x i64> @ternary_A_nand_BC_or_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {418; CHECK-LABEL: ternary_A_nand_BC_or_BC_2x64:419; CHECK: # %bb.0: # %entry420; CHECK-NEXT: xxlxor v5, v5, v5421; CHECK-NEXT: xxsplti32dx v5, 1, 63422; CHECK-NEXT: vsld v2, v2, v5423; CHECK-NEXT: vsrad v2, v2, v5424; CHECK-NEXT: xxeval v2, v2, v3, v4, 126425; CHECK-NEXT: blr426entry:427 %and = and <2 x i64> %B, %C428 %nand = xor <2 x i64> %and, <i64 -1, i64 -1> ; Vector nand operation429 %or = or <2 x i64> %B, %C430 %res = select <2 x i1> %A, <2 x i64> %nand, <2 x i64> %or431 ret <2 x i64> %res432}433 434; Function to test ternary(A, nand(B,C), or(B, C)) for <16 x i8>435define <16 x i8> @ternary_A_nand_BC_or_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {436; CHECK-LABEL: ternary_A_nand_BC_or_BC_16x8:437; CHECK: # %bb.0: # %entry438; CHECK-NEXT: xxspltib v5, 7439; CHECK-NEXT: vslb v2, v2, v5440; CHECK-NEXT: vsrab v2, v2, v5441; CHECK-NEXT: xxeval v2, v2, v3, v4, 126442; CHECK-NEXT: blr443entry:444 %and = and <16 x i8> %B, %C445 %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 operation446 %or = or <16 x i8> %B, %C447 %res = select <16 x i1> %A, <16 x i8> %nand, <16 x i8> %or448 ret <16 x i8> %res449}450 451; Function to test ternary(A, nand(B,C), or(B, C)) for <8 x i16>452define <8 x i16> @ternary_A_nand_BC_or_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {453; CHECK-LABEL: ternary_A_nand_BC_or_BC_8x16:454; CHECK: # %bb.0: # %entry455; CHECK-NEXT: xxspltiw v5, 983055456; CHECK-NEXT: vslh v2, v2, v5457; CHECK-NEXT: vsrah v2, v2, v5458; CHECK-NEXT: xxeval v2, v2, v3, v4, 126459; CHECK-NEXT: blr460entry:461 %and = and <8 x i16> %B, %C462 %nand = xor <8 x i16> %and, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> ; Vector nand operation463 %or = or <8 x i16> %B, %C464 %res = select <8 x i1> %A, <8 x i16> %nand, <8 x i16> %or465 ret <8 x i16> %res466}467