[SystemZ] Add test missing from r191764.
[oota-llvm.git] / test / CodeGen / SystemZ / fp-move-09.ll
1 ; Test moves between FPRs and GPRs for z196 and above.
2 ;
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z196 | FileCheck %s
4
5 ; Check that moves from i32s to floats can use high registers.
6 define float @f1(i16 *%ptr) {
7 ; CHECK-LABEL: f1:
8 ; CHECK: llhh [[REG:%r[0-5]]], 0(%r2)
9 ; CHECK: oihh [[REG]], 16256
10 ; CHECK: ldgr %f0, [[REG]]
11 ; CHECK: br %r14
12   %base = load i16 *%ptr
13   %ext = zext i16 %base to i32
14   %full = or i32 %ext, 1065353216
15   %res = bitcast i32 %full to float
16   ret float %res
17 }
18
19 ; Check that moves from floats to i32s can use high registers.
20 ; This "store the low byte" technique is used by llvmpipe, for example.
21 define void @f2(float %val, i8 *%ptr) {
22 ; CHECK-LABEL: f2:
23 ; CHECK: lgdr [[REG:%r[0-5]]], %f0
24 ; CHECK: stch [[REG]], 0(%r2)
25 ; CHECK: br %r14
26   %res = bitcast float %val to i32
27   %trunc = trunc i32 %res to i8
28   store i8 %trunc, i8 *%ptr
29   ret void
30 }