[llvm] r359592 - [AArch64] add more tests for constant folding failures; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 11:15:18 PDT 2019
Author: spatel
Date: Tue Apr 30 11:15:18 2019
New Revision: 359592
URL: http://llvm.org/viewvc/llvm-project?rev=359592&view=rev
Log:
[AArch64] add more tests for constant folding failures; NFC
Modified:
llvm/trunk/test/CodeGen/AArch64/fp-const-fold.ll
Modified: llvm/trunk/test/CodeGen/AArch64/fp-const-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/fp-const-fold.ll?rev=359592&r1=359591&r2=359592&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/fp-const-fold.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/fp-const-fold.ll Tue Apr 30 11:15:18 2019
@@ -13,6 +13,8 @@ define double @constant_fold_fdiv_by_zer
ret double %r
}
+; frem by 0.0 --> NaN
+
define double @constant_fold_frem_by_zero(double* %p) {
; CHECK-LABEL: constant_fold_frem_by_zero:
; CHECK: // %bb.0:
@@ -23,3 +25,63 @@ define double @constant_fold_frem_by_zer
%r = frem double 4.940660e-324, 0.0
ret double %r
}
+
+; Inf * 0.0 --> NaN
+
+define double @constant_fold_fmul_nan(double* %p) {
+; CHECK-LABEL: constant_fold_fmul_nan:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov x8, #9218868437227405312
+; CHECK-NEXT: fmov d0, xzr
+; CHECK-NEXT: fmov d1, x8
+; CHECK-NEXT: fmul d0, d1, d0
+; CHECK-NEXT: ret
+ %r = fmul double 0x7ff0000000000000, 0.0
+ ret double %r
+}
+
+; Inf + -Inf --> NaN
+
+define double @constant_fold_fadd_nan(double* %p) {
+; CHECK-LABEL: constant_fold_fadd_nan:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov x8, #-4503599627370496
+; CHECK-NEXT: mov x9, #9218868437227405312
+; CHECK-NEXT: fmov d0, x8
+; CHECK-NEXT: fmov d1, x9
+; CHECK-NEXT: fadd d0, d1, d0
+; CHECK-NEXT: ret
+ %r = fadd double 0x7ff0000000000000, 0xfff0000000000000
+ ret double %r
+}
+
+; Inf - Inf --> NaN
+
+define double @constant_fold_fsub_nan(double* %p) {
+; CHECK-LABEL: constant_fold_fsub_nan:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov x8, #9218868437227405312
+; CHECK-NEXT: fmov d0, x8
+; CHECK-NEXT: fsub d0, d0, d0
+; CHECK-NEXT: ret
+ %r = fsub double 0x7ff0000000000000, 0x7ff0000000000000
+ ret double %r
+}
+
+; Inf * 0.0 + ? --> NaN
+
+define double @constant_fold_fma_nan(double* %p) {
+; CHECK-LABEL: constant_fold_fma_nan:
+; CHECK: // %bb.0:
+; CHECK-NEXT: mov x8, #4631107791820423168
+; CHECK-NEXT: mov x9, #9218868437227405312
+; CHECK-NEXT: fmov d0, xzr
+; CHECK-NEXT: fmov d1, x8
+; CHECK-NEXT: fmov d2, x9
+; CHECK-NEXT: fmadd d0, d2, d0, d1
+; CHECK-NEXT: ret
+ %r = call double @llvm.fma.f64(double 0x7ff0000000000000, double 0.0, double 42.0)
+ ret double %r
+}
+
+declare double @llvm.fma.f64(double, double, double)
More information about the llvm-commits
mailing list