1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; Test strict conversion of floating-point values to unsigned i32s (z10 only).
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
6 ; z10 doesn't have native support for unsigned fp-to-i32 conversions;
7 ; they were added in z196 as the Convert to Logical family of instructions.
8 ; Promoting to i64 doesn't generate an inexact condition for values that are
9 ; outside the i32 range but in the i64 range, so use the default expansion.
10 ; Note that the strict expansion sequence must be used.
12 declare i32 @llvm.experimental.constrained.fptoui.i32.f32(float, metadata)
13 declare i32 @llvm.experimental.constrained.fptoui.i32.f64(double, metadata)
14 declare i32 @llvm.experimental.constrained.fptoui.i32.f128(fp128, metadata)
17 define i32 @f1(float %f) #0 {
20 ; CHECK-NEXT: larl %r1, .LCPI0_0
21 ; CHECK-NEXT: le %f1, 0(%r1)
22 ; CHECK-NEXT: kebr %f0, %f1
23 ; CHECK-NEXT: jnl .LBB0_2
24 ; CHECK-NEXT: # %bb.1:
25 ; CHECK-NEXT: lhi %r0, 0
26 ; CHECK-NEXT: lzer %f1
27 ; CHECK-NEXT: j .LBB0_3
28 ; CHECK-NEXT: .LBB0_2:
29 ; CHECK-NEXT: llilh %r0, 32768
30 ; CHECK-NEXT: .LBB0_3:
31 ; CHECK-NEXT: sebr %f0, %f1
32 ; CHECK-NEXT: cfebr %r2, 5, %f0
33 ; CHECK-NEXT: xr %r2, %r0
35 %conv = call i32 @llvm.experimental.constrained.fptoui.i32.f32(float %f,
36 metadata !"fpexcept.strict") #0
41 define i32 @f2(double %f) #0 {
44 ; CHECK-NEXT: larl %r1, .LCPI1_0
45 ; CHECK-NEXT: ld %f1, 0(%r1)
46 ; CHECK-NEXT: kdbr %f0, %f1
47 ; CHECK-NEXT: jnl .LBB1_2
48 ; CHECK-NEXT: # %bb.1:
49 ; CHECK-NEXT: lhi %r0, 0
50 ; CHECK-NEXT: lzdr %f1
51 ; CHECK-NEXT: j .LBB1_3
52 ; CHECK-NEXT: .LBB1_2:
53 ; CHECK-NEXT: llilh %r0, 32768
54 ; CHECK-NEXT: .LBB1_3:
55 ; CHECK-NEXT: sdbr %f0, %f1
56 ; CHECK-NEXT: cfdbr %r2, 5, %f0
57 ; CHECK-NEXT: xr %r2, %r0
59 %conv = call i32 @llvm.experimental.constrained.fptoui.i32.f64(double %f,
60 metadata !"fpexcept.strict") #0
65 define i32 @f3(ptr %src) #0 {
68 ; CHECK-NEXT: ld %f0, 0(%r2)
69 ; CHECK-NEXT: ld %f2, 8(%r2)
70 ; CHECK-NEXT: larl %r1, .LCPI2_0
71 ; CHECK-NEXT: lxeb %f1, 0(%r1)
72 ; CHECK-NEXT: kxbr %f0, %f1
73 ; CHECK-NEXT: jnl .LBB2_2
74 ; CHECK-NEXT: # %bb.1:
75 ; CHECK-NEXT: lhi %r0, 0
76 ; CHECK-NEXT: lzxr %f1
77 ; CHECK-NEXT: j .LBB2_3
78 ; CHECK-NEXT: .LBB2_2:
79 ; CHECK-NEXT: llilh %r0, 32768
80 ; CHECK-NEXT: .LBB2_3:
81 ; CHECK-NEXT: sxbr %f0, %f1
82 ; CHECK-NEXT: cfxbr %r2, 5, %f0
83 ; CHECK-NEXT: xr %r2, %r0
85 %f = load fp128, ptr %src
86 %conv = call i32 @llvm.experimental.constrained.fptoui.i32.f128(fp128 %f,
87 metadata !"fpexcept.strict") #0
91 attributes #0 = { strictfp }