blob: 600b7c0904a44cd7b7cd4632e2978c07c85467b9 [file] [log] [blame]
Aleksandar Beserminji3546c162018-04-27 13:30:27 +00001; 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).
3
4; RUN: llc -march=mipsel -mattr=+msa,+fp64 < %s | FileCheck %s --check-prefixes=CHECK-CONTRACT-OFF
5; RUN: llc -march=mipsel -mattr=+msa,+fp64 -fp-contract=off < %s | FileCheck %s --check-prefixes=CHECK-CONTRACT-OFF
6; RUN: llc -march=mips -mattr=+msa,+fp64 -fp-contract=fast < %s | FileCheck %s --check-prefixes=CHECK-CONTRACT-FAST
7
8declare <4 x float> @llvm.mips.fmul.w(<4 x float>, <4 x float>)
9declare <4 x float> @llvm.mips.fadd.w(<4 x float>, <4 x float>)
10declare <4 x float> @llvm.mips.fsub.w(<4 x float>, <4 x float>)
11
12define void @foo(<4 x float>* %agg.result, <4 x float>* %acc, <4 x float>* %a, <4 x float>* %b) {
13entry:
14 %0 = load <4 x float>, <4 x float>* %a, align 16
15 %1 = load <4 x float>, <4 x float>* %b, align 16
16 %2 = call <4 x float> @llvm.mips.fmul.w(<4 x float> %0, <4 x float> %1)
17 %3 = load <4 x float>, <4 x float>* %acc, align 16
18 %4 = call <4 x float> @llvm.mips.fadd.w(<4 x float> %3, <4 x float> %2)
19 store <4 x float> %4, <4 x float>* %agg.result, align 16
20 ret void
21 ; CHECK-CONTRACT-OFF: fmul.w
22 ; CHECK-CONTRACT-OFF: fadd.w
23 ; CHECK-CONTRACT-FAST: fmadd.w
24}
25
26define void @boo(<4 x float>* %agg.result, <4 x float>* %acc, <4 x float>* %a, <4 x float>* %b) {
27entry:
28 %0 = load <4 x float>, <4 x float>* %a, align 16
29 %1 = load <4 x float>, <4 x float>* %b, align 16
30 %2 = call <4 x float> @llvm.mips.fmul.w(<4 x float> %0, <4 x float> %1)
31 %3 = load <4 x float>, <4 x float>* %acc, align 16
32 %4 = call <4 x float> @llvm.mips.fsub.w(<4 x float> %3, <4 x float> %2)
33 store <4 x float> %4, <4 x float>* %agg.result, align 16
34 ret void
35 ; CHECK-CONTRACT-OFF: fmul.w
36 ; CHECK-CONTRACT-OFF: fsub.w
37 ; CHECK-CONTRACT-FAST: fmsub.w
38}