1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
6 ; Test strict 64-bit square root.
9 declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
11 ; Check register square root.
12 define double @f1(double %val) #0 {
15 ; CHECK-NEXT: sqdbr %f0, %f0
17 %res = call double @llvm.experimental.constrained.sqrt.f64(
19 metadata !"round.dynamic",
20 metadata !"fpexcept.strict") #0
24 ; Check the low end of the SQDB range.
25 define double @f2(double *%ptr) #0 {
28 ; CHECK-NEXT: sqdb %f0, 0(%r2)
30 %val = load double, double *%ptr
31 %res = call double @llvm.experimental.constrained.sqrt.f64(
33 metadata !"round.dynamic",
34 metadata !"fpexcept.strict") #0
38 ; Check the high end of the aligned SQDB range.
39 define double @f3(double *%base) #0 {
42 ; CHECK-NEXT: sqdb %f0, 4088(%r2)
44 %ptr = getelementptr double, double *%base, i64 511
45 %val = load double, double *%ptr
46 %res = call double @llvm.experimental.constrained.sqrt.f64(
48 metadata !"round.dynamic",
49 metadata !"fpexcept.strict") #0
53 ; Check the next doubleword up, which needs separate address logic.
54 ; Other sequences besides this one would be OK.
55 define double @f4(double *%base) #0 {
58 ; CHECK-NEXT: aghi %r2, 4096
59 ; CHECK-NEXT: sqdb %f0, 0(%r2)
61 %ptr = getelementptr double, double *%base, i64 512
62 %val = load double, double *%ptr
63 %res = call double @llvm.experimental.constrained.sqrt.f64(
65 metadata !"round.dynamic",
66 metadata !"fpexcept.strict") #0
70 ; Check negative displacements, which also need separate address logic.
71 define double @f5(double *%base) #0 {
74 ; CHECK-NEXT: aghi %r2, -8
75 ; CHECK-NEXT: sqdb %f0, 0(%r2)
77 %ptr = getelementptr double, double *%base, i64 -1
78 %val = load double, double *%ptr
79 %res = call double @llvm.experimental.constrained.sqrt.f64(
81 metadata !"round.dynamic",
82 metadata !"fpexcept.strict") #0
86 ; Check that SQDB allows indices.
87 define double @f6(double *%base, i64 %index) #0 {
90 ; CHECK-NEXT: sllg %r1, %r3, 3
91 ; CHECK-NEXT: sqdb %f0, 800(%r1,%r2)
93 %ptr1 = getelementptr double, double *%base, i64 %index
94 %ptr2 = getelementptr double, double *%ptr1, i64 100
95 %val = load double, double *%ptr2
96 %res = call double @llvm.experimental.constrained.sqrt.f64(
98 metadata !"round.dynamic",
99 metadata !"fpexcept.strict") #0
103 attributes #0 = { strictfp }