brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 891a33c Raw
62 lines · plain
1; Test moves between FPRs and GPRs for z13 and above.2;3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s4 5; Check that moves from i32s to floats use a low GR32 and vector operation.6define float @f1(ptr %ptr) {7; CHECK-LABEL: f1:8; CHECK: llh [[REG:%r[0-5]]], 0(%r2)9; CHECK: oilh [[REG]], 1625610; CHECK: vlvgf %v0, [[REG]], 011; CHECK: br %r1412  %base = load i16, ptr %ptr13  %ext = zext i16 %base to i3214  %full = or i32 %ext, 106535321615  %res = bitcast i32 %full to float16  ret float %res17}18 19; Check that moves from floats to i32s use a low GR32 and vector operation.20define void @f2(float %val, ptr %ptr) {21; CHECK-LABEL: f2:22; CHECK: vlgvf [[REG:%r[0-5]]], %v0, 023; CHECK: stc [[REG]], 0(%r2)24; CHECK: br %r1425  %res = bitcast float %val to i3226  %trunc = trunc i32 %res to i827  store i8 %trunc, ptr %ptr28  ret void29}30 31; Like f2, but with a conditional store.32define void @f3(float %val, ptr %ptr, i32 %which) {33; CHECK-LABEL: f3:34; CHECK-DAG: ciblh %r3, 0, 0(%r14)35; CHECK-DAG: vlgvf [[REG:%r[0-5]]], %v0, 036; CHECK: stc [[REG]], 0(%r2)37; CHECK: br %r1438  %int = bitcast float %val to i3239  %trunc = trunc i32 %int to i840  %old = load i8, ptr %ptr41  %cmp = icmp eq i32 %which, 042  %res = select i1 %cmp, i8 %trunc, i8 %old43  store i8 %res, ptr %ptr44  ret void45}46 47; ...and again with 16-bit memory.48define void @f4(float %val, ptr %ptr, i32 %which) {49; CHECK-LABEL: f4:50; CHECK-DAG: ciblh %r3, 0, 0(%r14)51; CHECK-DAG: vlgvf [[REG:%r[0-5]]], %v0, 052; CHECK: sth [[REG]], 0(%r2)53; CHECK: br %r1454  %int = bitcast float %val to i3255  %trunc = trunc i32 %int to i1656  %old = load i16, ptr %ptr57  %cmp = icmp eq i32 %which, 058  %res = select i1 %cmp, i16 %trunc, i16 %old59  store i16 %res, ptr %ptr60  ret void61}62