Aleksandar Beserminji | 3546c16 | 2018-04-27 13:30:27 +0000 | [diff] [blame] | 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). |
| 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 | |
| 8 | declare <4 x float> @llvm.mips.fmul.w(<4 x float>, <4 x float>) |
| 9 | declare <4 x float> @llvm.mips.fadd.w(<4 x float>, <4 x float>) |
| 10 | declare <4 x float> @llvm.mips.fsub.w(<4 x float>, <4 x float>) |
| 11 | |
| 12 | define void @foo(<4 x float>* %agg.result, <4 x float>* %acc, <4 x float>* %a, <4 x float>* %b) { |
| 13 | entry: |
| 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 | |
| 26 | define void @boo(<4 x float>* %agg.result, <4 x float>* %acc, <4 x float>* %a, <4 x float>* %b) { |
| 27 | entry: |
| 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 | } |