1 ; Test that the compiled does not fuse fmul and fadd into fmadd when no -fp-contract=fast
2 ; option is set (the same applies for fmul, fsub and fmsub).
4 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,+mips32r2 < %s \
5 ; RUN: | FileCheck %s --check-prefixes=CHECK-CONTRACT-OFF
6 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,+mips32r2 -fp-contract=off < %s \
7 ; RUN: | FileCheck %s --check-prefixes=CHECK-CONTRACT-OFF
8 ; RUN: llc -march=mips -mattr=+msa,+fp64,+mips32r2 -fp-contract=fast < %s \
9 ; RUN: | FileCheck %s --check-prefixes=CHECK-CONTRACT-FAST
11 declare <4 x float> @llvm.mips.fmul.w(<4 x float>, <4 x float>)
12 declare <4 x float> @llvm.mips.fadd.w(<4 x float>, <4 x float>)
13 declare <4 x float> @llvm.mips.fsub.w(<4 x float>, <4 x float>)
15 define void @foo(ptr %agg.result, ptr %acc, ptr %a, ptr %b) {
17 %0 = load <4 x float>, ptr %a, align 16
18 %1 = load <4 x float>, ptr %b, align 16
19 %2 = call <4 x float> @llvm.mips.fmul.w(<4 x float> %0, <4 x float> %1)
20 %3 = load <4 x float>, ptr %acc, align 16
21 %4 = call <4 x float> @llvm.mips.fadd.w(<4 x float> %3, <4 x float> %2)
22 store <4 x float> %4, ptr %agg.result, align 16
24 ; CHECK-CONTRACT-OFF: fmul.w
25 ; CHECK-CONTRACT-OFF: fadd.w
26 ; CHECK-CONTRACT-FAST: fmadd.w
29 define void @boo(ptr %agg.result, ptr %acc, ptr %a, ptr %b) {
31 %0 = load <4 x float>, ptr %a, align 16
32 %1 = load <4 x float>, ptr %b, align 16
33 %2 = call <4 x float> @llvm.mips.fmul.w(<4 x float> %0, <4 x float> %1)
34 %3 = load <4 x float>, ptr %acc, align 16
35 %4 = call <4 x float> @llvm.mips.fsub.w(<4 x float> %3, <4 x float> %2)
36 store <4 x float> %4, ptr %agg.result, align 16
38 ; CHECK-CONTRACT-OFF: fmul.w
39 ; CHECK-CONTRACT-OFF: fsub.w
40 ; CHECK-CONTRACT-FAST: fmsub.w