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 4 5; 6; Test strict 64-bit square root. 7; 8 9declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) 10 11; Check register square root. 12define double @f1(double %val) #0 { 13; CHECK-LABEL: f1: 14; CHECK: # %bb.0: 15; CHECK-NEXT: sqdbr %f0, %f0 16; CHECK-NEXT: br %r14 17 %res = call double @llvm.experimental.constrained.sqrt.f64( 18 double %val, 19 metadata !"round.dynamic", 20 metadata !"fpexcept.strict") #0 21 ret double %res 22} 23 24; Check the low end of the SQDB range. 25define double @f2(double *%ptr) #0 { 26; CHECK-LABEL: f2: 27; CHECK: # %bb.0: 28; CHECK-NEXT: sqdb %f0, 0(%r2) 29; CHECK-NEXT: br %r14 30 %val = load double, double *%ptr 31 %res = call double @llvm.experimental.constrained.sqrt.f64( 32 double %val, 33 metadata !"round.dynamic", 34 metadata !"fpexcept.strict") #0 35 ret double %res 36} 37 38; Check the high end of the aligned SQDB range. 39define double @f3(double *%base) #0 { 40; CHECK-LABEL: f3: 41; CHECK: # %bb.0: 42; CHECK-NEXT: sqdb %f0, 4088(%r2) 43; CHECK-NEXT: br %r14 44 %ptr = getelementptr double, double *%base, i64 511 45 %val = load double, double *%ptr 46 %res = call double @llvm.experimental.constrained.sqrt.f64( 47 double %val, 48 metadata !"round.dynamic", 49 metadata !"fpexcept.strict") #0 50 ret double %res 51} 52 53; Check the next doubleword up, which needs separate address logic. 54; Other sequences besides this one would be OK. 55define double @f4(double *%base) #0 { 56; CHECK-LABEL: f4: 57; CHECK: # %bb.0: 58; CHECK-NEXT: aghi %r2, 4096 59; CHECK-NEXT: sqdb %f0, 0(%r2) 60; CHECK-NEXT: br %r14 61 %ptr = getelementptr double, double *%base, i64 512 62 %val = load double, double *%ptr 63 %res = call double @llvm.experimental.constrained.sqrt.f64( 64 double %val, 65 metadata !"round.dynamic", 66 metadata !"fpexcept.strict") #0 67 ret double %res 68} 69 70; Check negative displacements, which also need separate address logic. 71define double @f5(double *%base) #0 { 72; CHECK-LABEL: f5: 73; CHECK: # %bb.0: 74; CHECK-NEXT: aghi %r2, -8 75; CHECK-NEXT: sqdb %f0, 0(%r2) 76; CHECK-NEXT: br %r14 77 %ptr = getelementptr double, double *%base, i64 -1 78 %val = load double, double *%ptr 79 %res = call double @llvm.experimental.constrained.sqrt.f64( 80 double %val, 81 metadata !"round.dynamic", 82 metadata !"fpexcept.strict") #0 83 ret double %res 84} 85 86; Check that SQDB allows indices. 87define double @f6(double *%base, i64 %index) #0 { 88; CHECK-LABEL: f6: 89; CHECK: # %bb.0: 90; CHECK-NEXT: sllg %r1, %r3, 3 91; CHECK-NEXT: sqdb %f0, 800(%r1,%r2) 92; CHECK-NEXT: br %r14 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( 97 double %val, 98 metadata !"round.dynamic", 99 metadata !"fpexcept.strict") #0 100 ret double %res 101} 102 103attributes #0 = { strictfp } 104