[PATCH] D136764: [MachineCombiner][RISCV] Add fmadd/fmsub/fnmsub instructions patterns

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 15:02:10 PST 2022


craig.topper added a comment.

In D136764#3885520 <https://reviews.llvm.org/D136764#3885520>, @asi-sc wrote:

> Performance impact on Whetstone (double-precision) for sifive-u74 `-march=rv64imafdc -O3 -funroll-loops -finline-functions -ffast-math -DDP -mtune=sifive-u74`: 
> N1 +67%
> N2 +45% 
> MWIPS +18%
>
> Baseline
>
>   Loop content                  Result              MFLOPS      MOPS   Seconds
>   
>   N1 floating point     -1.12398255667391900       285.015              0.700
>   N2 floating point     -1.12187079889295083       224.672              6.220
>   N3 if then else        1.00000000000000000                5725.464    0.188
>   N4 fixed point        12.00000000000000000               327505510.400    0.000
>   N5 sin,cos etc.        0.49902937281518078                  20.516   42.163
>   N6 floating point      0.99999987890802811       169.612             33.064
>   N7 assignments         3.00000000000000000                7123.768    0.270
>   N8 exp,sqrt etc.       0.75100163018453681                  21.097   18.333
>   
>   MWIPS                                           1030.036            100.938
>
> This patch
>
>   Loop content                  Result              MFLOPS      MOPS   Seconds
>   
>   N1 floating point     -1.12398255667393077       476.923              0.498
>   N2 floating point     -1.12187079889296992       325.987              5.098
>   N3 if then else        1.00000000000000000                7110.547    0.180
>   N4 fixed point        12.00000000000000000               299613459.692    0.000
>   N5 sin,cos etc.        0.49902937281518367                  19.847   51.836
>   N6 floating point      0.99999987890802855       307.010             21.725
>   N7 assignments         3.00000000000000000               28396.673    0.080
>   N8 exp,sqrt etc.       0.75100163018453681                  21.007   21.897
>   
>   MWIPS                                           1220.474            101.313

Do you know why sin, cos and  exp, sqrt seems to take longer?



================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:1278
+                                DoRegPressureReduce)) {
+    if (isFADD(Root.getOpcode()))
+      Patterns.push_back(MachineCombinerPattern::FMADD_AX);
----------------
Cache the the result is FADD when you called it the first time?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136764/new/

https://reviews.llvm.org/D136764



More information about the llvm-commits mailing list