1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-none-linux-gnu -mattr=-neon -fp-contract=fast | FileCheck %s --check-prefix=Aarch64
3 ; RUN: llc < %s -mtriple=aarch64-none-linux-gnu -mattr=+neon -fp-contract=fast | FileCheck %s --check-prefix=Aarch64-Neon
5 define float @f1(float %a, float %b, float %c) {
8 ; Aarch64-NEXT: fmadd s0, s1, s0, s2
11 ; Aarch64-Neon-LABEL: f1:
12 ; Aarch64-Neon: // %bb.0:
13 ; Aarch64-Neon-NEXT: fmadd s0, s1, s0, s2
14 ; Aarch64-Neon-NEXT: ret
15 %mul = fmul fast float %b, %a
16 %add = fadd fast float %mul, %c
20 define float @f2(float %a, float %b, float %c) {
23 ; Aarch64-NEXT: fmul s0, s1, s0
24 ; Aarch64-NEXT: //ARITH_FENCE
25 ; Aarch64-NEXT: fadd s0, s0, s2
28 ; Aarch64-Neon-LABEL: f2:
29 ; Aarch64-Neon: // %bb.0:
30 ; Aarch64-Neon-NEXT: fmul s0, s1, s0
31 ; Aarch64-Neon-NEXT: //ARITH_FENCE
32 ; Aarch64-Neon-NEXT: fadd s0, s0, s2
33 ; Aarch64-Neon-NEXT: ret
34 %mul = fmul fast float %b, %a
35 %tmp = call float @llvm.arithmetic.fence.f32(float %mul)
36 %add = fadd fast float %tmp, %c
40 define double @f3(double %a) {
43 ; Aarch64-NEXT: fmov d1, #4.00000000
44 ; Aarch64-NEXT: fmul d0, d0, d1
47 ; Aarch64-Neon-LABEL: f3:
48 ; Aarch64-Neon: // %bb.0:
49 ; Aarch64-Neon-NEXT: fmov d1, #4.00000000
50 ; Aarch64-Neon-NEXT: fmul d0, d0, d1
51 ; Aarch64-Neon-NEXT: ret
52 %1 = fadd fast double %a, %a
53 %2 = fadd fast double %a, %a
54 %3 = fadd fast double %1, %2
58 define double @f4(double %a) {
61 ; Aarch64-NEXT: fadd d0, d0, d0
62 ; Aarch64-NEXT: fmov d1, d0
63 ; Aarch64-NEXT: //ARITH_FENCE
64 ; Aarch64-NEXT: fadd d0, d1, d0
67 ; Aarch64-Neon-LABEL: f4:
68 ; Aarch64-Neon: // %bb.0:
69 ; Aarch64-Neon-NEXT: fadd d0, d0, d0
70 ; Aarch64-Neon-NEXT: fmov d1, d0
71 ; Aarch64-Neon-NEXT: //ARITH_FENCE
72 ; Aarch64-Neon-NEXT: fadd d0, d1, d0
73 ; Aarch64-Neon-NEXT: ret
74 %1 = fadd fast double %a, %a
75 %t = call double @llvm.arithmetic.fence.f64(double %1)
76 %2 = fadd fast double %a, %a
77 %3 = fadd fast double %t, %2
81 define <2 x float> @f5(<2 x float> %a) {
84 ; Aarch64-NEXT: fmov s2, #4.00000000
85 ; Aarch64-NEXT: fmul s0, s0, s2
86 ; Aarch64-NEXT: fmul s1, s1, s2
89 ; Aarch64-Neon-LABEL: f5:
90 ; Aarch64-Neon: // %bb.0:
91 ; Aarch64-Neon-NEXT: fmov v1.2s, #4.00000000
92 ; Aarch64-Neon-NEXT: fmul v0.2s, v0.2s, v1.2s
93 ; Aarch64-Neon-NEXT: ret
94 %1 = fadd fast <2 x float> %a, %a
95 %2 = fadd fast <2 x float> %a, %a
96 %3 = fadd fast <2 x float> %1, %2
100 define <2 x float> @f6(<2 x float> %a) {
103 ; Aarch64-NEXT: fadd s0, s0, s0
104 ; Aarch64-NEXT: fadd s1, s1, s1
105 ; Aarch64-NEXT: fmov s2, s1
106 ; Aarch64-NEXT: fmov s3, s0
107 ; Aarch64-NEXT: //ARITH_FENCE
108 ; Aarch64-NEXT: //ARITH_FENCE
109 ; Aarch64-NEXT: fadd s0, s3, s0
110 ; Aarch64-NEXT: fadd s1, s2, s1
113 ; Aarch64-Neon-LABEL: f6:
114 ; Aarch64-Neon: // %bb.0:
115 ; Aarch64-Neon-NEXT: fadd v0.2s, v0.2s, v0.2s
116 ; Aarch64-Neon-NEXT: fmov d1, d0
117 ; Aarch64-Neon-NEXT: //ARITH_FENCE
118 ; Aarch64-Neon-NEXT: fadd v0.2s, v1.2s, v0.2s
119 ; Aarch64-Neon-NEXT: ret
120 %1 = fadd fast <2 x float> %a, %a
121 %t = call <2 x float> @llvm.arithmetic.fence.v2f32(<2 x float> %1)
122 %2 = fadd fast <2 x float> %a, %a
123 %3 = fadd fast <2 x float> %t, %2
127 declare float @llvm.arithmetic.fence.f32(float)
128 declare double @llvm.arithmetic.fence.f64(double)
129 declare <2 x float> @llvm.arithmetic.fence.v2f32(<2 x float>)