brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.0 KiB · b41220b Raw
345 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, xor(B, C), and(B, C)) for <4 x i32>14define <4 x i32> @ternary_A_xor_BC_and_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {15; CHECK-LABEL: ternary_A_xor_BC_and_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, 2221; CHECK-NEXT:    blr22entry:23  %xor = xor <4 x i32> %B, %C24  %and = and <4 x i32> %B, %C25  %res = select <4 x i1> %A, <4 x i32> %xor, <4 x i32> %and26  ret <4 x i32> %res27}28 29; Function to test ternary(A, xor(B, C), and(B, C)) for <2 x i64>30define <2 x i64> @ternary_A_xor_BC_and_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {31; CHECK-LABEL: ternary_A_xor_BC_and_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, 2238; CHECK-NEXT:    blr39entry:40  %xor = xor <2 x i64> %B, %C41  %and = and <2 x i64> %B, %C42  %res = select <2 x i1> %A, <2 x i64> %xor, <2 x i64> %and43  ret <2 x i64> %res44}45 46; Function to test ternary(A, xor(B, C), and(B, C)) for <16 x i8>47define <16 x i8> @ternary_A_xor_BC_and_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {48; CHECK-LABEL: ternary_A_xor_BC_and_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, 2254; CHECK-NEXT:    blr55entry:56  %xor = xor <16 x i8> %B, %C57  %and = and <16 x i8> %B, %C58  %res = select <16 x i1> %A, <16 x i8> %xor, <16 x i8> %and59  ret <16 x i8> %res60}61 62; Function to test ternary(A, xor(B, C), and(B, C)) for <8 x i16>63define <8 x i16> @ternary_A_xor_BC_and_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {64; CHECK-LABEL: ternary_A_xor_BC_and_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, 2270; CHECK-NEXT:    blr71entry:72  %xor = xor <8 x i16> %B, %C73  %and = and <8 x i16> %B, %C74  %res = select <8 x i1> %A, <8 x i16> %xor, <8 x i16> %and75  ret <8 x i16> %res76}77 78; Function to test ternary(A, nor(B, C), and(B, C)) for <4 x i32>79define <4 x i32> @ternary_A_nor_BC_and_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {80; CHECK-LABEL: ternary_A_nor_BC_and_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, 2486; CHECK-NEXT:    blr87entry:88  %or = or <4 x i32> %B, %C89  %nor = xor <4 x i32> %or, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector NOR operation90  %and = and <4 x i32> %B, %C91  %res = select <4 x i1> %A, <4 x i32> %nor, <4 x i32> %and92  ret <4 x i32> %res93}94 95; Function to test ternary(A, nor(B, C), and(B, C)) for <2 x i64>96define <2 x i64> @ternary_A_nor_BC_and_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {97; CHECK-LABEL: ternary_A_nor_BC_and_BC_2x64:98; CHECK:       # %bb.0: # %entry99; CHECK-NEXT:    xxlxor v5, v5, v5100; CHECK-NEXT:    xxsplti32dx v5, 1, 63101; CHECK-NEXT:    vsld v2, v2, v5102; CHECK-NEXT:    vsrad v2, v2, v5103; CHECK-NEXT:    xxeval v2, v2, v3, v4, 24104; CHECK-NEXT:    blr105entry:106  %or = or <2 x i64> %B, %C107  %nor = xor <2 x i64> %or, <i64 -1, i64 -1>  ; Vector NOR operation108  %and = and <2 x i64> %B, %C109  %res = select <2 x i1> %A, <2 x i64> %nor, <2 x i64> %and110  ret <2 x i64> %res111}112 113; Function to test ternary(A, nor(B, C), and(B, C)) for <16 x i8>114define <16 x i8> @ternary_A_nor_BC_and_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {115; CHECK-LABEL: ternary_A_nor_BC_and_BC_16x8:116; CHECK:       # %bb.0: # %entry117; CHECK-NEXT:    xxspltib v5, 7118; CHECK-NEXT:    vslb v2, v2, v5119; CHECK-NEXT:    vsrab v2, v2, v5120; CHECK-NEXT:    xxeval v2, v2, v3, v4, 24121; CHECK-NEXT:    blr122entry:123  %or = or <16 x i8> %B, %C124  %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 operation125  %and = and <16 x i8> %B, %C126  %res = select <16 x i1> %A, <16 x i8> %nor, <16 x i8> %and127  ret <16 x i8> %res128}129 130; Function to test ternary(A, nor(B, C), and(B, C)) for <8 x i16>131define <8 x i16> @ternary_A_nor_BC_and_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {132; CHECK-LABEL: ternary_A_nor_BC_and_BC_8x16:133; CHECK:       # %bb.0: # %entry134; CHECK-NEXT:    xxspltiw v5, 983055135; CHECK-NEXT:    vslh v2, v2, v5136; CHECK-NEXT:    vsrah v2, v2, v5137; CHECK-NEXT:    xxeval v2, v2, v3, v4, 24138; CHECK-NEXT:    blr139entry:140  %or = or <8 x i16> %B, %C141  %nor = xor <8 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector NOR operation142  %and = and <8 x i16> %B, %C143  %res = select <8 x i1> %A, <8 x i16> %nor, <8 x i16> %and144  ret <8 x i16> %res145}146 147; Function to test ternary(A, eqv(B, C), and(B, C)) for <4 x i32>148define <4 x i32> @ternary_A_eqv_BC_and_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {149; CHECK-LABEL: ternary_A_eqv_BC_and_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, 25155; CHECK-NEXT:    blr156entry:157  %xor = xor <4 x i32> %B, %C158  %eqv = xor <4 x i32> %xor, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector eqv operation159  %and = and <4 x i32> %B, %C160  %res = select <4 x i1> %A, <4 x i32> %eqv, <4 x i32> %and161  ret <4 x i32> %res162}163 164; Function to test ternary(A, eqv(B, C), and(B, C)) for <2 x i64>165define <2 x i64> @ternary_A_eqv_BC_and_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {166; CHECK-LABEL: ternary_A_eqv_BC_and_BC_2x64:167; CHECK:       # %bb.0: # %entry168; CHECK-NEXT:    xxlxor v5, v5, v5169; CHECK-NEXT:    xxsplti32dx v5, 1, 63170; CHECK-NEXT:    vsld v2, v2, v5171; CHECK-NEXT:    vsrad v2, v2, v5172; CHECK-NEXT:    xxeval v2, v2, v3, v4, 25173; CHECK-NEXT:    blr174entry:175  %xor = xor <2 x i64> %B, %C176  %eqv = xor <2 x i64> %xor, <i64 -1, i64 -1>  ; Vector eqv operation177  %and = and <2 x i64> %B, %C178  %res = select <2 x i1> %A, <2 x i64> %eqv, <2 x i64> %and179  ret <2 x i64> %res180}181 182; Function to test ternary(A, eqv(B, C), and(B, C)) for <16 x i8>183define <16 x i8> @ternary_A_eqv_BC_and_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {184; CHECK-LABEL: ternary_A_eqv_BC_and_BC_16x8:185; CHECK:       # %bb.0: # %entry186; CHECK-NEXT:    xxspltib v5, 7187; CHECK-NEXT:    vslb v2, v2, v5188; CHECK-NEXT:    vsrab v2, v2, v5189; CHECK-NEXT:    xxeval v2, v2, v3, v4, 25190; CHECK-NEXT:    blr191entry:192  %xor = xor <16 x i8> %B, %C193  %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 operation194  %and = and <16 x i8> %B, %C195  %res = select <16 x i1> %A, <16 x i8> %eqv, <16 x i8> %and196  ret <16 x i8> %res197}198 199; Function to test ternary(A, eqv(B, C), and(B, C)) for <8 x i16>200define <8 x i16> @ternary_A_eqv_BC_and_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {201; CHECK-LABEL: ternary_A_eqv_BC_and_BC_8x16:202; CHECK:       # %bb.0: # %entry203; CHECK-NEXT:    xxspltiw v5, 983055204; CHECK-NEXT:    vslh v2, v2, v5205; CHECK-NEXT:    vsrah v2, v2, v5206; CHECK-NEXT:    xxeval v2, v2, v3, v4, 25207; CHECK-NEXT:    blr208entry:209  %xor = xor <8 x i16> %B, %C210  %eqv = xor <8 x i16> %xor, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector eqv operation211  %and = and <8 x i16> %B, %C212  %res = select <8 x i1> %A, <8 x i16> %eqv, <8 x i16> %and213  ret <8 x i16> %res214}215 216; Function to test ternary(A, not(C), and(B, C)) for <4 x i32>217define <4 x i32> @ternary_A_not_C_and_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {218; CHECK-LABEL: ternary_A_not_C_and_BC_4x32:219; CHECK:       # %bb.0: # %entry220; CHECK-NEXT:    xxleqv v5, v5, v5221; CHECK-NEXT:    vslw v2, v2, v5222; CHECK-NEXT:    vsraw v2, v2, v5223; CHECK-NEXT:    xxeval v2, v2, v3, v4, 26224; CHECK-NEXT:    blr225entry:226  %not = xor <4 x i32> %C, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector not operation227  %and = and <4 x i32> %B, %C228  %res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %and229  ret <4 x i32> %res230}231 232; Function to test ternary(A, not(C), and(B, C)) for <2 x i64>233define <2 x i64> @ternary_A_not_C_and_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {234; CHECK-LABEL: ternary_A_not_C_and_BC_2x64:235; CHECK:       # %bb.0: # %entry236; CHECK-NEXT:    xxlxor v5, v5, v5237; CHECK-NEXT:    xxsplti32dx v5, 1, 63238; CHECK-NEXT:    vsld v2, v2, v5239; CHECK-NEXT:    vsrad v2, v2, v5240; CHECK-NEXT:    xxeval v2, v2, v3, v4, 26241; CHECK-NEXT:    blr242entry:243  %not = xor <2 x i64> %C, <i64 -1, i64 -1>  ; Vector not operation244  %and = and <2 x i64> %B, %C245  %res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %and246  ret <2 x i64> %res247}248 249; Function to test ternary(A, not(C), and(B, C)) for <16 x i8>250define <16 x i8> @ternary_A_not_C_and_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {251; CHECK-LABEL: ternary_A_not_C_and_BC_16x8:252; CHECK:       # %bb.0: # %entry253; CHECK-NEXT:    xxspltib v5, 7254; CHECK-NEXT:    vslb v2, v2, v5255; CHECK-NEXT:    vsrab v2, v2, v5256; CHECK-NEXT:    xxeval v2, v2, v3, v4, 26257; CHECK-NEXT:    blr258entry:259  %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 operation260  %and = and <16 x i8> %B, %C261  %res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %and262  ret <16 x i8> %res263}264 265; Function to test ternary(A, not(C), and(B, C)) for <8 x i16>266define <8 x i16> @ternary_A_not_C_and_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {267; CHECK-LABEL: ternary_A_not_C_and_BC_8x16:268; CHECK:       # %bb.0: # %entry269; CHECK-NEXT:    xxspltiw v5, 983055270; CHECK-NEXT:    vslh v2, v2, v5271; CHECK-NEXT:    vsrah v2, v2, v5272; CHECK-NEXT:    xxeval v2, v2, v3, v4, 26273; CHECK-NEXT:    blr274entry:275  %not = xor <8 x i16> %C, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector not operation276  %and = and <8 x i16> %B, %C277  %res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %and278  ret <8 x i16> %res279}280 281; Function to test ternary(A, not(B), and(B, C)) for <4 x i32>282define <4 x i32> @ternary_A_not_B_and_BC_4x32(<4 x i1> %A, <4 x i32> %B, <4 x i32> %C) {283; CHECK-LABEL: ternary_A_not_B_and_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, 28289; CHECK-NEXT:    blr290entry:291  %not = xor <4 x i32> %B, <i32 -1, i32 -1, i32 -1, i32 -1>  ; Vector not operation292  %and = and <4 x i32> %B, %C293  %res = select <4 x i1> %A, <4 x i32> %not, <4 x i32> %and294  ret <4 x i32> %res295}296 297; Function to test ternary(A, not(B), and(B, C)) for <2 x i64>298define <2 x i64> @ternary_A_not_B_and_BC_2x64(<2 x i1> %A, <2 x i64> %B, <2 x i64> %C) {299; CHECK-LABEL: ternary_A_not_B_and_BC_2x64:300; CHECK:       # %bb.0: # %entry301; CHECK-NEXT:    xxlxor v5, v5, v5302; CHECK-NEXT:    xxsplti32dx v5, 1, 63303; CHECK-NEXT:    vsld v2, v2, v5304; CHECK-NEXT:    vsrad v2, v2, v5305; CHECK-NEXT:    xxeval v2, v2, v3, v4, 28306; CHECK-NEXT:    blr307entry:308  %not = xor <2 x i64> %B, <i64 -1, i64 -1>  ; Vector not operation309  %and = and <2 x i64> %B, %C310  %res = select <2 x i1> %A, <2 x i64> %not, <2 x i64> %and311  ret <2 x i64> %res312}313 314; Function to test ternary(A, not(B), and(B, C)) for <16 x i8>315define <16 x i8> @ternary_A_not_B_and_BC_16x8(<16 x i1> %A, <16 x i8> %B, <16 x i8> %C) {316; CHECK-LABEL: ternary_A_not_B_and_BC_16x8:317; CHECK:       # %bb.0: # %entry318; CHECK-NEXT:    xxspltib v5, 7319; CHECK-NEXT:    vslb v2, v2, v5320; CHECK-NEXT:    vsrab v2, v2, v5321; CHECK-NEXT:    xxeval v2, v2, v3, v4, 28322; CHECK-NEXT:    blr323entry:324  %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 operation325  %and = and <16 x i8> %B, %C326  %res = select <16 x i1> %A, <16 x i8> %not, <16 x i8> %and327  ret <16 x i8> %res328}329 330; Function to test ternary(A, not(B), and(B, C)) for <8 x i16>331define <8 x i16> @ternary_A_not_B_and_BC_8x16(<8 x i1> %A, <8 x i16> %B, <8 x i16> %C) {332; CHECK-LABEL: ternary_A_not_B_and_BC_8x16:333; CHECK:       # %bb.0: # %entry334; CHECK-NEXT:    xxspltiw v5, 983055335; CHECK-NEXT:    vslh v2, v2, v5336; CHECK-NEXT:    vsrah v2, v2, v5337; CHECK-NEXT:    xxeval v2, v2, v3, v4, 28338; CHECK-NEXT:    blr339entry:340  %not = xor <8 x i16> %B, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>  ; Vector not operation341  %and = and <8 x i16> %B, %C342  %res = select <8 x i1> %A, <8 x i16> %not, <8 x i16> %and343  ret <8 x i16> %res344}345