1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
4 ; https://bugs.llvm.org/show_bug.cgi?id=41668
6 define double @constant_fold_fdiv_by_zero(ptr %p) {
7 ; CHECK-LABEL: constant_fold_fdiv_by_zero:
9 ; CHECK-NEXT: mov x8, #9218868437227405312
10 ; CHECK-NEXT: fmov d0, x8
12 %r = fdiv double 4.940660e-324, 0.0
18 define double @constant_fold_frem_by_zero(ptr %p) {
19 ; CHECK-LABEL: constant_fold_frem_by_zero:
21 ; CHECK-NEXT: mov x8, #9221120237041090560
22 ; CHECK-NEXT: fmov d0, x8
24 %r = frem double 4.940660e-324, 0.0
30 define double @constant_fold_fmul_nan(ptr %p) {
31 ; CHECK-LABEL: constant_fold_fmul_nan:
33 ; CHECK-NEXT: mov x8, #9221120237041090560
34 ; CHECK-NEXT: fmov d0, x8
36 %r = fmul double 0x7ff0000000000000, 0.0
42 define double @constant_fold_fadd_nan(ptr %p) {
43 ; CHECK-LABEL: constant_fold_fadd_nan:
45 ; CHECK-NEXT: mov x8, #9221120237041090560
46 ; CHECK-NEXT: fmov d0, x8
48 %r = fadd double 0x7ff0000000000000, 0xfff0000000000000
54 define double @constant_fold_fsub_nan(ptr %p) {
55 ; CHECK-LABEL: constant_fold_fsub_nan:
57 ; CHECK-NEXT: mov x8, #9221120237041090560
58 ; CHECK-NEXT: fmov d0, x8
60 %r = fsub double 0x7ff0000000000000, 0x7ff0000000000000
64 ; Inf * 0.0 + ? --> NaN
66 define double @constant_fold_fma_nan(ptr %p) {
67 ; CHECK-LABEL: constant_fold_fma_nan:
69 ; CHECK-NEXT: mov x8, #9221120237041090560
70 ; CHECK-NEXT: fmov d0, x8
72 %r = call double @llvm.fma.f64(double 0x7ff0000000000000, double 0.0, double 42.0)
76 define double @fdiv_nnan_nan_op0(double %x) {
77 ; CHECK-LABEL: fdiv_nnan_nan_op0:
80 %r = fdiv nnan double 0xfff8000000000000, %x
84 define double @fmul_nnan_nan_op1(double %x) {
85 ; CHECK-LABEL: fmul_nnan_nan_op1:
88 %r = fmul nnan double %x, 0x7ff8000000000000
92 ; Negative test - nan is ok.
93 ; TODO: Should simplify to nan.
95 define double @fdiv_ninf_nan_op0(double %x) {
96 ; CHECK-LABEL: fdiv_ninf_nan_op0:
98 ; CHECK-NEXT: mov x8, #-2251799813685248
99 ; CHECK-NEXT: fmov d1, x8
100 ; CHECK-NEXT: fdiv d0, d1, d0
102 %r = fdiv ninf double 0xfff8000000000000, %x
106 ; Negative test - nan is ok.
107 ; TODO: Should simplify to nan.
109 define double @fadd_ninf_nan_op1(double %x) {
110 ; CHECK-LABEL: fadd_ninf_nan_op1:
112 ; CHECK-NEXT: mov x8, #9221120237041090560
113 ; CHECK-NEXT: fmov d1, x8
114 ; CHECK-NEXT: fadd d0, d0, d1
116 %r = fadd ninf double %x, 0x7ff8000000000000
120 define double @fdiv_ninf_inf_op0(double %x) {
121 ; CHECK-LABEL: fdiv_ninf_inf_op0:
124 %r = fdiv ninf double 0x7ff0000000000000, %x
128 define double @fadd_ninf_inf_op1(double %x) {
129 ; CHECK-LABEL: fadd_ninf_inf_op1:
132 %r = fadd ninf double %x, 0xfff0000000000000
136 ; Negative test - inf is ok.
137 ; TODO: Should simplify to inf.
139 define double @fsub_nnan_inf_op0(double %x) {
140 ; CHECK-LABEL: fsub_nnan_inf_op0:
142 ; CHECK-NEXT: mov x8, #9218868437227405312
143 ; CHECK-NEXT: fmov d1, x8
144 ; CHECK-NEXT: fsub d0, d1, d0
146 %r = fsub nnan double 0x7ff0000000000000, %x
150 ; Negative test - inf is ok.
151 ; TODO: Should simplify to -inf.
153 define double @fmul_nnan_inf_op1(double %x) {
154 ; CHECK-LABEL: fmul_nnan_inf_op1:
156 ; CHECK-NEXT: mov x8, #-4503599627370496
157 ; CHECK-NEXT: fmov d1, x8
158 ; CHECK-NEXT: fmul d0, d0, d1
160 %r = fmul nnan double %x, 0xfff0000000000000
164 define double @fdiv_nnan_undef_op0(double %x) {
165 ; CHECK-LABEL: fdiv_nnan_undef_op0:
168 %r = fdiv nnan double undef, %x
172 define double @fdiv_nnan_undef_op1(double %x) {
173 ; CHECK-LABEL: fdiv_nnan_undef_op1:
176 %r = fdiv nnan double %x, undef
180 define double @fdiv_ninf_undef_op0(double %x) {
181 ; CHECK-LABEL: fdiv_ninf_undef_op0:
184 %r = fdiv ninf double undef, %x
188 define double @fdiv_ninf_undef_op1(double %x) {
189 ; CHECK-LABEL: fdiv_ninf_undef_op1:
192 %r = fdiv ninf double %x, undef
196 declare double @llvm.fma.f64(double, double, double)