• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; Test conversion of floating-point values to unsigned i64s (z10 only).
3;
4; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
5
6; z10 doesn't have native support for unsigned fp-to-i64 conversions;
7; they were added in z196 as the Convert to Logical family of instructions.
8; Convert via signed i64s instead.
9
10; Test f32->i64.
11define i64 @f1(float %f) {
12; CHECK-LABEL: f1:
13; CHECK:       # %bb.0:
14; CHECK-NEXT:    larl %r1, .LCPI0_0
15; CHECK-NEXT:    le %f1, 0(%r1)
16; CHECK-NEXT:    cebr %f0, %f1
17; CHECK-NEXT:    jnl .LBB0_2
18; CHECK-NEXT:  # %bb.1:
19; CHECK-NEXT:    cgebr %r2, 5, %f0
20; CHECK-NEXT:    br %r14
21; CHECK-NEXT:  .LBB0_2:
22; CHECK-NEXT:    sebr %f0, %f1
23; CHECK-NEXT:    cgebr %r2, 5, %f0
24; CHECK-NEXT:    xihf %r2, 2147483648
25; CHECK-NEXT:    br %r14
26  %conv = fptoui float %f to i64
27  ret i64 %conv
28}
29
30; Test f64->i64.
31define i64 @f2(double %f) {
32; CHECK-LABEL: f2:
33; CHECK:       # %bb.0:
34; CHECK-NEXT:    larl %r1, .LCPI1_0
35; CHECK-NEXT:    ldeb %f1, 0(%r1)
36; CHECK-NEXT:    cdbr %f0, %f1
37; CHECK-NEXT:    jnl .LBB1_2
38; CHECK-NEXT:  # %bb.1:
39; CHECK-NEXT:    cgdbr %r2, 5, %f0
40; CHECK-NEXT:    br %r14
41; CHECK-NEXT:  .LBB1_2:
42; CHECK-NEXT:    sdbr %f0, %f1
43; CHECK-NEXT:    cgdbr %r2, 5, %f0
44; CHECK-NEXT:    xihf %r2, 2147483648
45; CHECK-NEXT:    br %r14
46  %conv = fptoui double %f to i64
47  ret i64 %conv
48}
49
50; Test f128->i64.
51define i64 @f3(fp128 *%src) {
52; CHECK-LABEL: f3:
53; CHECK:       # %bb.0:
54; CHECK-NEXT:    ld %f0, 0(%r2)
55; CHECK-NEXT:    ld %f2, 8(%r2)
56; CHECK-NEXT:    larl %r1, .LCPI2_0
57; CHECK-NEXT:    lxeb %f1, 0(%r1)
58; CHECK-NEXT:    cxbr %f0, %f1
59; CHECK-NEXT:    jnl .LBB2_2
60; CHECK-NEXT:  # %bb.1:
61; CHECK-NEXT:    cgxbr %r2, 5, %f0
62; CHECK-NEXT:    br %r14
63; CHECK-NEXT:  .LBB2_2:
64; CHECK-NEXT:    sxbr %f0, %f1
65; CHECK-NEXT:    cgxbr %r2, 5, %f0
66; CHECK-NEXT:    xihf %r2, 2147483648
67; CHECK-NEXT:    br %r14
68  %f = load fp128, fp128 *%src
69  %conv = fptoui fp128 %f to i64
70  ret i64 %conv
71}
72