[llvm] b794d72 - [InstSimplify] add tests for fmul with 0.0 operand; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 07:39:18 PDT 2022


Author: Sanjay Patel
Date: 2022-10-04T10:29:53-04:00
New Revision: b794d72bf4eaba541c398fc67adfdd9775995a6a

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

LOG: [InstSimplify] add tests for fmul with 0.0 operand; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
index be84594e72027..3b7bfef9606b0 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
@@ -170,6 +170,65 @@ define double @fmul_X_1(double %a) {
   ret double %b
 }
 
+define half @fmul_nnan_ninf_nneg_0.0(i15 %x) {
+; CHECK-LABEL: @fmul_nnan_ninf_nneg_0.0(
+; CHECK-NEXT:    [[F:%.*]] = uitofp i15 [[X:%.*]] to half
+; CHECK-NEXT:    [[R:%.*]] = fmul half [[F]], 0xH0000
+; CHECK-NEXT:    ret half [[R]]
+;
+  %f = uitofp i15 %x to half
+  %r = fmul half %f, 0.0
+  ret half %r
+}
+
+define half @fmul_nnan_ninf_nneg_n0.0(i15 %x) {
+; CHECK-LABEL: @fmul_nnan_ninf_nneg_n0.0(
+; CHECK-NEXT:    [[F:%.*]] = uitofp i15 [[X:%.*]] to half
+; CHECK-NEXT:    [[R:%.*]] = fmul half [[F]], 0xH8000
+; CHECK-NEXT:    ret half [[R]]
+;
+  %f = uitofp i15 %x to half
+  %r = fmul half %f, -0.0
+  ret half %r
+}
+
+define half @fmul_nnan_nneg_0.0(i16 %x) {
+; CHECK-LABEL: @fmul_nnan_nneg_0.0(
+; CHECK-NEXT:    [[F:%.*]] = uitofp i16 [[X:%.*]] to half
+; CHECK-NEXT:    [[R:%.*]] = fmul half [[F]], 0xH0000
+; CHECK-NEXT:    ret half [[R]]
+;
+  %f = uitofp i16 %x to half
+  %r = fmul half %f, 0.0
+  ret half %r
+}
+
+define double @fmul_nnan_ninf_nneg_n0.0_commute(i127 %x) {
+; CHECK-LABEL: @fmul_nnan_ninf_nneg_n0.0_commute(
+; CHECK-NEXT:    [[F:%.*]] = uitofp i127 [[X:%.*]] to float
+; CHECK-NEXT:    [[E:%.*]] = fpext float [[F]] to double
+; CHECK-NEXT:    [[R:%.*]] = fmul double -0.000000e+00, [[E]]
+; CHECK-NEXT:    ret double [[R]]
+;
+  %f = uitofp i127 %x to float
+  %e = fpext float %f to double
+  %r = fmul double -0.0, %e
+  ret double %r
+}
+
+define double @fmul_nnan_ninf_nneg_0.0_commute(i128 %x) {
+; CHECK-LABEL: @fmul_nnan_ninf_nneg_0.0_commute(
+; CHECK-NEXT:    [[F:%.*]] = uitofp i128 [[X:%.*]] to float
+; CHECK-NEXT:    [[E:%.*]] = fpext float [[F]] to double
+; CHECK-NEXT:    [[R:%.*]] = fmul double 0.000000e+00, [[E]]
+; CHECK-NEXT:    ret double [[R]]
+;
+  %f = uitofp i128 %x to float
+  %e = fpext float %f to double
+  %r = fmul double 0.0, %e
+  ret double %r
+}
+
 ; PR2642
 define <4 x float> @fmul_X_1_vec(<4 x float> %x) {
 ; CHECK-LABEL: @fmul_X_1_vec(


        


More information about the llvm-commits mailing list