[llvm] 7ff67d5 - [AArch64] Rewrite floatdp_1source.ll test. NFC

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 15:01:02 PDT 2021


Author: David Green
Date: 2021-09-08T23:00:34+01:00
New Revision: 7ff67d5bf8d049b368625b6fe06c50aedc222939

URL: https://github.com/llvm/llvm-project/commit/7ff67d5bf8d049b368625b6fe06c50aedc222939
DIFF: https://github.com/llvm/llvm-project/commit/7ff67d5bf8d049b368625b6fe06c50aedc222939.diff

LOG: [AArch64] Rewrite floatdp_1source.ll test. NFC

Rewrite this test to not rely on volatile stores in a large function,
just use separate functions like any other test would.

Added: 
    

Modified: 
    llvm/test/CodeGen/AArch64/floatdp_1source.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/floatdp_1source.ll b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
index ec7d32dbfae63..1c37f7045342f 100644
--- a/llvm/test/CodeGen/AArch64/floatdp_1source.ll
+++ b/llvm/test/CodeGen/AArch64/floatdp_1source.ll
@@ -1,9 +1,6 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
 
- at varhalf = global half 0.0
- at varfloat = global float 0.0
- at vardouble = global double 0.0
-
 declare float @fabsf(float) readonly
 declare double @fabs(double) readonly
 
@@ -25,114 +22,200 @@ declare double @rint(double) readonly
 declare float @nearbyintf(float) readonly
 declare double @nearbyint(double) readonly
 
