1 ; Test strict 64-bit square root.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 \
4 ; RUN: | FileCheck -check-prefix=CHECK -check-prefix=CHECK-SCALAR %s
5 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
7 declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
9 ; Check register square root.
10 define double @f1(double %val) {
12 ; CHECK: sqdbr %f0, %f0
14 %res = call double @llvm.experimental.constrained.sqrt.f64(
16 metadata !"round.dynamic",
17 metadata !"fpexcept.strict")
21 ; Check the low end of the SQDB range.
22 define double @f2(double *%ptr) {
24 ; CHECK: sqdb %f0, 0(%r2)
26 %val = load double, double *%ptr
27 %res = call double @llvm.experimental.constrained.sqrt.f64(
29 metadata !"round.dynamic",
30 metadata !"fpexcept.strict")
34 ; Check the high end of the aligned SQDB range.
35 define double @f3(double *%base) {
37 ; CHECK: sqdb %f0, 4088(%r2)
39 %ptr = getelementptr double, double *%base, i64 511
40 %val = load double, double *%ptr
41 %res = call double @llvm.experimental.constrained.sqrt.f64(
43 metadata !"round.dynamic",
44 metadata !"fpexcept.strict")
48 ; Check the next doubleword up, which needs separate address logic.
49 ; Other sequences besides this one would be OK.
50 define double @f4(double *%base) {
52 ; CHECK: aghi %r2, 4096
53 ; CHECK: sqdb %f0, 0(%r2)
55 %ptr = getelementptr double, double *%base, i64 512
56 %val = load double, double *%ptr
57 %res = call double @llvm.experimental.constrained.sqrt.f64(
59 metadata !"round.dynamic",
60 metadata !"fpexcept.strict")
64 ; Check negative displacements, which also need separate address logic.
65 define double @f5(double *%base) {
68 ; CHECK: sqdb %f0, 0(%r2)
70 %ptr = getelementptr double, double *%base, i64 -1
71 %val = load double, double *%ptr
72 %res = call double @llvm.experimental.constrained.sqrt.f64(
74 metadata !"round.dynamic",
75 metadata !"fpexcept.strict")
79 ; Check that SQDB allows indices.
80 define double @f6(double *%base, i64 %index) {
82 ; CHECK: sllg %r1, %r3, 3
83 ; CHECK: sqdb %f0, 800(%r1,%r2)
85 %ptr1 = getelementptr double, double *%base, i64 %index
86 %ptr2 = getelementptr double, double *%ptr1, i64 100
87 %val = load double, double *%ptr2
88 %res = call double @llvm.experimental.constrained.sqrt.f64(
90 metadata !"round.dynamic",
91 metadata !"fpexcept.strict")