1; Check whether nmadd/nmsub instructions are properly generated 2; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NM 3; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -mattr=+fp64 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NM 4; RUN: llc < %s -march=mipsel -mcpu=mips32r2 -mattr=micromips -enable-no-nans-fp-math -asm-show-inst | FileCheck %s -check-prefixes=ALL,CHECK-NM,CHECK-MM 5; RUN: llc < %s -march=mips64el -mcpu=mips64 -target-abi=n64 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NM-64 6; RUN: llc < %s -march=mips64el -mcpu=mips64r2 -target-abi=n64 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NM-64 7; RUN: llc < %s -march=mips64el -mcpu=mips4 -target-abi=n64 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NM-64 8; RUN: llc < %s -march=mipsel -mcpu=mips32 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NOT-NM 9; RUN: llc < %s -march=mipsel -mcpu=mips32r6 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NOT-NM 10; RUN: llc < %s -march=mips64el -mcpu=mips3 -target-abi=n64 -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NOT-NM-64 11; RUN: llc < %s -march=mipsel -mcpu=mips32r6 -mattr=micromips -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NOT-NM 12; RUN: llc < %s -march=mipsel -mcpu=mips32r3 -mattr=micromips -enable-no-nans-fp-math | FileCheck %s -check-prefixes=ALL,CHECK-NM 13 14define float @add1(float %f, float %g, float %h) local_unnamed_addr #0 { 15entry: 16; ALL-LABEL: add1 17 18; CHECK-NM-64: nmadd.s $f0, $f14, $f12, $f13 19; CHECK-NM: nmadd.s $f0, $f0, $f12, $f14 20; CHECK-MM: NMADD_S_MM 21; CHECK-NOT-NM-64 mul.s $f0, $f12, $f13 22; CHECK-NOT-NM-64: neg.s $f0, $f0 23; CHECK-NOT-NM: mul.s $f0, $f12, $f14 24; CHECK-NOT-NM: neg.s $f0, $f0 25 26 %mul = fmul nnan float %f, %g 27 %add = fadd nnan float %mul, %h 28 %sub = fsub nnan float -0.000000e+00, %add 29 ret float %sub 30} 31 32define double @add2(double %f, double %g, double %h) local_unnamed_addr #0 { 33entry: 34; ALL-LABEL: add2 35 36; CHECK-NM-64: nmadd.d $f0, $f14, $f12, $f13 37; CHECK-NM: nmadd.d $f0, $f0, $f12, $f14 38; CHECK-MM: NMADD_D32_MM 39; CHECK-NOT-NM-64 mul.d $f0, $f12, $f13 40; CHECK-NOT-NM-64: neg.d $f0, $f0 41; CHECK-NOT-NM: mul.d $f0, $f12, $f14 42; CHECK-NOT-NM: neg.d $f0, $f0 43 44 %mul = fmul nnan double %f, %g 45 %add = fadd nnan double %mul, %h 46 %sub = fsub nnan double -0.000000e+00, %add 47 ret double %sub 48} 49 50define float @sub1(float %f, float %g, float %h) local_unnamed_addr #0 { 51entry: 52; ALL-LABEL: sub1 53 54; CHECK-NM-64: nmsub.s $f0, $f14, $f12, $f13 55; CHECK-NM: nmsub.s $f0, $f0, $f12, $f14 56; CHECK-MM: NMSUB_S_MM 57; CHECK-NOT-NM-64 mul.s $f0, $f12, $f13 58; CHECK-NOT-NM-64: neg.s $f0, $f0 59; CHECK-NOT-NM: mul.s $f0, $f12, $f14 60; CHECK-NOT-NM: neg.s $f0, $f0 61 62 %mul = fmul nnan float %f, %g 63 %sub = fsub nnan float %mul, %h 64 %sub1 = fsub nnan float -0.000000e+00, %sub 65 ret float %sub1 66} 67 68define double @sub2(double %f, double %g, double %h) local_unnamed_addr #0 { 69entry: 70; ALL-LABEL: sub2 71 72; CHECK-NM-64: nmsub.d $f0, $f14, $f12, $f13 73; CHECK-NM: nmsub.d $f0, $f0, $f12, $f14 74; CHECK-MM: NMSUB_D32_MM 75; CHECK-NOT-NM-64 mul.d $f0, $f12, $f13 76; CHECK-NOT-NM-64: neg.d $f0, $f0 77; CHECK-NOT-NM: mul.d $f0, $f12, $f14 78; CHECK-NOT-NM: neg.d $f0, $f0 79 80 %mul = fmul nnan double %f, %g 81 %sub = fsub nnan double %mul, %h 82 %sub1 = fsub nnan double -0.000000e+00, %sub 83 ret double %sub1 84} 85