113 lines · plain
1; Test vector truncating stores.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s4 5; Test a v16i8->v16i1 truncation.6define void @f1(<16 x i8> %val, ptr %ptr) {7; No expected output, but must compile.8 %trunc = trunc <16 x i8> %val to <16 x i1>9 store <16 x i1> %trunc, ptr %ptr10 ret void11}12 13; Test a v8i16->v8i1 truncation.14define void @f2(<8 x i16> %val, ptr %ptr) {15; No expected output, but must compile.16 %trunc = trunc <8 x i16> %val to <8 x i1>17 store <8 x i1> %trunc, ptr %ptr18 ret void19}20 21; Test a v8i16->v8i8 truncation.22define void @f3(<8 x i16> %val, ptr %ptr) {23; CHECK-LABEL: f3:24; CHECK: vpkh [[REG1:%v[0-9]+]], %v24, %v2425; CHECK: vsteg [[REG1]], 0(%r2)26; CHECK: br %r1427 %trunc = trunc <8 x i16> %val to <8 x i8>28 store <8 x i8> %trunc, ptr %ptr29 ret void30}31 32; Test a v4i32->v4i1 truncation.33define void @f4(<4 x i32> %val, ptr %ptr) {34; No expected output, but must compile.35 %trunc = trunc <4 x i32> %val to <4 x i1>36 store <4 x i1> %trunc, ptr %ptr37 ret void38}39 40; Test a v4i32->v4i8 truncation. At the moment we use a VPERM rather than41; a chain of packs.42define void @f5(<4 x i32> %val, ptr %ptr) {43; CHECK-LABEL: f5:44; CHECK: vperm [[REG:%v[0-9]+]],45; CHECK: vstef [[REG]], 0(%r2)46; CHECK: br %r1447 %trunc = trunc <4 x i32> %val to <4 x i8>48 store <4 x i8> %trunc, ptr %ptr49 ret void50}51 52; Test a v4i32->v4i16 truncation.53define void @f6(<4 x i32> %val, ptr %ptr) {54; CHECK-LABEL: f6:55; CHECK: vpkf [[REG1:%v[0-9]+]], %v24, %v2456; CHECK: vsteg [[REG1]], 0(%r2)57; CHECK: br %r1458 %trunc = trunc <4 x i32> %val to <4 x i16>59 store <4 x i16> %trunc, ptr %ptr60 ret void61}62 63; Test a v2i64->v2i1 truncation.64define void @f7(<2 x i64> %val, ptr %ptr) {65; CHECK-LABEL: f7:66; CHECK: # %bb.0:67; CHECK-NEXT: vlgvg %r0, %v24, 068; CHECK-DAG: sll %r0, 169; CHECK-DAG: vlgvg %r1, %v24, 170; CHECK-NEXT: rosbg %r0, %r1, 63, 63, 071; CHECK-NEXT: nilf %r0, 372; CHECK-NEXT: stc %r0, 0(%r2)73; CHECK-NEXT: br %r1474 %trunc = trunc <2 x i64> %val to <2 x i1>75 store <2 x i1> %trunc, ptr %ptr76 ret void77}78 79; Test a v2i64->v2i8 truncation. At the moment we use a VPERM rather than80; a chain of packs.81define void @f8(<2 x i64> %val, ptr %ptr) {82; CHECK-LABEL: f8:83; CHECK: vperm [[REG:%v[0-9]+]],84; CHECK: vsteh [[REG]], 0(%r2)85; CHECK: br %r1486 %trunc = trunc <2 x i64> %val to <2 x i8>87 store <2 x i8> %trunc, ptr %ptr88 ret void89}90 91; Test a v2i64->v2i16 truncation. At the moment we use a VPERM rather than92; a chain of packs.93define void @f9(<2 x i64> %val, ptr %ptr) {94; CHECK-LABEL: f9:95; CHECK: vperm [[REG:%v[0-9]+]],96; CHECK: vstef [[REG]], 0(%r2)97; CHECK: br %r1498 %trunc = trunc <2 x i64> %val to <2 x i16>99 store <2 x i16> %trunc, ptr %ptr100 ret void101}102 103; Test a v2i64->v2i32 truncation.104define void @f10(<2 x i64> %val, ptr %ptr) {105; CHECK-LABEL: f10:106; CHECK: vpkg [[REG1:%v[0-9]+]], %v24, %v24107; CHECK: vsteg [[REG1]], 0(%r2)108; CHECK: br %r14109 %trunc = trunc <2 x i64> %val to <2 x i32>110 store <2 x i32> %trunc, ptr %ptr111 ret void112}113