1 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s --check-prefix=X86
2 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple x86_64-pc-win64 -o - | FileCheck %s --check-prefix=X86
3 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple i686-unknown-unknown -o - | FileCheck %s --check-prefix=X86
4 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple powerpc-unknown-unknown -o - | FileCheck %s --check-prefix=PPC
5 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple armv7-none-linux-gnueabi -o - | FileCheck %s --check-prefix=ARM
6 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple armv7-none-linux-gnueabihf -o - | FileCheck %s --check-prefix=ARMHF
7 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple thumbv7k-apple-watchos2.0 -o - -target-abi aapcs16 | FileCheck %s --check-prefix=ARM7K
8 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple aarch64-unknown-unknown -ffast-math -ffp-contract=fast -complex-range=improved -o - | FileCheck %s --check-prefix=AARCH64-FASTMATH
9 // RUN: %clang_cc1 %s -O0 -emit-llvm -triple spir -o - | FileCheck %s --check-prefix=SPIR
11 float _Complex
add_float_rr(float a
, float b
) {
12 // X86-LABEL: @add_float_rr(
18 float _Complex
add_float_cr(float _Complex a
, float b
) {
19 // X86-LABEL: @add_float_cr(
25 float _Complex
add_float_rc(float a
, float _Complex b
) {
26 // X86-LABEL: @add_float_rc(
32 float _Complex
add_float_cc(float _Complex a
, float _Complex b
) {
33 // X86-LABEL: @add_float_cc(
41 float _Complex
sub_float_rr(float a
, float b
) {
42 // X86-LABEL: @sub_float_rr(
48 float _Complex
sub_float_cr(float _Complex a
, float b
) {
49 // X86-LABEL: @sub_float_cr(
55 float _Complex
sub_float_rc(float a
, float _Complex b
) {
56 // X86-LABEL: @sub_float_rc(
63 float _Complex
sub_float_cc(float _Complex a
, float _Complex b
) {
64 // X86-LABEL: @sub_float_cc(
72 float _Complex
mul_float_rr(float a
, float b
) {
73 // X86-LABEL: @mul_float_rr(
79 float _Complex
mul_float_cr(float _Complex a
, float b
) {
80 // X86-LABEL: @mul_float_cr(
87 float _Complex
mul_float_rc(float a
, float _Complex b
) {
88 // X86-LABEL: @mul_float_rc(
96 float _Complex
mul_float_cc(float _Complex a
, float _Complex b
) {
97 // X86-LABEL: @mul_float_cc(
98 // X86: %[[AC:[^ ]+]] = fmul
99 // X86: %[[BD:[^ ]+]] = fmul
100 // X86: %[[AD:[^ ]+]] = fmul
101 // X86: %[[BC:[^ ]+]] = fmul
102 // X86: %[[RR:[^ ]+]] = fsub
103 // X86: %[[RI:[^ ]+]] = fadd
107 // X86: fcmp uno float %[[RR]]
108 // X86: fcmp uno float %[[RI]]
109 // X86: call {{.*}} @__mulsc3(
111 // SPIR: call spir_func {{.*}} @__mulsc3(
115 float _Complex
div_float_rr(float a
, float b
) {
116 // X86-LABEL: @div_float_rr(
122 float _Complex
div_float_cr(float _Complex a
, float b
) {
123 // X86-LABEL: @div_float_cr(
130 float _Complex
div_float_rc(float a
, float _Complex b
) {
131 // X86-LABEL: @div_float_rc(
133 // X86: call {{.*}} @__divsc3(
136 // SPIR: call spir_func {{.*}} @__divsc3(
138 // a / b = (A+iB) / (C+iD) = (E+iF)
142 // E = (A+B*DdC)/CpRD
143 // F = (B-A*DdC)/CpRD
147 // E = (A*CdD+B)/DpRC
148 // F = (B*CdD-A)/DpRC
149 // AARCH64-FASTMATH-LABEL: @div_float_rc(float noundef nofpclass(nan inf) %a, [2 x float] noundef nofpclass(nan inf) alignstack(8) %b.coerce)
151 // AARCH64-FASTMATH: call {{.*}}float @llvm.fabs.f32(float {{.*}})
153 // AARCH64-FASTMATH-NEXT: call {{.*}}float @llvm.fabs.f32(float {{.*}})
154 // AARCH64-FASTMATH-NEXT: fcmp {{.*}}ugt float
155 // AARCH64-FASTMATH-NEXT: br i1 {{.*}}, label
156 // AARCH64-FASTMATH: abs_rhsr_greater_or_equal_abs_rhsi:
160 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
163 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
164 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
167 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
168 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
169 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
172 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
173 // AARCH64-FASTMATH-NEXT: fsub {{.*}}float
174 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
175 // AARCH64-FASTMATH-NEXT: br label
176 // AARCH64-FASTMATH: abs_rhsr_less_than_abs_rhsi:
180 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
183 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
184 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
187 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
188 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
189 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
192 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
193 // AARCH64-FASTMATH-NEXT: fsub {{.*}}float
194 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
196 // AARCH64-FASTMATH-NEXT: br label
197 // AARCH64-FASTMATH: complex_div:
198 // AARCH64-FASTMATH-NEXT: phi {{.*}}float
199 // AARCH64-FASTMATH-NEXT: phi {{.*}}float
200 // AARCH64-FASTMATH: ret
203 float _Complex
div_float_cc(float _Complex a
, float _Complex b
) {
204 // X86-LABEL: @div_float_cc(
206 // X86: call {{.*}} @__divsc3(
209 // SPIR: call spir_func {{.*}} @__divsc3(
211 // a / b = (A+iB) / (C+iD) = (E+iF)
215 // E = (A+B*DdC)/CpRD
216 // F = (B-A*DdC)/CpRD
220 // E = (A*CdD+B)/DpRC
221 // F = (B*CdD-A)/DpRC
222 // AARCH64-FASTMATH-LABEL: @div_float_cc([2 x float] noundef nofpclass(nan inf) alignstack(8) %a.coerce, [2 x float] noundef nofpclass(nan inf) alignstack(8) %b.coerce)
224 // AARCH64-FASTMATH: call {{.*}}float @llvm.fabs.f32(float {{.*}})
226 // AARCH64-FASTMATH-NEXT: call {{.*}}float @llvm.fabs.f32(float {{.*}})
227 // AARCH64-FASTMATH-NEXT: fcmp {{.*}}ugt float
228 // AARCH64-FASTMATH-NEXT: br i1 {{.*}}, label
229 // AARCH64-FASTMATH: abs_rhsr_greater_or_equal_abs_rhsi:
233 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
236 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
237 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
240 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
241 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
242 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
245 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
246 // AARCH64-FASTMATH-NEXT: fsub {{.*}}float
247 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
248 // AARCH64-FASTMATH-NEXT: br label
249 // AARCH64-FASTMATH: abs_rhsr_less_than_abs_rhsi:
253 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
256 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
257 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
260 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
261 // AARCH64-FASTMATH-NEXT: fadd {{.*}}float
262 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
265 // AARCH64-FASTMATH-NEXT: fmul {{.*}}float
266 // AARCH64-FASTMATH-NEXT: fsub {{.*}}float
267 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}float
269 // AARCH64-FASTMATH-NEXT: br label
270 // AARCH64-FASTMATH: complex_div:
271 // AARCH64-FASTMATH-NEXT: phi {{.*}}float
272 // AARCH64-FASTMATH-NEXT: phi {{.*}}float
276 double _Complex
add_double_rr(double a
, double b
) {
277 // X86-LABEL: @add_double_rr(
283 double _Complex
add_double_cr(double _Complex a
, double b
) {
284 // X86-LABEL: @add_double_cr(
290 double _Complex
add_double_rc(double a
, double _Complex b
) {
291 // X86-LABEL: @add_double_rc(
297 double _Complex
add_double_cc(double _Complex a
, double _Complex b
) {
298 // X86-LABEL: @add_double_cc(
306 double _Complex
sub_double_rr(double a
, double b
) {
307 // X86-LABEL: @sub_double_rr(
313 double _Complex
sub_double_cr(double _Complex a
, double b
) {
314 // X86-LABEL: @sub_double_cr(
320 double _Complex
sub_double_rc(double a
, double _Complex b
) {
321 // X86-LABEL: @sub_double_rc(
328 double _Complex
sub_double_cc(double _Complex a
, double _Complex b
) {
329 // X86-LABEL: @sub_double_cc(
337 double _Complex
mul_double_rr(double a
, double b
) {
338 // X86-LABEL: @mul_double_rr(
344 double _Complex
mul_double_cr(double _Complex a
, double b
) {
345 // X86-LABEL: @mul_double_cr(
352 double _Complex
mul_double_rc(double a
, double _Complex b
) {
353 // X86-LABEL: @mul_double_rc(
360 double _Complex
mul_double_cc(double _Complex a
, double _Complex b
) {
361 // X86-LABEL: @mul_double_cc(
362 // X86: %[[AC:[^ ]+]] = fmul
363 // X86: %[[BD:[^ ]+]] = fmul
364 // X86: %[[AD:[^ ]+]] = fmul
365 // X86: %[[BC:[^ ]+]] = fmul
366 // X86: %[[RR:[^ ]+]] = fsub double %[[AC]], %[[BD]]
367 // X86: %[[RI:[^ ]+]] = fadd double
371 // X86: fcmp uno double %[[RR]]
372 // X86: fcmp uno double %[[RI]]
373 // X86: call {{.*}} @__muldc3(
376 // SPIR: call spir_func {{.*}} @__muldc3(
380 double _Complex
div_double_rr(double a
, double b
) {
381 // X86-LABEL: @div_double_rr(
387 double _Complex
div_double_cr(double _Complex a
, double b
) {
388 // X86-LABEL: @div_double_cr(
395 double _Complex
div_double_rc(double a
, double _Complex b
) {
396 // X86-LABEL: @div_double_rc(
398 // X86: call {{.*}} @__divdc3(
401 // SPIR: call spir_func {{.*}} @__divdc3(
403 // a / b = (A+iB) / (C+iD) = (E+iF)
407 // E = (A+B*DdC)/CpRD
408 // F = (B-A*DdC)/CpRD
412 // E = (A*CdD+B)/DpRC
413 // F = (B*CdD-A)/DpRC
414 // AARCH64-FASTMATH-LABEL: @div_double_rc(double noundef nofpclass(nan inf) %a, [2 x double] noundef nofpclass(nan inf) alignstack(8) %b.coerce)
416 // AARCH64-FASTMATH: call {{.*}}double @llvm.fabs.f64(double {{.*}})
418 // AARCH64-FASTMATH-NEXT: call {{.*}}double @llvm.fabs.f64(double {{.*}})
419 // AARCH64-FASTMATH-NEXT: fcmp {{.*}}ugt double
420 // AARCH64-FASTMATH-NEXT: br i1 {{.*}}, label
421 // AARCH64-FASTMATH: abs_rhsr_greater_or_equal_abs_rhsi:
425 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
428 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
429 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
432 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
433 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
434 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
437 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
438 // AARCH64-FASTMATH-NEXT: fsub {{.*}}double
439 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
440 // AARCH64-FASTMATH-NEXT: br label
441 // AARCH64-FASTMATH: abs_rhsr_less_than_abs_rhsi:
445 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
448 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
449 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
452 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
453 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
454 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
457 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
458 // AARCH64-FASTMATH-NEXT: fsub {{.*}}double
459 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
461 // AARCH64-FASTMATH-NEXT: br label
462 // AARCH64-FASTMATH: complex_div:
463 // AARCH64-FASTMATH-NEXT: phi {{.*}}double
464 // AARCH64-FASTMATH-NEXT: phi {{.*}}double
465 // AARCH64-FASTMATH: ret
468 double _Complex
div_double_cc(double _Complex a
, double _Complex b
) {
469 // X86-LABEL: @div_double_cc(
471 // X86: call {{.*}} @__divdc3(
474 // SPIR: call spir_func {{.*}} @__divdc3(
476 // a / b = (A+iB) / (C+iD) = (E+iF)
480 // E = (A+B*DdC)/CpRD
481 // F = (B-A*DdC)/CpRD
485 // E = (A*CdD+B)/DpRC
486 // F = (B*CdD-A)/DpRC
487 // AARCH64-FASTMATH-LABEL: @div_double_cc([2 x double] noundef nofpclass(nan inf) alignstack(8) %a.coerce, [2 x double] noundef nofpclass(nan inf) alignstack(8) %b.coerce)
489 // AARCH64-FASTMATH: call {{.*}}double @llvm.fabs.f64(double {{.*}})
491 // AARCH64-FASTMATH-NEXT: call {{.*}}double @llvm.fabs.f64(double {{.*}})
492 // AARCH64-FASTMATH-NEXT: fcmp {{.*}}ugt double
493 // AARCH64-FASTMATH-NEXT: br i1 {{.*}}, label
494 // AARCH64-FASTMATH: abs_rhsr_greater_or_equal_abs_rhsi:
498 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
501 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
502 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
505 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
506 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
507 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
510 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
511 // AARCH64-FASTMATH-NEXT: fsub {{.*}}double
512 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
513 // AARCH64-FASTMATH-NEXT: br label
514 // AARCH64-FASTMATH: abs_rhsr_less_than_abs_rhsi:
518 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
521 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
522 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
525 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
526 // AARCH64-FASTMATH-NEXT: fadd {{.*}}double
527 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
530 // AARCH64-FASTMATH-NEXT: fmul {{.*}}double
531 // AARCH64-FASTMATH-NEXT: fsub {{.*}}double
532 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}double
534 // AARCH64-FASTMATH-NEXT: br label
535 // AARCH64-FASTMATH: complex_div:
536 // AARCH64-FASTMATH-NEXT: phi {{.*}}double
537 // AARCH64-FASTMATH-NEXT: phi {{.*}}double
538 // AARCH64-FASTMATH: ret
542 long double _Complex
add_long_double_rr(long double a
, long double b
) {
543 // X86-LABEL: @add_long_double_rr(
549 long double _Complex
add_long_double_cr(long double _Complex a
, long double b
) {
550 // X86-LABEL: @add_long_double_cr(
556 long double _Complex
add_long_double_rc(long double a
, long double _Complex b
) {
557 // X86-LABEL: @add_long_double_rc(
563 long double _Complex
add_long_double_cc(long double _Complex a
, long double _Complex b
) {
564 // X86-LABEL: @add_long_double_cc(
572 long double _Complex
sub_long_double_rr(long double a
, long double b
) {
573 // X86-LABEL: @sub_long_double_rr(
579 long double _Complex
sub_long_double_cr(long double _Complex a
, long double b
) {
580 // X86-LABEL: @sub_long_double_cr(
586 long double _Complex
sub_long_double_rc(long double a
, long double _Complex b
) {
587 // X86-LABEL: @sub_long_double_rc(
594 long double _Complex
sub_long_double_cc(long double _Complex a
, long double _Complex b
) {
595 // X86-LABEL: @sub_long_double_cc(
603 long double _Complex
mul_long_double_rr(long double a
, long double b
) {
604 // X86-LABEL: @mul_long_double_rr(
610 long double _Complex
mul_long_double_cr(long double _Complex a
, long double b
) {
611 // X86-LABEL: @mul_long_double_cr(
618 long double _Complex
mul_long_double_rc(long double a
, long double _Complex b
) {
619 // X86-LABEL: @mul_long_double_rc(
626 long double _Complex
mul_long_double_cc(long double _Complex a
, long double _Complex b
) {
627 // X86-LABEL: @mul_long_double_cc(
628 // X86: %[[AC:[^ ]+]] = fmul
629 // X86: %[[BD:[^ ]+]] = fmul
630 // X86: %[[AD:[^ ]+]] = fmul
631 // X86: %[[BC:[^ ]+]] = fmul
632 // X86: %[[RR:[^ ]+]] = fsub x86_fp80 %[[AC]], %[[BD]]
633 // X86: %[[RI:[^ ]+]] = fadd x86_fp80
637 // X86: fcmp uno x86_fp80 %[[RR]]
638 // X86: fcmp uno x86_fp80 %[[RI]]
639 // X86: call {{.*}} @__mulxc3(
641 // PPC-LABEL: @mul_long_double_cc(
642 // PPC: %[[AC:[^ ]+]] = fmul
643 // PPC: %[[BD:[^ ]+]] = fmul
644 // PPC: %[[AD:[^ ]+]] = fmul
645 // PPC: %[[BC:[^ ]+]] = fmul
646 // PPC: %[[RR:[^ ]+]] = fsub ppc_fp128 %[[AC]], %[[BD]]
647 // PPC: %[[RI:[^ ]+]] = fadd ppc_fp128
651 // PPC: fcmp uno ppc_fp128 %[[RR]]
652 // PPC: fcmp uno ppc_fp128 %[[RI]]
653 // PPC: call {{.*}} @__multc3(
655 // SPIR: call spir_func {{.*}} @__muldc3(
659 long double _Complex
div_long_double_rr(long double a
, long double b
) {
660 // X86-LABEL: @div_long_double_rr(
666 long double _Complex
div_long_double_cr(long double _Complex a
, long double b
) {
667 // X86-LABEL: @div_long_double_cr(
674 long double _Complex
div_long_double_rc(long double a
, long double _Complex b
) {
675 // X86-LABEL: @div_long_double_rc(
677 // X86: call {{.*}} @__divxc3(
679 // PPC-LABEL: @div_long_double_rc(
681 // PPC: call {{.*}} @__divtc3(
683 // SPIR: call spir_func {{.*}} @__divdc3(
685 // a / b = (A+iB) / (C+iD) = (E+iF)
689 // E = (A+B*DdC)/CpRD
690 // F = (B-A*DdC)/CpRD
694 // E = (A*CdD+B)/DpRC
695 // F = (B*CdD-A)/DpRC
696 // AARCH64-FASTMATH-LABEL: @div_long_double_rc(fp128 noundef nofpclass(nan inf) %a, [2 x fp128] noundef nofpclass(nan inf) alignstack(16) %b.coerce)
698 // AARCH64-FASTMATH: call {{.*}}fp128 @llvm.fabs.f128(fp128 {{.*}})
700 // AARCH64-FASTMATH-NEXT: call {{.*}}fp128 @llvm.fabs.f128(fp128 {{.*}})
701 // AARCH64-FASTMATH-NEXT: fcmp {{.*}}ugt fp128
702 // AARCH64-FASTMATH-NEXT: br i1 {{.*}}, label
703 // AARCH64-FASTMATH: abs_rhsr_greater_or_equal_abs_rhsi:
707 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
710 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
711 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
714 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
715 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
716 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
719 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
720 // AARCH64-FASTMATH-NEXT: fsub {{.*}}fp128
721 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
722 // AARCH64-FASTMATH-NEXT: br label
723 // AARCH64-FASTMATH: abs_rhsr_less_than_abs_rhsi:
727 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
730 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
731 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
734 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
735 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
736 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
739 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
740 // AARCH64-FASTMATH-NEXT: fsub {{.*}}fp128
741 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
743 // AARCH64-FASTMATH-NEXT: br label
744 // AARCH64-FASTMATH: complex_div:
745 // AARCH64-FASTMATH-NEXT: phi {{.*}}fp128
746 // AARCH64-FASTMATH-NEXT: phi {{.*}}fp128
747 // AARCH64-FASTMATH: ret
750 long double _Complex
div_long_double_cc(long double _Complex a
, long double _Complex b
) {
751 // X86-LABEL: @div_long_double_cc(
753 // X86: call {{.*}} @__divxc3(
755 // PPC-LABEL: @div_long_double_cc(
757 // PPC: call {{.*}} @__divtc3(
759 // SPIR: call spir_func {{.*}} @__divdc3(
761 // a / b = (A+iB) / (C+iD) = (E+iF)
765 // E = (A+B*DdC)/CpRD
766 // F = (B-A*DdC)/CpRD
770 // E = (A*CdD+B)/DpRC
771 // F = (B*CdD-A)/DpRC
772 // AARCH64-FASTMATH-LABEL: @div_long_double_cc([2 x fp128] noundef nofpclass(nan inf) alignstack(16) %a.coerce, [2 x fp128] noundef nofpclass(nan inf) alignstack(16) %b.coerce)
774 // AARCH64-FASTMATH: call {{.*}}fp128 @llvm.fabs.f128(fp128 {{.*}})
776 // AARCH64-FASTMATH-NEXT: call {{.*}}fp128 @llvm.fabs.f128(fp128 {{.*}})
777 // AARCH64-FASTMATH-NEXT: fcmp {{.*}}ugt fp128
778 // AARCH64-FASTMATH-NEXT: br i1 {{.*}}, label
779 // AARCH64-FASTMATH: abs_rhsr_greater_or_equal_abs_rhsi:
783 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
786 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
787 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
790 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
791 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
792 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
795 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
796 // AARCH64-FASTMATH-NEXT: fsub {{.*}}fp128
797 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
798 // AARCH64-FASTMATH-NEXT: br label
799 // AARCH64-FASTMATH: abs_rhsr_less_than_abs_rhsi:
803 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
806 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
807 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
810 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
811 // AARCH64-FASTMATH-NEXT: fadd {{.*}}fp128
812 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
815 // AARCH64-FASTMATH-NEXT: fmul {{.*}}fp128
816 // AARCH64-FASTMATH-NEXT: fsub {{.*}}fp128
817 // AARCH64-FASTMATH-NEXT: fdiv {{.*}}fp128
819 // AARCH64-FASTMATH-NEXT: br label
820 // AARCH64-FASTMATH: complex_div:
821 // AARCH64-FASTMATH-NEXT: phi {{.*}}fp128
822 // AARCH64-FASTMATH-NEXT: phi {{.*}}fp128
823 // AARCH64-FASTMATH: ret
827 // Comparison operators don't rely on library calls or have interseting math
828 // properties, but test that mixed types work correctly here.
829 _Bool
eq_float_cr(float _Complex a
, float b
) {
830 // X86-LABEL: @eq_float_cr(
837 _Bool
eq_float_rc(float a
, float _Complex b
) {
838 // X86-LABEL: @eq_float_rc(
845 _Bool
eq_float_cc(float _Complex a
, float _Complex b
) {
846 // X86-LABEL: @eq_float_cc(
853 _Bool
ne_float_cr(float _Complex a
, float b
) {
854 // X86-LABEL: @ne_float_cr(
861 _Bool
ne_float_rc(float a
, float _Complex b
) {
862 // X86-LABEL: @ne_float_rc(
869 _Bool
ne_float_cc(float _Complex a
, float _Complex b
) {
870 // X86-LABEL: @ne_float_cc(
878 // Check that the libcall will obtain proper calling convention on ARM
879 _Complex
double foo(_Complex
double a
, _Complex
double b
) {
880 // These functions are not defined as floating point helper functions in
881 // Run-time ABI for the ARM architecture document so they must not always
882 // use the base AAPCS.
885 // ARM: call void @__muldc3
887 // SPIR: call spir_func void @__muldc3
889 // ARMHF-LABEL: @foo(
890 // ARMHF: call { double, double } @__muldc3
892 // ARM7K-LABEL: @foo(
893 // ARM7K: call { double, double } @__muldc3
897 typedef _Complex
double ComplexDouble
;
898 typedef double Double
;
900 float _Complex
double_cr_sugar(ComplexDouble a
, Double b
) {
901 // X86-LABEL: @double_cr_sugar(