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=z14 | FileCheck %s
6 ; Test strict 32-bit square root.
9 declare float @llvm.experimental.constrained.sqrt.f32(float, metadata, metadata)
11 ; Check register square root.
12 define float @f1(float %val) #0 {
15 ; CHECK-NEXT: sqebr %f0, %f0
17 %res = call float @llvm.experimental.constrained.sqrt.f32(
19 metadata !"round.dynamic",
20 metadata !"fpexcept.strict") #0
24 ; Check the low end of the SQEB range.
25 define float @f2(ptr %ptr) #0 {
28 ; CHECK-NEXT: sqeb %f0, 0(%r2)
30 %val = load float, ptr %ptr
31 %res = call float @llvm.experimental.constrained.sqrt.f32(
33 metadata !"round.dynamic",
34 metadata !"fpexcept.strict") #0
38 ; Check the high end of the aligned SQEB range.
39 define float @f3(ptr %base) #0 {
42 ; CHECK-NEXT: sqeb %f0, 4092(%r2)
44 %ptr = getelementptr float, ptr %base, i64 1023
45 %val = load float, ptr %ptr
46 %res = call float @llvm.experimental.constrained.sqrt.f32(
48 metadata !"round.dynamic",
49 metadata !"fpexcept.strict") #0
53 ; Check the next word up, which needs separate address logic.
54 ; Other sequences besides this one would be OK.
55 define float @f4(ptr %base) #0 {
58 ; CHECK-NEXT: aghi %r2, 4096
59 ; CHECK-NEXT: sqeb %f0, 0(%r2)
61 %ptr = getelementptr float, ptr %base, i64 1024
62 %val = load float, ptr %ptr
63 %res = call float @llvm.experimental.constrained.sqrt.f32(
65 metadata !"round.dynamic",
66 metadata !"fpexcept.strict") #0
70 ; Check negative displacements, which also need separate address logic.
71 define float @f5(ptr %base) #0 {
74 ; CHECK-NEXT: aghi %r2, -4
75 ; CHECK-NEXT: sqeb %f0, 0(%r2)
77 %ptr = getelementptr float, ptr %base, i64 -1
78 %val = load float, ptr %ptr
79 %res = call float @llvm.experimental.constrained.sqrt.f32(
81 metadata !"round.dynamic",
82 metadata !"fpexcept.strict") #0
86 ; Check that SQEB allows indices.
87 define float @f6(ptr %base, i64 %index) #0 {
90 ; CHECK-NEXT: sllg %r1, %r3, 2
91 ; CHECK-NEXT: sqeb %f0, 400(%r1,%r2)
93 %ptr1 = getelementptr float, ptr %base, i64 %index
94 %ptr2 = getelementptr float, ptr %ptr1, i64 100
95 %val = load float, ptr %ptr2
96 %res = call float @llvm.experimental.constrained.sqrt.f32(
98 metadata !"round.dynamic",
99 metadata !"fpexcept.strict") #0
103 attributes #0 = { strictfp }