-define void @simple_float() {
-; CHECK-LABEL: simple_float:
-  %val1 = load volatile float, float* @varfloat
-
-  %valabs = call float @fabsf(float %val1)
-  store volatile float %valabs, float* @varfloat
-; CHECK: fabs {{s[0-9]+}}, {{s[0-9]+}}
-
-  %valneg = fsub float -0.0, %val1
-  store volatile float %valneg, float* @varfloat
-; CHECK: fneg {{s[0-9]+}}, {{s[0-9]+}}
-
-  %valsqrt = call float @llvm.sqrt.f32(float %val1)
-  store volatile float %valsqrt, float* @varfloat
-; CHECK: fsqrt {{s[0-9]+}}, {{s[0-9]+}}
-
-  %valceil = call float @ceilf(float %val1)
-  store volatile float %valceil, float* @varfloat
-; CHECK: frintp {{s[0-9]+}}, {{s[0-9]+}}
-
-  %valfloor = call float @floorf(float %val1)
-  store volatile float %valfloor, float* @varfloat
-; CHECK: frintm {{s[0-9]+}}, {{s[0-9]+}}
-
-  %valtrunc = call float @truncf(float %val1)
-  store volatile float %valtrunc, float* @varfloat
-; CHECK: frintz {{s[0-9]+}}, {{s[0-9]+}}
-
-  %valrint = call float @rintf(float %val1)
-  store volatile float %valrint, float* @varfloat
-; CHECK: frintx {{s[0-9]+}}, {{s[0-9]+}}
+define float @fabs_f(float %v) {
+; CHECK-LABEL: fabs_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fabs s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @fabsf(float %v)
+  ret float %r
+}
 
-  %valnearbyint = call float @nearbyintf(float %val1)
-  store volatile float %valnearbyint, float* @varfloat
-; CHECK: frinti {{s[0-9]+}}, {{s[0-9]+}}
+define float @fsub_f(float %v) {
+; CHECK-LABEL: fsub_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fneg s0, s0
+; CHECK-NEXT:    ret
+  %r = fsub float -0.0, %v
+  ret float %r
+}
 
-  ret void
+define float @sqrt_f(float %v) {
+; CHECK-LABEL: sqrt_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fsqrt s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @llvm.sqrt.f32(float %v)
+  ret float %r
 }
 
-define void @simple_double() {
-; CHECK-LABEL: simple_double:
-  %val1 = load volatile double, double* @vardouble
+define float @ceil_f(float %v) {
+; CHECK-LABEL: ceil_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintp s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @ceilf(float %v)
+  ret float %r
+}
 
-  %valabs = call double @fabs(double %val1)
-  store volatile double %valabs, double* @vardouble
-; CHECK: fabs {{d[0-9]+}}, {{d[0-9]+}}
+define float @floor_f(float %v) {
+; CHECK-LABEL: floor_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintm s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @floorf(float %v)
+  ret float %r
+}
 
-  %valneg = fsub double -0.0, %val1
-  store volatile double %valneg, double* @vardouble
-; CHECK: fneg {{d[0-9]+}}, {{d[0-9]+}}
+define float @trunc_f(float %v) {
+; CHECK-LABEL: trunc_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintz s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @truncf(float %v)
+  ret float %r
+}
 
-  %valsqrt = call double @llvm.sqrt.f64(double %val1)
-  store volatile double %valsqrt, double* @vardouble
-; CHECK: fsqrt {{d[0-9]+}}, {{d[0-9]+}}
+define float @rint_f(float %v) {
+; CHECK-LABEL: rint_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintx s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @rintf(float %v)
+  ret float %r
+}
 
-  %valceil = call double @ceil(double %val1)
-  store volatile double %valceil, double* @vardouble
-; CHECK: frintp {{d[0-9]+}}, {{d[0-9]+}}
+define float @nearbyint_f(float %v) {
+; CHECK-LABEL: nearbyint_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frinti s0, s0
+; CHECK-NEXT:    ret
+  %r = call float @nearbyintf(float %v)
+  ret float %r
+}
 
-  %valfloor = call double @floor(double %val1)
-  store volatile double %valfloor, double* @vardouble
-; CHECK: frintm {{d[0-9]+}}, {{d[0-9]+}}
+define double @fabs_d(double %v) {
+; CHECK-LABEL: fabs_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fabs d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @fabs(double %v)
+  ret double %r
+}
 
-  %valtrunc = call double @trunc(double %val1)
-  store volatile double %valtrunc, double* @vardouble
-; CHECK: frintz {{d[0-9]+}}, {{d[0-9]+}}
+define double @fsub_d(double %v) {
+; CHECK-LABEL: fsub_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fneg d0, d0
+; CHECK-NEXT:    ret
+  %r = fsub double -0.0, %v
+  ret double %r
+}
 
-  %valrint = call double @rint(double %val1)
-  store volatile double %valrint, double* @vardouble
-; CHECK: frintx {{d[0-9]+}}, {{d[0-9]+}}
+define double @sqrt_d(double %v) {
+; CHECK-LABEL: sqrt_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fsqrt d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @llvm.sqrt.f64(double %v)
+  ret double %r
+}
 
-  %valnearbyint = call double @nearbyint(double %val1)
-  store volatile double %valnearbyint, double* @vardouble
-; CHECK: frinti {{d[0-9]+}}, {{d[0-9]+}}
+define double @ceil_d(double %v) {
+; CHECK-LABEL: ceil_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintp d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @ceil(double %v)
+  ret double %r
+}
 
-  ret void
+define double @floor_d(double %v) {
+; CHECK-LABEL: floor_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintm d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @floor(double %v)
+  ret double %r
 }
 
-define void @converts() {
-; CHECK-LABEL: converts:
+define double @trunc_d(double %v) {
+; CHECK-LABEL: trunc_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintz d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @trunc(double %v)
+  ret double %r
+}
 
-  %val16 = load volatile half, half* @varhalf
-  %val32 = load volatile float, float* @varfloat
-  %val64 = load volatile double, double* @vardouble
+define double @rint_d(double %v) {
+; CHECK-LABEL: rint_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frintx d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @rint(double %v)
+  ret double %r
+}
 
-  %val16to32 = fpext half %val16 to float
-  store volatile float %val16to32, float* @varfloat
-; CHECK: fcvt {{s[0-9]+}}, {{h[0-9]+}}
+define double @nearbyint_d(double %v) {
+; CHECK-LABEL: nearbyint_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    frinti d0, d0
+; CHECK-NEXT:    ret
+  %r = call double @nearbyint(double %v)
+  ret double %r
+}
 
-  %val16to64 = fpext half %val16 to double
-  store volatile double %val16to64, double* @vardouble
-; CHECK: fcvt {{d[0-9]+}}, {{h[0-9]+}}
+define float @conv_h_f(half %v) {
+; CHECK-LABEL: conv_h_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fcvt s0, h0
+; CHECK-NEXT:    ret
+  %r = fpext half %v to float
+  ret float %r
+}
 
-  %val32to16 = fptrunc float %val32 to half
-  store volatile half %val32to16, half* @varhalf
-; CHECK: fcvt {{h[0-9]+}}, {{s[0-9]+}}
+define double @conv_h_d(half %v) {
+; CHECK-LABEL: conv_h_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fcvt d0, h0
+; CHECK-NEXT:    ret
+  %r = fpext half %v to double
+  ret double %r
+}
 
-  %val32to64 = fpext float %val32 to double
-  store volatile double %val32to64, double* @vardouble
-; CHECK: fcvt {{d[0-9]+}}, {{s[0-9]+}}
+define half @conv_f_h(float %v) {
+; CHECK-LABEL: conv_f_h:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fcvt h0, s0
+; CHECK-NEXT:    ret
+  %r = fptrunc float %v to half
+  ret half %r
+}
 
-  %val64to16 = fptrunc double %val64 to half
-  store volatile half %val64to16, half* @varhalf
-; CHECK: fcvt {{h[0-9]+}}, {{d[0-9]+}}
+define double @conv_f_d(float %v) {
+; CHECK-LABEL: conv_f_d:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fcvt d0, s0
+; CHECK-NEXT:    ret
+  %r = fpext float %v to double
+  ret double %r
+}
 
-  %val64to32 = fptrunc double %val64 to float
-  store volatile float %val64to32, float* @varfloat
-; CHECK: fcvt {{s[0-9]+}}, {{d[0-9]+}}
+define half @conv_d_h(double %v) {
+; CHECK-LABEL: conv_d_h:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fcvt h0, d0
+; CHECK-NEXT:    ret
+  %r = fptrunc double %v to half
+  ret half %r
+}
 
-  ret void
+define float @conv_d_f(double %v) {
+; CHECK-LABEL: conv_d_f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    fcvt s0, d0
+; CHECK-NEXT:    ret
+  %r = fptrunc double %v to float
+  ret float %r
 }


        


More information about the llvm-commits mailing list