• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test f128 floating-point conversion to/from integers on z14.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
4
5; Test signed i32->f128.
6define void @f1(i32 %i, fp128 *%dst) {
7; CHECK-LABEL: f1:
8; CHECK: cxfbr %f0, %r2
9; CHECK: vmrhg %v0, %v0, %v2
10; CHECK: vst %v0, 0(%r3)
11; CHECK: br %r14
12  %conv = sitofp i32 %i to fp128
13  store fp128 %conv, fp128 *%dst
14  ret void
15}
16
17; Test signed i64->f128.
18define void @f2(i64 %i, fp128 *%dst) {
19; CHECK-LABEL: f2:
20; CHECK: cxgbr %f0, %r2
21; CHECK: vmrhg %v0, %v0, %v2
22; CHECK: vst %v0, 0(%r3)
23; CHECK: br %r14
24  %conv = sitofp i64 %i to fp128
25  store fp128 %conv, fp128 *%dst
26  ret void
27}
28
29; Test unsigned i32->f128.
30define void @f3(i32 %i, fp128 *%dst) {
31; CHECK-LABEL: f3:
32; CHECK: cxlfbr %f0, 0, %r2, 0
33; CHECK: vmrhg %v0, %v0, %v2
34; CHECK: vst %v0, 0(%r3)
35; CHECK: br %r14
36  %conv = uitofp i32 %i to fp128
37  store fp128 %conv, fp128 *%dst
38  ret void
39}
40
41; Test unsigned i64->f128.
42define void @f4(i64 %i, fp128 *%dst) {
43; CHECK-LABEL: f4:
44; CHECK: cxlgbr %f0, 0, %r2, 0
45; CHECK: vmrhg %v0, %v0, %v2
46; CHECK: vst %v0, 0(%r3)
47; CHECK: br %r14
48  %conv = uitofp i64 %i to fp128
49  store fp128 %conv, fp128 *%dst
50  ret void
51}
52
53; Test signed f128->i32.
54define i32 @f5(fp128 *%src) {
55; CHECK-LABEL: f5:
56; CHECK: vl %v0, 0(%r2)
57; CHECK: vrepg %v2, %v0, 1
58; CHECK: cfxbr %r2, 5, %f0
59; CHECK: br %r14
60  %f = load fp128, fp128 *%src
61  %conv = fptosi fp128 %f to i32
62  ret i32 %conv
63}
64
65; Test signed f128->i64.
66define i64 @f6(fp128 *%src) {
67; CHECK-LABEL: f6:
68; CHECK: vl %v0, 0(%r2)
69; CHECK: vrepg %v2, %v0, 1
70; CHECK: cgxbr %r2, 5, %f0
71; CHECK: br %r14
72  %f = load fp128, fp128 *%src
73  %conv = fptosi fp128 %f to i64
74  ret i64 %conv
75}
76
77; Test unsigned f128->i32.
78define i32 @f7(fp128 *%src) {
79; CHECK-LABEL: f7:
80; CHECK: vl %v0, 0(%r2)
81; CHECK: vrepg %v2, %v0, 1
82; CHECK: clfxbr %r2, 5, %f0, 0
83; CHECK: br %r14
84  %f = load fp128, fp128 *%src
85  %conv = fptoui fp128 %f to i32
86  ret i32 %conv
87}
88
89; Test unsigned f128->i64.
90define i64 @f8(fp128 *%src) {
91; CHECK-LABEL: f8:
92; CHECK: vl %v0, 0(%r2)
93; CHECK: vrepg %v2, %v0, 1
94; CHECK: clgxbr %r2, 5, %f0, 0
95; CHECK: br %r14
96  %f = load fp128, fp128 *%src
97  %conv = fptoui fp128 %f to i64
98  ret i64 %conv
99}
100