1 ; Test strict 32-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=z14 | FileCheck %s
7 declare float @llvm.experimental.constrained.sqrt.f32(float, metadata, metadata)
9 ; Check register square root.
10 define float @f1(float %val) #0 {
12 ; CHECK: sqebr %f0, %f0
14 %res = call float @llvm.experimental.constrained.sqrt.f32(
16 metadata !"round.dynamic",
17 metadata !"fpexcept.strict") #0
21 ; Check the low end of the SQEB range.
22 define float @f2(float *%ptr) #0 {
24 ; CHECK: sqeb %f0, 0(%r2)
26 %val = load float, float *%ptr
27 %res = call float @llvm.experimental.constrained.sqrt.f32(
29 metadata !"round.dynamic",
30 metadata !"fpexcept.strict") #0
34 ; Check the high end of the aligned SQEB range.
35 define float @f3(float *%base) #0 {
37 ; CHECK: sqeb %f0, 4092(%r2)
39 %ptr = getelementptr float, float *%base, i64 1023
40 %val = load float, float *%ptr
41 %res = call float @llvm.experimental.constrained.sqrt.f32(
43 metadata !"round.dynamic",
44 metadata !"fpexcept.strict") #0
48 ; Check the next word up, which needs separate address logic.
49 ; Other sequences besides this one would be OK.
50 define float @f4(float *%base) #0 {
52 ; CHECK: aghi %r2, 4096
53 ; CHECK: sqeb %f0, 0(%r2)
55 %ptr = getelementptr float, float *%base, i64 1024
56 %val = load float, float *%ptr
57 %res = call float @llvm.experimental.constrained.sqrt.f32(
59 metadata !"round.dynamic",
60 metadata !"fpexcept.strict") #0
64 ; Check negative displacements, which also need separate address logic.
65 define float @f5(float *%base) #0 {
68 ; CHECK: sqeb %f0, 0(%r2)
70 %ptr = getelementptr float, float *%base, i64 -1
71 %val = load float, float *%ptr
72 %res = call float @llvm.experimental.constrained.sqrt.f32(
74 metadata !"round.dynamic",
75 metadata !"fpexcept.strict") #0
79 ; Check that SQEB allows indices.
80 define float @f6(float *%base, i64 %index) #0 {
82 ; CHECK: sllg %r1, %r3, 2
83 ; CHECK: sqeb %f0, 400(%r1,%r2)
85 %ptr1 = getelementptr float, float *%base, i64 %index
86 %ptr2 = getelementptr float, float *%ptr1, i64 100
87 %val = load float, float *%ptr2
88 %res = call float @llvm.experimental.constrained.sqrt.f32(
90 metadata !"round.dynamic",
91 metadata !"fpexcept.strict") #0
95 attributes #0 = { strictfp }